Problems with floating-point support on ARM

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Sep 10 09:06:01 UTC 2009


Hi,

RTEMS currently supports only soft-float ARM so this will be assumed. The
default floating-point model for GCC on ARM is FPA.

That means (excerpt from the corresponding ARM document):

Little-endian double-precision values are neither pure little-endian nor pure
big-endian.

This differs from that more recent VFP (Vectored Floatin-Point architecture).

In IEEE 754 we have the following double format:

least significant word (lsw): fraction [31:0]
moast significant word (msw): sign | exponent | fraction [51:32]

This will be stored in different ways:

                 VFP LE    VFP BE    FPA
lower address       lsw       msw    msw
higher address      msw       lsw    lsw

The important thing here is that on little-endian the msw and lsw are switched.
Newlib does not support the FPA floating-point model on little-endian. In this
case it produces wrong results and writes to arbitrary memory locations.

A possible fix is to add the following options to the GCC configuration command
line:

    --with-float=soft
    --with-fpu=vfp

The VFP floating-point hardware model is not implemented in GCC, thus the
hard-float multilibs have to be disabled in gcc/config/arm/t-rtems.

Have a nice day!

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list