How can I preserve the contents of RAM between resets? | Cypress Semiconductor
How can I preserve the contents of RAM between resets?
Is there a way to preserve the contents of a section of RAM between resets on the PSoC5? I have tried several methods without success.
1. Using int KeepMe __attribute__ ((section (".bss")));
Theoretically the .bss section is uninitialized in contrast to .data. However, all variables are set to 0 on Reset.
2 Modifying the cm3gcc.ld file to start ram at a higher address
rom (rx) : ORIGIN = 0, LENGTH = (262144 - 0)
/* ram (rwx) : ORIGIN = 0x20000000 - (65536 / 2), LENGTH = (65536 - 0x4000 - 0x1000) */
ram (rwx) : ORIGIN = 0x20000400 - (65536 / 2), LENGTH = (65536 - 0x4000 - 0x1000)
tkeep (rw) : ORIGIN = 0x20000000, LENGTH = 1024
3. Tried various compiler flags.
All without success - the ram is set to zero on reset!
I would be much obliged if anyone can suggest a way with perhaps a snippet of code or even some pointers.