1、IAR

1、option->C/C++ compiler--->defined symbols 下添加一行_DLIB_FILE_DESCRIPTOR

2、修改库文件

          stm32 中printf使用


     3、在串口都配置好的情况下,在main.c文件中加入

  #include <stdio.h>

  #ifdef __GNUC__
 
  #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
   #else

  #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
  #endif

 

 PUTCHAR_PROTOTYPE
 {
 
 
  USART_SendData(EVAL_COM1, (uint8_t) ch);

 
  while (USART_GetFlagStatus(EVAL_COM1, USART_FLAG_TC) == RESET)
  {}

  return ch;
 }

 之后如若编译出现identifier "FILE" is undefined,即将Options->GeneralOptions->Library Configuation中的Library选为full即可



2、keil MDK下




相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
  • 2021-10-31
  • 2021-09-13
  • 2021-08-07
  • 2021-12-18
猜你喜欢
  • 2021-12-18
  • 2021-06-05
  • 2022-12-23
  • 2021-12-18
  • 2021-11-01
  • 2021-12-28
  • 2021-07-07
相关资源
相似解决方案