Currently I am using the NVS driver to read and write from a FLASH sector. When I read directly after I write, I can see the right data. However, if I read after a program load, it is gone.
How to make sure that that flash sector is not being erased when I enter debugging mode / flash it / reboot the device? I have tried to set Debug Configuration -> Flash Settings->Erase Settings during Program Load to "Do not erase sectors (program load only)", but then I get this error:
Cortex_M4_0: File Loader: Memory write failed: Timed out waiting for target flashloader to execute command.
I also tried to use the CCFG.c file and set SET_CCFG_CCFG_PROT_... to protect all sectors, and then set the Debug Configuration->Flash Settings->Erase Settings during program load to "All unprotected sectors". However, that still does not work.
What am I missing?