cancel
Showing results for 
Search instead for 
Did you mean: 

sha256sum different for hex file generated from STM32CubeIDE and STM32CubeCLT

SBhon.1
Associate II

Hi,

I am working on automating the build process of the ST firmware and for that I was looking for CLI tools which can be used for the same. I found that STM32CubeCLT is a toolset extracted from STM32CubeIDE, so I was trying out the toolset to check if it fulfils my needs. For development purposes we use STM32CubeIDE.

To check if same hex file is generated, I built the firmware to generate the hex files using the STM32CubeIDE and STM32CubeCLT and calculated the sha2556sum hash of both the files. It turns out that both the hex files return different hash values.

Is there any specific reason for this? I checked the commands executed by both the IDE and the CLI tool and the commands are same as far as I can tell. Note that I did clean build both the times(i.e. for CLI and IDE).

Also I have noticed that there is no user manual/reference document for the STM32CubeCLT toolset except for the quick start guide. So I used the command mentioned in the quick start guide to build firmware using CLI.

 

Regards,

Sahil

4 REPLIES 4
Peter BENSCH
ST Employee

Well, if a single bit of the two HEX files is different, you will get a completely different SHA256. Even if, for example, the two tools create HEX files with different record lengths, which would result in an identical binary, you will inevitably have a different SHA256 value.

Instead of comparing HEX files via SHA256, you could convert the HEX to BIN and compare them binary.

Regards
/Peter

In order 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.
Andrew Neil
Evangelist III

Do they both use the exact same GCC version?

Hi Peter,

I checked with the Bin file also. Same problem. It generates two different hash values.

I have also noticed that generated files have different sizes.

Built from IDE:

...
Finished building target: timer_test.elf
 
arm-none-eabi-size   timer_test.elf 
arm-none-eabi-objdump -h -S  timer_test.elf  > "timer_test.list"
arm-none-eabi-objcopy  -O ihex  timer_test.elf  "timer_test.hex"
arm-none-eabi-objcopy  -O binary  timer_test.elf  "timer_test.bin"
   text	   data	    bss	    dec	    hex	filename
  18864	     20	   1836	  20720	   50f0	timer_test.elf
Finished building: default.size.stdout
Finished building: timer_test.bin
Finished building: timer_test.hex

 Built from CLI:

...
Finished building target: timer_test.elf
 
arm-none-eabi-size  timer_test.elf 
arm-none-eabi-objdump -h -S timer_test.elf  > "timer_test.list"
arm-none-eabi-objcopy  -O ihex timer_test.elf  "timer_test.hex"
arm-none-eabi-objcopy  -O binary timer_test.elf  "timer_test.bin"
   text	   data	    bss	    dec	    hex	filename
  18856	     20	   1836	  20712	   50e8	timer_test.elf
Finished building: default.size.stdout
 
Finished building: timer_test.bin
Finished building: timer_test.hex

Any specific reasons for happening this?

I can share you a sample project if you want for reference.

Regards,

Sahil.

They're different sizes, so the hash will be different.

Open them in STM32CubeProgrammer and examine what is different. Likely it's something trivial.

You can compare the actual compiler and linker build statements used in each case to determine why this is happening.

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