1. 首先打开工程的options设置

IAR里面STM32工程使用printf

2. 设置编译器的预宏定义,添加宏定义_DLIB_FILE_DESCRIPTOR

IAR里面STM32工程使用printf

3. 修改文件DLib_Defaults.h

DLib_Defaults.h

#ifndef _DLIB_FILE_DESCRIPTOR
#define _DLIB_FILE_DESCRIPTOR 1
#endif

4. 添加putc函数

int fputc(int ch, FILE *f)
{
  while(!(USART_DEBUG->ISR & USART_ISR_TXE));
  USART_DEBUG->TDR = ch;
  return(ch);
}

 

相关文章:

  • 2021-05-27
  • 2021-04-05
  • 2021-05-18
  • 2021-12-18
  • 2022-12-23
  • 2021-09-06
  • 2021-12-18
猜你喜欢
  • 2021-06-05
  • 2021-12-28
  • 2022-12-23
  • 2021-11-01
  • 2021-05-24
相关资源
相似解决方案