We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I want to use the CMSIS-DSP library for the STM32G431 to implement a fixed point FIR. In the Keil RTE I selected CMSIS-DSP and installed the Libraries. I haven't yet added the FIR code to my project but I did add the include "arm_math.h".
In the Keil project, under CMSIS it shows the path to "arm_cortex_M4lf_math.lib (DSP)" and I can see an entire CMSIS 5.7.0 is installed along with DSP.
When I compile my program I get the error shown below:
1) What is the cause of this compile error?
compiling phase_det.c... ../Drivers/CMSIS/Include/core_cm4.h(81): error: #35: #error directive: "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" ..\Src\phase_det.c: 0 warnings, 1 error
bptsj said:What is the cause of this compile error?
What is the cause of this compile error?
Exactly as it says:
bptsj said:Compiler generates FPU instructions for a device without an FPU
Does the STM32G431 have an FPU ?
As far as I can tell reading the data sheet & ref manual,
All variants of the part have the FPU.
1) Does a compile flag need to be set to enable the FPU?\
2) For fixed point IIR filters why do I need an FPU anyway?
There is an option:
https://www.keil.com/support/man/docs/uv4/uv4_dg_adstarg.htm
You'd have thought that selecting the Device would set it appropriately?
When I set to FPU Not used and included arm_math.h it did not give this same error but the ST motor control code gave several errors because it requires the single precision FPU.
So, next I still included arm_math.h in my source file but in core_cm4.h I added #define __FPU_PRESENT 1. This is already defined as 1 in stm32g431xx.h but evidently is not "seen" by core_cm4.h. Doing this the program compiles without any errors.
I have not yet added the call to the biquad filter, but at least it is oaky with arm_math.h.
Any ideas why core_cm4.h (under Drivers\CMSIS\include) does not see the flag in stm32g431xx.h ?
Is this an ST issue? The code was built using CubeMx STM32Cube_FW_G4_V1.1.0
bptsj said:Any ideas why core_cm4.h (under Drivers\CMSIS\include) does not see the flag in stm32g431xx.h ?
presumably because core_cm4.h is being included before stm32g431xx.h ?
bptsj said:The code was built (sic?) using CubeMx STM32Cube_FW_G4_V1.1.0
You mean created (or "generated") by CubeMX ?
You're using Keil to build it - yes?
My code is generated my CubeMX and compiled with Keil, yes
I did a project search on core_cm4.h. It is included in stm32g431xx.h at the end after __FPU_PRESENT is defined but is also included in arm_math.h. If arm_math.h is processed before stm32g431xx.h won't this create the failure. Maybe in my source code file that declares arm_math.h I should define __FPU_PRESENT before the include.?
#ifndef __FPU_PRESENT
#define __FPU_PRESENT 1
#include arm_math.h
#endif
Andy Neil said:presumably because core_cm4.h is being included before stm32g431xx.h ?
See:
https://community.st.com/s/question/0D53W00000BL3mXSAT/error-compiler-generates-fpu-instructions-for-a-device-without-an-fpu-check-fpupresent