Skip to content

Add wolfBoot support for NXP LPC54S018M-EVK#752

Open
dgarske wants to merge 8 commits intowolfSSL:masterfrom
dgarske:nxp_lpc54s018m
Open

Add wolfBoot support for NXP LPC54S018M-EVK#752
dgarske wants to merge 8 commits intowolfSSL:masterfrom
dgarske:nxp_lpc54s018m

Conversation

@dgarske
Copy link
Copy Markdown
Contributor

@dgarske dgarske commented Apr 15, 2026

No description provided.

dgarske and others added 7 commits April 15, 2026 09:26
   The LPC54S018M HAL had three critical SPIFI controller issues preventing
   flash write/erase operations from working, which blocked wolfBoot_success(),
   wolfBoot_update_trigger(), and the firmware swap:

   1. Wrong memory-mode read command: Used opcode 0x6B (Quad Output, serial
      address) but the boot ROM configures 0xEB (Quad I/O, quad address) with
      MCMD=0xEB930000. The mismatch caused garbled address bits when re-entering
      XIP after flash operations, crashing on instruction fetch.

   2. SPIFI POLL mode not waiting: The boot ROM leaves CLIMIT[7:0]=0x00 which
      makes the hardware POLL comparison always succeed immediately. Set
      IDATA=0x00 and CLIMIT[7:0]=0x01 to properly wait for flash BUSY to clear.

   3. SPIFI reset clears CTRL/CLIMIT: The reset used to exit memory mode clears
      the boot ROM's timing config (CTRL=0x600F03E8) and cache limit
      (CLIMIT=0x08000000). Save and restore both registers around every reset.

   Additional changes:
   - Add RAMFUNCTION memcpy (src/string.o) to test app for SPIFI XIP safety
   - Add bare-metal UART driver for Flexcomm0 (non-blocking, skips if FC0
     doesn't respond — observed on some LPC54S018M-EVK boards)
   - Add DSB+ISB barriers after entering memory mode for pipeline coherency
   - Enable DEBUG_UART in example config
   - Update test app to follow LPC55S69 port patterns with LED indicators
     for boot version and update status

   Tested: cold boot, ECC256 signature verify, wolfBoot_success(),
   wolfBoot_update_trigger(), and full v1->v2 firmware swap all working.
   Swap takes ~60 seconds for the 960KB partition (240 sector operations).
  - HAL: Remove debug spifi_test_mode_switch(), use wolfBoot_printf
    instead of raw uart_write, add printf.h include
  - Test app: Use check_parts() (was defined but unused), replace
    custom print_str/print_hex32 with wolfBoot_printf, fix LED logic
    to show LED1 for v1 and LED2 for v2+ (was always LED1)
  - Docs: Remove incorrect MCUXpresso SDK section (port is bare-metal),
    fix typo, add swap timing note, add flash script references
  - Build: Add --no-warn-rwx-segments to arch.mk, improve Makefile
    comments
  - Add tools/scripts/nxp-lpc54s018m-flash.sh following the
    nxp-s32k142-flash.sh pattern (build, sign, flash via pyocd)

  Tested: full boot + firmware update cycle (v1 -> v2 swap) verified
  on LPC54S018M-EVK hardware.
@dgarske dgarske self-assigned this Apr 15, 2026
Copilot AI review requested due to automatic review settings April 15, 2026 17:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds wolfBoot bring-up for the NXP LPC54S018M-EVK (LPC540xx/LPC54S0xx SPIFI-boot family), including a bare-metal HAL, build/link integration, and tooling/docs to build/sign/flash and exercise A/B updates.

Changes:

  • Add bare-metal SPIFI (QSPI XIP) HAL + linker scripts for TARGET=nxp_lpc54s0xx.
  • Add LPC54S0xx test application + Makefile integration and example .config.
  • Add documentation, a pyocd-based flashing helper script, and CI build coverage for the new config.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tools/scripts/nxp-lpc54s0xx-flash.sh New end-to-end build/sign/flash helper for LPC54S018M-EVK via pyocd
test-app/app_nxp_lpc54s0xx.c New LPC54S0xx test app demonstrating confirm + update trigger with LEDs
test-app/Makefile Add nxp_lpc54s0xx target wiring and syscall/string objects
test-app/ARM-nxp_lpc54s0xx.ld New test-app linker script template for SPIFI-boot layout
hal/nxp_lpc54s0xx.ld New wolfBoot linker script template for SPIFI-boot external flash
hal/nxp_lpc54s0xx.c New bare-metal HAL for SPIFI flash ops + optional UART debug
docs/Targets.md Document LPC540xx/LPC54S0xx SPIFI-boot support and workflow
config/examples/nxp_lpc54s0xx.config New reference configuration for LPC54S018M-EVK
arch.mk Add nxp_lpc54s0xx target flags (flash offset, linker flags)
Makefile Post-process wolfboot.bin to add enhanced boot block + vector checksum
.github/workflows/test-configs.yml Add CI build job for the new example config

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/scripts/nxp-lpc54s0xx-flash.sh Outdated
Comment thread hal/nxp_lpc54s0xx.c
Comment thread Makefile Outdated
Comment thread config/examples/nxp_lpc54s0xx.config Outdated
Comment thread tools/scripts/nxp-lpc54s0xx-flash.sh
Comment thread tools/scripts/nxp-lpc54s0xx-flash.sh
@dgarske dgarske assigned danielinux and unassigned dgarske Apr 15, 2026
@dgarske dgarske requested a review from danielinux April 15, 2026 22:15
@dgarske dgarske added the Later It won't be fixed in the upcoming release label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Later It won't be fixed in the upcoming release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants