Calculating CRC32 as commonly calculated online

Technical Note 191210

Architectures:

All

Component:

general

Updated:

3/12/2020 2:16 PM

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.

 

We do no longer support Internet Explorer. To get the best experience of iar.com, we recommend upgrading to a modern browser such as Chrome or Edge.