新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > stm32 IAR环境printf函数调用

stm32 IAR环境printf函数调用

作者:时间:2016-11-26来源:网络收藏
在串口都配置好的情况下,在main.c文件中加入

#include

本文引用地址:http://www.eepw.com.cn/article/201611/321732.htm

#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;
}

#ifdefUSE_FULL_ASSERT

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



评论


技术专区

关闭