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

michael michael.rychlik at rsm.ie
Wed Mar 16 11:51:15 CET 2011


Thankyou for the tips re: floating point on the ARM. I have had some success.

Firstly uusing -CfVFPv3 in the options like so:

$ make all PP=/home/linaro/ppcarm_2.5.1 PREFIX="/opt/fpc-svn" 
OPT="-dFPC_ARMEL -O- -dFPC_ABI_EABI -CfVFPv3"

did not do the trick. Neither did adding -Cparmv6 to the options. With these 
in place  the compilation works but the assembly fails with errors like:

Error: selected processor does not support ARM mode `fmuld d0,d0,d1'

I do not have gas on the ARM board but as. OK I found I could assemble 
system.s manually by adding the options -mcpu=armv6 -mfpu=vfpv3 to the as 
command.

So create a script called "as" that simpley calls the original as and adds 
those options. BINGO I can now build a compiler that generates hardware 
floating point instructions.

With that I can build our app. This was rather dramatic. An almost doubling of 
the execution speed!! Which is rather critical for us as we were pushing the 
limits of this board.

So it seems fpc does not pass the correct options to as. Is there anyway I can 
make it do so? My approach is obviously something of a hack.

Thank you all.


On Tuesday 15 March 2011 12:55:08 Jeppe Johansen wrote:
> Den 15-03-2011 11:32, michael skrev:
> > 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.
> > _______________________________________________
> > fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> > http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
> I think that it should work if you do it like:
>
> make clean all PP=/path/to/ppcarm PREFIX="/opt/fpc-svn" OPT="-dFPC_ARMEL
> -O- -dFPC_ABI_EABI -CfVFPv3"
>
> It could be that there are simply some options missing to gas. It should
> generate assembler files. You could try to call the assembler manually
> and see what options it takes. I think some versions need
> "-march=armv7+vfp3" or something like that
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel





More information about the fpc-devel mailing list