Calculating CRC32 as commonly calculated online

Technical Note 191210

Targets:
All

Component:
General

Updated:
1/13/2020 12:21 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 IAR ielftool, the relevant settings in the Project>Options>Linker>Checksum dialog box are:

  • 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.

 

© IAR Systems 1995-2020 - All rights reserved.

We use cookies on this website to provide you with a better experience. You need to accept cookies to continue using this site. Cookies