This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Prevent RW data initialization in hex file

Hi I have a problem with hex file generation in MDK-ARM.
I want the hex file only contain data in FLASH not RAM. But for all RW data there is some output in the resulting hex file which points to RAM not FLASH:

:020000042000DA
:1000400000000000000000000000000000000000B0
:1000500000000000000000000000000000000000A0
:100060000000000000000000000000000000000090
:100070000000000000000000000000000000000080
:100080000000000000000000000000000000000070
:100090000000000000000000000000000000000060
:1000A0000000000000000000000000000000000050
:1000B0000000000000000000000000000000000040
:1000C0000000000000000000000000000000000030
:1000D0000044950800000000000000000102030435
:0400E00006070809FE

Portion from map file:

     Code (inc. data)   RO Data    RW Data    ZI Data      Debug

     16930       1348        678        164      21140     541021   Grand Totals
     16930       1348        678        164      21140     541021   ELF Image Totals
     16930       1348        678        164          0          0   ROM Totals

Portion from linker script (scatter):

LOAD_RAM 0x20000040
{
  DATA_RAM +0
  {
    * (+RW,+ZI)
  }
}

I have read about the UNINIT attribute but it is not the case I need. RW data is produced from something like

static uip_timer timerPeriodic;

But I don't want specify zero-init attribute for each of this variable, as there are libraries used and other linkers (such as GNU linker) have the NOLOAD directive which prevents these RAM segments in hex file.

How to avoid this?