[fpc-devel] Patch: Add support for armhf

peter green plugwash at p10link.net
Tue Mar 20 23:43:25 CET 2012

I attatch a patch which adds support for armhf to freepascal.

Armhf reffers to arm with the VFP hardfloat variant of EABI.  The 
defaults are setup to
be suitable for debian armhf (armv7 vfpv3_d16).

The changes in the patch are documented below.

rtl/arm/setjump.inc, rtl/arm/math.inc, rtl/arm/mathu.inc rtl/arm/arm.inc,
rtl/arm/setjumph.inc. compiler/arm/narminl.pas, compiler/arm/cgcpu.pas,
compiler/arm/narmcnv.pas, compiler/arm/narmcal.pas, 
compiler/arm/cpuinfo.pas, compiler/arm/narmadd.pas, 

Add support for the vfpv3_d16 variant of vfp. Currently I Don't think 
actually uses any vfp version specific instructions so the code 
generated probablly
won't be any different from when vfpv2 is selected. Still I think we 
should recognise
this FPU version as it's what debian uses and we want to pass the 
correct FPU
option to the assembler for inline asm users.

While writing this part of the patch I came to wonder if we should 
introduce a FPUVFP
define that is defined when any variant of VFP is selected. It would 
simplify a lot of
conditionals in the RTL and would make it a lot less work to add a new 
VFP variant
in future.


Fix an internal error number that was used twice in two different places.

compiler/systems.inc compiler/systems.pas

Add new abi target "EABIHF"

compiler/fpcdefs.inc, compiler/systems/i_linux.pas,
compiler/pp.pas, compiler/systems/t_linux.pas:

add and document FPC_ARMHF define to create an armhf compiler.

compiler/ncgutil.pas, compiler/arm/narmcal.pas:

check that the parameter/result is actually in an integer register 
before taking special
codepath to handle that case

compiler/arm/armreg.dat compiler/arm/rarmnum.inc, compiler/arm/rarmsup.inc,
compiler/arm/rarmrni.inc, compiler/arm/rarmstd.inc, 

Give odd numbered single registers their own numbers so we can use them 
as locations
for parameters.

Fix a typo in the stdname for S30


Raise the minimum imaginary multimeter number to make room for the 
aformentioned odd
numbered single registers.

Mark appropriate odd numbered single registers as volatile.


Tell the assembler that we are using VFP and what version we are using.

Pass some armhf specific options (copied from what gcc does) when we are 
for the eabihf abi target.


Actually implement the new ABI


Define FPC_ABI_EABI in addition to FPC_ABI_EABIHF on EABI VFP hardfloat 
systems since
most code needs to behave the same on both

Set default CPU and FPU types to appropriate values when the EABIHF abi
target is selected.

Error out if the user tries to select EABIHF target with a non vfp FPU.

 compiler/msg/errore.msg, compiler/msgtxt.inc, compiler/msgidx.inc:

Add new message for error mentioned in previous section and run make 
messages (note: make messages seems to have added a lot of noise in the 

Please review this patch and consider it for inclusion.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fpc.diff
Type: text/x-diff
Size: 76637 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120320/16b845ad/attachment.diff>

More information about the fpc-devel mailing list