Skip to content

arch/arm/stm32n6: Add STM32N6 chip and Nucleo-N657X0-Q board support#18892

Open
ImBonkers wants to merge 4 commits into
apache:masterfrom
ImBonkers:stm32n6-port
Open

arch/arm/stm32n6: Add STM32N6 chip and Nucleo-N657X0-Q board support#18892
ImBonkers wants to merge 4 commits into
apache:masterfrom
ImBonkers:stm32n6-port

Conversation

@ImBonkers
Copy link
Copy Markdown

Summary

  • Why: there is no STM32N6 support in tree. This PR adds support for STM32N6 family and the Nucleo-N657X0-Q development board.
  • What: new arch chip directory arch/arm/src/stm32n6 and new board directory boards/arm/stm32n6/nucleo-n657x0-q, plus chip and board documentation pages. Three commits:
  1. arch/arm/stm32n6: Add STM32N6 chip support.
  2. boards/arm/stm32n6/nucleo-n657x0-q: Add Nucleo-N657X0-Q board support.
  3. Documentation/platforms/arm: Add STM32N6 chip and Nucleo-N657X0-Q pages.
  • How: the chip boots to an NSH console over USART1 via the on-board ST-Link and runs in DEV boot mode. The scope of this PR does not cover MPU, I/D-cache, MVE (Helium), DMA-RX on serial, LPUART, USART2..5, RS-485, TrustZone Non-Secure world, or XSPI signed-flash boot, etc. DEV mode loads nuttx.bin directly to AXISRAM at 0x34000400. stm32_serial.c is a stripped down version of arch/arm/src/stm32h5/stm32_serial.c.
  • Related NuttX issue: none.
  • Related NuttX Apps issue / PR: none.

Impact

  • Is new feature added? Is existing feature changed? YES
    new chip family stm32n6 and new board nucleo-n657x0-q. No existing feature changed.

  • Impact on user (will user need to adapt to change)? NO

  • Impact on build (will build process change)? NO
    tools/ci/testlist/arm-14.dat already covers this chip via the /arm/stm32n* glob; CMake chip pickup via add_subdirectory(${NUTTX_CHIP_ABS_DIR}) works without changes to arch/arm/src/CMakeLists.txt.

  • Impact on hardware (will arch(s) / board(s) / driver(s) change)? YES
    new chip and new board. No sibling arch or board files modified.

  • Impact on documentation (is update required / provided)? YES
    new files: Documentation/platforms/arm/stm32n6/index.rst and Documentation/platforms/arm/stm32n6/boards/nucleo-n657x0-q/index.rst.

  • Impact on security (any sort of implications)? NO
    the chip runs in the Secure state with SAU in its reset configuration. No TrustZone Non-Secure programming and no RIF re-configuration.

  • Impact on compatibility (backward/forward/interoperability)? NO.

  • Anything else? The three commits each build on their own.

Testing

I confirm that changes are verified on local setup and works as intended:

  • Build Host: Ubuntu 24.04 x86_64, arm-none-eabi-gcc from the ghcr.io/apache/nuttx/apache-nuttx-ci-linux container image (latest tag as of this PR).

  • Target: STM Nucleo-N657X0-Q, flashed via the on-board ST-Link in DEV mode. Configs: nucleo-n657x0-q:nsh and nucleo-n657x0-q:ostest.

  • Reproduction steps:

    ./tools/configure.sh nucleo-n657x0-q:nsh   # or :ostest
    make
    # -w32 0xE000ED08 0x34000400 points VTOR at the loaded image
    STM32_Programmer_CLI -c port=SWD mode=UR -halt \
      -d nuttx.bin 0x34000400 \
      -w32 0xE000ED08 0x34000400 \
      -g 0x34000400

Testing logs:

$ ./tools/configure.sh nucleo-n657x0-q:nsh
$ make
...
Memory region         Used Size  Region Size  %age Used
            sram:       82812 B      4095 KB      1.97%
CP: nuttx.bin

$ ./tools/configure.sh nucleo-n657x0-q:ostest
$ make
...
Memory region         Used Size  Region Size  %age Used
            sram:      149116 B      4095 KB      3.56%
CP: nuttx.bin

--- Run 1: nsh ---

NuttShell (NSH) NuttX-12.13.0
nsh> uname -a
NuttX 12.13.0 f21a2c8f68 May 17 2026 20:04:10 arm nucleo-n657x0-q
nsh> uptime
00:00:04 up  0:00, load average: 0.00, 0.00, 0.00
nsh> uptime
00:00:14 up  0:00, load average: 0.00, 0.00, 0.00
nsh>
(10 second wall-clock equivalence)

--- Run 2: ostest ---

nsh> ostest
...
user_main: Exiting
ostest_main: Exiting with status 0
nsh>

All 31 ostest sub-tests pass.

--- CI parity (apache/nuttx-ci-linux container) ---

Build Attempt 1 of 4
====================================================================================
Configuration/Tool: nucleo-n657x0-q:nsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2026-05-17 18:28:52
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Building NuttX...
arm-none-eabi-ld: warning: /github/workspace/sources/nuttx/nuttx has a LOAD segment with RWX permissions
  [1/1] Normalize nucleo-n657x0-q:nsh
Build Attempt 1 of 4
====================================================================================
Configuration/Tool: nucleo-n657x0-q:ostest,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2026-05-17 18:29:01
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Building NuttX...
arm-none-eabi-ld: warning: /github/workspace/sources/nuttx/nuttx has a LOAD segment with RWX permissions
  [1/1] Normalize nucleo-n657x0-q:ostest
