1.9.8 Bootloader Application Verification - HexMate

Overview  

When using the checksum method to verify the application, a method is needed to compute the checksum of the image and place it in the header of the binary. The method used here is to run a post processing step which takes the Intel hex-formatted file produced by the compiler/linker, compute the checksum of the data within the file and insert the computed checksum at the correct location back into the original hex file. The tool used to do this is HexMate which is part of the standard MPLABX tool chain.

Implementation Details  

During the MCC generation process, the files "postBuild.bat" and "postBuild.sh" are created. Then, depending on the OS, one of these scripts are called as a post build step. The script is a two step process.
  • The first step is to compute and insert the checksum into a temporary file. When computing the checksum, HexMate needs to account for all unprogrammed regions within the checksum range. Since an unprogrammed value in flash will read as a 0x00FFFFFF, HexMate inserts these values of unprogrammed flash or blank regions of memory into the temporary hex file. The consequence of this step is that the temporary hex file can be considerably larger then the original hex file since it includes every location in the flash whether is will be programmed or not.

  • To reduce the size, the second step of the script copies just the two bytes of the computed checksum value from this temporary hex file and then inserts it back into the original file. The final hex file can now be downloaded to the device using the PC or other application.