I've been having a play with the NVS utility in the MSP MCU FRAM Utilities, and almost have it working as expected, but not quite! The NVS data is being correctly being positioned in FRAM, and retained on restarts, but if I reload the code it is being reinitialised. I'm guessing its something trivial I am missing - hopefully someone can point me in the right direction. Following is a precis of what I have done, and where I am currently at. I'm using the GCC toolchain, and studio 10.4.
First up, the NVS storage is being assigned to the .persistent SECTION using the following;
uint8_t nvs_data[NVS_DATA_STORAGE_SIZE(sizeof(nvs_data_t))] __attribute__((section(".persistent"))) ;
From the map, and the debugger, this is all being located correctly in the .persistent section in FRAM (0x4xxx in the 5964 processor).
From the linker .ld script for this processor, the appropriate section is;
/* This section contains data that is initialised during load
but not on application reset. */
. = ALIGN(2);
PROVIDE (__persistent_start = .);
. = ALIGN(2);
PROVIDE (__persistent_end = .);
} > FRAM
My first stab was that this should include a (NOLOAD) directive to suppress initialisation during load, but this appears to make no difference. From having a peek with the debugger, the NVS data has definitely been reinitialised before NVS gets to perform its own validation.
Any ideas where I am going wrong?