新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > stm32 IAR環(huán)境printf函數調用

stm32 IAR環(huán)境printf函數調用

作者: 時間:2016-11-26 來源:網絡 收藏
在串口都配置好的情況下,在main.c文件中加入

#include

本文引用地址:http://butianyuan.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即可



評論


技術專區(qū)

關閉