OTA upgradeable stack corruption of metadata

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

   

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 ?  

   

Thanks for your help.

0 Likes
1 Solution
Anonymous
Not applicable

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 ?

View solution in original post

0 Likes
5 Replies
Anonymous
Not applicable

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 ?

0 Likes
Anonymous
Not applicable

Hi,

   

We apologize for the inconvenience caused. We will create an internal ticket based on your inputs, to explore if better solutions are possible. Thanks for letting us know about the issue and the way you worked around it.

   

Regards,

   

-Mahdhu Sudhan

0 Likes
Anonymous
Not applicable

See below the modification made to the launcher function highlighted in yellow:

   

Please let me know how to prevent this patch from being overwritten by autogenerated file.

   

   

0 Likes
Anonymous
Not applicable

Hi Madhu,

   

Seems the patch above has not been integrated in the last PSOC update.

   

Do I need to create a case to make sure this is implemented in the next release ?

   

Thanks for letting me know.

0 Likes
Anonymous
Not applicable

Hi,

It seems that the patch I suggested has been released in Bootloader V1.60.

Thanks for this update.

I feedback this information as it took 8 months to Cypress without any feedback to integrate it into a release !

Also, as I didn't get an answer on how to prevent a patch in autogenerated files to be overwritten, you can use the Build Settings / ARM GCC../ USER Commands / Post Build and add an Xcopy command to copy the patched file over the generated one.

Thanks for your support.

0 Likes