调试配置
3 Mar 2025
Read time: 1 minute(s)
BootLoader 和 RT-Thread 均用到调试端口。在 Bringup 过程中,正确配置调试端口至关重要,可以帮助开发者快速发现问题的根本原因,从而快速解决问题。
以 d21x demo128_nand 工程为例, 使用 uart0
端口作为调试口,详细配置流程如下:
- 配置 BootLoader
-
通过 bm 命令进入 bootloader 配置。
-
在 menuconfig 界面中,选择 Using Uart0 选项,并设置相应的参数。
Board options --> [*] Using Uart0 Uart0 Parameter ---> //设置对应的参数 BootLoader options ---> Console ---> (0) Console UART ID //选择对应的串口号
-
保存配置并退出。
-
- 配置 RT-Thread
-
输入 me 命令进入 rt-thread menuconfig 配置界面。
-
在 menuconfig 界面中,选择 Using Uart0 选项,并设置相应的参数。
Board options --> [*] Using Uart0 Uart0 Parameter ---> //设置对应的参数 Rt-Thread options ---> RT-Thread Kernel ---> Kernel Device Object ---> (uart0) the device name for console //设置对应的串口号
-
保存配置并退出。
-
-
pinmux 设置:配置串口对应的硬件复用功能。
以 d21x demo128_nand 工程为例, 在 target/d211/demo128-nand/pinmux.c 文件中配置 pinmux。struct aic_pinmux aic_pinmux_config[] = { #ifdef AIC_USING_UART0 /* uart0 */ {5, PIN_PULL_DIS, 3, "PA.0"}, {5, PIN_PULL_DIS, 3, "PA.1"}, #endif
-
5:复用功能,可以查看芯片手册.引脚复用功能说明。
-
PIN_PULL_DIS:禁止上拉下拉,根据需要选择是否上下拉,有的串口工具无上拉,且主板这边也没做上拉,可以使用上拉。
-
3:驱动强度,默认即可。
-
"PA.0":引脚名称,根据硬件设计的原理图选择。
-
-
保存,使用命令 m 编译烧写固件。
-
重启开发板,即可使用串口调试。