Skip to content

Add wolfBoot port for STM32N6 (NUCLEO-N657X0-Q)#720

Open
aidangarske wants to merge 1 commit intomasterfrom
stm32n6-port-wolfboot
Open

Add wolfBoot port for STM32N6 (NUCLEO-N657X0-Q)#720
aidangarske wants to merge 1 commit intomasterfrom
stm32n6-port-wolfboot

Conversation

@aidangarske
Copy link
Member

@aidangarske aidangarske commented Mar 11, 2026

Description

  • New wolfBoot port for STM32N6 (Cortex-M55) targeting the NUCLEO-N657X0-Q board
  • Bare-metal HAL with XSPI2 NOR flash driver (Macronix MX25UM51245G), single-SPI mode
  • wolfBoot runs from SRAM as FSBL, boots signed application via XIP from external NOR flash
  • OpenOCD config, flash script, CI build test, and documentation.
  • OpenOCD was used specifically becuase we cant write to internal flash with the N6 STM32CubeProgrammer cant directly program the external NOR flash that the N6 uses. OpenOCD's stmqspi driver can talk to external XSPI/QSPI flash through the STM32's XSPI peripheral. Our reset-init event handler in the OpenOCD config
    sets up XSPI2, probes the NOR flash, and then flash write_image programs it. On top of that, we also need to load_image wolfBoot into SRAM and manually set up VTOR/MSP/resume

Details

  • HAL (hal/stm32n6.c, hal/stm32n6.h): Clock, PWR, GPIO, XSPI2, cache, and debug UART. All flash functions are RAMFUNCTION for safe operation from
    XIP.
  • Build system (arch.mk, Makefile, test-app/Makefile): CORTEX_M33 with -mcpu=cortex-m55 override, EXT_FLASH for update/swap partitions
  • Test app (test-app/app_stm32n6.c): LED blink on Port G (active LOW), flash erase test, wolfBoot_success() call from XIP
  • Linker scripts (hal/stm32n6.ld, test-app/ARM-stm32n6.ld): wolfBoot at 0x34000000 (SRAM), test app RAM at 0x34010000
  • Flash tooling (tools/scripts/stm32n6_flash.sh, config/openocd/openocd_stm32n6.cfg): Programs NOR flash and loads wolfBoot to SRAM via
    OpenOCD/ST-Link
  • Config (config/examples/stm32n6.config): ECC256+SHA256, boot at 0x70020000, update at 0x70120000
  • CI (.github/workflows/test-configs.yml): Build verification
  • Docs (docs/Targets.md): Memory layout, build/flash instructions, XIP constraints, debugging

Test plan

  • CI build passes (make with stm32n6.config)
  • Flash and boot on NUCLEO-N657X0-Q: green LED solid, blue LED blinking
  • wolfBoot_success() completes (RAMFUNCTION flash write from XIP)

@aidangarske aidangarske self-assigned this Mar 11, 2026
Copilot AI review requested due to automatic review settings March 11, 2026 01:17
Copy link
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

Adds a new wolfBoot port for STM32N6 / NUCLEO-N657X0-Q, including a bare-metal HAL for XSPI2 NOR XIP, flash/debug tooling via OpenOCD, and CI/docs updates.

Changes:

  • Adds STM32N6 HAL + linker scripts to run wolfBoot from SRAM and boot an XIP app from external NOR
  • Adds a STM32N6 test-app, build integration, example config, and CI build job
  • Adds OpenOCD configuration + a flash script and updates target documentation

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tools/scripts/stm32n6_flash.sh Automates building/flashing via OpenOCD and boots wolfBoot from SRAM
test-app/app_stm32n6.c New bare-metal test app for STM32N6 (LED + XIP flash op + wolfBoot_success)
test-app/Makefile Adds stm32n6 build flags/linker script integration for the test app
test-app/ARM-stm32n6.ld Linker script for XIP test-app in NOR and runtime data in SRAM
hal/stm32n6.ld Linker script for wolfBoot executing from SRAM
hal/stm32n6.h STM32N6 register/bit definitions for clocks, GPIO, XSPI2, UART, cache ops
hal/stm32n6.c STM32N6 HAL implementation (clock/power, XSPI2 NOR driver, flash/ext_flash API)
docs/Targets.md New STM32N6 target documentation (memory map, build/flash/debug workflow)
config/openocd/openocd_stm32n6.cfg OpenOCD target config + XSPI2 init and stmqspi flash bank setup
config/examples/stm32n6.config Example wolfBoot config for STM32N6 + external flash partitioning
arch.mk Adds stm32n6 target selection and ARM build settings (mcpu=cortex-m55, origins)
Makefile Sets stm32n6 main targets and introduces a stm32n6-specific flash target
.github/workflows/test-configs.yml Adds CI build verification job for stm32n6 example config

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

  Add HAL, build system, test app, and documentation for the
  STM32N6 (Cortex-M55) targeting the NUCLEO-N657X0-Q board.
  wolfBoot runs from SRAM as FSBL and boots a signed application
  via XIP from external NOR flash on XSPI2.
@aidangarske aidangarske force-pushed the stm32n6-port-wolfboot branch from fedaf00 to 1416f2f Compare March 11, 2026 18:37
@aidangarske aidangarske requested a review from Copilot March 11, 2026 18:40
Copy link
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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.


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

@aidangarske aidangarske marked this pull request as ready for review March 11, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants