Keil Logo

ARMCLANG: Selecting software floating-point option for AArch32


Information in this knowledgebase article applies to:

  • MDK v5.x
  • AArch32 target devices
  • Armclang compiler toolchain v6.x and newer versions

QUESTION

I'm working on an AArch32 based target device. In my project I only want to use software floating-point libraries for my floating-point operations, instead of using the hardware FPU on my device. How should I specify in compiler and linker options in command line to achieve this without using MDK µVision IDE?

ANSWER

When compiling for AArch32, by default, Arm Compiler uses floating-point hardware that is available on the target. To disable the use of floating-point hardware instructions, use the compiler -mfpu=none option, e.g.

armclang --target=arm-arm-none-eabi -march=armv7e-m -mfpu=none

On AArch32 targets, using -mfpu=none disables the hardware for both Advanced SIMD and floating-point arithmetic. If the compiler encounters floating-point types in the source code, it will use software-based floating-point library functions. This is similar to the -mfloat-abi=soft compiler option.

And for the Arm linker, the linker option --fpu=SoftVFP should be used, in order to tell the linker you don't want to use the floating-point hardware, so that a certain of floating-point initialization modules, such as _fp_init, won't be linked into your image. e.g.

armlink --fpu=SoftVFP

Note that the Arm linker option --fpu=none should only be used when no floating-point code is used at all in your project.

MORE INFORMATION

Last Reviewed: Friday, June 28, 2019


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.