May 28, 2019
12:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 28, 2019
12:22 AM
Hi everyone,
I'm struggeling with a project on a XMC4400 device in DAVE and naturally I want tu use the FPU. I turned on the full hardware floating point ABI.
The compiler is called with the flags -mfloat-abi=hard and -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 - which initially looks good to my limited experience.
However, looking into the included header files by Infineon, in "core_cm4.h" I would find the following lines:
Performing workspace-wide searches, there is not a single line in the entire workspace defining __GNUC__ nor __VFP_FP__ nor __SOFTFP__ - only __FPU_PRESENT is true.
Therefore, this code will define __FPU_USED as false - which is precisely what I don't want.
Does anybody have a clue how to fix this issue?
Best regards
Niklas
I'm struggeling with a project on a XMC4400 device in DAVE and naturally I want tu use the FPU. I turned on the full hardware floating point ABI.
The compiler is called with the flags -mfloat-abi=hard and -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 - which initially looks good to my limited experience.
However, looking into the included header files by Infineon, in "core_cm4.h" I would find the following lines:
#if defined ( __CC_ARM )
[...]
#elif defined ( __GNUC__ )
#if defined (__VFP_FP__) && !defined(__SOFTFP__)
#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
#define __FPU_USED 1U
#else
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#define __FPU_USED 0U
#endif
#else
#define __FPU_USED 0U
#endif
Performing workspace-wide searches, there is not a single line in the entire workspace defining __GNUC__ nor __VFP_FP__ nor __SOFTFP__ - only __FPU_PRESENT is true.
Therefore, this code will define __FPU_USED as false - which is precisely what I don't want.
Does anybody have a clue how to fix this issue?
Best regards
Niklas
1 Reply
Jun 03, 2019
03:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 03, 2019
03:26 PM
Hi,
The __VFP_FP__ and __SOFTFP__ are macros predefined by the compiler itself depending on the command line options.
You can check them by adding the compiler options ' -dM -E' (https://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines)
The __VFP_FP__ is defined as long as you specify -mfpu=fpv4-sp-d16
The __SOFTFP__ is only defined if you specify -mfloat-abi=soft. In all other cases i.e. -mfloat-abi=softfp or –mfloat-abi=hard, it is not defined.
The __FPU_PRESENT is defined in the device header file.
The difference between -mfloat-abi=softfp or –mfloat-abi=hard, is the usage of the floating point registers in the later to pass floating point parameters to functions.
Regards,
Jesus
The __VFP_FP__ and __SOFTFP__ are macros predefined by the compiler itself depending on the command line options.
You can check them by adding the compiler options ' -dM -E' (https://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines)
The __VFP_FP__ is defined as long as you specify -mfpu=fpv4-sp-d16
The __SOFTFP__ is only defined if you specify -mfloat-abi=soft. In all other cases i.e. -mfloat-abi=softfp or –mfloat-abi=hard, it is not defined.
The __FPU_PRESENT is defined in the device header file.
The difference between -mfloat-abi=softfp or –mfloat-abi=hard, is the usage of the floating point registers in the later to pass floating point parameters to functions.
Regards,
Jesus