This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Best approach for flash storage data version control

SDK 14.2

nRF52832

The application I'm developing uses the flash memory to store parameters such as calibration parameters for the sensors on the product. I foresee that in a future firmware update the number of variables might be expanded and I would like to be ahead of this problem and have some sort of data version control in the flash storage.I would like to prevent loss of calibration parameters when I read the flash data in a newer structure format then what was previously saved in flash. Are there any best practices, examples or blogs for this particulair problem?

The parameters are written by the application or can be read with a BLE service, so using the UICR is not the best solution, although it would be easier to have a certain parameters at a specific location inside non-volatile memory.

I have thought of using the first few bytes of the flash as a flash and firmware revision(major and minor) number to know which flash data layout is stored after the version numbers. I'll have to write some functions to migrate the data between different versions structures, use additional structures for each new data revision or could I append new variables to an excisting structure definition without changing the order of the previous parameters as they are written to the flash?

I look forward to your solutions or ideas.

Parents Reply Children
No Data
Related