Loading...
 
Skip to main content

System Workbench for STM32


Enable FPU in System Workbench for STM32

Hi all,
It would be great to enable Hardware FPU on F4 devices.
Which compiler flags or directives need to be enabled?
Thank you
Filippo

Hi Filippo,

I had this problem a while back using codesourcery, the flags that need to be enabled are

-mfpu=fpv4-sp-d16 -mfloat-abi=softfp

There was also an issue with the toolchain, I ended up switching it to the launchpad gnu arm toolchain with much success. I don't know if this is even an issue with this toolchain since I have not tested it. If I get a chance I will create a project and try it out.

Thanks,
George


Hi George,
than you for the tip.
I made some tests and I tried your solution, it works!
Anyway I've been reading the difference between:

  • [+]mfloat-abi=soft (software emulated floating point)
  • [+]mfloat-abi=softfp (uses FPU instructions, keep compatiblity with non "soft" libraries, but data are loaded into the FPU in a slower way)
  • [+]mfloat-abi=hard (best performances, but not compatible with object not generated using hard flag)

https://wiki.debian.org/ArmHardFloatPort/VfpComparison
so when possible hard flag should be used.
If the projct does not use external libraries, is possible to use "hard" flag, but the flag has to be enabled in: GCC compiler, GCC Linker and GCC Assrmbler.
To do so, go to project properties (Alt + Enter), choose C/C++ Build and then settings, then add flags:
http://s16.postimg.org/olvegtf05/Untitled.png

Bye Filippo

France

Hi Filippo,

To add this kind of options, rather than modifying directly the command line pattern, it is better to change the "additionnal flags" in the "Miscellaneous" tab.

For the FPU settings, in a forthcoming update they will be available in the "MCU Settings" tab, with the FPU kind and ABI preselected depending on the MCU chosen when creating the project.

Bernard