Skip to main content
RBack.1
Associate III
April 6, 2022
Question

Does STM32CubeProgrammer display a CRC (or equivalent) someplace for a hex file upon load? Most programming software I've used in the past has provided this.

  • April 6, 2022
  • 2 replies
  • 2149 views

..

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
April 6, 2022

Seem to recall ST-LINK Utilities having a 32-bit sum

The tools will do a byte level verify.

General problem moving beyond single ROM programming is that the .HEX file is sparse and can describe multiple regions, frequently MB or GB apart, and the fill patterns and alignment requirements also might change, or be accounted for.

If you need security/assurance in your own code/images, you should check and sign them yourself, and validate them during early execution, or from the loader you have transferring control to them.

Check the STM32 side reporting vs your PC side checking/signing.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
RBack.1
RBack.1Author
Associate III
April 6, 2022

I do use a checksum inside my image which is verified before the application is run, however I do want the technicians programming my boards to have an indication that they have loaded the correct hex file before programming. There are multiple hex files for the same PCB in my company for different applications

It would also be helpful to be able to read the hex file crc or checksum off of programmed PCBs without connecting them to a communications interface first.

I've looked for a crc or checksum in the ST tools but have been surprised not to find one easily.

Tesla DeLorean
Guru
April 6, 2022

I can see a file being provided with a SHA, MD5 or CRC32, but most older tools generated a checksum for the binary data they constructed from the .HEX described content, not the file itself. Having the linker, or post-link, generate a file output name with the MD5 appended is one I've seen used effectively.

While I can see value here, I'm not convinced one solution will make all happy. And what worked in 1980 isn't a solution today.

>>It would also be helpful to be able to read the hex file crc or checksum off of programmed PCBs without connecting them to a communications interface first.

How would that work? Devices frequently have 1-2MB of internal flash, and perhaps 4-256MB external. How does one determine the subset within which the user app occupies?

@Nawres GHARBI​ could the tools always generate and display an MD5, or other suitable/classic HASH, for ALL loaded files, ie of the .HEX, .S19, .ELF, .AXF, .DFU, .BIN, etc. And perhaps minimally authenticate/confirm?

In a form such as this f9k_lap_101.b94de250c8c2fa60389c1479c4ef816a.bin

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
April 6, 2022

C:\UBLOX\F9K101>C:\SiLabs\SimplicityStudio\v3\developer\msys\1.0\bin\md5sum f9k_lap_101.b94de250c8c2fa60389c1479c4ef816a.bin

b94de250c8c2fa60389c1479c4ef816a *f9k_lap_101.b94de250c8c2fa60389c1479c4ef816a.bin

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..