====================================================================================

--- Lint ---

$ ./tools/checkpatch.sh -g HEAD~3..HEAD -> All checks pass
$ codespell                             -> clean on diff
$ cmake-format --check                  -> clean on new CMakeLists.txt

ImBonkers added 3 commits May 17, 2026 18:27
Introduce minimal chip support for the STMicro STM32N6 family
(Cortex-M55, ARMv8.1-M with TrustZone and FPU), sufficient to bring
up an NSH console over USART1.

Scope (deliberately minimal first drop):

  - Chip selector ARCH_CHIP_STM32N6 wired into arch/arm/Kconfig and
    chip-name mapping ("stm32n6").
  - Sub-Kconfig under arch/arm/src/stm32n6 with the STM32N657X0 chip
    selector and a single user-selectable USART (USART1).
  - Boot path: stm32_start with a naked dispatcher that clears the
    boot-ROM MSPLIM/PSPLIM stack limits before any compiler-emitted
    prologue, then runs vector relocation and SRAM-only heap init.
    The chip runs entirely in the Secure state; SAU is left in its
    reset configuration.
  - PLL1-based clock tree fed from HSI64 targeting 200 MHz CPU, with
    USART1 kernel-clock routed to HSI for a predictable BRR that is
    independent of any later clock change.
  - Low-level USART driver with full serial framework support.
    stm32_serial.c is adapted from arch/arm/src/stm32h5/stm32_serial.c
    (sibling ARMv8-M Mainline port with the same USART IP), stripped
    of DMA-RX, LPUART, the per-USART2..5 plumbing, RS-485 driver-enable,
    TIOCSINVERT/SWAP and HALFDUPLEX paths.
  - SysTick system timer.
  - GPIO, PWR and RCC helpers.

TrustZone, MPU, I/D-cache and Helium (MVE) are left disabled to
minimise bring-up surface; these will be added in follow-up patches
alongside the drivers that need them.

Signed-off-by: ImBonkers <samuelnlinden@pm.me>
Add board support for the STMicro Nucleo-N657X0-Q, sufficient to boot
NSH over the on-board ST-LINK virtual COM port (USART1, 115200 8N1)
in DEV (serial) boot mode.

Two defconfigs are shipped:

  - nsh:    minimal NuttShell prompt.
  - ostest: nsh + apps/testing/ostest for RTOS smoke testing.

Production signed XSPI flash boot is deferred to a follow-up; in DEV
mode the image is loaded directly into AXISRAM at 0x34000400 by the
host (e.g. STM32CubeProgrammer over ST-LINK), keeping the linker
script trivial — .text/.rodata/.data/.bss/.heap all in AXISRAM.

Signed-off-by: ImBonkers <samuelnlinden@pm.me>
Add the chip overview page for the STMicro STM32N6 family and the
board page for the Nucleo-N657X0-Q development board introduced in
the previous two commits.

  - platforms/arm/stm32n6/index.rst
        Chip overview: core, peripherals supported in the initial
        port, and a pointer to the board page.

  - platforms/arm/stm32n6/boards/nucleo-n657x0-q/index.rst
        Board page: hardware summary, supported peripherals,
        the two shipped configs (nsh, ostest), and the DEV-mode
        flash recipe used to load NuttX into AXISRAM via ST-LINK.

The pages are picked up by the existing glob-based toctree in
Documentation/platforms/arm/index.rst, no parent index changes are
required.

Signed-off-by: ImBonkers <samuelnlinden@pm.me>
@github-actions github-actions Bot added Area: Build system Arch: arm Issues related to ARM (32-bit) architecture Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: arm labels May 17, 2026
@linguini1
Copy link
Copy Markdown
Contributor

Awesome! Could you please attach the full OS Test logs?

@ImBonkers
Copy link
Copy Markdown
Author

Full ostest log attached.
ostest.log

Copy link
Copy Markdown
Contributor

@linguini1 linguini1 May 17, 2026

Choose a reason for hiding this comment

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

Could you format this according to the board.rst template in Documentation/contributing/doc_templates? It makes the docs more cohesive. And if you can, please include an image of the board!

Copy link
Copy Markdown
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

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

Looks good to me besides docs comment! Nice work!

…e against template, add board image.

Address review feedback to make the Nucleo-N657X0-Q page consistent
with the rest of Documentation/platforms/.  Apply the section
ordering from Documentation/contributing/doc_templates/board.rst,
add a photograph of the board, and correct hardware facts against
authoritative sources (ST product page, UM3417, board.h).

Signed-off-by: ImBonkers <samuelnlinden@pm.me>
@ImBonkers
Copy link
Copy Markdown
Author

Rewrote the docs, added a photo of the board.

@lupyuen
Copy link
Copy Markdown
Member

lupyuen commented May 18, 2026

@ImBonkers Could you squash these 2 commits into One Single Commit:

  • "Documentation/platforms/arm: Add STM32N6 chip and Nucleo-N657X0-Q pages."
  • "Documentation/platforms/arm/stm32n6: rework Nucleo-N657X0-Q board page against template, add board image."

And shorten the Commit Title to "Documentation/arm: Add STM32N6 and Nucleo-N657X0-Q"? Thanks :-) https://github.com/apache/nuttx/actions/runs/26004136077/job/76439720447#step:3:129

❌ Commit subject too long > 80
Used config files:
    1: .codespellrc
Some checks failed. For contributing guidelines, see:
  https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Area: Build system Board: arm Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants