Hi,
I'm using the RTC backup ram on a lpc23xx board in order to saved crucial varables.
But it seems it's always set to 0 at startup and I want to avoid that.
I'm using a scatter file and I define a rtc_ram section like this :
RW_RTCRAM 0xE0084000 0x000007FF { main.o (rtc_ram) }
I tried to use zero init at declaration , but It's always set to 0 :
volatile uc_saved_status_t uc_saved_status __attribute__((section("rtc_ram"),zero_init));
How can I bypass the init for the RTC ram ?
Thanks in advance
It seems to add the attribute UNINIT in the scatter file does the job :
RW_RTCRAM 0xE0084000 UNINIT 0x000007FF { main.o (rtc_ram) }
Remember to add a good checksum or similar to make sure that you can differentiate between uninitialized variables, and variables that have kept the state after a restart of the processor.
Note that if the supply on the battery-supply pin runs low, you can get bit errors in the memory even if most of the variables looks ok. This is especially important if you have a super-cap that will only support a limited number of hours/days without power until reaching dangerously low voltage levels.