Calculating CRC32 as commonly calculated online

Technical Note 191210

Arkitekturer:

All

Komponent:

general

Uppdaterad:

2020-03-12 14:16

Introduction

This Technical Note shows how to calculate CRC32 with IAR Embedded Workbench for Arm using the most common CRC32 algorithm as used by online CRC calculators. 

Discussion

For example, with the following online CRC32 calculators the input data 0x01 0x02 0x03 0x04 gives the result 0xB63CFBCD:

  1. https://crccalc.com/?crc=01020304&method=crc32&datatype=hex
  2. http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
  3. https://www.lammertbies.nl/comm/info/crc-calculation.html

Note that the CRC32 example project in Technical Note 45456 gives a different result compared to the online CRC calculators.

To get the same result as the online CRC calculators with ielftool.exe, these are the relevant settings in the options page Project>Options>Linker>Checksum :

  • Use as input must not be selected
  • Complement must be set to 1’s complement (XOR with -1)
  • Bit order must be set to LSB first (use mirroring)

Example Project

See example project crc32std_ewarm_7804.zip (created with IAR Embedded Workbench for Arm version 7.80.4).

Online CRC calculators

See the following screenshots from the three online CRC-calculators:

Conclusion

It is possible to calculate CRC32 with IAR Embedded Workbench for Arm using the most common CRC32 algorithm as used by online CRC calculators.

 

All product names are trademarks or registered trademarks of their respective owners.

 

Det här innehållet finns tyvärr inte på svenska.

Vår webbplats finns främst på vårt koncernspråk engelska, förutom det innehåll för investerare som vi är lagstadgade att kommunicera på svenska. Vi rekommenderar att du besöker vår globala webbplats på engelska för att få en bättre upplevelse.

Vi stöder inte längre Internet Explorer. För att få bästa möjliga upplevelse av iar.com rekommenderar vi att du uppgraderar till en modern webbläsare som Chrome eller Edge.