Command CRC

This command performs a CRC32 on a range of Flash memory as specified by a CRC table that exists in that region. Applicable Flash regions are those listed in the device’s “System Address Map” that start with NVMC::. The CRC tables are user-programmable, and multiple tables can exist in a region. Tables must be aligned to a 16-byte address boundary.

These restrictions apply as security measures:

  • The CRC command will not return the result of the CRC; it will only indicate whether the value matched or mismatched the expected value
  • The region of memory to check and its expected CRC must be stored internally in a table. Therefore, the regions that may be tested must be planned in advance, and their expected CRCs must be calculated beforehand The debugger does not provide the expected CRC value; instead, it provides the starting location of one of these tables. As a result, the user must know where these tables are stored. Refer to Table 6-13 for more information on the CRC tables.
  • There is a 128-bit fuse value (KeyVal*) used as a key to unlock the CRC command. If KeyVal is set to all ‘1’s, no key is required; if it is set to all ‘0’s, this functionality is disabled.
Table 6-13. General CRC Table Format
WordOffsetNameValue/FormatDescription
00x0HDR0x43524349Constant, denotes the CRC header
10x4ADDR0x0C000000Start Address, must be word-aligned (four bytes)
20x8SIZE0x100

Size in bytes, but must be a multiple of four.

The maximum size is the largest Flash region.

30xCREFVAL0xAABBCCDDExpected CRC32 result
CRC Table Structure
typedef struct {
 unsigned int hdr;
 unsigned int addr;
 unsigned int size;
 unsigned int refval;
} crcTable;

The calculation used is CRC-32-IEEE 802.3 with the following settings:

  • Polynomial Length (PLEN) = 32 bits
  • Polynomial (POLY) = 0x04C11DB7 (Poly)
  • Initial Value = 0xFFFFFFFF (Init)
  • Reflected Input (RIN) = Input data is reflected—Least Significant bit (LSb) first
  • Reflected Output (ROUT) = Output data is reflected
  • No XOR (FXOR) is applied to the output CRC Accumulator (ACC)
    • This is equivalent to an FXOR of 0x00000000
  • The accumulator result is compared to REFVAL to determine pass or fail

The CRC command returns its availability before accepting two arguments: MEMMAP and TableAddress. After processing, the command returns the status of the operation, which can indicate a CRC table error, pass or fail. The Accumulator and Checksum are never returned.

Table 6-15 defines the command structure, and Figure 6-7 shows the communication sequence.