gcc, linker script, elf, static data and FLASH

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

gcc, linker script, elf, static data and FLASH

1,325 Views
Petter
Contributor II
How can I specify that static variables goes into the SRAM, but their init values goes into the FLASH so I can do a copy on boot?

If I specify that static data (.data section) should go in the FLASH it will be read-only. If I specify that the .data section should go in the SRAM I don't the init values (the latter is OK if you have something to load an ELF file into memory).

Thanks
Labels (1)
0 Kudos
1 Reply

213 Views
Petter
Contributor II
I can solve this by putting the static data in the .data section (in SRAM), and then write a small util to extract the data from the elf file and make a copy in the .rodata section (in FLASH). Then I can copy the static data at startup.
0 Kudos