This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to use CMSIS-DSP Library on STM32G431- getting compile error

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

Parents
  • 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

Reply
  • 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

Children
No data