help needed FPU not working on STM32F4 with MIOS32

3 posts in this topic

Hello all!

I've run into a problem while implementing a granular synth on a STM32F4 Discovery using MIOS32. The synth algorithm makes use of floating point operations - I thought it would not be a source of performance issue, since the MCU has a dedicated unit for floating point calculations. Actually, there are performance issues, because the FPU is not enabled for the compiler (I'm using the original toolchain). There's a line commented out in trunk/include/makefile/common.mk:

ifeq ($(FAMILY),STM32F4xx)
# leads to a crash - reason not analysed yet
#CFLAGS += -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mthumb -mfloat-abi=hard -mlittle-endian -ffunction-sections -fdata-sections -fomit-frame-pointer

# works (but FPU not enabled)
CFLAGS += -mcpu=cortex-m4 -mlittle-endian -ffunction-sections -fdata-sections -fomit-frame-pointer

I tried to uncomment that line, it compiled, but crashed for real on the MCU.

Do you know if there's a workaround for that? What can be the source of this problem? Rewriting the synth algorithm is not an option, this is my thesis project, and the deadline is close.

Thanks in advance!

Share this post

Link to post
Share on other sites

Read somewhere that the FreeRTOS in the repository does not includes the Cortex-M4 floating point support, does not support the saving and restoring the vectored floating point registers during context switches. 

See the #4  tip on this page:



Share this post

Link to post
Share on other sites

Did anyone figure out how to get floats to work with the FPU without crashing? I've tried with -mfloat-abi=softfp and not using the FPU in an ISR but still can't get it to work.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now