Posted on: 2010-02-02 20:34
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? Regards, Klaus
Posted on: 2010-02-02 23:45
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.
Posted on: 2010-02-03 13:12
Thank you for the input. -mfpu=fpa did the job. Regards, Klaus