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

UNINIT Section Gets Zero Filled

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

Parents Reply Children
No data