loeller Posted December 1, 2016 Report Share Posted December 1, 2016 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 endif 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! Quote Link to comment Share on other sites More sharing options...
norbim1 Posted December 1, 2016 Report Share Posted December 1, 2016 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: https://community.arm.com/docs/DOC-7544 Quote Link to comment Share on other sites More sharing options...
val Posted April 7, 2018 Report Share Posted April 7, 2018 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. Quote Link to comment Share on other sites More sharing options...
Antichambre Posted April 29, 2018 Report Share Posted April 29, 2018 I was looking for something else and I found this:https://github.com/openAVproductions/openAV-stm32f4/tree/master/03_float Quote Link to comment Share on other sites More sharing options...
Phatline Posted May 3, 2018 Report Share Posted May 3, 2018 (edited) because of using float... i was searching and trying the last day... i figured following out: when dont use: "-fomit-frame-pointer" in common.mk, t+ deactivate gcc optimize then floating point is functional, @ least with a "small programm" (see the atached zip file fpu__working.zip) i was trying to follow the source of the blackscreen and hardfault, thought of frtos and mutexes, off stacksize, mios-switches, and all kind of stuff, deleted all i could in my program, and come to the point - without fomit-frame-pointer and gcc optimize - its only a thing of "size" of the programm not the used functions (i tryed 10 ours till now, all kind off stuff, and thats my conclusio) (i addet much useless stuff, but from all a bit to a file and its still not hardfaulting, but screens are black and the mios-studio debugging is also not functional it fries without hardfault error, you will have to go in bootloader to load a nother code on the machine ( i of course have a switch for that) fpu__still_working.zip so feel free to add stuff to the attached programs, & find out what the program let hardfault... we may have to activate fomit frame pointer and gcc optimize... maybe this 2 settings are enough for a geek - to easyer find the problem in first place, for me i am tapping in the dark - good morning - good night. Quote in "common.mk" search for your STM32Board: # works (but FPU not enabled) CFLAGS += -mcpu=cortex-m4 -mlittle-endian -ffunction-sections -fdata-sections -fomit-frame-pointer and replace the whole thing with: # works (but no "-fomit-frame-pointer" set CFLAGS += -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -ffunction-sections -fdata-sections in your Lokal Makefile (the direction where your program is)search for: OPTIMIZE = -Osreplace with: OPTIMIZE = i am done, the other things like including float fmath.h which is not functional with dead ends in mios... are too high for me...there is some mess with the library... i will try now in my code to get a dynamic logaritm without using floats in any kind - thats my conclusio Edited May 3, 2018 by Phatline Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.