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.
| Word | Offset | Name | Value/Format | Description |
|---|---|---|---|---|
| 0 | 0x0 | HDR | 0x43524349 | Constant, denotes the CRC header |
| 1 | 0x4 | ADDR | 0x0C000000 | Start Address, must be word-aligned (four bytes) |
| 2 | 0x8 | SIZE | 0x100 | Size in bytes, but must be a multiple of four. The maximum size is the largest Flash region. |
| 3 | 0xC | REFVAL | 0xAABBCCDD | Expected CRC32 result |
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
- This is equivalent to an FXOR of
- 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.
