IAR下设置格式化输出

IAR下printf格式化输出设置

  • 试验环境LPLD固件库3.1

  • 软件平台IAR 7.2


在格式化输出的过程中意外的发现一个奇怪的问题:

printf函数在格式化输出的时候居然不支持%f %g的格式化形式,这是很奇怪的,因为同样的C语言,VC++里面是完全能够运行得到正确的结果的,在IAR下查看函数源文件发现是基于一个在common文件夹下的printf.c文件,源码中也没有看到对%f %g的支持,由此得出,这是一个阉割版的printf函数,系统调用的是这个函数所以,得出的结果与理想相差较大。

参考解决方案:
read.c修改后文件

/*******************
 *
 * Copyright 1998-2010 IAR Systems AB.  
 *
 * This is a template implementation of the "__read" function used by
 * the standard library.  Replace it with a system-specific
 * implementation.
 *
 * The "__read" function reads a number of bytes, at most "size" into
 * the memory area pointed to by "buffer".  It returns the number of
 * bytes read, 0 at the end of the file, or _LLIO_ERROR if failure
 * occurs.
 *
 * The template implementation below assumes that the application
 * provides 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值