Skip to main content
Visitor II
May 2, 2020
Question

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

  • May 2, 2020
  • 5 replies
  • 1283 views

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.

    This topic has been closed for replies.

    5 replies

    Super User
    May 2, 2020

    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.

    Visitor II
    May 2, 2020

    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.11Author
    Visitor II
    May 2, 2020

    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.

    Super User
    May 2, 2020

    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.

    Super User
    May 3, 2020

    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