Skip to main content
FWege.1
Associate II
January 21, 2022
Question

Firmware CRC / Debugger

  • January 21, 2022
  • 1 reply
  • 2154 views

Dear all

I want to check flash integrity with CRC checksum – IAR workbench has built-in features to calculate and add the CRC to the firmware.

Under STM32CubeIDE I use a post build

srec_cat.exe firmware.bin -binary -stm32-l-e 0xEFFC -o firmware_withCRC.bin -binary

Works great with HAL library function HAL_CRC_Calculate

But how this can be combined with the debugger – there only elf-files can be loaded. My firmware stops executing if CRC is wrong - so I have to change the code each time I starts the debugger.

Thanks in advance,

Franz

This topic has been closed for replies.

1 reply

Bob S
Super User
January 21, 2022

The easiest answer is to have the CRC check disabled in your "debug" build. Or set a breakpoint on the line that checks the CRC value and either skip that line or overwrite the calculated CRC value with the expected value.

The more involved answer is figure out how to fill in the elf file with unused areas in memory set to 0xff and then calculate/instead the checksum (into the elf). Not worth the effort to me.