Skip to content

Commit eee953f

Browse files
dgarskedanielinux
authored andcommitted
Add tests and improve docs
1 parent 2831b6d commit eee953f

5 files changed

Lines changed: 110 additions & 23 deletions

File tree

.github/workflows/test-configs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ jobs:
211211
arch: ppc
212212
config-file: ./config/examples/nxp-t2080.config
213213

214+
nxp_lpc54s018m_test:
215+
uses: ./.github/workflows/test-build.yml
216+
with:
217+
arch: arm
218+
config-file: ./config/examples/nxp_lpc54s018m.config
219+
214220
nxp_ls1028a_test:
215221
uses: ./.github/workflows/test-build.yml
216222
with:

config/examples/nxp_lpc54s018m.config

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,51 @@
1+
# wolfBoot configuration for NXP LPCXpresso54S018M-EVK
2+
#
3+
# Target: NXP LPC54S018M (Cortex-M4F, 180 MHz)
4+
# Boot: ROM boot loads wolfBoot from external SPIFI QSPI flash at 0x10000000
5+
# HAL: Bare-metal (hal/nxp_lpc54s018m.c) — no NXP MCUXpresso SDK required
6+
#
7+
# Flash layout (SPIFI QSPI, 16 MB total):
8+
# 0x10000000 wolfBoot (up to BOOT partition base)
9+
# 0x10010000 BOOT partition (960 KB, signed application)
10+
# 0x10100000 UPDATE partition (960 KB)
11+
# 0x101F0000 SWAP sector (4 KB)
12+
113
ARCH?=ARM
214
TARGET?=nxp_lpc54s018m
15+
16+
# Signature and hash algorithms
317
SIGN?=ECC256
418
HASH?=SHA256
19+
520
DEBUG?=0
621
DEBUG_UART?=1
22+
23+
# Vector table relocation is required — ROM boot leaves VTOR at 0
724
VTOR?=1
25+
826
NO_ASM?=0
27+
28+
# Single-flash layout (all partitions in internal SPIFI region)
929
EXT_FLASH?=0
1030
SPI_FLASH?=0
31+
1132
ALLOW_DOWNGRADE?=0
1233
NVM_FLASH_WRITEONCE?=0
1334
WOLFBOOT_VERSION?=0
1435
V?=0
36+
37+
# Single-precision math (reduced footprint, no ASM)
1538
SPMATH?=1
39+
40+
# RAM_CODE required: flash erase/program routines must execute from SRAM
41+
# because SPIFI cannot service instruction fetches while being written
1642
RAM_CODE?=1
43+
1744
DUALBANK_SWAP?=0
45+
46+
# Enable NXP LPC PKA peripheral for ECC acceleration
1847
PKA?=1
48+
1949
WOLFBOOT_PARTITION_SIZE?=0xF0000
2050
WOLFBOOT_SECTOR_SIZE?=0x1000
2151
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x10010000

