cancel
Showing results for 
Search instead for 
Did you mean: 

difference between .elf and .bin file to program STM32

cjaya.2
Associate II

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.

6 REPLIES 6
STTwo-32
ST Employee

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 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

SofLit
ST Employee

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

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hi,

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

Is this application ok?

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

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

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Evangelist III

@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.