2019-07-09 02:52 PM
Hello all, I'd like to know if I'm making full use of the FPU on an F730 using SW4STM32/Eclipse. In project properties i set floating point hardware to fpV5-sp-d16 and the ABI to hardware. I also define __FPU_PRESENT & ARM_MATH_CM7 and set the library path and libraries. However, __FPU_PRESENT is automatically set to 0. If i change it to 1, the code works and doesn't seem to run any faster. Examining the assembly code (with fpu_present == 0 ) looks like proper fpu instructions and SCB_GetFPUType() returns 1, so maybe it doesn't matter? It's confusing.
2019-07-09 03:59 PM
You must include stm32f7xx.h and define STM32F730xx globally at project level. And do not change __FPU_PRESENT as it's meant to be defined by MCU manufacturer and is defined in stm32f730xx.h file.
Also set GCC parameter to -mfloat-abi=hard. With IDEs usually it can be done in compiler settings.
2019-07-09 04:34 PM
Yes, i see that __fpu_present is already set in stm32f730xx.h, but i already knew that the fpu is present and my abi is set to hardware, but why is __FPU_USED set to zero in core_cm7.h? I'm pretty sure the fpu is being used anyway, please reread my op.
2019-07-09 04:39 PM
So very sorry for the confusion. The second usage of __FPU_PRESENT in my op should read __FPU_USED!. __FPU_USED is getting set to 0 in core_cm7.h
2019-07-09 11:39 PM
You can edit Your posts...
No, __FPU_USED isn't set to 0. Look at those definitions more carefully an check for Yourself:
int x = __FPU_USED;
2019-07-10 12:08 PM
After spending more time with the code & what documentation i can find, _FPU_USED should be defined to properly initialize the FPU in SystemInit(). However, in core_cm7.h when using GNUC, __FPU_USED is only set if __VFP_FP__ is defined, which it isn't, so __FPU_USED is set to 0. Is it ok to just force it to 1 in core_cm7?
Does anyone have any experience with this who doesn't want to argue about whether I'm really seeing zeros on my computer screen?
2019-07-10 12:44 PM
Well, then search for a real reason why __VFP_FP__ isn't defined by compiler. Maybe You haven't set -mcpu=cortex-m7 parameter?
Are You checking those values with compiled code or believing code analyzer?