您的位置 首页 国产IC

stm32 IAR环境printf函数调用

在串口都配置好的情况下,在mainc文件中加入includestdioh>ifdef__GNUC__definePUTCHAR_PROTOTYPEint__io_putchar(intch

在串口都装备好的情况下,在main.c文件中参加

#include

#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即可

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/bandaoti/ic/258078.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部