Conversation
|
|
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: bsp_mcxaReviewers: hywing Changed Files (Click to expand)
🏷️ Tag: workflowReviewers: Rbb666 kurisaW supperthomas Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-03-09 16:43 CST)
📝 Review Instructions
|
There was a problem hiding this comment.
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-mcxa366BSP 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.jsonand 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; |
There was a problem hiding this comment.
[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() 失败时直接返回,未释放内存,导致泄漏。建议在错误路径释放该内存(并可考虑使用项目中常见的设备挂载辅助接口/模式)。
| if (ret != RT_EOK) return -2; | |
| if (ret != RT_EOK) | |
| { | |
| rt_free(spi_device); | |
| return -2; | |
| } |
| POST_ACTION = OBJCPY + ' -O binary --remove-section=.boot_data --remove-section=.image_vertor_table --remove-section=.ncache $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' | ||
|
|
There was a problem hiding this comment.
[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 不会按预期移除该段。
| "nxp/mcx/mcxa/frdm-mcxa153", | ||
| "nxp/mcx/mcxa/frdm-mcxa156", | ||
| "nxp/mcx/mcxa/frdm-mcxa346", | ||
| "nxp/mcx/mcxa/frdm-mcxa366", |
There was a problem hiding this comment.
[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 缺少前缀,影响分类与审查。
| "nxp/mcx/mcxa/frdm-mcxa153", | ||
| "nxp/mcx/mcxa/frdm-mcxa156", | ||
| "nxp/mcx/mcxa/frdm-mcxa346", | ||
| "nxp/mcx/mcxa/frdm-mcxa366", |
There was a problem hiding this comment.
[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 链接。请补全这些信息,便于审查与验证。
| group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) | ||
|
|
||
| if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']): | ||
| src += ['arduino_main.cpp'] | ||
|
|
There was a problem hiding this comment.
[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++ 文件。
| 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) |
| 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 |
There was a problem hiding this comment.
[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_GPIO、select BSP_USING_ADC0、select BSP_USING_I2C1/I2C2 等引用了仓库中并不存在的 Kconfig 符号(已全仓搜索确认没有定义)。这会导致 Kconfig 警告,并且这些“选择”不会真正启用期望的外设。请改为本 BSP 实际存在的配置项(例如 BSP_USING_PIN、BSP_USING_ADC、BSP_USING_I2C 以及实际存在的实例开关)。
| 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 |
|
|
||
| menuconfig BSP_USING_CLOCK_TIMER | ||
| bool "Enable Timer" | ||
| select RT_USING_CLOCK_TIME |
There was a problem hiding this comment.
[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。
| select RT_USING_CLOCK_TIME |
|
|
||
| if BSP_USING_UART | ||
| config BSP_USING_UART2 | ||
| bool "Enable LPUART2 as defalt UART" |
There was a problem hiding this comment.
[spelling/类别]: Typo in Kconfig prompt string (defalt -> default)
English: The prompt says "defalt" which is a typo; please change it to "default".
中文:提示字符串中的 "defalt" 为拼写错误,建议改为 "default"。
| bool "Enable LPUART2 as defalt UART" | |
| bool "Enable LPUART2 as default UART" |
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up