STM8 用printf代替uart方法
#ifdef__GNUC__
#definePUTCHAR_PROTOTYPEint__io_putchar(intch)
#else
#definePUTCHAR_PROTOTYPEintfputc(intch,FILE*f)
#endif
PUTCHAR_PROTOTYPE
{
//發送數據代碼
returnch;
}
出現identifier "FILE" is undefined,工程option中,如下選折:
需要在 IAR的Options -> General Options ->Library Configuration里設置一下函數庫,不然printf函數不對,將Library Configuration 中的Library 設置由"Normal"改為"Full"就可以了。
評論