3.5.20 How Do I Stop My Project's Checksum From Changing?

The checksum that represents your built project (whether this is generated by the MPLAB X IDE or by tools such as Hexmate) is calculated from the generated output of the compiler. Indeed, the algorithms used to obtain the checksum are specifically designed so that even small changes in this output are almost guaranteed to produce a different checksum result. Checksums are not calculated from your project’s source code. To ensure that your checksum does not change from build to build, you must ensure that the output of the compiler does not change.

The following actions and situations could cause changes in the compiled output and hence changes in your project’s checksum.

  • Changing the source code, header files, or library code used by the project between builds.
  • Changing the order in which source files or libraries are compiled or linked between builds.
  • Having source code that makes using of macros such as __DATE__ and __TIME__, which produce output that is dependent on when the project was built.
  • Moving the location of source files between builds, where those files use macros such as __FILE__, which produces output that is dependent on where the source file is located.
  • Changing the compiler options between builds.
  • Changing the compiler version between builds.

Note that the checksum algorithms used by tools such as Hexmate and the MPLAB X IDE can change, which can result in a different checksum for the same compiler output. Such changes are rare, but check the compiler and IDE release notes to see if the tools have been modified.