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?
Thank you this helped me a lot.
I was familiar with the GNU linker which has another syntax and couldn't find the correct way for MDK-ARM linker.
A good start is to use the project properties tabs to create an initial scatter file and use as a start for manual editing. Lots of projects doesn't even need any manual editing of the scatter file.