臂无 - EABI - 海合会:用printf打印浮点数 [英] arm-none-eabi-gcc : Printing float number using printf
问题描述
我写SAM3N的ARM Cortex-M3微控制器的C程序。当我尝试打印浮点数,它只是打印'F'。
例如:的printf(%F,43.12);
打印˚F
只,而不是 43.12
。
I am writing a C program for SAM3N arm cortex-M3 microcontroller. When I try to print float numbers, it just prints 'f'.
Example: printf("%f",43.12);
prints f
only, not the 43.12
.
但随着整数打印工作正常。
But printing with integers works fine.
如何启用花车完整的打印?我知道,编译器,默认情况下,禁用浮动印刷减少code尺寸(即看起来,他们连动的缩减版本)。另外请注意,没有 CFLAGS = -Dprintf = iprintf
在Makefile中。
How to enable full printing of floats? I know that the compiler, by default, disabled float printing to reduce code size (i.e. seems, they linked cut-down version). Also please note that, there is no CFLAGS=-Dprintf=iprintf
used in makefile.
工具细节:
- ARM / GNU C编译器(的crosstool-NG 1.13.1 - 爱特梅尔构建:13)4.6.1
- 以上工具来与爱特梅尔工作室6.0。
推荐答案
你可以试试,在添加链接器设置下面的选项
Can you try, adding the below option in linker settings
-lc -lrdimon -u _printf_float
-lc -lrdimon -u _printf_float
和它在ARM-CORTEXM0
and it worked for me in ARM-CORTEXM0
这篇关于臂无 - EABI - 海合会:用printf打印浮点数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!