ARMCC: How to enable the hardware FPU support for Cortex-M7
Information in this knowledgebase article applies to:
I know that Cortex-M7 has the option to support a hardware Floating Point Unit (FPU). For instance, I'm using the device Atmel ATSAMV71 that has the hardware FPU support for double floating-point operations. How can I enable this hardware FPU support in my project?
For this specific device Atmel ATSAMV71, after installing the corresponding device support pack *_DFP and CMSIS pack, there is a CMSIS-RTOS Blinky example that can be installed via MDK-ARM Pack Installer, which can be used as a reference to see how to change different FPU support options.
In this CMSIS-RTOS Blinky example, open Options for Target - Target - Floating Point Hardware, as shown in this screenshot:
There is a drop-down list to select from these three options:
After selecting this "Floating Point Hardware" option, µVision will set up the corresponding C/C++ option and linker option in Options for Target - C/C++ - Compiler control string and Options for Target - Linker - Linker control string accordingly, as explained as follows:
Moreover, in the SystemInit() routine for the CMSIS library, the following codes are specified accordingly to the SystemInit() function of your system startup C file, in order to enable the FPU.
#if (__FPU_USED == 1) // Keil /* enable FPU if available and used */ SCB->CPACR |= ((3UL << 10*2) | /* set CP10 Full Access */ (3UL << 11*2) ); /* set CP11 Full Access */ #endif
Although for Contex-M7 Floating-Point Extension (FPv5) is recommended for both single and double precision operations because of its additional floating point processing instructions which might help speed up the floating point data processing in your application, you can still specify different Floating-Point Extension, such as FPv4 for the single precision operations. In order to do so, you can specify --fpu=FPv4-SP option, such as --cpu Cortex-M7.fp.sp --fpu=FPv4-SP which overrides any implicit FPU option that is defined by --cpu=name option.
If you have a Cortex-M7 device that is not yet supported by any MDK Device Family Pack, you can take this example as a reference to set up the compiler and linker options and the SystemInit() routine accordingly to enable the hardware FPU support.
The following Discussion Forum threads may provide information related to this topic.
Last Reviewed: Wednesday, January 25, 2017
of your data.