Absolute address of Retained Memory

I am using a coin cell battery to power VBAT to ensure retained RAM is preserved through power off. This is working fine.
Recently I implemented a new feature to store a list of UIDs as an array of uint64_t values. This works fine as well, however, after a code change flash it appears that the base pointer to the array in retained memory has moved.
Is this possible when no changes to other retained variables have been made?
Is there a way to make the array address in the retained memory absolute/static?

1 Like

Retained memory may move when flashing new firmware. It's controlled by the linker and cannot be set to a specific address.

Ah. That's going to be a problem.

I could backup to an SD card file and then re-load after a flash. Would you have any other better ideas - store the array address in eeprom and compare at start-up?

On Gen 2 device, the only option is to back up the retained data to external storage like EEPROM or SD card. You can register for the reset system event and save the data before reset, this will catch the OTA update case as well.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.