cancel
Showing results for 
Search instead for 
Did you mean: 

Flash Integrity CRC

Dfarr.1
Senior

I'm trying to piece together the post-build process for flash integrity check using CRC. I'm running on an STM32F777.

So far I've been following:

https://community.st.com/s/question/0D50X0000B9vdDC/how-can-i-calculate-crc-of-image-in-post-build

and

https://www.eevblog.com/forum/microcontrollers/stm32-hex-file-signing-with-crc/

and

https://github.com/ethanhuanginst/STM32CubeIDE-Workshop-2019/tree/master/hands-on/06_F746-DISCO-CRC

But I'm seeing an error (warning?) that these guides don't mention and I haven't been able to find an explanation elsewhere:

warning: The STM32 filter uses 4-byte alignment,

  but unaligned data is present. Use a "--fill 0xNN --within <input>

  --range-padding 4" filter *before* the STM32 filter to fix this problem. See

  srec_info(1) for how to see the data ranges.

I've tried adding the changes suggested by the error message, but they throw additional errors and it feels like a rabbit hole.

What's causing this unaligned data? Can I/should I fix it?

12 REPLIES 12

> Seems srecord -fill is non-inclusive of the end address.

Thanks for coming back with the answer.

Srecord is a powerful tool, but it has an unusual (even if justifiable) command-line syntax and a terrible manual.

The price is hard to beat, though... 🙂

JW

> Generally the reason I've never bothered with SRecord is that I built equivalent tools decades ago to perform specific tasks without all the circus and command line voodoo sequences

I tend to resort to homebrew only when it comes to something less than usual.

I do use an stm-crc program though, written on a lazy afternoon by one of my colleagues who's way better PC programmer than me, years ago, when srec did not have the STM32-CRC option. Once you have such a program at hand, as a basis, it's just natural to evolve from that forever, I admit.

JW

Not applicable

Hello, just for reference you can use this command (need to adapt to the current STM32 flash size):

srec_cat FIRM1.hex -Intel -fill 0xFF 0x08000000 0x080FFFFC -crop 0x08000000 0x080FFFFC -STM32 0x080FFFFC -o ROM1.hex -Intel

I managed to get a bootloader (USB Host) to work that burns the image from a USB flash drive, including the CRC of Flash, in case anyone is interested, I tried to leave my steps in these several posts:

https://community.st.com/s/question/0D53W00001ZYLpTSAX/stm32-usb-training-113-usb-msc-dfu-host-labs-does-the-current-code-not-fit