@@ -21,6 +21,7 @@ This README describes configuration of supported targets.
2121* [ NXP iMX-RT] ( #nxp-imx-rt )
2222* [ NXP Kinetis] ( #nxp-kinetis )
2323* [ NXP LPC54xxx] ( #nxp-lpc54xxx )
24+ * [ NXP LPC54S018M] ( #nxp-lpc54s018m )
2425* [ NXP LPC55S69] ( #nxp-lpc55s69 )
2526* [ NXP LS1028A] ( #nxp-ls1028a )
2627* [ NXP MCXA153] ( #nxp-mcxa153 )
@@ -1937,6 +1938,202 @@ arm-none-eabi-gdb wolfboot.elf -ex "target remote localhost:3333"
19371938```
19381939
19391940
1941+ ## NXP LPC54S018M
1942+
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 ` .
1947+
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.
1950+
1951+ Because flash erase/write operations disable XIP (execute-in-place), all flash
1952+ programming functions must run from RAM. The configuration uses ` RAM_CODE=1 ` to
1953+ ensure this.
1954+
1955+ ### LPC54S018M: Link2 debug probe setup
1956+
1957+ The LPC54S018M-EVK has an on-board LPC-Link2 debug probe (LPC4322). The probe
1958+ firmware determines the debug protocol: CMSIS-DAP or J-Link. J-Link firmware is
1959+ recommended for use with wolfBoot.
1960+
1961+ ** Jumper JP5** controls the Link2 boot mode:
1962+ - ** Installed (normal):** Link2 runs from its internal flash (debug probe mode)
1963+ - ** Removed (DFU):** Link2 enters DFU mode for firmware programming
1964+
1965+ To program J-Link firmware onto the Link2:
1966+
1967+ 1 . Remove JP5 and power cycle the board. The Link2 enters DFU mode
1968+ (USB ` 1fc9:000c ` ).
1969+
1970+ 2 . Install [ NXP LinkServer] ( https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/linkserver-for-microcontrollers:LINKERSERVER )
1971+ which includes LPCScrypt.
1972+
1973+ 3 . Boot LPCScrypt onto the Link2 (requires sudo or udev rules):
1974+
1975+ ``` sh
1976+ sudo /usr/local/LinkServer/lpcscrypt/scripts/boot_lpcscrypt
1977+ ```
1978+
1979+ 4 . Identify the LPCScrypt serial port and program J-Link firmware:
1980+
1981+ ``` sh
1982+ # Find the new ttyACM device created after boot_lpcscrypt
1983+ ls -lt /dev/ttyACM*
1984+
1985+ # Program J-Link firmware (replace /dev/ttyACMx with the correct port)
1986+ sudo /usr/local/LinkServer/lpcscrypt/bin/lpcscrypt -d /dev/ttyACMx \
1987+ program /usr/local/LinkServer/lpcscrypt/probe_firmware/LPCLink2/Firmware_JLink_LPC-Link2_20230502.bin BankA
1988+ ```
1989+
1990+ 5 . Re-install JP5 and power cycle the board. The Link2 should now enumerate
1991+ as a Segger J-Link USB device.
1992+
1993+ ** Note:** If ` uart-monitor ` or another tool has the serial port open, you must
1994+ release it first (e.g., ` uart-monitor yield /dev/ttyACMx ` ) before running
1995+ lpcscrypt.
1996+
1997+ To program CMSIS-DAP firmware instead (for use with pyocd/OpenOCD):
1998+
1999+ ``` sh
2000+ sudo /usr/local/LinkServer/lpcscrypt/bin/lpcscrypt -d /dev/ttyACMx \
2001+ program /usr/local/LinkServer/lpcscrypt/probe_firmware/LPCLink2/LPC432x_CMSIS_DAP_V5_460.bin.hdr BankA
2002+ ```
2003+
2004+ ### LPC54S018M: MCUXpresso SDK setup
2005+
2006+ This requires the NXP MCUXpresso SDK. We tested using
2007+ [ mcuxsdk-manifests] ( https://github.com/nxp-mcuxpresso/mcuxsdk-manifests ) and
2008+ [ CMSIS_5] ( https://github.com/nxp-mcuxpresso/CMSIS_5 ) placed under "../NXP".
2009+
2010+ ``` sh
2011+ cd ../NXP
2012+
2013+ # Install west
2014+ python -m venv west-venv
2015+ source west-venv/bin/activate
2016+ pip install west
2017+
2018+ # Set up the repository
2019+ west init -m https://github.com/nxp-mcuxpresso/mcuxsdk-manifests.git mcuxpresso-sdk
2020+ cd mcuxpresso-sdk
2021+ west update
2022+
2023+ deactivate
2024+ ```
2025+
2026+ The CMSIS headers are also needed:
2027+
2028+ ``` sh
2029+ cd ../NXP
2030+ git clone https://github.com/nxp-mcuxpresso/CMSIS_5.git
2031+ ```
2032+
2033+ ### LPC54S018M: Flash partition layout
2034+
2035+ The 4MB SPIFI flash is partitioned as follows:
2036+
2037+ | Region | Address | Size |
2038+ | --------------| -------------| --------|
2039+ | wolfBoot | 0x10000000 | 64KB |
2040+ | Boot (app) | 0x10010000 | 960KB |
2041+ | Update | 0x10100000 | 960KB |
2042+ | Swap sector | 0x101F0000 | 4KB |
2043+
2044+ The sector size is 4KB, matching the W25Q32JV minimum erase size.
2045+
2046+ ### LPC54S018M: Configuring and compiling
2047+
2048+ Copy the example configuration file and build with make:
2049+
2050+ ``` sh
2051+ cp config/examples/nxp_lpc54s018m.config .config
2052+ make
2053+ ```
2054+
2055+ This produces ` factory.bin ` containing wolfBoot + the signed test application.
2056+
2057+ ### LPC54S018M: Loading the firmware
2058+
2059+ The on-board Link2 debugger supports both CMSIS-DAP and J-Link protocols.
2060+ See [ Link2 debug probe setup] ( #lpc54s018m-link2-debug-probe-setup ) for
2061+ programming the probe firmware.
2062+
2063+ ** Using JLink** (Link2 with J-Link firmware):
2064+
2065+ ```
2066+ JLinkExe -device LPC54S018M -if SWD -speed 4000
2067+ loadbin factory.bin 0x10000000
2068+ r
2069+ g
2070+ ```
2071+
2072+ ** Using pyocd** (Link2 with CMSIS-DAP firmware):
2073+
2074+ ``` sh
2075+ pyocd pack install LPC54S018J4MET180
2076+ pyocd flash -t LPC54S018J4MET180 factory.bin --base-address 0x10000000
2077+ pyocd reset -t LPC54S018J4MET180
2078+ ```
2079+
2080+ ** Note:** The LPC54S018M boot ROM validates a vector table checksum at offset
2081+ 0x1C. The build system automatically computes and patches this checksum into
2082+ ` wolfboot.bin ` . If the checksum is invalid, the boot ROM will enter ISP mode
2083+ instead of booting from SPIFI flash.
2084+
2085+ ### LPC54S018M: Testing firmware update
2086+
2087+ 1 . Build and flash factory.bin (version 1). USR_LED1 (P3.14) lights up.
2088+
2089+ 2 . Sign a version 2 update image and load it to the update partition:
2090+
2091+ ``` sh
2092+ # Build update image (version 2)
2093+ make test-app/image_v2_signed.bin
2094+ ```
2095+
2096+ ```
2097+ JLinkExe -device LPC54S018M -if SWD -speed 4000
2098+ loadbin test-app/image_v2_signed.bin 0x10100000
2099+ r
2100+ g
2101+ ```
2102+
2103+ 3 . The test application detects the update, triggers a swap via
2104+ ` wolfBoot_update_trigger() ` , and resets. After the swap, USR_LED2 (P3.3)
2105+ lights up indicating version 2 is running.
2106+
2107+ 4 . The application calls ` wolfBoot_success() ` to confirm the update and
2108+ prevent rollback.
2109+
2110+ ### LPC54S018M: LED indicators
2111+
2112+ The test application uses three user LEDs (accent LEDs accent active low):
2113+
2114+ | LED | GPIO | Meaning |
2115+ | -----------| --------| ----------------------------|
2116+ | USR_LED1 | P3.14 | Version 1 running |
2117+ | USR_LED2 | P3.3 | Version 2+ running |
2118+ | USR_LED3 | P2.2 | Update activity in progress |
2119+
2120+ ### LPC54S018M: Debugging with JLink
2121+
2122+ ```
2123+ JLinkGDBServer -device LPC54S018M -if SWD -speed 4000 -port 3333
2124+ ```
2125+
2126+ Then, from another console:
2127+
2128+ ```
2129+ arm-none-eabi-gdb wolfboot.elf -ex "target remote localhost:3333"
2130+ (gdb) add-symbol-file test-app/image.elf 0x10010100
2131+ ```
2132+
2133+ Note: The image.elf symbol offset is the boot partition address (0x10010000) plus
2134+ the wolfBoot image header size (0x100).
2135+
2136+
19402137## NXP LPC55S69
19412138
19422139The NXP LPC55S69 is a dual-core Cortex-M33 microcontroller. The support has been
0 commit comments