STM32 HAL库 UART使用printf
// 添加这个函数 int fputc(int ch,FILE *f) { uint8_t temp[1]={ch}; HAL_UART_Transmit(&UartHandle,temp,1,2); } MDK设置:勾选Use Micro LIB 测试板子:STM32F746NG-DISCOVERY main.c文件 /* Includes ------------------------------------------------------------------*/ #include "main.h" #include <stdio.h> /** @addtogroup STM32F7xx_HAL_Examples * @{ */ /** @addtogroup UART_TwoBoards_ComDMA * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ #define TRANSMITTER_BOARD /* Private macro -----------------------