2024-08-06 03:26 AM - edited 2024-08-06 03:27 AM
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
Solved! Go to Solution.
2024-08-07 04:32 AM
Hi all,
I found the issue why I was getting different hash value for the hex file generated from ST CLI and IDE.
When I tested initially, I had STM32CubeIDE v1.10.1 and STM32CubeCLT v1.16.0 installed on my system. Turns out these two versions had different compilers so because of that it was actually generating somewhat different hex files(STM32CubeCLT were little bit smaller in size compared to STM32CubeIDE).
Now I updated my STM32CubeIDE to latest version that is 1.16.0 and now both the methods generate same hex file and I am getting same hash value.
Regards,
Sahil
2024-08-06 04:19 AM
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
2024-08-06 04:28 AM
Do they both use the exact same GCC version?
2024-08-06 04:32 AM
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.
2024-08-06 04:40 AM
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.
2024-08-07 04:32 AM
Hi all,
I found the issue why I was getting different hash value for the hex file generated from ST CLI and IDE.
When I tested initially, I had STM32CubeIDE v1.10.1 and STM32CubeCLT v1.16.0 installed on my system. Turns out these two versions had different compilers so because of that it was actually generating somewhat different hex files(STM32CubeCLT were little bit smaller in size compared to STM32CubeIDE).
Now I updated my STM32CubeIDE to latest version that is 1.16.0 and now both the methods generate same hex file and I am getting same hash value.
Regards,
Sahil