6.5.2 Checksum/CRC32

A checksum or CRC32 is a hexadecimal number derived from the application code and other settings of an MCU or DSC. See the Related Links for information on how project checksum/CRC32 is calculated in the Dashboard and how a checksum may be used in some devices for user ID.

Error Detection

Checksums are used to detect errors between builds. For example, consider a project built on one computer with one checksum. If that project is copied to another computer and built there, an identical checksum means the project was successfully copied while a different checksum means the copying failed.

Care should be taken when developing project code if the checksum is used for error detection. Do not use the compiler macros __TIME__ or __DATE__. Also, do no use the macros __FILE__ or assert() if file paths will change.

CK Hexmate Checksum

For projects using the MPLAB XC8 C compiler, in the Project Properties window under the XC Linker Category, Additional options Option category, there is a Checksum option. Click on the option to see the Option Description below.

  • For PIC MCU devices, MPLAB XC8 C compiler uses the -mchecksum option to create the checksum, which includes calling Hexmate with its -ck option. See the MPLAB XC8 C Compiler User’s Guide for PIC MCU for details on the Checksum Option.
  • For AVR MCU devices, MPLAB X IDE creates the checksum, which includes directly calling Hexmate with its -ck option. Although the XC8 compiler is not involved, the same location for the Checksum option is used for both PIC and AVR devices.