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

时间:2024-03-29 15:06:34

keil中使用DSP库时遇到了该问题。

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

然后发现是包含了这个文件的后出现的问题

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

使用DSP库首先编译器要在Option---C++--define中加上ARM_MATH_CM4

例如:使用M4浮点计算和DSP库完整宏定义如下

USE_HAL_DRIVER,STM32F303xC,USE_HAL_DRIVER,STM32F303xC,ARM_MATH_CM4

然后将调用该库的文件夹的Options for Group ->C/C++中添加__FPU_PRESENT,如图。

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

然后打开include的<arm_math.h>,可在文件开头看到一句话;

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

所以在#include <arm_math.h>前面加上 #define  __FPU_PRESENT  1U

即可得到 0 Error (s),0 Warning (s).