2022-01-20 08:41 PM
Hi, I am working on SPC58NG84E7 bootloader. I have Bootloader code(at 0x00FC0000) with which i am using "FlashErase" API to Erase Flash Memory block at 0x00FF0000 with "-Os size" Optimization But its not working. Also, I tried putting breakpoint to the next line after erase, but breakpoint does not hit. Looks like its stuck in the execution.
I tried all other optimizations as well but same result.
Also, without optimization (NONE(-O0)) its working fine.
Same result is for "FlashProgram" API.
What could be the issue here?
Please help me resolve the issue.
Solved! Go to Solution.
2022-01-31 12:46 AM
Hi Oliver,
I tried using this setting but same result is observed. I am not able to erase the memory.
I also tried different memory blocks(0x01000000 and 0x01020000) but still not working and control got stuck in unhandled exception.
Thanks and Regards
Deepesh
2022-01-31 12:48 AM
Thanks Oliver for your help.
Thanks
Deepesh
2022-02-04 06:43 AM
Hello,
R&D had no time to provide an analysis for this issue this week.
I hope they could next one.
Best Regards,
-Olivier
2022-02-11 12:37 PM
Agreed, if your program works properly with -O0 and bombs with any other optimization, it sounds like your program has some variables that should be marked volatile.
The optimizer is getting rid of code that does nothing useful (in its opinion), like repeatedly checking a flag. Why would you check a flag that never gets set? That's useless, get rid of that code.
Or setting a variable that never gets read, that's useless, get rid of that code.
Now if those variables happen to be device registers, they should be marked as volatile to tell the optimizer not to make assumptions about there being no behind the scenes activity.
Values that are being shared between interrupts and mainline code, or between tasks should be declared _Atomic (C11). And if you're doing complex things, the values should be guarded with a mutex.
2022-03-15 02:50 AM
Hi Oliver ,
Any update on this above issue .I am also facing similar issue .While debug I can able to erase flash .But I loaded the bootloader code into the flash flasherase not works .stuck inside the flash erase .If u have any update pls let me know.
Thanks advance...