Safety-certified tools Tools for Automotive Applications C-STAT Static analysis C-RUN Runtime analysis Debugging and trace probes
This technical note describes how to configure IAR ELF Tool to calculate CRC32 the same way as the built-in hardware CRC32 calculator of STM32 devices from STMicroelectronics.
The settings might depend on which version of IAR Embedded Workbench for ARM you are using.
This technical note will describe the IAR ELF Tool settings for version 6.40 (and later).
IAR ELF Tool settings
To configure the CRC32 calculation in the IDE, choose Project>Options>Linker>Checksum and make there settings:
Click to download:
This source code shows how the built-in hardware CRC32 calculator of STM32 devices is invoked to calculate the CRC32 value. The CRC32 value calculated by the device is then compared to the CRC32 value calculated by IAR ELF Tool.
extern uint32_t __checksum;
uint32_t calcCrc32(uint8_t* data, uint32_t len)
uint32_t* pBuffer = (uint32_t*) data;
uint32_t BufferLength = len/4;
uint32_t index = 0;
for(index = 0; index < BufferLength; index++)
CRC->DR = pBuffer[index];
uint32_t valCrc32 =
calcCrc32((uint8_t*)0x08000000, 0x040000 - 4);
if (valCrc32 == __checksum)
This technical note describes CRC32 calculation (IAR ELF Tool and STM32 hardware), using version 6.40 (or newer) of IAR Embedded Workbench for ARM.
If your version of IAR Embedded Workbench for ARM is not covered by this technical note, contact IAR Systems support for assistance.
All Product names are trademarks or registered trademarks of their respective owners.