cancel
Showing results for 
Search instead for 
Did you mean: 

Release bin file does not work while the debug bin file works

JCoop.11
Associate

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.

5 REPLIES 5
TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".
berendi
Principal

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.

JCoop.11
Associate

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.

TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".

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