ARM compiler options

From Free Pascal wiki
Revision as of 11:41, 12 January 2014 by BigChimp (talk | contribs) (clarification floating point)
Jump to navigationJump to search

Overview

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

Current (FCP 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. dding -dFPC_ARMHF when compiling a program will not change anything: http://lists.freepascal.org/lists/fpc-devel/2013-May/032093.html

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

ABI

ABIs are selected using the -Ca switch.

Light bulb  Note: Normally, specifying an ABI is not needed. Source: http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg35496.html


Instruction sets

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

  • ARMV3
  • ARMV4
  • ARMV4T
  • ARMV5: e.g. in Nokia N900
  • ARMV5T
  • ARMV5TEJ
  • ARMV6: e.g. in Raspberry Pi; will probably work on most current hardware
  • ARMV6K
  • ARMV6T2
  • ARMV6Z
  • ARMV7
  • ARMV7A
  • ARMV7R
  • ARMV7M
  • ARMV7EM

Floating point support

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

  • soft: softfloat/no FPU support.
  • vfpv2: e.g. on Raspberry Pi
  • vfpv3
  • vfpv3_d16

Note: there are also options that determine how floating point support in general should be done (e.g. require floating point coprocessor using -dFPC_ARMHF; see above)

From:http://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg28056.html

  • 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.
  • The softfp/vfpv2 distinction for armel indicates how the fp operations are performed.
    • Softfp means that all fp operations are performed by software
    • vfpv2 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 speicfy -OoFASTMATH to sacrifice precision for performance.
  • -fPIC: does this need to be mentioned?