基于STM32在IAR中调用printf()函数
2015-11-01 17:10
295 查看
在主文件main.c中添加如下代码:
#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;
}
#ifdef USE_FULL_ASSERT
若变异出现错误:
identifier "FILE" is undefined
则选中工程,将Options->GeneralOptions->Library Configuation中的Library选为full即可
#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;
}
#ifdef USE_FULL_ASSERT
若变异出现错误:
identifier "FILE" is undefined
则选中工程,将Options->GeneralOptions->Library Configuation中的Library选为full即可
相关文章推荐
- 第八周期中的总结
- hdu 5538House Building(长春现场赛)
- 如何清除或初始化 easyui 的 treegrid 控件的数据
- hdoj2579Dating with girls(2)【BFS】
- 开关问题【高斯消元】
- Unity+NGUI性能优化方法总结
- Codeforces 592 A. PawnChess 【Codeforces Round #328 (Div. 2)】
- 一个java程序员自学IOS开发之路(五)
- python装饰器
- 图像处理与计算机视觉:基础,经典以及最近发展
- xshell传输文件—rz,sz命令
- iOS深入学习(Block全面分析)
- Leetcode132: Rotate List
- SqlServer2005 恢复数据库时出现Exclusive access could not be obtained because the database is in use 的解决方法
- Android坐标系 scrollTo方法的原理
- 第九周项目三稀疏矩阵相加
- 杭电acm2187
- 图像处理与计算机视觉:基础,经典以及最近发展(5)计算机视觉
- apk反编译和动态调试smali实例收集
- apache httpd学习笔记一 - 下载安装并初步了解