cancel
Showing results for 
Search instead for 
Did you mean: 

#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"

CWang.2
Associate II

Hi, I downloaded X-CUBE-DSPDEMO from https://my.st.com/content/my_st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-dspdemo.license=1593557368708.product=X-CUBE-DSPDEMO.version=1. 0.0.html

When I try to compile the STM32F746_DSPDEMO from Keil, i.e., MDK-ARM version of the code, I get the following errors, what is wrong?

Build started: Project: Project

*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'

Build target 'X-CUBE-DSPDEMO'

compiling main.c...

compiling DistanceFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\DistanceFunctions\DistanceFunctions.c: 0 warnings, 1 error

compiling FastMathFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\FastMathFunctions\FastMathFunctions.c: 0 warnings, 1 error

compiling FilteringFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\FilteringFunctions\FilteringFunctions.c: 0 warnings, 1 error

compiling MatrixFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\MatrixFunctions\MatrixFunctions.c: 0 warnings, 1 error

compiling SVMFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\SVMFunctions\SVMFunctions.c: 0 warnings, 1 error

compiling StatisticsFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\StatisticsFunctions\StatisticsFunctions.c: 0 warnings, 1 error

compiling SupportFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\SupportFunctions\SupportFunctions.c: 0 warnings, 1 error

compiling TransformFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\TransformFunctions\TransformFunctions.c: 0 warnings, 1 error

compiling BayesFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\BayesFunctions\BayesFunctions.c: 0 warnings, 1 error

compiling ComplexMathFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\ComplexMathFunctions\ComplexMathFunctions.c: 0 warnings, 1 error

compiling BasicMathFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\AppData\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\BasicMathFunctions\BasicMathFunctions.c: 0 warnings, 1 error

compiling ControllerFunctions.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\ControllerFunctions\ControllerFunctions.c: 0 warnings, 1 error

compiling CommonTables.c...

..\..\..\..\Drivers\CMSIS\Include\core_cm7.h(129): 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)"

C:\Local\Arm\Packs\ARM\CMSIS\5.7.0\CMSIS\DSP\Source\CommonTables\CommonTables.c: 0 warnings, 1 error

compiling LCDConf.c...

"STM32746G_DISCOVERY\X-CUBE-DSPDEMO.axf" - 13 Error(s), 0 Warning(s).

Target not created.

Build Time Elapsed: 00:00:12

5 REPLIES 5
TDK
Guru

The __FPU_PRESENT should be defined within a header file or specified on the compiler options prior to including core_cm7.h.

Looks like it's defined in:

https://raw.githubusercontent.com/STMicroelectronics/STM32CubeF7/master/Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f746xx.h

If you feel a post has answered your question, please click "Accept as Solution".
CWang.2
Associate II

Thanks very much for your reply!

I see it is defined in global.h, which is the first include in main.h. How can I make sure it gets included first?

In main.h:

/* Define to prevent recursive inclusion -------------------------------------*/

#ifndef __MAIN_H

#define __MAIN_H

/* Includes ------------------------------------------------------------------*/

#include "global.h"

#include "display.h"

In global.h:

/* Define to prevent recursive inclusion -------------------------------------*/

#ifndef __GLOBAL_H

#define __GLOBAL_H

#define __FPU_PRESENT       1    /*!< FPU present */

TDK
Guru

> How can I make sure it gets included first?

Go into your source file, and look at the order of includes to ensure global.h gets included before whatever is including core_cm7.h. In the HAL architecture, you do this by including "stm32f746xx.h" in your source file, which will go and include the other files for you.

If you feel a post has answered your question, please click "Accept as Solution".
Kolab
Senior

ensure that the microcontroller set on CubeMX is the same one you have on your board

Not clear that CubeMX is involved.

If it's a pre-build MDK project, one might go to the target and build panes, making sure the right model, compiler, and floating point selection is available. The F746 only has the FPU-S (Single Precision)

The compiler used by the OP also looks quite old (even for 2 years ago), most of ST's projects are going to target something newer.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..