cancel
Showing results for 
Search instead for 
Did you mean: 

Firmware CRC / Debugger

FWege.1
Associate III

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

1 REPLY 1
Bob S
Principal

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.