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 ?
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.
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.
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.