diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/.config b/bsp/nxp/mcx/mcxa/frdm-mcxa346/.config index 30fa7004d7e..550684b739e 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa346/.config +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/.config @@ -236,7 +236,9 @@ CONFIG_FINSH_USING_OPTION_COMPLETION=y # CONFIG_RT_USING_DEV_BUS is not set CONFIG_RT_USING_DEVICE_IPC=y CONFIG_RT_UNAMED_PIPE_NUMBER=64 -# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set +CONFIG_RT_USING_SYSTEM_WORKQUEUE=y +CONFIG_RT_SYSTEM_WORKQUEUE_STACKSIZE=2048 +CONFIG_RT_SYSTEM_WORKQUEUE_PRIORITY=23 CONFIG_RT_USING_SERIAL=y CONFIG_RT_USING_SERIAL_V1=y # CONFIG_RT_USING_SERIAL_V2 is not set @@ -337,10 +339,39 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # # Network # -# CONFIG_RT_USING_SAL is not set -# CONFIG_RT_USING_NETDEV is not set +CONFIG_RT_USING_SAL=y +CONFIG_SAL_INTERNET_CHECK=y +CONFIG_SOCKET_TABLE_STEP_LEN=4 + +# +# Docking with protocol stacks +# +# CONFIG_SAL_USING_LWIP is not set +CONFIG_SAL_USING_AT=y +# CONFIG_SAL_USING_TLS is not set +# end of Docking with protocol stacks + +CONFIG_SAL_SOCKETS_NUM=16 +CONFIG_RT_USING_NETDEV=y +CONFIG_NETDEV_USING_IFCONFIG=y +CONFIG_NETDEV_USING_PING=y +CONFIG_NETDEV_USING_NETSTAT=y +CONFIG_NETDEV_USING_AUTO_DEFAULT=y +# CONFIG_NETDEV_USING_LINK_STATUS_CALLBACK is not set +# CONFIG_NETDEV_USING_IPV6 is not set +CONFIG_NETDEV_IPV4=1 +CONFIG_NETDEV_IPV6=0 # CONFIG_RT_USING_LWIP is not set -# CONFIG_RT_USING_AT is not set +CONFIG_RT_USING_AT=y +# CONFIG_AT_DEBUG is not set +# CONFIG_AT_USING_SERVER is not set +CONFIG_AT_USING_CLIENT=y +CONFIG_AT_CLIENT_NUM_MAX=1 +CONFIG_AT_USING_SOCKET=y +# CONFIG_AT_USING_SOCKET_SERVER is not set +CONFIG_AT_USING_CLI=y +# CONFIG_AT_PRINT_RAW_CMD is not set +CONFIG_AT_SW_VERSION_NUM=0x10301 # end of Network # @@ -444,7 +475,48 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_PKG_USING_NETUTILS is not set # CONFIG_PKG_USING_CMUX is not set # CONFIG_PKG_USING_PPP_DEVICE is not set -# CONFIG_PKG_USING_AT_DEVICE is not set +CONFIG_PKG_USING_AT_DEVICE=y +CONFIG_PKG_AT_DEVICE_PATH="/packages/iot/at_device" +# CONFIG_AT_DEVICE_USING_M26 is not set +# CONFIG_AT_DEVICE_USING_EC20 is not set +# CONFIG_AT_DEVICE_USING_ESP32 is not set +CONFIG_AT_DEVICE_USING_ESP8266=y +# CONFIG_AT_DEVICE_ESP8266_INIT_ASYN is not set +CONFIG_AT_DEVICE_ESP8266_SOCKET=y +CONFIG_AT_DEVICE_ESP8266_SAMPLE=y +# CONFIG_AT_DEVICE_ESP8266_SAMPLE_BSP_TAKEOVER is not set +CONFIG_ESP8266_SAMPLE_WIFI_SSID="332266" +CONFIG_ESP8266_SAMPLE_WIFI_PASSWORD="wasd8888" +CONFIG_ESP8266_SAMPLE_CLIENT_NAME="uart3" +CONFIG_ESP8266_SAMPLE_RECV_BUFF_LEN=512 +# CONFIG_AT_DEVICE_USING_RW007 is not set +# CONFIG_AT_DEVICE_USING_SIM800C is not set +# CONFIG_AT_DEVICE_USING_SIM76XX is not set +# CONFIG_AT_DEVICE_USING_MW31 is not set +# CONFIG_AT_DEVICE_USING_W60X is not set +# CONFIG_AT_DEVICE_USING_A9G is not set +# CONFIG_AT_DEVICE_USING_BC26 is not set +# CONFIG_AT_DEVICE_USING_AIR720 is not set +# CONFIG_AT_DEVICE_USING_ME3616 is not set +# CONFIG_AT_DEVICE_USING_M6315 is not set +# CONFIG_AT_DEVICE_USING_BC28 is not set +# CONFIG_AT_DEVICE_USING_EC200X is not set +# CONFIG_AT_DEVICE_USING_N21 is not set +# CONFIG_AT_DEVICE_USING_N58 is not set +# CONFIG_AT_DEVICE_USING_M5311 is not set +# CONFIG_AT_DEVICE_USING_L610 is not set +# CONFIG_AT_DEVICE_USING_N720 is not set +# CONFIG_AT_DEVICE_USING_ML305 is not set +# CONFIG_AT_DEVICE_USING_ML307 is not set +# CONFIG_PKG_USING_AT_DEVICE_V210 is not set +# CONFIG_PKG_USING_AT_DEVICE_V204 is not set +# CONFIG_PKG_USING_AT_DEVICE_V203 is not set +# CONFIG_PKG_USING_AT_DEVICE_V202 is not set +# CONFIG_PKG_USING_AT_DEVICE_V201 is not set +# CONFIG_PKG_USING_AT_DEVICE_V200 is not set +CONFIG_PKG_USING_AT_DEVICE_LATEST_VERSION=y +CONFIG_PKG_AT_DEVICE_VER="latest" +CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999 # CONFIG_PKG_USING_ATSRV_SOCKET is not set # CONFIG_PKG_USING_WIZNET is not set # CONFIG_PKG_USING_ZB_COORDINATOR is not set @@ -645,6 +717,9 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_PKG_USING_RVBACKTRACE is not set # CONFIG_PKG_USING_HPATCHLITE is not set # CONFIG_PKG_USING_THREAD_METRIC is not set +# CONFIG_PKG_USING_UORB is not set +# CONFIG_PKG_USING_RT_TUNNEL is not set +# CONFIG_PKG_USING_VIRTUAL_TERMINAL is not set # end of tools packages # @@ -739,6 +814,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_PKG_USING_R_RHEALSTONE is not set # CONFIG_PKG_USING_HEARTBEAT is not set # CONFIG_PKG_USING_MICRO_ROS_RTTHREAD_PACKAGE is not set +# CONFIG_PKG_USING_CHERRYECAT is not set # end of system packages # @@ -901,6 +977,12 @@ CONFIG_PKG_NXP_MCX_SERIES_DRIVER_VER="latest" # CONFIG_PKG_USING_GD32_ARM_CMSIS_DRIVER is not set # CONFIG_PKG_USING_GD32_ARM_SERIES_DRIVER is not set # end of GD32 Drivers + +# +# HPMicro SDK +# +# CONFIG_PKG_USING_HPM_SDK is not set +# end of HPMicro SDK # end of HAL & SDK Drivers # @@ -949,6 +1031,7 @@ CONFIG_PKG_NXP_MCX_SERIES_DRIVER_VER="latest" # CONFIG_PKG_USING_MLX90393 is not set # CONFIG_PKG_USING_MLX90392 is not set # CONFIG_PKG_USING_MLX90394 is not set +# CONFIG_PKG_USING_MLX90396 is not set # CONFIG_PKG_USING_MLX90397 is not set # CONFIG_PKG_USING_MS5611 is not set # CONFIG_PKG_USING_MAX31865 is not set diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/at_sample_client.c b/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/at_sample_client.c new file mode 100644 index 00000000000..d4c927c7c08 --- /dev/null +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/at_sample_client.c @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2018-07-06 chenyong first version + */ + +#include +#include + +#include +#include + +#define LOG_TAG "at.sample" +#include + +#define AT_CMD_MAX_LEN 512 + +/* AT+CIFSR Query local IP address and MAC */ +int at_client_test(int argc, char **argv) +{ + at_response_t resp = RT_NULL; + int result = 0; + + if (argc != 1) + { + LOG_E("at_client_test - AT client send commands to AT server."); + return -1; + } + + resp = at_create_resp(256, 0, rt_tick_from_millisecond(5000)); + if (resp == RT_NULL) + { + LOG_E("No memory for response structure!"); + return -2; + } + + /* close echo */ + at_exec_cmd(resp, "ATE0"); + + result = at_exec_cmd(resp, "AT+CIFSR"); + if (result != RT_EOK) + { + LOG_E("AT client send commands failed or return response error!"); + goto __exit; + } + + /* Print response line buffer */ + { + const char *line_buffer = RT_NULL; + + LOG_D("Response buffer"); + + for(rt_size_t line_num = 1; line_num <= resp->line_counts; line_num++) + { + if((line_buffer = at_resp_get_line(resp, line_num)) != RT_NULL) + { + LOG_D("line %d buffer : %s", line_num, line_buffer); + } + else + { + LOG_E("Parse line buffer error!"); + } + } + } + + { + char resp_arg[AT_CMD_MAX_LEN] = { 0 }; + const char * resp_expr = "%*[^\"]\"%[^\"]\""; + + LOG_D(" Parse arguments"); + if (at_resp_parse_line_args(resp, 1, resp_expr, resp_arg) == 1) + { + LOG_D("Station IP : %s", resp_arg); + rt_memset(resp_arg, 0x00, AT_CMD_MAX_LEN); + } + else + { + LOG_E("Parse error, current line buff : %s", at_resp_get_line(resp, 4)); + } + + if (at_resp_parse_line_args(resp, 2, resp_expr, resp_arg) == 1) + { + LOG_D("Station MAC : %s", resp_arg); + } + else + { + LOG_E("Parse error, current line buff : %s", at_resp_get_line(resp, 5)); + goto __exit; + } + } +__exit: + if(resp) + { + at_delete_resp(resp); + } + + return result; +} + +int at_client_test_init(int argc, char **argv) +{ +#define AT_CLIENT_RECV_BUFF_LEN 1024 +#define AT_CLIENT_SEND_BUFF_LEN 512 + if (argc != 2) + { + rt_kprintf("at_client_init -- AT client initialize.\n"); + return -RT_ERROR; + } + + at_client_init(argv[1], AT_CLIENT_RECV_BUFF_LEN, AT_CLIENT_SEND_BUFF_LEN); + + return RT_EOK; +} +#ifdef FINSH_USING_MSH +#include +MSH_CMD_EXPORT(at_client_test, AT client send cmd and get response); +MSH_CMD_EXPORT_ALIAS(at_client_test_init, at_client_init, initialize AT client); +#endif \ No newline at end of file diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/uart3_test.c b/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/uart3_test.c new file mode 100644 index 00000000000..5c87f5633ce --- /dev/null +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/uart3_test.c @@ -0,0 +1,52 @@ +#include + +#define TX_UART_NAME "uart3" + +static rt_device_t tx_serial = RT_NULL; + +/* 发送任务入口函数 */ +static void serial_tx_thread(void *parameter) +{ + char msg[] = "hello RT-Thread!\r\n"; + + while (1) + { + rt_device_write(tx_serial, 0, msg, sizeof(msg) - 1); + rt_thread_mdelay(500); /* 每 500ms 发一次 */ + } +} + +/* 初始化函数,在系统启动完成后自动运行 */ +int uart3_tx_init(void) +{ + /* 查找 uart3 设备 */ + tx_serial = rt_device_find(TX_UART_NAME); + if (tx_serial == RT_NULL) + { + rt_kprintf("Cannot find %s device!\n", TX_UART_NAME); + return -1; + } + + /* 打开设备(仅发送,不需要接收) */ + rt_device_open(tx_serial, RT_DEVICE_FLAG_WRONLY); + + /* 创建线程 */ + rt_thread_t tid = rt_thread_create( + "uart3_tx", /* 线程名 */ + serial_tx_thread, /* 入口函数 */ + RT_NULL, /* 参数 */ + 1024, /* 栈大小 */ + 20, /* 优先级 */ + 10 /* 时间片 */ + ); + + if (tid != RT_NULL) + rt_thread_startup(tid); + else + rt_kprintf("Create uart3_tx thread failed!\n"); + + return 0; +} +//INIT_APP_EXPORT(uart3_tx_init); +/* 导出到 msh 命令列表中 */ +MSH_CMD_EXPORT(uart3_tx_init, uart3 device test); diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/uart_sample.c b/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/uart_sample.c new file mode 100644 index 00000000000..b8170f50053 --- /dev/null +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/uart_sample.c @@ -0,0 +1,91 @@ +/* + * 程序清单:这是一个 串口 设备使用例程 + * 例程导出了 uart_sample 命令到控制终端 + * 命令调用格式:uart_sample uart3 + * 命令解释:命令第二个参数是要使用的串口设备名称,为空则使用默认的串口设备 + * 程序功能:通过串口输出字符串"hello RT-Thread!",然后错位输出输入的字符 +*/ + +#include + +#define SAMPLE_UART_NAME "uart3" + +/* 用于接收消息的信号量 */ +static struct rt_semaphore rx_sem; +static rt_device_t serial; + +/* 接收数据回调函数 */ +static rt_err_t uart_input(rt_device_t dev, rt_size_t size) +{ + /* 串口接收到数据后产生中断,调用此回调函数,然后发送接收信号量 */ + rt_sem_release(&rx_sem); + + return RT_EOK; +} + +static void serial_thread_entry(void *parameter) +{ + char ch; + + while (1) + { + /* 从串口读取一个字节的数据,没有读取到则等待接收信号量 */ + while (rt_device_read(serial, -1, &ch, 1) != 1) + { + /* 阻塞等待接收信号量,等到信号量后再次读取数据 */ + rt_sem_take(&rx_sem, RT_WAITING_FOREVER); + } + /* 读取到的数据通过串口错位输出 */ + ch = ch + 1; + rt_device_write(serial, 0, &ch, 1); + } +} + +static int uart_sample(int argc, char *argv[]) +{ + rt_err_t ret = RT_EOK; + char uart_name[RT_NAME_MAX]; + char str[] = "hello RT-Thread!\r\n"; + + if (argc == 2) + { + rt_strncpy(uart_name, argv[1], RT_NAME_MAX); + } + else + { + rt_strncpy(uart_name, SAMPLE_UART_NAME, RT_NAME_MAX); + } + + /* 查找系统中的串口设备 */ + serial = rt_device_find(uart_name); + if (!serial) + { + rt_kprintf("find %s failed!\n", uart_name); + return RT_ERROR; + } + + /* 初始化信号量 */ + rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO); + /* 以中断接收及轮询发送模式打开串口设备 */ + rt_device_open(serial, RT_DEVICE_FLAG_INT_RX); + /* 设置接收回调函数 */ + rt_device_set_rx_indicate(serial, uart_input); + /* 发送字符串 */ + rt_device_write(serial, 0, str, (sizeof(str) - 1)); + + /* 创建 serial 线程 */ + rt_thread_t thread = rt_thread_create("serial", serial_thread_entry, RT_NULL, 1024, 25, 10); + /* 创建成功则启动线程 */ + if (thread != RT_NULL) + { + rt_thread_startup(thread); + } + else + { + ret = RT_ERROR; + } + + return ret; +} +/* 导出到 msh 命令列表中 */ +MSH_CMD_EXPORT(uart_sample, uart device sample); diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/board/MCUX_Config/board/pin_mux.c b/bsp/nxp/mcx/mcxa/frdm-mcxa346/board/MCUX_Config/board/pin_mux.c index 03b612b08b6..0526e3406be 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa346/board/MCUX_Config/board/pin_mux.c +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/board/MCUX_Config/board/pin_mux.c @@ -485,4 +485,38 @@ void BOARD_InitPins(void) .lockRegister = kPORT_UnlockRegister}; /* PORT3_9 (pin 97) is configured as LPSPI1_SDI */ PORT_SetPinConfig(PORT3, 9U, &port3_9_pin97_config); + + + /* ------------------ UART3 TX (PORT4_5) ------------------ */ + const port_pin_config_t uart3_tx_config = { + .pullSelect = kPORT_PullUp, /* 内部上拉 */ + .pullValueSelect = kPORT_LowPullResistor, /* 低阻上拉 */ + .slewRate = kPORT_FastSlewRate, /* 快速上升沿 */ + .passiveFilterEnable = kPORT_PassiveFilterDisable, + .openDrainEnable = kPORT_OpenDrainDisable, + .driveStrength = kPORT_LowDriveStrength, + .driveStrength1 = kPORT_NormalDriveStrength, + .mux = kPORT_MuxAlt3, /* UART3_TX 对应 ALT3 */ + .inputBuffer = kPORT_InputBufferEnable, + .invertInput = kPORT_InputNormal, + .lockRegister = kPORT_UnlockRegister}; + /* PORT4_5 is configured as LPUART3_TX */ + PORT_SetPinConfig(PORT4, 5U, &uart3_tx_config); + + /* ------------------ UART3 RX (PORT4_2) ------------------ */ + const port_pin_config_t uart3_rx_config = { + .pullSelect = kPORT_PullUp, + .pullValueSelect = kPORT_LowPullResistor, + .slewRate = kPORT_FastSlewRate, + .passiveFilterEnable = kPORT_PassiveFilterDisable, + .openDrainEnable = kPORT_OpenDrainDisable, + .driveStrength = kPORT_LowDriveStrength, + .driveStrength1 = kPORT_NormalDriveStrength, + .mux = kPORT_MuxAlt3, /* UART3_RX 对应 ALT3 */ + .inputBuffer = kPORT_InputBufferEnable, + .invertInput = kPORT_InputNormal, + .lockRegister = kPORT_UnlockRegister}; + /* PORT4_2 is configured as LPUART3_RX */ + PORT_SetPinConfig(PORT4, 2U, &uart3_rx_config); + } diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvoptx b/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvoptx index 56d3a78b4df..1467bd5065a 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvoptx +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvoptx @@ -120,7 +120,7 @@ 0 CMSIS_AGDI_V8M - -X"Any" -UAny -O206 -S9 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0MCXA34X_1024.FLM -FS00 -FL0FE000 -FP0($$Device:MCXA346VLQ$devices\MCXA346\arm\MCXA34X_1024.FLM) + -X"Any" -UAny -O206 -S9 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0MCXA_1024 -FS00 -FL0FE000 -FP0($$Device:MCXA346VLQ$devices\MCXA346\arm\MCXA_1024.FLM) 0 @@ -206,22 +206,170 @@ 0 0 0 + applications\uart_sample.c + uart_sample.c + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + applications\at_sample_client.c + at_sample_client.c + 0 + 0 + + + 1 + 4 + 1 + 0 + 0 + 0 applications\main.c main.c 0 0 + + 1 + 5 + 1 + 0 + 0 + 0 + applications\uart3_test.c + uart3_test.c + 0 + 0 + - Compiler + AT 0 0 0 0 2 - 3 + 6 + 1 + 0 + 0 + 0 + ..\..\..\..\..\components\net\at\src\at_utils.c + at_utils.c + 0 + 0 + + + 2 + 7 + 1 + 0 + 0 + 0 + ..\..\..\..\..\components\net\at\src\at_client.c + at_client.c + 0 + 0 + + + 2 + 8 + 1 + 0 + 0 + 0 + ..\..\..\..\..\components\net\at\src\at_cli.c + at_cli.c + 0 + 0 + + + 2 + 9 + 1 + 0 + 0 + 0 + ..\..\..\..\..\components\net\at\at_socket\at_socket.c + at_socket.c + 0 + 0 + + + + + at_device + 0 + 0 + 0 + 0 + + 3 + 10 + 1 + 0 + 0 + 0 + packages\at_device-latest\class\esp8266\at_socket_esp8266.c + at_socket_esp8266.c + 0 + 0 + + + 3 + 11 + 1 + 0 + 0 + 0 + packages\at_device-latest\src\at_device.c + at_device.c + 0 + 0 + + + 3 + 12 + 1 + 0 + 0 + 0 + packages\at_device-latest\class\esp8266\at_device_esp8266.c + at_device_esp8266.c + 0 + 0 + + + 3 + 13 + 1 + 0 + 0 + 0 + packages\at_device-latest\samples\at_sample_esp8266.c + at_sample_esp8266.c + 0 + 0 + + + + + Compiler + 0 + 0 + 0 + 0 + + 4 + 14 1 0 0 @@ -232,8 +380,8 @@ 0 - 2 - 4 + 4 + 15 1 0 0 @@ -244,8 +392,8 @@ 0 - 2 - 5 + 4 + 16 1 0 0 @@ -256,8 +404,8 @@ 0 - 2 - 6 + 4 + 17 1 0 0 @@ -268,8 +416,8 @@ 0 - 2 - 7 + 4 + 18 1 0 0 @@ -280,8 +428,8 @@ 0 - 2 - 8 + 4 + 19 1 0 0 @@ -292,8 +440,8 @@ 0 - 2 - 9 + 4 + 20 1 0 0 @@ -304,8 +452,8 @@ 0 - 2 - 10 + 4 + 21 1 0 0 @@ -324,8 +472,8 @@ 0 0 - 3 - 11 + 5 + 22 1 0 0 @@ -336,8 +484,8 @@ 0 - 3 - 12 + 5 + 23 1 0 0 @@ -348,8 +496,8 @@ 0 - 3 - 13 + 5 + 24 1 0 0 @@ -360,8 +508,8 @@ 0 - 3 - 14 + 5 + 25 1 0 0 @@ -372,8 +520,8 @@ 0 - 3 - 15 + 5 + 26 1 0 0 @@ -384,8 +532,8 @@ 0 - 3 - 16 + 5 + 27 1 0 0 @@ -396,8 +544,8 @@ 0 - 3 - 17 + 5 + 28 1 0 0 @@ -408,8 +556,8 @@ 0 - 3 - 18 + 5 + 29 1 0 0 @@ -420,8 +568,8 @@ 0 - 3 - 19 + 5 + 30 1 0 0 @@ -432,8 +580,8 @@ 0 - 3 - 20 + 5 + 31 1 0 0 @@ -444,8 +592,8 @@ 0 - 3 - 21 + 5 + 32 1 0 0 @@ -456,8 +604,8 @@ 0 - 3 - 22 + 5 + 33 1 0 0 @@ -468,8 +616,8 @@ 0 - 3 - 23 + 5 + 34 1 0 0 @@ -480,8 +628,8 @@ 0 - 3 - 24 + 5 + 35 1 0 0 @@ -492,8 +640,8 @@ 0 - 3 - 25 + 5 + 36 1 0 0 @@ -504,8 +652,8 @@ 0 - 3 - 26 + 5 + 37 1 0 0 @@ -516,8 +664,8 @@ 0 - 3 - 27 + 5 + 38 1 0 0 @@ -528,8 +676,8 @@ 0 - 3 - 28 + 5 + 39 1 0 0 @@ -540,8 +688,8 @@ 0 - 3 - 29 + 5 + 40 1 0 0 @@ -552,8 +700,8 @@ 0 - 3 - 30 + 5 + 41 1 0 0 @@ -572,8 +720,8 @@ 0 0 - 4 - 31 + 6 + 42 1 0 0 @@ -584,8 +732,8 @@ 0 - 4 - 32 + 6 + 43 1 0 0 @@ -596,8 +744,8 @@ 0 - 4 - 33 + 6 + 44 1 0 0 @@ -608,8 +756,8 @@ 0 - 4 - 34 + 6 + 45 1 0 0 @@ -620,8 +768,8 @@ 0 - 4 - 35 + 6 + 46 1 0 0 @@ -640,20 +788,20 @@ 0 0 - 5 - 36 + 7 + 47 1 0 0 0 - ..\..\..\..\..\components\finsh\cmd.c - cmd.c + ..\..\..\..\..\components\finsh\shell.c + shell.c 0 0 - 5 - 37 + 7 + 48 1 0 0 @@ -664,26 +812,26 @@ 0 - 5 - 38 + 7 + 49 1 0 0 0 - ..\..\..\..\..\components\finsh\shell.c - shell.c + ..\..\..\..\..\components\finsh\msh.c + msh.c 0 0 - 5 - 39 + 7 + 50 1 0 0 0 - ..\..\..\..\..\components\finsh\msh.c - msh.c + ..\..\..\..\..\components\finsh\cmd.c + cmd.c 0 0 @@ -696,8 +844,8 @@ 0 0 - 6 - 40 + 8 + 51 1 0 0 @@ -707,9 +855,9 @@ 0 0 - - 6 - 41 + + 8 + 52 1 0 0 @@ -720,8 +868,8 @@ 0 - 6 - 42 + 8 + 53 1 0 0 @@ -732,8 +880,8 @@ 0 - 6 - 43 + 8 + 54 1 0 0 @@ -744,8 +892,8 @@ 0 - 6 - 44 + 8 + 55 1 0 0 @@ -756,8 +904,8 @@ 0 - 6 - 45 + 8 + 56 1 0 0 @@ -768,8 +916,8 @@ 0 - 6 - 46 + 8 + 57 1 0 0 @@ -780,8 +928,8 @@ 0 - 6 - 47 + 8 + 58 1 0 0 @@ -792,8 +940,8 @@ 0 - 6 - 48 + 8 + 59 1 0 0 @@ -804,8 +952,8 @@ 0 - 6 - 49 + 8 + 60 1 0 0 @@ -816,8 +964,8 @@ 0 - 6 - 50 + 8 + 61 1 0 0 @@ -828,8 +976,8 @@ 0 - 6 - 51 + 8 + 62 1 0 0 @@ -840,8 +988,8 @@ 0 - 6 - 52 + 8 + 63 1 0 0 @@ -852,8 +1000,8 @@ 0 - 6 - 53 + 8 + 64 1 0 0 @@ -864,8 +1012,8 @@ 0 - 6 - 54 + 8 + 65 1 0 0 @@ -884,56 +1032,56 @@ 0 0 - 7 - 55 + 9 + 66 1 0 0 0 - ..\..\..\..\..\src\klibc\kerrno.c - kerrno.c + ..\..\..\..\..\src\klibc\kstring.c + kstring.c 0 0 - 7 - 56 + 9 + 67 1 0 0 0 - ..\..\..\..\..\src\klibc\kstdio.c - kstdio.c + ..\..\..\..\..\src\klibc\kerrno.c + kerrno.c 0 0 - 7 - 57 + 9 + 68 1 0 0 0 - ..\..\..\..\..\src\klibc\kstring.c - kstring.c + ..\..\..\..\..\src\klibc\rt_vsscanf.c + rt_vsscanf.c 0 0 - 7 - 58 + 9 + 69 1 0 0 0 - ..\..\..\..\..\src\klibc\rt_vsscanf.c - rt_vsscanf.c + ..\..\..\..\..\src\klibc\kstdio.c + kstdio.c 0 0 - 7 - 59 + 9 + 70 1 0 0 @@ -952,8 +1100,8 @@ 0 0 - 8 - 60 + 10 + 71 1 0 0 @@ -964,8 +1112,8 @@ 0 - 8 - 61 + 10 + 72 1 0 0 @@ -976,8 +1124,8 @@ 0 - 8 - 62 + 10 + 73 1 0 0 @@ -988,8 +1136,8 @@ 0 - 8 - 63 + 10 + 74 2 0 0 @@ -1000,8 +1148,8 @@ 0 - 8 - 64 + 10 + 75 1 0 0 @@ -1012,8 +1160,8 @@ 0 - 8 - 65 + 10 + 76 2 0 0 @@ -1024,8 +1172,8 @@ 0 - 8 - 66 + 10 + 77 1 0 0 @@ -1044,8 +1192,8 @@ 0 0 - 9 - 67 + 11 + 78 1 0 0 @@ -1056,8 +1204,8 @@ 0 - 9 - 68 + 11 + 79 1 0 0 @@ -1068,8 +1216,8 @@ 0 - 9 - 69 + 11 + 80 1 0 0 @@ -1080,8 +1228,8 @@ 0 - 9 - 70 + 11 + 81 1 0 0 @@ -1092,8 +1240,8 @@ 0 - 9 - 71 + 11 + 82 1 0 0 @@ -1104,8 +1252,8 @@ 0 - 9 - 72 + 11 + 83 1 0 0 @@ -1116,8 +1264,8 @@ 0 - 9 - 73 + 11 + 84 1 0 0 @@ -1128,8 +1276,8 @@ 0 - 9 - 74 + 11 + 85 1 0 0 @@ -1140,8 +1288,8 @@ 0 - 9 - 75 + 11 + 86 1 0 0 @@ -1152,8 +1300,8 @@ 0 - 9 - 76 + 11 + 87 1 0 0 @@ -1164,8 +1312,8 @@ 0 - 9 - 77 + 11 + 88 1 0 0 @@ -1176,8 +1324,8 @@ 0 - 9 - 78 + 11 + 89 1 0 0 @@ -1188,8 +1336,8 @@ 0 - 9 - 79 + 11 + 90 1 0 0 @@ -1200,8 +1348,8 @@ 0 - 9 - 80 + 11 + 91 1 0 0 @@ -1212,8 +1360,8 @@ 0 - 9 - 81 + 11 + 92 1 0 0 @@ -1224,8 +1372,8 @@ 0 - 9 - 82 + 11 + 93 1 0 0 @@ -1236,8 +1384,8 @@ 0 - 9 - 83 + 11 + 94 1 0 0 @@ -1248,8 +1396,8 @@ 0 - 9 - 84 + 11 + 95 1 0 0 @@ -1260,8 +1408,8 @@ 0 - 9 - 85 + 11 + 96 1 0 0 @@ -1272,8 +1420,8 @@ 0 - 9 - 86 + 11 + 97 1 0 0 @@ -1284,8 +1432,8 @@ 0 - 9 - 87 + 11 + 98 1 0 0 @@ -1296,8 +1444,8 @@ 0 - 9 - 88 + 11 + 99 1 0 0 @@ -1308,8 +1456,8 @@ 0 - 9 - 89 + 11 + 100 1 0 0 @@ -1320,8 +1468,8 @@ 0 - 9 - 90 + 11 + 101 1 0 0 @@ -1332,8 +1480,8 @@ 0 - 9 - 91 + 11 + 102 1 0 0 @@ -1344,8 +1492,8 @@ 0 - 9 - 92 + 11 + 103 1 0 0 @@ -1356,8 +1504,8 @@ 0 - 9 - 93 + 11 + 104 1 0 0 @@ -1368,8 +1516,8 @@ 0 - 9 - 94 + 11 + 105 1 0 0 @@ -1380,8 +1528,8 @@ 0 - 9 - 95 + 11 + 106 1 0 0 @@ -1392,8 +1540,8 @@ 0 - 9 - 96 + 11 + 107 1 0 0 @@ -1404,8 +1552,8 @@ 0 - 9 - 97 + 11 + 108 1 0 0 @@ -1416,8 +1564,8 @@ 0 - 9 - 98 + 11 + 109 1 0 0 @@ -1428,8 +1576,8 @@ 0 - 9 - 99 + 11 + 110 1 0 0 @@ -1440,8 +1588,8 @@ 0 - 9 - 100 + 11 + 111 1 0 0 @@ -1452,8 +1600,8 @@ 0 - 9 - 101 + 11 + 112 1 0 0 @@ -1464,8 +1612,8 @@ 0 - 9 - 102 + 11 + 113 1 0 0 @@ -1477,4 +1625,72 @@ + + SAL + 0 + 0 + 0 + 0 + + 12 + 114 + 1 + 0 + 0 + 0 + ..\..\..\..\..\components\net\netdev\src\netdev.c + netdev.c + 0 + 0 + + + 12 + 115 + 1 + 0 + 0 + 0 + ..\..\..\..\..\components\net\netdev\src\netdev_ipaddr.c + netdev_ipaddr.c + 0 + 0 + + + 12 + 116 + 1 + 0 + 0 + 0 + ..\..\..\..\..\components\net\sal\impl\af_inet_at.c + af_inet_at.c + 0 + 0 + + + 12 + 117 + 1 + 0 + 0 + 0 + ..\..\..\..\..\components\net\sal\socket\net_netdb.c + net_netdb.c + 0 + 0 + + + 12 + 118 + 1 + 0 + 0 + 0 + ..\..\..\..\..\components\net\sal\src\sal_socket.c + sal_socket.c + 0 + 0 + + + diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvprojx b/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvprojx index a4553409c63..92b00d0b222 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvprojx +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvprojx @@ -10,13 +10,13 @@ rtthread-frdm-mcxa346 0x4 ARM-ADS - 6230000::V6.23::ARMCLANG + 6190000::V6.19::ARMCLANG 1 MCXA346VLQ NXP - NXP.MCXA346_DFP.25.06.00 + NXP.MCXA346_DFP.25.09.00 https://mcuxpresso.nxp.com/cmsis_pack/repo/ IRAM(0x20000000,0x03c000) IRAM2(0x04000000,0x2000) IROM(0x03000000,0x2000) IROM2(0x00000000,0x0fe000) XRAM(0x04002000,0x2000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP CLOCK(12000000) ELITTLE @@ -338,9 +338,9 @@ 0 --target=arm-arm-none-eabi - __RTTHREAD__, CPU_MCXA346VLQ, RT_USING_ARMLIBC, DEBUG, __STDC_LIMIT_MACROS, RT_USING_LIBC, __CLK_TCK=RT_TICK_PER_SECOND + RT_USING_ARMLIBC, __STDC_LIMIT_MACROS, CPU_MCXA346VLQ, RT_USING_LIBC, DEBUG, __CLK_TCK=RT_TICK_PER_SECOND, __RTTHREAD__ - ..\..\..\..\..\components\drivers\include;applications;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\libc\posix\io\poll;..\..\..\..\..\components\libc\compilers\common\extension;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\drivers\smp_call;..\Libraries\drivers\config;..\..\..\..\..\components\drivers\spi;..\..\..\..\..\components\drivers\include;.;..\..\..\..\..\libcpu\arm\common;packages\nxp-mcx-cmsis-latest\Core\Include;packages\nxp-mcx-series-latest\MCXA346\drivers;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\libc\posix\io\eventfd;..\..\..\..\..\components\drivers\include;packages\nxp-mcx-series-latest\MCXA346\periph2;..\..\..\..\..\libcpu\arm\cortex-m33;..\..\..\..\..\components\libc\posix\ipc;..\..\..\..\..\components\finsh;packages\nxp-mcx-series-latest\MCXA346;..\..\..\..\..\components\libc\compilers\common\extension\fcntl\octal;..\Libraries\drivers;..\..\..\..\..\components\drivers\include;..\..\..\..\..\include;..\..\..\..\..\components\libc\posix\io\epoll;board\MCUX_Config\board;..\..\..\..\..\components\drivers\include;packages\nxp-mcx-series-latest\MCXA346\components\codec;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\libc\compilers\common\include;board;..\..\..\..\..\components\drivers\phy + ..\..\..\..\..\components\drivers\include;..\Libraries\drivers\config;board;..\..\..\..\..\components\libc\compilers\common\extension\fcntl\octal;..\..\..\..\..\components\net\sal\impl;..\..\..\..\..\components\drivers\include;.;..\..\..\..\..\libcpu\arm\common;..\..\..\..\..\include;packages\at_device-latest\inc;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\net\sal\include\socket\sys_socket;..\..\..\..\..\components\drivers\spi;..\..\..\..\..\components\drivers\include;applications;..\..\..\..\..\components\drivers\include;packages\nxp-mcx-series-latest\MCXA346;..\..\..\..\..\components\libc\posix\io\eventfd;packages\nxp-mcx-series-latest\MCXA346\periph2;..\..\..\..\..\components\net\sal\include\socket;packages\nxp-mcx-series-latest\MCXA346\components\codec;packages\at_device-latest\class\esp8266;board\MCUX_Config\board;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\libc\posix\ipc;..\..\..\..\..\components\drivers\phy;..\..\..\..\..\components\libc\posix\io\epoll;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\drivers\smp_call;..\..\..\..\..\components\net\netdev\include;..\..\..\..\..\components\libc\compilers\common\extension;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\drivers\include;packages\nxp-mcx-series-latest\MCXA346\drivers;..\..\..\..\..\libcpu\arm\cortex-m33;..\..\..\..\..\components\net\at\include;..\..\..\..\..\components\libc\compilers\common\include;..\..\..\..\..\components\net\at\at_socket;..\Libraries\drivers;..\..\..\..\..\components\net\sal\include;..\..\..\..\..\components\net\utest;..\..\..\..\..\components\finsh;packages\nxp-mcx-cmsis-latest\Core\Include;..\..\..\..\..\components\libc\posix\io\poll;..\..\..\..\..\components\drivers\include @@ -389,11 +389,76 @@ 1 applications\drv_spi_sample_rw007.c + + uart_sample.c + 1 + applications\uart_sample.c + + + at_sample_client.c + 1 + applications\at_sample_client.c + main.c 1 applications\main.c + + uart3_test.c + 1 + applications\uart3_test.c + + + + + AT + + + at_utils.c + 1 + ..\..\..\..\..\components\net\at\src\at_utils.c + + + at_client.c + 1 + ..\..\..\..\..\components\net\at\src\at_client.c + + + at_cli.c + 1 + ..\..\..\..\..\components\net\at\src\at_cli.c + + + at_socket.c + 1 + ..\..\..\..\..\components\net\at\at_socket\at_socket.c + + + + + at_device + + + at_socket_esp8266.c + 1 + packages\at_device-latest\class\esp8266\at_socket_esp8266.c + + + at_device.c + 1 + packages\at_device-latest\src\at_device.c + + + at_device_esp8266.c + 1 + packages\at_device-latest\class\esp8266\at_device_esp8266.c + + + at_sample_esp8266.c + 1 + packages\at_device-latest\samples\at_sample_esp8266.c + @@ -1600,9 +1665,9 @@ Finsh - cmd.c + shell.c 1 - ..\..\..\..\..\components\finsh\cmd.c + ..\..\..\..\..\components\finsh\shell.c msh_parse.c @@ -1610,14 +1675,14 @@ ..\..\..\..\..\components\finsh\msh_parse.c - shell.c + msh.c 1 - ..\..\..\..\..\components\finsh\shell.c + ..\..\..\..\..\components\finsh\msh.c - msh.c + cmd.c 1 - ..\..\..\..\..\components\finsh\msh.c + ..\..\..\..\..\components\finsh\cmd.c @@ -2470,24 +2535,24 @@ klibc - kerrno.c + kstring.c 1 - ..\..\..\..\..\src\klibc\kerrno.c + ..\..\..\..\..\src\klibc\kstring.c - kstdio.c + kerrno.c 1 - ..\..\..\..\..\src\klibc\kstdio.c + ..\..\..\..\..\src\klibc\kerrno.c - kstring.c + rt_vsscanf.c 1 - ..\..\..\..\..\src\klibc\kstring.c + ..\..\..\..\..\src\klibc\rt_vsscanf.c - rt_vsscanf.c + kstdio.c 1 - ..\..\..\..\..\src\klibc\rt_vsscanf.c + ..\..\..\..\..\src\klibc\kstdio.c rt_vsnprintf_tiny.c @@ -2721,6 +2786,36 @@ + + SAL + + + netdev.c + 1 + ..\..\..\..\..\components\net\netdev\src\netdev.c + + + netdev_ipaddr.c + 1 + ..\..\..\..\..\components\net\netdev\src\netdev_ipaddr.c + + + af_inet_at.c + 1 + ..\..\..\..\..\components\net\sal\impl\af_inet_at.c + + + net_netdb.c + 1 + ..\..\..\..\..\components\net\sal\socket\net_netdb.c + + + sal_socket.c + 1 + ..\..\..\..\..\components\net\sal\src\sal_socket.c + + + diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/rtconfig.h b/bsp/nxp/mcx/mcxa/frdm-mcxa346/rtconfig.h index 71bdd77c255..99e61ba377e 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa346/rtconfig.h +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/rtconfig.h @@ -146,6 +146,9 @@ #define RT_USING_DEVICE_IPC #define RT_UNAMED_PIPE_NUMBER 64 +#define RT_USING_SYSTEM_WORKQUEUE +#define RT_SYSTEM_WORKQUEUE_STACKSIZE 2048 +#define RT_SYSTEM_WORKQUEUE_PRIORITY 23 #define RT_USING_SERIAL #define RT_USING_SERIAL_V1 #define RT_SERIAL_USING_DMA @@ -186,6 +189,28 @@ /* Network */ +#define RT_USING_SAL +#define SAL_INTERNET_CHECK +#define SOCKET_TABLE_STEP_LEN 4 + +/* Docking with protocol stacks */ + +#define SAL_USING_AT +/* end of Docking with protocol stacks */ +#define SAL_SOCKETS_NUM 16 +#define RT_USING_NETDEV +#define NETDEV_USING_IFCONFIG +#define NETDEV_USING_PING +#define NETDEV_USING_NETSTAT +#define NETDEV_USING_AUTO_DEFAULT +#define NETDEV_IPV4 1 +#define NETDEV_IPV6 0 +#define RT_USING_AT +#define AT_USING_CLIENT +#define AT_CLIENT_NUM_MAX 1 +#define AT_USING_SOCKET +#define AT_USING_CLI +#define AT_SW_VERSION_NUM 0x10301 /* end of Network */ /* Memory protection */ @@ -232,6 +257,16 @@ /* end of CYW43439 WiFi */ /* end of Wi-Fi */ +#define PKG_USING_AT_DEVICE +#define AT_DEVICE_USING_ESP8266 +#define AT_DEVICE_ESP8266_SOCKET +#define AT_DEVICE_ESP8266_SAMPLE +#define ESP8266_SAMPLE_WIFI_SSID "332266" +#define ESP8266_SAMPLE_WIFI_PASSWORD "wasd8888" +#define ESP8266_SAMPLE_CLIENT_NAME "uart3" +#define ESP8266_SAMPLE_RECV_BUFF_LEN 512 +#define PKG_USING_AT_DEVICE_LATEST_VERSION +#define PKG_AT_DEVICE_VER_NUM 0x99999 /* IoT Cloud */ @@ -330,6 +365,10 @@ /* GD32 Drivers */ /* end of GD32 Drivers */ + +/* HPMicro SDK */ + +/* end of HPMicro SDK */ /* end of HAL & SDK Drivers */ /* sensors drivers */ @@ -419,6 +458,7 @@ #define BSP_USING_PIN #define BSP_USING_UART #define BSP_USING_UART2 +#define BSP_USING_UART3 /* end of On-chip Peripheral Drivers */ /* Board extended module Drivers */