Problem with double precision floats in Yagarto

Guest #1581138
Rate this post
• ▲ 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
1
  double d = 10.0;
results in GDB reporting the value as 5.31664595E-315

whereas lines like:
1
  int i = 10;
2
  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?

Regards,
Klaus
#1581443
Rate this post
• ▲ 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 
changed.

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.

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.