docs/Targets.md

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ This README describes configuration of supported targets.
2020
* [Nordic nRF54L15](#nordic-nrf54l15)
2121
* [NXP iMX-RT](#nxp-imx-rt)
2222
* [NXP Kinetis](#nxp-kinetis)
23-
* [NXP LPC54xxx](#nxp-lpc54xxx)
24-
* [NXP LPC54S018M](#nxp-lpc54s018m)
23+
* [NXP LPC546xx](#nxp-lpc546xx)
24+
* [NXP LPC540xx / LPC54S0xx (SPIFI boot)](#nxp-lpc540xx--lpc54s0xx-spifi-boot)
2525
* [NXP LPC55S69](#nxp-lpc55s69)
2626
* [NXP LS1028A](#nxp-ls1028a)
2727
* [NXP MCXA153](#nxp-mcxa153)
@@ -1897,11 +1897,17 @@ c
18971897
```
18981898

18991899

1900-
## NXP LPC54xxx
1900+
## NXP LPC546xx
1901+
1902+
This covers the LPC546xx series (Cortex-M4F with internal NOR flash), using the
1903+
NXP MCUXpresso SDK. Tested on LPC54606J512.
1904+
1905+
For the LPC540xx / LPC54S0xx SPIFI-boot series (no internal flash), see the
1906+
[next section](#nxp-lpc540xx--lpc54s0xx-spifi-boot).
19011907

19021908
### Build Options
19031909

1904-
The LPC54xxx build can be obtained by specifying the CPU type and the MCUXpresso SDK path at compile time.
1910+
The build can be obtained by specifying the CPU type and the MCUXpresso SDK path at compile time.
19051911

19061912
The following configuration has been tested against LPC54606J512BD208:
19071913

@@ -1938,15 +1944,22 @@ arm-none-eabi-gdb wolfboot.elf -ex "target remote localhost:3333"
19381944
```
19391945

19401946

1941-
## NXP LPC54S018M
1947+
## NXP LPC540xx / LPC54S0xx (SPIFI boot)
19421948

1943-
The NXP LPC54S018M is a Cortex-M4 microcontroller running at 180MHz. Unlike the
1944-
LPC54606 which has internal flash, the LPC54S018M has **no internal NOR flash**
1945-
all code executes from on-package SPIFI-mapped QSPI flash (Winbond W25Q32JV, 4MB)
1946-
at address `0x10000000`.
1949+
This section covers the LPC540xx and LPC54S0xx family (LPC54005, LPC54016,
1950+
LPC54018, LPC54S005, LPC54S016, LPC54S018, and the "M" in-package-flash
1951+
variants LPC54018M / LPC54S018M). These are Cortex-M4F parts at 180 MHz with
1952+
**no internal NOR flash** — all code executes from SPIFI-mapped QSPI flash at
1953+
address `0x10000000`. The boot ROM loads the image from SPIFI via an
1954+
"enhanced boot block" descriptor embedded in the vector table area.
19471955

1948-
This has been tested on the LPC54S018M-EVK board, which includes an on-board
1949-
Link2 debug probe (CMSIS-DAP / J-Link compatible) and a VCOM UART via Flexcomm0.
1956+
The wolfBoot HAL (`hal/nxp_lpc54s018m.c`) is bare-metal (no NXP SDK
1957+
dependency) and targets this whole SPIFI-boot subseries. It has been
1958+
verified on the LPC54S018M-EVK, which uses an on-package Winbond W25Q32JV
1959+
(4MB) and provides an on-board Link2 debug probe (CMSIS-DAP / J-Link) with
1960+
a VCOM UART on Flexcomm0. Other members of the family should work after
1961+
adjusting the SPIFI device configuration words to match the attached QSPI
1962+
part and sector size.
19501963

19511964
Because flash erase/write operations disable XIP (execute-in-place), all flash
19521965
programming functions must run from RAM. The configuration uses `RAM_CODE=1` to
@@ -2096,7 +2109,21 @@ either message means the binary is not bootable on this chip.
20962109

20972110
### LPC54S018M: Testing firmware update
20982111

2099-
A convenience script automates the full build, sign, and flash process:
2112+
The helper script [`tools/scripts/nxp-lpc54s018m-flash.sh`](../tools/scripts/nxp-lpc54s018m-flash.sh)
2113+
automates the full **build → sign → flash** cycle for the LPC54S018M-EVK:
2114+
2115+
1. Copies `config/examples/nxp_lpc54s018m.config` to `.config`
2116+
2. Runs `make` to produce `factory.bin` (wolfBoot + signed v1 test-app)
2117+
3. Parses the active `.config` to resolve partition and trailer addresses
2118+
4. Erases the BOOT and UPDATE partition trailer sectors (clean boot state)
2119+
5. Flashes `factory.bin` to SPIFI at `0x10000000` via `pyocd`
2120+
6. Optionally signs a v2 test-app and flashes it to the update partition
2121+
to exercise the swap-and-confirm update flow
2122+
2123+
It drives [pyocd](https://pyocd.io/) with CMSIS-DAP firmware on the on-board
2124+
Link2 probe. Override `CONFIG_FILE`, `PYOCD_TARGET`, or `CROSS_COMPILE` via
2125+
environment variables to adapt the script to other LPC540xx/LPC54S0xx
2126+
boards. Run with `--help` for the full option list.
21002127

21012128
```sh
21022129
# Build and flash v1 only

hal/nxp_lpc54s018m.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@
1818
* along with this program; if not, write to the Free Software
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
2020
*
21-
* NXP LPC54S018M HAL for wolfBoot
21+
* NXP LPC540xx / LPC54S0xx (SPIFI-boot) HAL for wolfBoot
2222
*
23-
* The LPC54S018M has no internal NOR flash. All code executes from
24-
* on-package SPIFI QSPI flash (W25Q32JV, 4MB) mapped at 0x10000000.
25-
* Flash operations MUST run from RAM since XIP is disabled during
26-
* erase/write.
23+
* Covers the LPC540xx and LPC54S0xx subseries (LPC54005/54016/54018,
24+
* LPC54S005/54S016/54S018, and the in-package flash "M" variants
25+
* LPC54018M / LPC54S018M). None of these parts have internal NOR flash —
26+
* all code executes from external QSPI flash mapped via SPIFI at
27+
* address 0x10000000. Flash operations MUST run from RAM since XIP is
28+
* disabled during erase/write.
29+
*
30+
* Verified on the LPC54S018M-EVK (Winbond W25Q32JV, 4 MB). Other family
31+
* members should work after adjusting the SPIFI device configuration words
32+
* and sector/partition sizes to match the attached QSPI part.
2733
*
2834
* This HAL uses bare-metal register access — no NXP SDK dependencies.
2935
*/

tools/scripts/nxp-lpc54s018m-flash.sh

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,31 @@
22
#
33
# NXP LPC54S018M-EVK Flash Script
44
#
5-
# This script automates:
6-
# 1. Configure for NXP LPC54S018M-EVK
7-
# 2. Build factory.bin (or factory + v2 update)
8-
# 3. Flash via pyocd (CMSIS-DAP)
5+
# End-to-end helper to build wolfBoot, sign the test application, and
6+
# program the LPC54S018M-EVK SPIFI flash via pyocd. Also optionally
7+
# exercises the A/B update flow by signing a v2 image and loading it
8+
# into the update partition so wolfBoot will swap on the next boot.
99
#
10-
# The LPC-Link2 debug probe must have CMSIS-DAP firmware.
11-
# See docs/Targets.md for Link2 probe setup instructions.
10+
# Flow:
11+
# 1. Copy config/examples/nxp_lpc54s018m.config to .config
12+
# 2. make -> factory.bin (wolfBoot + signed v1 test-app)
13+
# 3. Parse .config to derive partition/trailer addresses
14+
# 4. Erase BOOT and UPDATE partition trailer sectors (clean boot state)
15+
# 5. pyocd flash factory.bin @ 0x10000000 (SPIFI base)
16+
# 6. With --test-update: sign v2, flash at WOLFBOOT_PARTITION_UPDATE_ADDRESS
17+
#
18+
# Requirements:
19+
# - pyocd + LPC54S018J4MET180 target pack
20+
# - arm-none-eabi-gcc toolchain
21+
# - LPC-Link2 probe running CMSIS-DAP firmware (see docs/Targets.md:
22+
# "LPC54S018M: Link2 debug probe setup")
23+
#
24+
# Customization (LPC540xx / LPC54S0xx family):
25+
# Override CONFIG_FILE, PYOCD_TARGET, or CROSS_COMPILE via environment to
26+
# reuse this script for other LPC540xx / LPC54S0xx boards.
27+
#
28+
# See also: docs/Targets.md section
29+
# "NXP LPC540xx / LPC54S0xx (SPIFI boot) -> LPC54S018M: Testing firmware update"
1230
#
1331

1432
set -e

0 commit comments

Comments
 (0)