| ← Previous: Training Results | Index | Next: Quickboot → |
The persistent envelope stores training results for two controllers. Its binary layout, CRC range, reference-board location, and selection behavior are observed. The update procedure at the end is an inferred safe design derived from those constraints; it is not a claim that the reference loader already implements atomic updates.
All offsets and sizes are in bytes. Multi-byte fields use the loader’s native little-endian representation.
Each controller record is exactly 0x49a4 bytes:
| Record offset | Size | Contents |
|---|---|---|
0x0000 |
0x0140 |
Complete message block (0xa0 halfwords) |
0x0140 |
0x2864 |
Serialized phypara (5170 halfwords) |
0x29a4 |
0x2000 |
ACSM (4096 contiguous halfwords) |
| End | 0x49a4 |
Next record or end of controller data |
The ACSM offset is therefore exactly 0x140 + 0x2864 = 0x29a4.
phypara uses the fixed 69-segment, 5170-halfword serialization order documented in 09-training-results.md and fully enumerated in appendix-phypara-order.md. It is not a linear PHY dump. ACSM is contiguous. Preserve every message byte and every reserved/unknown part of the record.
0x9800 envelopeThe reserved persistent object is 0x9800 bytes (38,912 bytes), even though the defined header and two result records occupy only 0x93c8 bytes.
| Envelope offset | Field | Size / value |
|---|---|---|
0x0000 |
magic |
u32, 0x54524444 (DDRT) |
0x0004 |
crc32 |
u32, CRC-32 of [0x08, 0x9800) |
0x0008 |
chipid |
u64 |
0x0010 |
mac_addr |
u64, may be zero |
0x0018 |
version |
u32; reference sample is zero |
0x001c |
type |
u32; 0 = LPDDR4X, 1 = LPDDR5 |
0x0020 |
cs_num |
u32, number of ranks |
0x0024 |
data_rate |
u32, MT/s |
0x0028 |
reserved header | through 0x007f (88 bytes) |
0x0080 |
DDR0 result | 0x49a4 bytes |
0x4a24 |
DDR1 result | 0x49a4 bytes |
0x93c8 |
remaining reserved result area | through 0x97ff |
0x9800 |
end of envelope | total reserved size |
The populated size calculation is:
0x80 + 2 * 0x49a4 = 0x93c8
DDR1 begins at 0x80 + 0x49a4 = 0x4a24. The bytes from 0x93c8 through 0x97ff are still part of the persistent object and still participate in its CRC. Complete plain-text hex dumps of the reference 6400 MT/s DDRT fixtures are published in two appendices:
CSR[0x020011] = 0x000f, crc32 = 0x0f7e240d, 0x0000..0x93c7 with zero-padding instructions for 0x93c8..0x97ff);appendix-reference-envelope-fdl-{e1..e3,g1..g3,k1..k3}.md) for all nine clean 60 Ω default RX ODT (CSR[0x010048] = 0x0c00) USB/FDL full-training captures (CSR[0x020011] = 0x006f, zero-filled 0x93c8..0x97ff tail).The stored checksum is the CRC-32 used by the reference implementation, confirmed with zlib.crc32, over the full reserved envelope except the magic and CRC fields themselves:
CRC input = bytes [0x08, 0x9800)
Thus the input starts with chipid and includes the defined header, both controller records, and all trailing reserved bytes. Its length is 0x97f8 bytes. It does not stop at 0x93c8, and it does not include magic or the stored CRC field. When modifying any covered byte, including padding, recompute the checksum over exactly this range.
On the reference board, the envelope resides in SPI flash in the bootinfo partition at partition-relative offset 0x10000. The reference flash sector size is 4 KiB. This location is board-specific rather than an intrinsic property of the format.
A storage implementation must accommodate the entire 0x9800 object and the flash erase geometry. Destroying magic invalidates the result and forces full training; erasing its first sector is sufficient for deliberate invalidation. A failed or interrupted training run must not silently destroy the last usable result.
The loader chooses quickboot only when the envelope passes all of these checks:
magic equals 0x54524444;type matches the detected memory generation;cs_num matches the detected rank count;data_rate matches the configured rate; and[0x08, 0x9800).Any failure selects full training. The loader structure performs the inexpensive metadata comparisons before calculating CRC; that ordering is an optimization, not a relaxation of any condition.
Hardware experiments on the reference board confirmed the following isolated cases:
| Envelope variant | Result |
|---|---|
| Invalid CRC, other fields correct | Full training, 5630 ms |
cs_num = 1 instead of 2, valid recomputed CRC |
Full training, 5630 ms |
data_rate = 4800 instead of 6400, valid recomputed CRC |
Full training, 5635 ms |
| Original valid envelope | Quickboot, 9 ms |
These measurements establish that each tested mismatch independently forces training. They do not experimentally establish the relative check order; that order comes from the loader structure. Erasing the sector had previously been observed to force training through invalid magic, but invalid magic was not part of the controlled, CRC-recomputed variant set.
version exists for format evolution, but version checking is not among the five observed acceptance conditions above. chipid and mac_addr are stored, but the cited selection evidence does not establish that they are compared during boot.
A robust implementation should treat the saved envelope as a write-on-success snapshot, not as a work buffer.
CsTestFail.[0x08, 0x9800) only after all other bytes are final, then store it at 0x0004.0x9800 bytes, check metadata, recompute the CRC over the full range, and only then consider the new snapshot usable.The reference full-training path did not automatically rewrite the envelope; writing was a separate later-loader action. A replacement implementation must therefore schedule persistence explicitly after successful training and validation.
For format changes, increment version, reject unsupported layouts, and retrain. Never reinterpret an existing field with different semantics. Because current observed selection does not check version, adding a version check is a necessary implementation hardening step when multiple layouts are possible, not a description of the reference behavior.
version, chipid, mac_addr, and all reserved bytes are not fully specified beyond the captured sample and layout.