add support for armhf
Original Reporter info from Mantis: plugwash
-
Reporter name: peter green
Original Reporter info from Mantis: plugwash
- Reporter name: peter green
Description:
I attach a patch which adds support for armhf to freepascal.
Armhf reffers to arm with the VFP hardfloat variant of EABI. The default CPU and FPU when building for armhf are setup to be suitable for debian armhf (armv7 vfpv3_d16) but I would not object if you lowered them to armv6 and vfpv2 (which I believe are the lowest sane defaults).
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/narmmat.pas,
compiler/arm/cpuinfo.pas, compiler/arm/narmadd.pas, compiler/arm/cpupara.pas:
Add support for the vfpv3_d16 variant of vfp. Currently I Don't think freepascal
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 (though the simplification would have to wait a while for bootstrapping reasons) and would make it a lot less work to add further VFP variant(s) in future. If you want me to do this then I will.
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, compiler/arm/rarmsri.inc,
compiler/arm/rarmcon.inc:
Give odd numbered single precision registers their own numbers so we can use them as locations for parameters.
Fix a typo in the stdname for S30
compiler/arm/cpubase.pas:
Raise the minimum imaginary multimeter number to make room for the aformentioned odd numbered single registers.
Mark appropriate odd numbered single registers as volatile.
compiler/arm/agarmgas.pas:
Tell the assembler that we are using VFP and what version we are using (I find on debian I can't compile code that uses VFP without doing this).
Pass some armhf specific options (copied from what gcc does) when we are building for the eabihf abi target.
compiler/arm/cpupara.pas:
Actually implement the new ABI
compiler/options.pas:
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 (see comment at beginning of report).
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 patch)
Please review this patch and consider it for inclusion.
Mantis conversion info:
- Mantis ID: 21554
- OS: linux
- OS Build: debian sid
- Platform: armhf
- Version: 2.7.1
- Fixed in version: 3.0.0
- Fixed in revision: 20660 (#6ba8dc71)