[fpc-devel] How to get FPC to generate floating point instructions for ARM?

michael michael.rychlik at rsm.ie
Tue Mar 15 11:32:39 CET 2011


I am trying to understand how to work with the various floating point options 
available for FPC when running on ARM under Linux. I'm not to familiar with 
all this so please bear with me.

Specifically I have a system comprising an TI OMAP3530: ARM CORTEX A8 running 
Linaro. /proc/cpuinfo reports it as:

Processor    : ARMv7 Processor rev 2 (v7l)
Features    : swp half thumb fastmult vfp edsp neon vfpv3

I notice that when compiling for ARM GCC, by default, generates floating point 
instructions like "fmuls s3, s11, s3" however if the -msoft-float option is 
given then GCC generates calls to software floating point routines like "bl 
__aeabi_fmul".

The former is somewhat faster and of course what I would like to achieve under 
FPC.

So far I have managed to build, using the lazarus_first_time script, an FPC 
cross compiler for ARM running on my PC, version 2.5.1.
Additionally I have built a native compiler on the ARM board from subversion 
sources. Compiled using the ppcarm created on the PC.

I built the native compiler with a command like:

$make clean all PP=/path/to/ppcarm PREFIX="/opt/fpc-svn" 
OPT="-dFPC_ARMEL -O- -dFPC_ABI_EABI"

The resulting compiler works on the target but it generates software floating 
point instructions like "bl float64_mul".

Here I get stuck. I cannot get FPC to generate floating point instructions.

Adding any floating point options to FPC when compiling my application, 
like -CfVFPV3, results in errors like:

PPU Loading /opt/fpc-svn/lib/fpc/2.5.1/units/arm-linux/rtl/system.ppu
Trying to use a unit which was compiled with a different FPU mode

Trying to rebuild my native compiler on the target with -CfVFPV3 in the 
options fails with errors about "selected CPU does not support ARM 
mode:....." for all of the floating point instructions generated.

Is there anyway to get FPC to generate floating point code similar to that 
produced by GCC by default?

Is there a way to rebuild just the units such that they are in the same FPU 
mode?

Thanks for any help.



More information about the fpc-devel mailing list