gcc, linker script, elf, static data and FLASH

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

gcc, linker script, elf, static data and FLASH

1,488 次查看
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
标签 (1)
0 项奖励
回复
1 回复

376 次查看
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 项奖励
回复