stm32 IAR环境printf函数调用
2016-04-19 10:56
531 查看
在串口都配置好的情况下,在main.c文件中加入
#include <stdio.h>
#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;
}
之后如若编译出现identifier "FILE" is undefined,即将Options->GeneralOptions->Library Configuation中的Library选为full即可
#include <stdio.h>
#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;
}
之后如若编译出现identifier "FILE" is undefined,即将Options->GeneralOptions->Library Configuation中的Library选为full即可
相关文章推荐
- 深入剖析tomcat读书笔记——连接器
- Sencha Cmd 6 和 Ext JS 6 指南文档(部分官方文档中文翻译)
- Android studio code template个性化设置
- (LeetCode 342) Power of Four
- HDU 1879 继续畅通工程
- Win7_64Bit安装Office2007注册表1402错误的解决办法
- GT9xx系列------gesture mode在framework里的实现
- HTML小技巧
- Javascript中匿名函数的多种调用方式
- ECMAscript6 map
- Storm例子
- JavaSE 扫雷项目展示
- 潮汕“七样羹”,吃了变后生
- continue、break、return的区别
- MyEclipse取消自动跳到Console窗口
- Unity中注意事项 其实很简单,应该是自己粗心吧- -
- Jenkins 中运行Android lint和monkey
- BroadcastReceiver三个常见的例子
- Mybatis 拦截器
- 简析Chrome和Webkit的渊源