cancel
Showing results for 
Search instead for 
Did you mean: 

Dual Bootloader with FDCAN Firmware Update and CRC Validation on STM32G0B1CCT6

AKG123
Associate II

I am working on a custom dual-boot bootloader for the STM32G0B1CCT6 with the following features:

  • Bootloader located at 0x08000000 (about 20 KB flash).

  • Two application firmware slots:

    • App1 at 0x08005000 (22 KB)

    • App2 at 0x0800A800 (22 KB)

  • On reset, the bootloader checks the CRC of App1 and App2 firmware:

    • If App1 is valid, it jumps to App1.

    • Else if App2 is valid, it jumps to App2.

    • Else it stays in bootloader mode.

  • Firmware updates are sent via FDCAN as .bin files (no special commands, just the binary data).

  • The bootloader receives the firmware, writes it to the free app slot, verifies CRC:

    • If CRC passes, it overwrites the old firmware and jumps to the new app.

    • If CRC fails, it keeps the old firmware and stays in bootloader mode.

  • I want to support multiple firmware updates this way reliably.

I have basic HAL code generated from CubeMX for FDCAN and CRC peripherals.

My questions:

  1. Is my memory layout and CRC validation approach suitable for STM32G0B1CCT6 with 64KB flash?

  2. How can I best implement the FDCAN reception to reliably receive large .bin files chunked over CAN FD?

  3. Are there any reference projects or examples from ST that implement similar dual-bootloader with CRC check and FDCAN update?

  4. Any tips on safely erasing and writing flash while receiving firmware over FDCAN?

  5. How do I store and update CRC metadata securely in flash?

  6. How to properly jump from bootloader to application and manage vector tables?

10 REPLIES 10

Hello @Saket_Om 

Thank you for the suggestion.

I’ve actually written a custom FDCAN bootloader code for the STM32, and I’d like to know if the approach I’ve taken is correct. Also, I’d really appreciate it if you could review it and suggest any improvements or necessary changes.

Is it okay to share the code here for feedback? I want to ensure I’m following best practices, especially regarding memory handling, chunking firmware, and CRC validation.

Thanks again