Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Bootloader CRC check

My M0 bootloader works. I can upload my file and execute it. The next step is a CRC check of the uploaded .bin file.
The easy part is the bootloader checking the uploaded file. Next,

- How to automatic generate a CRC in the BIN file?

- It is possible to generate a crc with an external tool but i need the crc value on a fixed place in the bin file so the external tool can overwrite that value. I tried to make a section in the linker script to reservate a part of flash for the crc variable but no idea how to do that.

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.

http://srecord.sourceforge.net/Question

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.


Thanks looks good. I guess you add the srec_cat to the build steps? What is your command there? Does the srec_cat glues the crc to the end of the file?
It can be handy to place a const struct on a fixed position in the flash, any idea how to do that?


C:\Ac6\workspace\Project_M0_BL_App\Debug>srec_cat Project_M0_BL_App.bin -crc32-b-e 0x8013C20

srec_cat: Project_M0_BL_App.bin: 1: warning: ignoring garbage lines
srec_cat: Project_M0_BL_App.bin: 4: file contains no data


 

Newest Forum Posts

  1. Монтаж камина с грилем в Москве - установка и барбекю by KpddomErorb, 2025-05-10 18:28
  2. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  9. Build a project in "release" mode by tang, 2025-02-20 10:36
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35

Last-Modified Blogs