Skip to content

add nxp frdm-mcxa366 support#11243

Open
yandld wants to merge 4 commits intoRT-Thread:masterfrom
yandld:master
Open

add nxp frdm-mcxa366 support#11243
yandld wants to merge 4 commits intoRT-Thread:masterfrom
yandld:master

Conversation

@yandld
Copy link
Contributor

@yandld yandld commented Mar 9, 2026

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

[

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

你的解决方案是什么 (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
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

👋 感谢您对 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

  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  • 将目标分支设置为 \ Set the target branch to:master
  • 设置PR number为 \ Set the PR number to:11243
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将自动推送至你的分支。
    The formatted code will be automatically pushed to your branch.

完成后,提交将自动更新至 master 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the master 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
Copy link

github-actions bot commented Mar 9, 2026

📌 Code Review Assignment

🏷️ Tag: bsp_mcxa

Reviewers: hywing

Changed Files (Click to expand)
  • bsp/nxp/mcx/mcxa/Libraries/drivers/drv_i2c.c
  • bsp/nxp/mcx/mcxa/Libraries/drivers/drv_spi.c
  • bsp/nxp/mcx/mcxa/Libraries/drivers/drv_uart.c
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/.ci/attachconfig/ci.attachconfig.yml
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/.config
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/Kconfig
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/SConscript
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/SConstruct
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/SConscript
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/arduino_main.cpp
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/arduino_pinout/RTduino-peripherals.png
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/arduino_pinout/SConscript
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/arduino_pinout/frdm-mcxa366-pinout1.jpg
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/arduino_pinout/frdm-mcxa366-pinout2.jpg
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/arduino_pinout/pins_arduino.c
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/arduino_pinout/pins_arduino.h
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/drv_spi_sample_rw007.c
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/main.c
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/board/Kconfig
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/board/MCUX_Config/board/clock_config.c
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/board/MCUX_Config/board/clock_config.h
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/board/MCUX_Config/board/pin_mux.c
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/board/MCUX_Config/board/pin_mux.h
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/board/SConscript
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/board/board.c
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/board/board.h
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/board/linker_scripts/MCXA366_flash.ld
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/board/linker_scripts/MCXA366_flash.scf
  • bsp/nxp/mcx/mcxa/frdm-mcxa366/project.uvoptx

🏷️ Tag: workflow

Reviewers: Rbb666 kurisaW supperthomas

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

📊 Current Review Status (Last Updated: 2026-03-09 16:43 CST)

  • Rbb666 Pending Review
  • hywing Pending Review
  • kurisaW Pending Review
  • supperthomas Pending Review

📝 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.

@github-actions github-actions bot added BSP: NXP Code related with NXP BSP labels Mar 9, 2026
@github-actions github-actions bot added the action github action yml imporve label Mar 9, 2026
@Rbb666 Rbb666 requested a review from Copilot March 9, 2026 06:56
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

This PR introduces a new RT-Thread BSP for the NXP FRDM-MCXA366 board under the existing bsp/nxp/mcx/mcxa/ family, along with minimal shared-driver updates and CI compile-list integration.

Changes:

  • Add a new frdm-mcxa366 BSP directory including board init, linker scripts, build scripts, and generated MCUX clock/pin configuration.
  • Update MCXA common drivers (UART/SPI/I2C) to recognize MCXA366 variants for clock attach selection.
  • Register the new BSP in .github/ALL_BSP_COMPILE.json and add board-local CI attach config.

Reviewed changes

Copilot reviewed 31 out of 35 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
bsp/nxp/mcx/mcxa/frdm-mcxa366/template.uvprojx New Keil uVision project template for the board
bsp/nxp/mcx/mcxa/frdm-mcxa366/template.uvoptx New Keil uVision options template
bsp/nxp/mcx/mcxa/frdm-mcxa366/rtconfig.py Toolchain/build flags for the BSP
bsp/nxp/mcx/mcxa/frdm-mcxa366/rtconfig.h Generated RT-Thread configuration header for the BSP
bsp/nxp/mcx/mcxa/frdm-mcxa366/board/linker_scripts/MCXA366_flash.scf Keil/armclang scatter file for flash layout
bsp/nxp/mcx/mcxa/frdm-mcxa366/board/linker_scripts/MCXA366_flash.ld GCC linker script for flash/RAM layout
bsp/nxp/mcx/mcxa/frdm-mcxa366/board/board.h Board header (heap bounds, init declaration)
bsp/nxp/mcx/mcxa/frdm-mcxa366/board/board.c Board init (pins/clocks/SysTick/heap/console)
bsp/nxp/mcx/mcxa/frdm-mcxa366/board/SConscript Board build script and MCUX config sources inclusion
bsp/nxp/mcx/mcxa/frdm-mcxa366/board/MCUX_Config/board/pin_mux.h Generated pinmux declarations and LED pin symbols
bsp/nxp/mcx/mcxa/frdm-mcxa366/board/MCUX_Config/board/pin_mux.c Generated pinmux init (clock enable/reset release/pin config)
bsp/nxp/mcx/mcxa/frdm-mcxa366/board/MCUX_Config/board/clock_config.h Generated clock config API and frequency macros
bsp/nxp/mcx/mcxa/frdm-mcxa366/board/MCUX_Config/board/clock_config.c Generated clock init implementation (default 180MHz)
bsp/nxp/mcx/mcxa/frdm-mcxa366/board/Kconfig BSP Kconfig options for peripherals and add-ons
bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/main.c Sample app: UART banner + LED blink + button IRQ
bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/drv_spi_sample_rw007.c RW007 SPI WiFi sample init (conditional)
bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/arduino_pinout/pins_arduino.h RTduino pin aliases and default bus/device names
bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/arduino_pinout/pins_arduino.c RTduino pin mapping table
bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/arduino_pinout/SConscript Build rules for RTduino pinout module
bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/arduino_main.cpp RTduino default sketch (setup/loop)
bsp/nxp/mcx/mcxa/frdm-mcxa366/applications/SConscript Applications build script (C/C++ sources + subdirs)
bsp/nxp/mcx/mcxa/frdm-mcxa366/SConstruct BSP top-level SCons build and package pre-check
bsp/nxp/mcx/mcxa/frdm-mcxa366/SConscript BSP module compile enumerator
bsp/nxp/mcx/mcxa/frdm-mcxa366/Kconfig BSP Kconfig entrypoint wiring to RT-Thread + packages + board
bsp/nxp/mcx/mcxa/frdm-mcxa366/.config Default defconfig for the BSP
bsp/nxp/mcx/mcxa/frdm-mcxa366/.ci/attachconfig/ci.attachconfig.yml BSP CI attachconfig presets (CAN/Arduino)
bsp/nxp/mcx/mcxa/Libraries/drivers/drv_uart.c Extend MCXA clock attach selection to MCXA366 variants
bsp/nxp/mcx/mcxa/Libraries/drivers/drv_spi.c Extend MCXA clock attach selection to MCXA366 variants
bsp/nxp/mcx/mcxa/Libraries/drivers/drv_i2c.c Extend MCXA clock attach selection to MCXA366 variants
.github/ALL_BSP_COMPILE.json Add FRDM-MCXA366 BSP to CI compile list


rw007_gpio_init();
ret = rt_spi_bus_attach_device_cspin(spi_device, BOARD_RW007_DEVICE_NAME, BOARD_RW007_SPI_BUS_NAME, BOARD_RW007_CS_PIN, RT_NULL);
if (ret != RT_EOK) return -2;
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

[bug/类别]: Memory leak on error paths when allocating rt_spi_device

English: spi_device is allocated with rt_malloc(), but if rt_spi_bus_attach_device_cspin() fails the function returns without freeing it. Please free the allocation on failure (and consider using the common attach helper pattern if available).
中文:spi_device 使用 rt_malloc() 分配,但当 rt_spi_bus_attach_device_cspin() 失败时直接返回,未释放内存,导致泄漏。建议在错误路径释放该内存(并可考虑使用项目中常见的设备挂载辅助接口/模式)。

Suggested change
if (ret != RT_EOK) return -2;
if (ret != RT_EOK)
{
rt_free(spi_device);
return -2;
}

Copilot uses AI. Check for mistakes.
Comment on lines +62 to +63
POST_ACTION = OBJCPY + ' -O binary --remove-section=.boot_data --remove-section=.image_vertor_table --remove-section=.ncache $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'

Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

[spelling/类别]: Possible typo in section name image_vertor_table

English: The section name image_vertor_table appears to be misspelled (likely image_vector_table). If the real section name is ...vector..., objcopy will not remove it as intended.
中文:image_vertor_table 可能是拼写错误(通常应为 image_vector_table)。若实际段名为 ...vector...,则 objcopy 不会按预期移除该段。

Copilot uses AI. Check for mistakes.
"nxp/mcx/mcxa/frdm-mcxa153",
"nxp/mcx/mcxa/frdm-mcxa156",
"nxp/mcx/mcxa/frdm-mcxa346",
"nxp/mcx/mcxa/frdm-mcxa366",
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

[custom/类别]: 🟡 [PR Title/PR 标题] Missing required prefix format

English: The PR title should follow the RT-Thread convention in lowercase, e.g. [nxp][mcx] ... or [nxp][bsp] .... Current title add nxp frdm-mcxa366 support has no prefix, which makes it harder to route/review.
中文:PR 标题应遵循 RT-Thread 约定的小写前缀格式,例如 [nxp][mcx] ...[nxp][bsp] ...。当前标题 add nxp frdm-mcxa366 support 缺少前缀,影响分类与审查。

Copilot generated this review using guidance from repository custom instructions.
"nxp/mcx/mcxa/frdm-mcxa153",
"nxp/mcx/mcxa/frdm-mcxa156",
"nxp/mcx/mcxa/frdm-mcxa346",
"nxp/mcx/mcxa/frdm-mcxa366",
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

[custom/类别]: 🟡 [PR Description/PR 描述] Description template not filled (missing What/Why/How and test info)

English: The PR description still contains the required template placeholders (square-bracket block) and does not state what changed, why it’s needed, and what BSP/config was verified (including any CI/action link). Please fill these sections so reviewers can validate the BSP support.
中文:PR 描述仍保留必须替换的模板占位内容(方括号块),且未说明 What/Why/How 以及已验证的 BSP/.config 与测试/CI 链接。请补全这些信息,便于审查与验证。

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +8 to +12
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)

if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']):
src += ['arduino_main.cpp']

Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

[bug/类别]: Arduino C++ source is appended after DefineGroup, so it won’t be built

English: group = DefineGroup(...) is created before arduino_main.cpp is appended to src, but DefineGroup snapshots src at call time. As a result, enabling RTduino may not compile/link setup()/loop() as intended. Move the RTduino conditional append before DefineGroup, or update the group creation to include the C++ file.
中文:DefineGroup(...) 在把 arduino_main.cpp 加入 src 之前就已经创建了,而 DefineGroup 会在调用时“快照”当前的 src。因此启用 RTduino 时可能不会编译/链接 setup()/loop()。建议将追加 arduino_main.cpp 的逻辑放到 DefineGroup 之前,或确保创建 group 时已包含该 C++ 文件。

Suggested change
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']):
src += ['arduino_main.cpp']
if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']):
src += ['arduino_main.cpp']
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +146
select BSP_USING_UART2
select BSP_USING_GPIO
select BSP_USING_ADC0
select BSP_USING_PWM0
select BSP_USING_PWM1
select BSP_USING_I2C1
select BSP_USING_I2C2
select BSP_USING_SPI1
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

[bug/类别]: Kconfig selects undefined symbols under BSP_USING_ARDUINO

English: select BSP_USING_GPIO, select BSP_USING_ADC0, select BSP_USING_I2C1/I2C2, etc. reference symbols that are not defined anywhere in the repository (search found no matching Kconfig definitions). This can lead to Kconfig warnings and the intended peripheral enabling won’t take effect. Please replace these with the actual symbols used by this BSP (e.g. BSP_USING_PIN, BSP_USING_ADC, BSP_USING_I2C, plus the concrete instance options that exist).
中文:select BSP_USING_GPIOselect BSP_USING_ADC0select BSP_USING_I2C1/I2C2 等引用了仓库中并不存在的 Kconfig 符号(已全仓搜索确认没有定义)。这会导致 Kconfig 警告,并且这些“选择”不会真正启用期望的外设。请改为本 BSP 实际存在的配置项(例如 BSP_USING_PINBSP_USING_ADCBSP_USING_I2C 以及实际存在的实例开关)。

Suggested change
select BSP_USING_UART2
select BSP_USING_GPIO
select BSP_USING_ADC0
select BSP_USING_PWM0
select BSP_USING_PWM1
select BSP_USING_I2C1
select BSP_USING_I2C2
select BSP_USING_SPI1
select BSP_USING_UART2
select BSP_USING_PIN
select BSP_USING_ADC
select BSP_USING_PWM
select BSP_USING_I2C
select BSP_USING_SPI
select BSP_USING_SPI1

Copilot uses AI. Check for mistakes.

menuconfig BSP_USING_CLOCK_TIMER
bool "Enable Timer"
select RT_USING_CLOCK_TIME
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

[bug/类别]: select RT_USING_CLOCK_TIME references an undefined Kconfig symbol

English: RT_USING_CLOCK_TIME is not defined anywhere in the repo (global search found no matches), so selecting it has no effect and may produce Kconfig warnings. If this option is meant to enable a specific timer/clock-time driver, please select the correct existing symbol (e.g. the corresponding RT_USING_HWTIMER/clock-time component used by this BSP) or remove the select.
中文:RT_USING_CLOCK_TIME 在仓库中没有任何定义(已全仓搜索确认无匹配),因此 select 不会生效且可能产生 Kconfig 警告。如果目的是启用某个定时器/clock-time 驱动,请改为选择实际存在的配置项(例如本 BSP 对应的 RT_USING_HWTIMER 或其他相关组件),或删除该 select

Suggested change
select RT_USING_CLOCK_TIME

Copilot uses AI. Check for mistakes.

if BSP_USING_UART
config BSP_USING_UART2
bool "Enable LPUART2 as defalt UART"
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

[spelling/类别]: Typo in Kconfig prompt string (defalt -> default)

English: The prompt says "defalt" which is a typo; please change it to "default".
中文:提示字符串中的 "defalt" 为拼写错误,建议改为 "default"。

Suggested change
bool "Enable LPUART2 as defalt UART"
bool "Enable LPUART2 as default UART"

Copilot uses AI. Check for mistakes.
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: NXP Code related with NXP BSP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants