System Workbench for STM32

You are viewing a reply to Bootloader CRC check  

Bootloader CRC check

I’d recommend using the open-source utility “srec_cat” to embed a CRC into your object file. It’s also capable of doing a lot of other things related to manipulating object code files.


I recently wrote a bootloader for a project I worked on recently, and I had do come up with a way to do exactly what you describe - insert a CRC of the image into a fixed location within the object code file. I used srec_cat to accomplish this.

You will want to run the srec_cat utility as part of your post-build process. I’d suggest making a small shell script (batch file) that runs the srec_cat program, and run the script/batch containing all the utilities you want to run (including srec_cat) as your post-build step.

Learning how to use the SRecord utilities can be a bit dauting. They can do a lot of nice things related to manipulating object code files, but this flexibility comes at the expense of ease of use. Fortunately, the author does provide comprehensive documentation.

I can provide some assistance in using srec_cat and setting up a post-build script to do this if you need it.