Forum: ARM programming with GCC/GNU tools Problem with double precision floats in Yagarto

Author: Klaus Roy-Poulsen (Guest)
Posted on:

Rate this post
0 useful
not useful
I'm having problem with double precision constants when using Yagarto 
and associated libraries.

The problem seems to be that the lower 4 bytes are swapped with the 
upper 4 bytes, compared to what the libraries and GDB expects.

A simple line of code
  double d = 10.0;
results in GDB reporting the value as 5.31664595E-315

whereas lines like:
  int i = 10;
  double d = i;
has the wanted result. Manually entering values in GDB results in values 
GDB understands.

This is probably caused by some wrong or missing compiler option(s), but 
I haven't figured out what I'm missing.

Currently the following CFLAGS are used:
CFLAGS= -g -O0 -mcpu=arm7tdmi -mthumb-interwork

And the following linker flags:
LFLAGS= -L $(YAGARTO_DIR)/lib/gcc/arm-elf/4.4.2/thumb/interwork

I have tried this with other/older version of Yagarto and the GNU tools, 
but with same result.

Does anyone know which options to use and/or the options used to 
generated the libraries?


Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
The older ARM FPA used a strange cross-endian format that differs from 
the more conventional format used by the VFP, but even without FP 
hardware, the emulation will match the format of what it is emulating. 
I would have thought that specifying -mcpu=arm7tdmi would have been 
enough to specify the FP format used.

I have used hardware with VFP with an older release of WinARM and I had 
to rebuild Newlib for VFP support (and GDB did not support VFP doubles), 
so the default was at that time FPA and I do not expect that to have 

However it may not hurt to experiment with the FP settings; try perhaps: 
-mfpu=fpa -msoft-float, and if that does not make it all match up switch 
to -mfpu=vfp -msoft-float.

Author: Klaus Roy-poulsen (krp)
Posted on:

Rate this post
0 useful
not useful
Thank you for the input. -mfpu=fpa did the job.



Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.