PEmicro Blog

Verify SAP Image Integrity Via Checksum with Cyclone Programmers

Jul 17, 2020

PEmicro’s software can calculate a checksum to help verify the data integrity of a SAP (Stand-Alone Programming) or eSAP (encrypted Stand-Alone Programming) image file. This checksum is a 32-bit hexadecimal number such as 0x0123ABCD. This number is unique to the SAP file, which is created by the user via the Image Creation Utility. If there are any differences (algorithms, object files, paths to these files, scripts, settings, description, name of the SAP files, or path of the SAP files) in how two SAP images are built, their checksums will also be different. The checksum should be recorded for a SAP image once it has been validated and becomes a golden file that is used for production. 

During production, the user can then compare the checksum of the image on the Cyclone against the checksum of the golden file. This ensures that the production line has selected the right image file for the product, and that the image file was not altered or corrupted.

This feature is available on the Cyclone LC and Cyclone FX programmers, starting with software release v.10.53. The most recent Cyclone software is always available on the Support & Downloads tab of the Cyclone product pages.

Calculating the checksum of a new sap image

1. The checksum is calculated at the time the image is generated on the PC. It is displayed at the bottom of the Cyclone Image Creation Utility window in the blue text.

Figure 1: Checksum Displayed in Image Creation Utility

2. It is also displayed on the line “ImageCRC32=”  within the CSAP status window. This window normally closes very quickly, but the user can access it by selecting Options -> Configure Pop-Up Windows Status -> Always Keep Opened.

Figure 2: Checksum Displayed in CSAP Status Window

To output the checksum to a log file, you can directly call CSAP with the “/log” parameter. See the blog post “How To Automate Cyclone Stand-Alone Programming Image Generation” for more details.

3. There is a python utility that allows users to  retrieve the checksum from a command line. This utility is in the Cyclone installation software in the folder “cycloneControl\controlsdk\examples”. Note that the utility loads our 32-bit cycloneControlSDK.dll. It will not work if you use Python 64-bit.

python api_example.py -getimagecrc=filename.sap

Figure 3: Retrieve Checksum via Python Utility

Extracting the checksum of a SAP file stored on the Cyclone 

1. The Cyclone Control GUI utility shows the checksum of all internal and external images. To access the utility go to Start Menu -> All Programs -> PEmicro Cyclone Programmer -> Cyclone Control GUI. Connect to your Cyclone and go to the Images tab. The checksum ($E5306E60) is displayed under the CRC column.

Figure 4: Checksum Displayed in Cyclone Control GUI. Images Tab 

2. The Cyclone can also show the checksum of a selected image directly on the home screen of the display. This is the menu path to follow on the Cyclone to add the number to the display:

Menu -> Configure Cyclone -> Configure Screen -> Configure Home Screen -> Select Display Line -> Element: Image CRC32

Figure 5: Checksum Displayed on Cyclone Screen3. You can retrieve the checksum from the command line with the cycloneControlConsole application or programmatically in your application using the Cyclone Control SDK. The checksum is the imagecrc32 property which is part of the image properties category.

The following command example is for the cycloneControlConsole:

CycloneControlConsole.exe -cyclone=10.1.2.1 -getproperty=imageproperties,1,imagecrc32

Figure 6: Retrieve Checksum via Cyclone Control Console

To use the Cyclone Control SDK in your application, use the Category "imageproperties" and the Property "imagecrc32”. If you have any questions about using Cyclone Control SDK with properties, please refer to Section 3c “Working With Properties“ of the Cyclone Control Suite SDK: Automated Flash Programming with C blog post.

Conclusion

PEmicro anticipates that the SAP image checksum feature provides a helpful way for the user to verify the correct image was selected in production. This is especially important for users who are handling multiple product lines and firmware versions. Combining this checksum feature with the automation provided through the Cyclone Control SDK, the user can create a highly automated production process that is efficient and reduces the chance of human error, saving your company time and money.

Tags related to this Blog Post

Cyclone     Cyclone FX     ARM     NXP     Production Programming