Skip to main content
RMcCa
Senior II
July 9, 2019
Question

STM32F730R8 __FPU_USED needed?

  • July 9, 2019
  • 6 replies
  • 1552 views

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.

    This topic has been closed for replies.

    6 replies

    Piranha
    Principal III
    July 9, 2019

    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.

    https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

    RMcCa
    RMcCaAuthor
    Senior II
    July 9, 2019

    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.

    RMcCa
    RMcCaAuthor
    Senior II
    July 9, 2019

    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​

    Piranha
    Principal III
    July 10, 2019

    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;

    RMcCa
    RMcCaAuthor
    Senior II
    July 10, 2019

    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?​

    Piranha
    Principal III
    July 10, 2019

    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?

    https://devzone.nordicsemi.com/f/nordic-q-a/42610/__fpu_used-not-set-despite-fpu-compiler-linker-flags