想在freertos里面添加UART printf打印

发布于:2024-10-12 ⋅ 阅读:(99) ⋅ 点赞:(0)

今天在编译nrf52840的时候出现下面的错误

.\_build\nrf52840_xxaa.axf: Error: L6915E: Library reports error: __use_no_semihosting was requested, but a semihosting fputc was linked in

把printf()的函数去掉编译,就没问题了 ,但printf()是需要的 

解决办法:1、如果工程里没有包含retarget.c文件,则添加此文件

                   2、在SDK_CONFIG.H文件里添加宏

// <q> RETARGET_ENABLED - retarget - Retargeting stdio functions
#ifndef RETARGET_ENABLED
#define RETARGET_ENABLED 1
#endif

再编译就没问题了。

.\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol app_uart_get (referred from retarget.o).

.\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol app_uart_put (referred from retarget.o).

加C:\Users\RDC-15\Desktop\ble_freertos_uart _rtt\ble_freertos_uart _rtt V0.0.5 _ble\components\libraries\uart/app_uart_fifo

灰的,开

// <q> APP_FIFO_ENABLED  - app_fifo - Software FIFO implementation
 

#ifndef APP_FIFO_ENABLED
#define APP_FIFO_ENABLED 1
#endif不对

// </e>

// <e> APP_UART_ENABLED - app_uart - UART driver
//==========================================================
#ifndef APP_UART_ENABLED
#define APP_UART_ENABLED 1
#endif
// <o> APP_UART_DRIVER_INSTANCE  - UART instance used
 
// <0=> 0 

#ifndef APP_UART_DRIVER_INSTANCE
#define APP_UART_DRIVER_INSTANCE 0
#endif  可以

下一个错误

#include "app_fifo.h"没有加进来

添加这个头文件 C:\Users\RDC-15\Desktop\ble_freertos_uart _rtt\ble_freertos_uart _rtt V0.0.5 _ble\components\libraries\fifo 

下一个错误

.\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol app_fifo_flush (referred from app_uart_fifo.o).
.\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol app_fifo_get (referred from app_uart_fifo.o).
.\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol app_fifo_init (referred from app_uart_fifo.o).
.\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol app_fifo_put (referred from app_uart_fifo.o).

是没有加app_fifo.c

添加app_fifo.c ,没有错误了

写了printf,加了这些东西,直接RTT不能打印了?是一切都打印不了了。

printf在UART上也打印不出来

就是把UART关上,那UART和RTT都打印不了

可能是没有对uart进行初始化!


网站公告

今日签到

点亮在社区的每一天
去签到