PEmicro Blog

Verify a Programmed Device via Checksum

Jun 30, 2020

The most common mechanism for verifying a programmed device is via the Verify Module command which verifies programmed memory against object files on a byte-by-byte basis. PEmicro also has several verification mechanisms which use Checksums/CRCs.

The Verify Checksum (VC) command automatically calculates checksum values for all flash memory ranges in a user's object files. The programmer then runs an algorithm to calculate checksums for these device regions and compares it to the ones calculated from the object file. The advantage of this method is that it is faster than byte by byte verification when the debug connection is slow.

The Verify Module CRC to Value (VV) command calculates a checksum for the entire device and compares it to a value provided by the user. This is often used as an addition step after byte by byte verification to check the state of the entire flash (even unprogrammed regions). 

Types of Checksums

The Cyclone can perform two types of verification using CRC-16 checksums:

  1. There is a  CRC-16 calculated from the addresses programmed on the device which is compared against the CRC-16 calculated from the raw data in the object file. This type of verification requires the addition of the Verify Checksum (VC) command into your programming script. Within the Cyclone Image Creation Utility, click on the Show Device CRC button to display the expected value calculated from the object file.

Figure 1: Adding the Verify Checksum (VC) command


Figure 2: Show Device CRC will display the expected CRC value ($6FC6)

  1. There is a CRC-16 calculated from the entire programmed device which is compared against a specified value. This requires the addition of the Verify Module CRC to Value (VV) command into your programming script.

Figure 3: Adding the Verify Module CRC to Value (VV) Command with specified CRC Value ($8630)

After the device under test has been programmed, the CRC-16 will be calculated and retrieved by the Cyclone. Not all algorithms support the VC or VV commands. If your algorithm is missing them, please contact our technical support department for assistance.

Displaying the Checksum

The Cyclone can show the two checksums on its display after the SAP image executes successfully. These are the steps to add them to the display: 

Menu -> Configure Cyclone -> Configure Screen -> Configure Home Screen -> Select Display Line -> Element: Object File CRC (VC) Calculated from Target

Menu -> Configure Cyclone -> Configure Screen -> Configure Home Screen -> Select Display Line -> Element: Whole Device CRC (VV) Calculated from Target

You can access and view the screen remotely using the Cyclone Control GUI’s Remote Display tab.

  Figure 4: The two checksums displayed on the Cyclone's LCD

Retrieving the Checksum Programmatically

You can retrieve the two checksums from the command line with the cycloneControlConsole application or programmatically in your application using the Cyclone Control SDK. The checksums are the targetobjectcrc and targetdevicecrc properties which are part of the targetproperties category.

Using Cyclone Control Console

CycloneControlConsole.exe -cyclone=10.0.9.13 -getproperty=targetproperties,1,targetobjectcrc -getproperty=targetproperties,1,targetdevicecrc

  Figure 5: The two checksums can be retrieved with the Cyclone Control Console

Using Cyclone Control SDK

To use the Cyclone Control SDK in your application, use Category "targetproperties" and Property "targetobjectcrc" or "targetdevicecrc". If you have any questions about using Cyclone Control SDK with properties, please refer to Section 3c “Working With Properties“ in the Cyclone Control SDK blog post.

Verification Failure

Here the wrong whole device CRC16 is specified using the previous example in Figure 3 to show what happens when there is a verification failure. The result is an error code that is usually in the $4001 to $4013 range displayed on the screen after the SAP image executes.

Figure 6: Verification Failure (Error Result)

Conclusion

PEmicro anticipates that adding the ability to calculate and retrieve a checksum will be helpful for Cyclone users, by making it very simple to accomplish this common task.

Tags related to this Blog Post

Cyclone     Cyclone FX     ARM     NXP     Production Programming     Debug     Automated Control