2020-05-02 12:15 PM
I have a bootloader that can copy a program bin file from the USB memory to the internal flash memory of STM32F429 and start the program. The bootloader doesn't care about the content of the bin file and just does the copying dutifully. The strange thing is that if the bin file is built with the debug configuration it works as expected, but if the bin file is built with the release configuration it doesn't work. When I check the post build step both the release and debug configuration use the same command:
arm-none-eabi-objcopy -O binary ${ProjName}.elf _${ProjName}.bin
I'm baffled why one works and the other one doesn't work. Should more options be added for the release build?
Any help is very much appreciated.
2020-05-02 02:54 PM
It's not that uncommon for this to happen. Likely there is a bug in the code that debug doesn't care about. Stack overflow, writing to an array out of bounds, assuming something is zero-initialized that isn't.
2020-05-02 03:17 PM
My bet is a missing volatile somewhere.
Check every variable touched by interrupt handlers or DMA. Don't trust any library to get it right.
2020-05-02 03:21 PM
But the same code in hex format for the release configuration loaded to the device via ST-Link works just fine, so probably not due a bug.
2020-05-02 03:49 PM
A hex file contains the same info as a bin file. It's supposed to, at least. Compare the flash after each download and you'll find a difference, if they behave differently.
2020-05-02 05:46 PM
The bootloader, when running the application, may have left something in non-reset state, and that may be the cause for the different behaviour.
JW