Building with float support
Jeff Johnston
jjohnstn@redhat.com
Mon Jan 5 19:26:00 GMT 2009
Rick Mann wrote:
> Is there anything to read about building newlib with floating-point
> support (particularly in snprintf()).
>
> I did this:
>
> ./configure --target=arm-elf --prefix=/usr/local/arm-elf-float
>
> and modified the resulting Makefile to include these lines:
>
> CFLAGS_FOR_TARGET = -DFLOATING_POINT -g -O2
> CXXFLAGS_FOR_TARGET = -DFLOATING_POINT -g -O2
>
> Then I did "make install" and placed the results from arm-elf-float
> into my existing arm-elf-gcc/newlib installation. After recompiling my
> project, I'm still getting behavior that indicates there's no floating
> point support (garbage printed for %f printf).
>
> Did I miss a setting or do something wrong?
>
> TIA,
Rick,
Floating point I/O support is on by default. You can configure to turn
it off but this is not being done for arm (or any other platform at this
time).
One thing to check is whether you have forgotten to include stdio.h in
your test case. The compiler will default the prototype for printf and
get floating-point arguments wrong. If that is not the case, you might
want to check that the newlib floating-point conversion routines are
working in this particular instance by calling dtoa (<stdio.h>) . If
you look in libc/include/machine/ieeefp.h, you will see that arm has a
few variants with regards to floating-point format so make sure that the
flags are being set correctly according to how the float argument is passed.
-- Jeff J.
More information about the Newlib
mailing list