Problem with printf and float

Jeppe Ledet-Pedersen jledet@space.aau.dk
Tue Oct 26 14:23:00 GMT 2010


Hi Pavel, All,

On 2010-10-26 09:05, Jeppe Ledet-Pedersen wrote:
> Thank you for your reply. I have tried your suggestion and both
> __IEEE_LITTLE_ENDIAN and IEEE_8087 are set correctly in both vfprintf.c
> and dtoa.c.
>
> __IEEE_BYTES_LITTLE_ENDIAN is not set. I don't see where this define is
> used except for endian.h? It seems to me like the current code yields
> the same setting for VFP and FPA in little endian mode, or am I missing
> something?

I did some further testing. If I compile an ELF toolchain (non-EABI) 
with crosstool-NG, I get correct output regardless of whether I use 
-mfpu=vfp or not (and thus defines __VFP_FP__) when compiling newlib.

This is my test output:

ARM ELF (__IEEE_BIG_ENDIAN, __IEEE_BYTES_LITTLE_ENDIAN, IEEE_MC68k):
00 00 55 c0 00 00 00 00
a is -84.000000
...

ARM ELF (__IEEE_LITTLE_ENDIAN, IEEE_8087):
00 00 00 00 00 00 55 c0
a is -84.000000
...

As soon as I compile for arm-unknown-eabi instead of arm-unknown-elf, I 
can only print if I convert to FPA format.

I'll continue my search. If you have any input or suggestions where to 
look, I'll be happy to hear from you.

Best regards,
Jeppe



More information about the Newlib mailing list