Skip to content

[bsp][stm32] Add stm32n657-st-nucleo BSP - #11799

Open
yans6666 wants to merge 1 commit into
RT-Thread:masterfrom
yans6666:stm32n6
Open

[bsp][stm32] Add stm32n657-st-nucleo BSP#11799
yans6666 wants to merge 1 commit into
RT-Thread:masterfrom
yans6666:stm32n6

Conversation

@yans6666

Copy link
Copy Markdown
Contributor

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

新增 stm32n657-st-nucleo BSP

你的解决方案是什么 (what is your solution)

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用clang-format 源码格式化工具确保格式符合RT-Thread代码规范 This PR has been formatted with clang-format and complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

@github-actions

Copy link
Copy Markdown

👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!

为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • Use workflow from 保持默认分支(通常为 master
    Keep the default branch (usually master) in Use workflow from
  • branch 输入框填写 PR 分支 stm32n6
    Enter PR branch stm32n6 in the branch field
  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将作为独立提交推送至你的分支。
    The formatting changes will be pushed to your branch as a separate commit.

完成后,提交将自动更新至 stm32n6 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the stm32n6 branch automatically, and the related Pull Request will be updated.

如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!

@github-actions github-actions Bot added BSP: STM32 BSP related with ST/STM32 BSP action github action yml imporve tools labels Sep 11, 2026
@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown

📌 Code Review Assignment

🏷️ Tag: bsp_stm32

Reviewers: @Liang1795 @hamburger-os @wdfk-prog

Changed Files (Click to expand)
  • bsp/stm32/README.md
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/adc_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/dac_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/dma_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/lptim_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/pwm_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/qspi_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/sdio_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/spi_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/tim_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/uart_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/usbd_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_dma.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_gpio.c
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_pwm.c
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_spi.c
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_tim.c
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart.c
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart_v2.c
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart_v2.h
  • bsp/stm32/libraries/HAL_Drivers/drv_common.c
  • bsp/stm32/libraries/Kconfig
  • bsp/stm32/stm32n657-st-nucleo/.config
  • bsp/stm32/stm32n657-st-nucleo/.gitignore
  • bsp/stm32/stm32n657-st-nucleo/Kconfig
  • bsp/stm32/stm32n657-st-nucleo/Project.uvmpw

🏷️ Tag: workflow

Reviewers: @Rbb666 @kurisaW @supperthomas

Changed Files (Click to expand)
  • .github/ALL_BSP_COMPILE.json

📊 Current Review Status (Last Updated: 2026-09-11 18:09 CST)


📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Build-breaking MPU, timer, DMA, and IAR configuration issues must be resolved before integration.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds STM32N657 Nucleo BSP support, toolchain projects, peripheral integration, and CI registration.

Changes:

  • Adds board startup, linker, build, signing, and documentation assets.
  • Extends shared STM32 GPIO, UART, DMA, timer, PWM, and SPI drivers for N6.
  • Registers the BSP in CI and BSP indexes.

Metadata / 元数据: The title is valid, but the PR description still lacks solution, test board/configuration, and action results. / 标题格式正确,但 PR 描述仍缺少解决方案、测试板卡/配置及 Action 结果。

File summaries
File Description
.github/ALL_BSP_COMPILE.json Registers BSP compilation
bsp/README.md Adds BSP capability entry
bsp/stm32/README.md Adds N6 board listing
bsp/stm32/libraries/Kconfig Defines STM32N6 series
tools/ci/bsp_detail.yml Adds BSP CI metadata
tools/ci/toolchain_bsp.yml Adds GCC CI target
bsp/stm32/stm32n657-st-nucleo/.config Provides default configuration
bsp/stm32/stm32n657-st-nucleo/.gitignore Ignores build outputs
bsp/stm32/stm32n657-st-nucleo/Kconfig Defines BSP configuration
bsp/stm32/stm32n657-st-nucleo/SConstruct Configures SCons build
bsp/stm32/stm32n657-st-nucleo/SConscript Collects BSP components
bsp/stm32/stm32n657-st-nucleo/rtconfig.py Defines toolchain flags
bsp/stm32/stm32n657-st-nucleo/rtconfig.h Provides generated configuration
bsp/stm32/stm32n657-st-nucleo/README.md Documents BSP usage
bsp/stm32/stm32n657-st-nucleo/README_zh.md Adds Chinese documentation
bsp/stm32/stm32n657-st-nucleo/applications/main.c Adds LED example
bsp/stm32/stm32n657-st-nucleo/applications/SConscript Builds applications
bsp/stm32/stm32n657-st-nucleo/board/board.c Configures system clocks
bsp/stm32/stm32n657-st-nucleo/board/board.h Defines board memory
bsp/stm32/stm32n657-st-nucleo/board/Kconfig Exposes peripherals
bsp/stm32/stm32n657-st-nucleo/board/SConscript Builds board sources
bsp/stm32/stm32n657-st-nucleo/board/linker_scripts/link_app.ld Adds GCC APP layout
bsp/stm32/stm32n657-st-nucleo/board/linker_scripts/link_app.sct Adds MDK APP layout
bsp/stm32/stm32n657-st-nucleo/board/linker_scripts/link_fsbl.ld Adds GCC FSBL layout
bsp/stm32/stm32n657-st-nucleo/board/linker_scripts/link_fsbl.sct Adds MDK FSBL layout
bsp/stm32/stm32n657-st-nucleo/board/CubeMX_Config/.mxproject Adds CubeMX metadata
bsp/stm32/stm32n657-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc Adds MCU configuration
bsp/stm32/stm32n657-st-nucleo/board/CubeMX_Config/Appli/Inc/main.h Adds application declarations
bsp/stm32/stm32n657-st-nucleo/board/CubeMX_Config/Appli/Inc/partition_stm32n657xx.h Defines TrustZone partition
bsp/stm32/stm32n657-st-nucleo/board/CubeMX_Config/Appli/Inc/stm32n6xx_hal_conf.h Configures N6 HAL
bsp/stm32/stm32n657-st-nucleo/board/CubeMX_Config/Appli/Inc/stm32n6xx_it.h Declares exception handlers
bsp/stm32/stm32n657-st-nucleo/board/CubeMX_Config/Appli/Src/secure_nsc.c Adds secure callbacks
bsp/stm32/stm32n657-st-nucleo/board/CubeMX_Config/Appli/Src/stm32n6xx_hal_msp.c Configures UART MSP
bsp/stm32/stm32n657-st-nucleo/board/CubeMX_Config/Appli/Src/stm32n6xx_it.c Adds exception handlers
bsp/stm32/stm32n657-st-nucleo/board/CubeMX_Config/Secure_nsclib/secure_nsc.h Declares secure API
bsp/stm32/stm32n657-st-nucleo/Signing_Programmer.bat Signs/programs APP
bsp/stm32/stm32n657-st-nucleo/fsbl/Signing_Programmer.bat Signs/programs FSBL
bsp/stm32/stm32n657-st-nucleo/build_app.bat Builds and signs APP
bsp/stm32/stm32n657-st-nucleo/program_app.bat Programs APP image
bsp/stm32/stm32n657-st-nucleo/setup_app.ini Configures MDK debugging
bsp/stm32/stm32n657-st-nucleo/Project.uvmpw Adds MDK workspace
bsp/stm32/stm32n657-st-nucleo/project.uvprojx Adds generated MDK project
bsp/stm32/stm32n657-st-nucleo/project.uvoptx Adds MDK options
bsp/stm32/stm32n657-st-nucleo/template.uvprojx Adds MDK template
bsp/stm32/stm32n657-st-nucleo/template.uvoptx Adds MDK template options
bsp/stm32/stm32n657-st-nucleo/project.ewp Adds generated IAR project
bsp/stm32/stm32n657-st-nucleo/project.eww Adds IAR workspace
bsp/stm32/stm32n657-st-nucleo/template.ewp Adds IAR template
bsp/stm32/stm32n657-st-nucleo/template.eww Adds IAR template workspace
bsp/stm32/stm32n657-st-nucleo/tools/STM32N6固件烧录工具.exe Adds programming binary
bsp/stm32/stm32n657-st-nucleo/figures/board.jpg Adds board image
bsp/stm32/stm32n657-st-nucleo/figures/image-20260911110923343.png Documents tool setup
bsp/stm32/stm32n657-st-nucleo/figures/image-20260911110954590.png Documents tool setup
bsp/stm32/stm32n657-st-nucleo/figures/image-20260911111014180.png Documents environment setup
bsp/stm32/stm32n657-st-nucleo/figures/image-20260911111036134.png Documents loader location
bsp/stm32/stm32n657-st-nucleo/figures/image-20260911111101078.png Documents loader setup
bsp/stm32/stm32n657-st-nucleo/figures/image-20260911112015746.png Documents MDK workflow
bsp/stm32/stm32n657-st-nucleo/figures/image-20260911112425301.png Documents MDK workflow
bsp/stm32/stm32n657-st-nucleo/figures/image-20260911112556644.png Documents FSBL selection
bsp/stm32/stm32n657-st-nucleo/figures/image-20260911113129450.png Illustrates FSBL boot
bsp/stm32/stm32n657-st-nucleo/figures/image-20260911113257650.png Illustrates load-and-run
bsp/stm32/stm32n657-st-nucleo/figures/image-20260911113738785.png Illustrates XiP boot
bsp/stm32/libraries/HAL_Drivers/drv_common.c Adds MPU initialization
bsp/stm32/libraries/HAL_Drivers/drivers/drv_config.h Includes N6 configurations
bsp/stm32/libraries/HAL_Drivers/drivers/drv_dma.h Enables N6 GPDMA
bsp/stm32/libraries/HAL_Drivers/drivers/drv_gpio.c Adds N6 EXTI support
bsp/stm32/libraries/HAL_Drivers/drivers/drv_pwm.c Adds N6 timer clock support
bsp/stm32/libraries/HAL_Drivers/drivers/drv_spi.c Adds N6 SPI support
bsp/stm32/libraries/HAL_Drivers/drivers/drv_tim.c Adds N6 timer support
bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart.c Adds N6 UART v1 support
bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart.h Selects N6 UART API
bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart_v2.c Adds N6 UART v2 support
bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart_v2.h Selects N6 UART v2 API
bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/adc_config.h Defines N6 ADC instances
bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/dac_config.h Defines N6 DAC instances
bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/dma_config.h Maps N6 GPDMA channels
bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/lptim_config.h Defines N6 LPTIM instances
bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/pwm_config.h Defines N6 PWM instances
bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/qspi_config.h Defines QSPI configuration
bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/sdio_config.h Defines SDIO configuration
bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/spi_config.h Defines N6 SPI buses
bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/tim_config.h Defines N6 TIM2
bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/uart_config.h Defines N6 UART instances
bsp/stm32/libraries/HAL_Drivers/drivers/config/n6/usbd_config.h Defines N6 USB device
Review details

Suppressed comments (4)

bsp/stm32/libraries/HAL_Drivers/drv_common.c:258

  • [Bug/缺陷]: Scope the MPU implementation to supported BSPs / 将 MPU 实现限定到受支持的 BSP

English: drv_common.c is built for every STM32 BSP, but this unguarded function uses ARMv8-M-only HAL types and APIs. Non-N6 BSPs will still compile the body even though the call is guarded, causing build failures; guard both the declaration and definition with BSP_ENABLE_MPU (or an N6-specific condition).
中文:drv_common.c 会被所有 STM32 BSP 编译,但该函数未加保护且使用了仅适用于 ARMv8-M 的 HAL 类型和 API。即使调用处有条件保护,非 N6 BSP 仍会编译函数体并导致构建失败;请同时用 BSP_ENABLE_MPU(或 N6 专用条件)保护声明和定义。
bsp/stm32/libraries/HAL_Drivers/drv_common.c:270

  • [Bug/缺陷]: Use linker symbols that actually exist / 使用实际存在的链接器符号

English: These identifiers are not declared or defined anywhere in the repository, while the new GCC scripts export __snoncacheable and __enoncacheable; enabling the default MPU option therefore cannot compile. Define compiler-specific section boundary symbols for GCC/MDK/IAR and pass a valid inclusive MPU limit.
中文:仓库中没有声明或定义这两个标识符,而新增的 GCC 链接脚本导出的是 __snoncacheable__enoncacheable;因此启用默认 MPU 选项后无法编译。请为 GCC/MDK/IAR 定义对应的段边界符号,并向 MPU 传入有效的包含式结束地址。
bsp/stm32/libraries/HAL_Drivers/drivers/drv_tim.c:1074

  • [Bug/缺陷]: N6 preprocessing never reaches this branch / N6 预处理无法到达此分支

English: The series dispatch immediately above has no SOC_SERIES_STM32N6 case, so an N6 build reaches #error "This driver has not supported this series yet!" before this code is compiled. Add N6 to that dispatch (with the appropriate APB classification) so enabling the advertised TIM2 support builds.
中文:上方的系列分派没有 SOC_SERIES_STM32N6 分支,因此 N6 构建在编译到这里之前就会触发 #error。请按正确的 APB 分类将 N6 加入该分派,使声明支持的 TIM2 配置能够构建。

#if defined(SOC_SERIES_STM32N6)
					val = HAL_RCCEx_GetTIMGFreq() / freq;			
#else
					val = HAL_RCC_GetPCLK1Freq() * pclk1_doubler / freq;
#endif	

bsp/stm32/stm32n657-st-nucleo/README.md:146

  • [Documentation/文档]: IAR support is not usable yet / IAR 支持目前不可用

English: The IAR template still targets STM32H743ZI, the generated project uses the Cortex-M7 context file, and both rtconfig.py and the project reference a missing board/linker_scripts/link.icf. Remove the IAR support claim/CI flag for now, or add a complete STM32N657 IAR project and linker file.
中文:IAR 模板仍以 STM32H743ZI 为目标,生成工程使用 Cortex-M7 上下文文件,并且 rtconfig.py 与工程都引用了不存在的 board/linker_scripts/link.icf。请暂时移除 IAR 支持声明和 CI 标记,或补全 STM32N657 的 IAR 工程及链接文件。

  • Files reviewed: 71/84 changed files
  • Comments generated: 7
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +41 to +45
#define DMA1_Stream0_IRQn GPDMA1_Channel0_IRQn
#define DMA1_Stream1_IRQn GPDMA1_Channel1_IRQn
#define DMA1_Stream2_IRQn GPDMA1_Channel2_IRQn
#define DMA1_Stream3_IRQn GPDMA1_Channel3_IRQn
#define DMA1_Stream4_IRQn GPDMA1_Channel4_IRQn
Comment on lines +40 to +43
config BSP_UART1_RX_USING_DMA
bool "Enable UART1 RX DMA"
depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA
default n
Comment on lines +455 to 457
#if defined (SOC_SERIES_STM32N6)
prescaler_value = HAL_RCCEx_GetTIMGFreq() / 1000 /1000;
#endif
Comment on lines +9 to +11
config BSP_ENABLE_MPU
bool "Enable MPU"
default y
{
. = ALIGN(8);
__snoncacheable = .;/* create symbol for start of section */
KEEP(*(noncacheable_buffer))
Comment on lines +46 to +48
| SPI | Supported | |
| PWM | Supported | |
| TIM | Supported | |
scons -j16
```

The program can be downloaded using `tools\STM32N6固件烧录工具.exe`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action github action yml imporve BSP: STM32 BSP related with ST/STM32 BSP tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants