您的位置:首页 > 其它

stm32 IAR环境printf函数调用

2016-04-19 10:56 531 查看
在串口都配置好的情况下,在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即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: