IAR瑞薩單片機(jī)開發(fā)加入printf調(diào)試函數(shù)
1.關(guān)鍵之處,否則會(huì)出現(xiàn)PUTCHAR函數(shù)未定義現(xiàn)象。
本文引用地址:http://www.ex-cimer.com/article/201611/318625.htm右鍵點(diǎn)擊工程選擇option->General Option->ibrary configuration中l(wèi)ibrary改為full,且General Option->library option->Printf formatter選項(xiàng)中選擇full2
2. main.c中加入,其中使用的是串口1,注意如果提示FILE未定義,請(qǐng)?jiān)陬^文件最頂層添加#include
1 /* Privatefunction prototypes --*/2 3 #ifdef __GNUC__4 /* With GCC/RAISONANCE, small printf(option LD Linker->Libraries->Small printf5 set to Yes) calls __io_putchar() */6 #define PUTCHAR_PROTOTYPE int__io_putchar(int ch)7 #else8 #define PUTCHAR_PROTOTYPE int fputc(int ch,FILE *f)9 #endif /* __GNUC__ */10 11 /**12 *@brief Retargets the C library printffunction to the USART.13 *@param None14 *@retval None15 */16 PUTCHAR_PROTOTYPE17 {18 /*Place your implementation of fputc here */19 /*e.g. write a character to the USART */20 USART_SendData(EVAL_COM1, (uint8_t) ch);21 /*Loop until the end of transmission */22 while (USART_GetFlagStatus(EVAL_COM1, USART_FLAG_TC) == RESET);23 return ch;24 }
printf函數(shù)打印字符串,遇到看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();