VFP predefined preprocessor defines
Hi,
I have to differ in my C code if it is build as Cortex M3 or Cortex M4 with FPU.
With other GCC compiler I use:
#if (defined (__VFP_FP__) && !defined (__SOFTFP__))
#endif
which works perfectly.
Unfortunately this does not work with Rowley Crosssworks, __VFP_FP__ and __SOFTFP__ are always defined, regardless of the compiler settings.
The documentation tells the following:
ARM FPU Type
arm_fpu_type – Enumeration
Specifies the FPU type to generate code for. The
options are:
• VFP - ARM9/ARM11 based processors
• VFP9 - the same as VFP
• VFPv3-D32 - Cortex-A/Cortex-R based processors
• VFPv3-D16 - Cortex-A/Cortex-R based processors
• FPv4-SP-D16 - Cortex-M4 processors
The corresponding preprocessor definitions:
• __ARM_ARCH_VFP__
• __ARM_ARCH_VFPv3_D32__
• __ARM_ARCH_VFPv3_D16__
• __ARM_ARCH_FPv4_SP_D16__
are defined.
But none of these defines are predefined.
I checked it with:
#if defined(__ARM_ARCH_VFP__)
#error "1"
#endif
#if defined(__ARM_ARCH_VFPv3_D32__)
#error "2"
#endif
#if defined(__ARM_ARCH_VFPv3_D16__)
#error "3"
#endif
#if defined(__ARM_ARCH_FPv4_SP_D16__)
#error "4"
#endif
#if defined(__VFP_FP__)
#error "5"
#endif
#if defined(__SOFTFP__)
#error "6"
#endif
For Cortex M4 with FPU I use in the project properties in code generation options the following settings:
ARM FP ABI Type: SoftFP
ARM FPU Type: FPv4-SP-D16
I am using latest version of Rowley Crossworks V2.3.2.2013053101.18474
Any help is appreciated.
Thanks,
Til
Please sign in to leave a comment.
Comments
1 comment