Skip to main content
Visitor II
August 27, 2024
Solved

difference between .elf and .bin file to program STM32

  • August 27, 2024
  • 4 replies
  • 2196 views

Hi, what is the difference between .elf file and .bin file to program STM32. If I load up the .bin file and program STM32, will it contain all the necessary such as program data and flash data. Is there a application to program individually the .bin file separately apart from STM32CUBE IDE.

    This topic has been closed for replies.
    Best answer by mƎALLEm

    Hello,


    @cjaya.2 wrote:

    If I load up the .bin file and program STM32, will it contain all the necessary such as program data and flash data.


    It contains the program. Data such as letteral pool and const declared variables will be in the bin file.


    Is there a application to program individually the .bin file separately apart from STM32CUBE IDE.

    You can do it with STM32CubeProgrammer but you need to put the first address of the flash as .bin file does not contain the addresses like HEX file.

    SofLit_0-1724792617235.png

     

    4 replies

    Technical Moderator
    August 27, 2024

    Hello @cjaya.2 

    • BIN is a byte-by-byte binary image of what goes into the target memory
    • HEX is a text representation of the image; it has addresses and checksums - so it can be "sparse"
    • ELF is the full build output - it contains symbol information, debug information, etc, in addition to the code itself.

    BIN and HEX are generated from the ELF.

    More details available here.

    If you are looking to program the .bin file on your MCU, you have to generate it using CubeIDE and programme it using CubeProgrammer.

    Best Regards.

    STTwo-32 

    mƎALLEmAnswer
    Technical Moderator
    August 27, 2024

    Hello,


    @cjaya.2 wrote:

    If I load up the .bin file and program STM32, will it contain all the necessary such as program data and flash data.


    It contains the program. Data such as letteral pool and const declared variables will be in the bin file.


    Is there a application to program individually the .bin file separately apart from STM32CUBE IDE.

    You can do it with STM32CubeProgrammer but you need to put the first address of the flash as .bin file does not contain the addresses like HEX file.

    SofLit_0-1724792617235.png

     

    cjaya.2Author
    Visitor II
    August 27, 2024

    Hi,

    I found this application to program the .bin file. https://www.st.com/en/development-tools/stsw-link004.html.

    Is this application ok?

    Technical Moderator
    August 27, 2024

    No this is an old and depricated tool called STLINK-Utility.

    This is the link to STM32CubeProgrammer: https://www.st.com/en/development-tools/stm32cubeprog.html

    And please "accept as solution" the comment that you feel it answered your question.

    Graduate II
    August 27, 2024

    In the business we call the .ELF an "Object File"

    https://en.wikipedia.org/wiki/Object_file

    Super User
    August 28, 2024

    @cjaya.2 wrote:

    Hi, what is the difference between .elf file and .bin file to program STM32.


    The others have explained the differences.

    Note that this is entirely general - not specific to STM32.