We experience corruption of flash metadata in our upgradable stack project when with turn on/off the power of the device quickly (CYBL11172).
It looks like the loader (or the stack) writes in flash some flags at every boot. As our product is battery operated, it is easy to corrupt the metadata, when changing the batteries.
We wanted to modify the loader and stack code to duplicate the two metadata rows, and add a checksum. The loader would recover the correct metadata, but we are unable to change the code as it is autogenerated.
Do you have a solution to prevent corruption of flash metadata with glitches on power supply during boot ?
How can we modify autogenerated source in PROC BLE for the bootloader component and bootloadable ?
The problem seems to come from the loader, as it systematically write the flag of the active application in the stack metadata, at every system power on (on upgradeable stack or dual application).
If a power off occurs during this flash write (bouncing battery contact for example), it erases the all stack metadata or corrupts it. This leaves your product dead. Need to reload with SWD the program.
We solved this big problem (as our product is in a glued casing) by duplicating the launcher.c and call the renamed functions with a modification to prevent writing the same information over in flash.
This works fine but isn't there a way to correct a bug in an autogenerated file without duplicating everything and call the new function ?