Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ src = Glob('*.c')

group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)

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

list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
Expand Down
25 changes: 25 additions & 0 deletions bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/arduino_main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-12-08 westcity-yolo first version
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

Date format is incorrect - same issue. Should be corrected to "2024-12-08" or current date.

日期格式不正确 - 相同的问题。应更正为"2024-12-08"或当前日期。

Suggested change
* 2025-12-08 westcity-yolo first version
* 2024-12-08 westcity-yolo first version

Copilot uses AI. Check for mistakes.
*
*/

#include <Arduino.h>

void setup(void)
{
/* put your setup code here, to run once: */
Serial.begin();
Serial.println("Hello RTduino!");
}

void loop(void)
{
/* put your main code here, to run repeatedly: */
delay(1000);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from building import *

cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp')
inc = [cwd]

group = DefineGroup('RTduino-pinout', src, depend = ['PKG_USING_RTDUINO'], CPPPATH = inc)

Return('group')
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-02-22 ChuShicheng first version
* 2023-02-23 Wangyuqiang second version
*/

#include <Arduino.h>
#include <board.h>
#include <drv_pin.h>
#include "pins_arduino.h"

/*
* {Arduino Pin, RT-Thread Pin [, Device Name, Channel]}
* [] means optional
* Digital pins must NOT give the device name and channel.
* Analog pins MUST give the device name and channel(ADC, PWM or DAC).
* Arduino Pin must keep in sequence.
*/
const pin_map_t pin_map_table[]=
{
{D0, GET_PINS(2,3), "uart2"}, /* Serial2-RX */
{D1, GET_PINS(2,2), "uart2"}, /* Serial2-TX */
{D2, GET_PINS(3,31)},
{D3, GET_PINS(3,14), "pwm1", 1}, /* PWM */
{D4, GET_PINS(4,7)},
{D5, GET_PINS(3,1), "pwm0", 0}, /* PWM */
{D6, GET_PINS(3,17), "pwm1", 0}, /* PWM */
{D7, GET_PINS(3,22)},
{D8, GET_PINS(4,3)},
{D9, GET_PINS(3,13), "pwm1", 2}, /* PWM */
{D10, GET_PINS(3,11),"spi1"}, /* SPI-SS */
{D11, GET_PINS(3,8), "spi1"}, /* SPI-SDO */
{D12, GET_PINS(3,9), "spi1"}, /* SPI-SDI */
{D13, GET_PINS(3,10),"spi1"}, /* SPI-SCK */
{D18, GET_PINS(1,8),"i2c2"}, /* I2C-SDA (Wire) */
{D19, GET_PINS(1,9),"i2c2"}, /* I2C-SCL (Wire) */
{A0, GET_PINS(1,14),"adc1", 12}, /* ADC */
{A1, GET_PINS(2,5), "adc1", 1}, /* ADC */
{A2, GET_PINS(2,7),"adc0", 7}, /* ADC */
{A3, GET_PINS(3,30),"adc1", 21},
{A4, GET_PINS(1,0),"i2c1"}, /* I2C-SDA (Wire) */
{A5, GET_PINS(1,1),"i2c1"}, /* I2C-SCL (Wire) */
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

Missing entry for A6 and A7 in pin_map_table. The header file defines A6 (22) and A7 (23) pins, but the pin_map_table only has entries up to A5. This will cause array access issues when these pins are referenced.

pin_map_table中缺少A6和A7的条目。头文件定义了A6(22)和A7(23)引脚,但pin_map_table只有到A5的条目。当引用这些引脚时,这将导致数组访问问题。

Suggested change
{A5, GET_PINS(1,1),"i2c1"}, /* I2C-SCL (Wire) */
{A5, GET_PINS(1,1),"i2c1"}, /* I2C-SCL (Wire) */
{A6, GET_PINS(1,14),"adc1", 12}, /* ADC (alias of A0 to keep sequence) */
{A7, GET_PINS(2,5), "adc1", 1}, /* ADC (alias of A1 to keep sequence) */

Copilot uses AI. Check for mistakes.

};
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-12-08 westcity-yolo first version
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

Date format is incorrect. Shows "2025-12-08" but current date should be in 2025 (January 2026). This appears to be a typo - should likely be "2024-12-08" or the current date "2026-01-XX".

日期格式不正确。显示"2025-12-08",但当前日期应该是2025年(2026年1月)。这似乎是个拼写错误 - 应该是"2024-12-08"或当前日期"2026-01-XX"。

Suggested change
* 2025-12-08 westcity-yolo first version
* 2024-12-08 westcity-yolo first version

Copilot uses AI. Check for mistakes.
*
*/

#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#define GET_PINS(PORTx, PINx) (32 * PORTx + PINx)

/* pins alias. Must keep in sequence */
#define D0 (0)
#define D1 (1)
#define D2 (2)
#define D3 (3)
#define D4 (4)
#define D5 (5)
#define D6 (6)
#define D7 (7)
#define D8 (8)
#define D9 (9)
#define D10 (10)
#define D11 (11)
#define D12 (12)
#define D13 (13)
#define D18 (14)
#define D19 (15)

#define A0 (16)
#define A1 (17)
#define A2 (18)
#define A3 (19)
#define A4 (20)
#define A5 (21)
#define A6 (22)
#define A7 (23)

#define RTDUINO_PIN_MAX_LIMIT A7 /* pin number max limit check */

#define F_CPU 180000000L /* CPU:180MHz */

/* i2c2 : P(,1_8-SDA P(,1_9-SCL */
#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c2"

/* Serial2 : P(,2_2-TX P(,2_3-RX */
#define RTDUINO_SERIAL2_DEVICE_NAME "uart2"

/* spi1 : P(,3_8-SDO P(,3_9-SDI P(,3_10-SCK P(,3_11-SS */

#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi1"

#endif /* Pins_Arduino_h */
17 changes: 17 additions & 0 deletions bsp/nxp/mcx/mcxa/frdm-mcxa346/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,23 @@ menu "On-chip Peripheral Drivers"
endif
endmenu

menu "Onboard Peripheral Drivers"
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

PR title should follow format: [module][subsystem] Description in lowercase. Current title uses "[add]" which is not a module/vendor name. Based on modified files in bsp/nxp/mcx/mcxa/frdm-mcxa346/, suggest: [frdm-mcxa346][rtduino] Add RTduino support or [mcxa][rtduino] Add RTduino support for frdm-mcxa346

PR标题应遵循格式:小写的[模块][子系统] 描述。当前标题使用"[add]",这不是模块/厂商名称。基于修改的文件在bsp/nxp/mcx/mcxa/frdm-mcxa346/,建议:[frdm-mcxa346][rtduino] Add RTduino support[mcxa][rtduino] Add RTduino support for frdm-mcxa346

Copilot generated this review using guidance from repository custom instructions.
config BSP_USING_ARDUINO
bool "Compatible with Arduino Ecosystem (RTduino)"
select PKG_USING_RTDUINO
select BSP_USING_UART2
select BSP_USING_GPIO
select BSP_USING_ADC
Copy link
Member

Choose a reason for hiding this comment

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

这里的select不全,要依照你在pin_arduino.c中实际定义的外设全部选中,还有adc的通道,这块看看驱动上是怎么设计接口的,包括pwm通道

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好滴 老师 收到!

select BSP_USING_ADC0
select BSP_USING_ADC0_CH0
Copy link
Member

Choose a reason for hiding this comment

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

上面pins_arduino.c对应的驱动这块没加上,另外在rtduino软件包下有测试过这些外设吗

Copy link
Contributor Author

Choose a reason for hiding this comment

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

老师这个文件已经修改对应的 但是外设还没有来得及全部测试 后续有时间我会回测试然后添加到支持列表里面

select BSP_USING_PWM
select BSP_USING_I2C
select BSP_USING_I2C1
select RTDUINO_USING_WIRE
imply RTDUINO_USING_SERVO
default n
endmenu


menu "Board extended module Drivers"
menuconfig BSP_USING_RW007
Expand Down
Loading