I have a project that writes configuration data into part of the flash memory. It is always in the same memory range. I would like to be able to preserve that data in flash between downloads. I was trying to find in the manual a description of this use case, but couldn't find any. I compile with GCC, that section of my linker script looks like:
/* Memories definition */
MEMORY
{
RAM (xrw): ORIGIN = 0x20000000, LENGTH = 160K
/* Pages 0 - 250 : System Firmware*/
ROM (rx): ORIGIN = 0x08000000, LENGTH = 502K
/* Page 251 : FW update checksum and decryption */
CFG_DATA1 (rx) : ORIGIN = 0x0807D800, LENGTH = 2K
/* Pages 252 - 255 : AWS thing name and keys */
CFG_DATA2 (rx) : ORIGIN = 0x0807E000, LENGTH = 8K
}
So basically, I would normally like to erase and program only the MEMORY section called ROM above and not CFG_DATA1 or CFG_DATA2. There are times that I may need to erase those sections as well, but normally, I'd like to preserve their contents.
I think that I probably need a custom script for TargetDownload, but I'm not sure. It seems to me that this is a fairly common use-case, but I can't find any help on the web for this.
Any help would be greatly appreciated.
/* Memories definition */
MEMORY
{
RAM (xrw): ORIGIN = 0x20000000, LENGTH = 160K
/* Pages 0 - 250 : System Firmware*/
ROM (rx): ORIGIN = 0x08000000, LENGTH = 502K
/* Page 251 : FW update checksum and decryption */
CFG_DATA1 (rx) : ORIGIN = 0x0807D800, LENGTH = 2K
/* Pages 252 - 255 : AWS thing name and keys */
CFG_DATA2 (rx) : ORIGIN = 0x0807E000, LENGTH = 8K
}
So basically, I would normally like to erase and program only the MEMORY section called ROM above and not CFG_DATA1 or CFG_DATA2. There are times that I may need to erase those sections as well, but normally, I'd like to preserve their contents.
I think that I probably need a custom script for TargetDownload, but I'm not sure. It seems to me that this is a fairly common use-case, but I can't find any help on the web for this.
Any help would be greatly appreciated.