Skip to content

Commit 2831b6d

Browse files
dgarskedanielinux
authored andcommitted
Expand documentation for the enhaced boot block
1 parent 46deb23 commit 2831b6d

1 file changed

Lines changed: 34 additions & 4 deletions

File tree

docs/Targets.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,10 +2059,40 @@ pyocd flash -t LPC54S018J4MET180 factory.bin --base-address 0x10000000
20592059
pyocd reset -t LPC54S018J4MET180
20602060
```
20612061

2062-
**Note:** The LPC54S018M boot ROM validates a vector table checksum at offset
2063-
0x1C. The build system automatically computes and patches this checksum into
2064-
`wolfboot.bin`. If the checksum is invalid, the boot ROM will enter ISP mode
2065-
instead of booting from SPIFI flash.
2062+
**Note:** The LPC54S018M boot ROM requires two post-processing steps on
2063+
`wolfboot.bin` before the chip can boot from SPIFI flash. Both are applied
2064+
automatically by the top-level `Makefile` (see the `wolfboot.bin:` rule,
2065+
gated on `TARGET=nxp_lpc54s018m`), so no user action is needed — but they
2066+
are documented here because the patched binary will not match the ELF output
2067+
and this affects any external flashing or signing workflow.
2068+
2069+
1. **Vector table checksum** (offset `0x1C`):
2070+
The boot ROM validates that the sum of the first 8 words of the vector
2071+
table (SP, Reset, NMI, HardFault, MemManage, BusFault, UsageFault,
2072+
checksum) equals zero. The build computes
2073+
`ck = (-sum_of_first_7_words) & 0xFFFFFFFF` and writes `ck` at offset
2074+
`0x1C`. If this checksum is wrong, the boot ROM enters ISP mode
2075+
(USB DFU / UART autobaud) instead of booting from SPIFI.
2076+
2077+
2. **Enhanced boot block** (at offset `0x160`, pointed to by offset `0x24`):
2078+
A 100-byte structure (25 × uint32) that the boot ROM reads **before**
2079+
jumping to the application, to configure the SPIFI controller for
2080+
quad I/O fast read XIP. Key fields:
2081+
- `0xFEEDA5A5` magic word
2082+
- Image type / image load address (`0x10000000`) / image size
2083+
- `0xEDDC94BD` signature (matches the pointer at offset `0x24`)
2084+
- SPIFI device configuration words (`0x001640EF`, `0x1301001D`,
2085+
`0x04030050`, `0x14110D09`) — these describe the W25Q32JV command
2086+
set, dummy cycles, and timing
2087+
- Offset `0x24` contains `{0xEDDC94BD, 0x160}` — the marker plus the
2088+
pointer to the block itself
2089+
2090+
Without this block the boot ROM leaves SPIFI in slow single-lane read
2091+
mode (or unconfigured), and XIP either fails or runs far below spec.
2092+
2093+
The build prints both `[LPC] enhanced boot block` and
2094+
`vector checksum: 0xXXXXXXXX` lines when these steps run — absence of
2095+
either message means the binary is not bootable on this chip.
20662096

20672097
### LPC54S018M: Testing firmware update
20682098

0 commit comments

Comments
 (0)