Hello all,
I'm trying to define an uninitialized section in RAM so that I can save some data when a soft reset occurs. However this section seems to be getting filled with zeros by the scatterload function.
I have defined the variable like this, in saved_ram.cpp:
SavedResetData __attribute__((section("NO_INIT"), zero_init)) reset_data;
The scatter file for my project is:
LR_IROM1 0x00200000 0x00008000 { ; load region size_region ER_IROM1 0x00200000 0x00008000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20008100 0x00077F00 { ; RW data .ANY (+RW +ZI) } RW_IRAM2 0x20000000 0x00008000 { foo.o (FOO_BUFFERS) } NO_INIT_SECTION 0x20008000 UNINIT NOCOMPRESS 0x00000100 { saved_ram.o (NO_INIT) } }
In the map file, I can see that the region is created and has the expected attributes:
Execution Region NO_INIT_SECTION (Base: 0x20008000, Size: 0x0000002c, Max: 0x00000100, ABSOLUTE, UNINIT) Base Addr Size Type Attr Idx E Section Name Object 0x20008000 0x0000002c Zero RW 291 NO_INIT saved_ram.o
Any ideas as to why this does not work?
Thanks,
Oliver
I put the UNINIT section at the highest RAM addresses (0x20077F00, 0x100) and it works now.
Is UNINIT supposed to work if the UNINIT section is between sections which get initialized?
Thank you, I have the same issue, and when I moved the section at the beginning of the RAM, it worked.