【rt-thread】rt_kprintf函数输出串口设备更改

一般 rt-thread 发布的 bsp 库默认的 rt_kprintf 函数的输出设备是串口1,想要更改输出设备为串口1,以 stm32 为例步骤如下:

  首先,打开 UART2 设备

  其次,在 menuconfig 中 RT-Thread Kernel --- Kernel Device Object --- Using console for rt_kprintf 修改 the device name for console 的值为 uart2

  最后,在文件 <stm32f1xx_hal_msp.c> 中加入串口2相关的时钟、引脚配置信息即可

posted @ 2019-01-30 14:00  壹点灵异  阅读(4525)  评论(0编辑  收藏  举报