ARM compiler options

From Lazarus wiki
Jump to navigationJump to search


The FPC compiler lets you create (cross)compilers for various ARM instruction sets, floating point units etc.

Current (FPC 2.6.x/2.7.x) compilers (and RTL PPUs etc) are built for just one ABI and cannot output other ABIs once built - e.g. adding -dFPC_ARMHF when compiling a program will not change anything:

The options below are passed in OPTS= when building FPC. When building a cross compiler, some of them can/should be passed in CROSSOPT as well.


ABIs are selected using the -Ca switch.

Light bulb  Note: Normally, specifying an ABI is not needed. Source:

Instruction sets

Instructions sets are selected using the -Cp switch. Possible instruction sets (note many sets are backward compatible):

  • ARMV3
  • ARMV4
  • ARMV4T
  • ARMV5
  • ARMV5T
  • ARMV6: e.g. in Raspberry Pi; will probably work on most current hardware
  • ARMV6K
  • ARMV6T2
  • ARMV6Z
  • ARMV7: e.g. in Nokia N900, Nokia N9, Nokia N950
  • ARMV7A: e.g. in Odroid U2, Odroid U3
  • ARMV7R
  • ARMV7M

Floating point support

Floating point support coprocessor (FPU) options are selected with the -Cf switch Possible FPU support options:

  • soft: softfloat/no FPU support.
  • vfpv2: e.g. on Raspberry Pi??
  • vfpv3: e.g. on Odroid U2, Odroid U3
  • vfpv3_d16



Below adapted from: [1]

  • armel and armhf indicate how floating point (fp) values are passed.
    • Armel means that all floating point values are always passed in integer registers.
    • Armhf means that fp values are generally passed in floating point registers. As indicated above, armhf is settable by -dFPC_ARMHF; see above)
  • The softfp/vfpv2 distinction for armel indicates how the fp operations are performed.
    • Softfp means that all fp operations are performed by software
    • vfpv2, vfpv3 means that fp operations are performed by the hardware. Although fp values are still passed in integer registers, they're copied to fp registers before performing the operation.

From an ABI point of view softfp and vfpv2 are compatible. However, vfpv2 executables will crash if run on a processor not having vfpv2 hardware.

Other relevant options

  • If you are using FPC 2.7.1+ and want to speed up floating point, you can also specify -OoFASTMATH to sacrifice precision for performance.

See also