STM32F4xx添加浮点运算解算IMU(CubeMX + μVision 5.14)

1.在IMU四元数解算文件内添加 #include <arm_math.h>。

 

2.支持更为快速的sin/cos三角函数运算,需添加以下三个文件:

STM32F4xx添加浮点运算解算IMU(CubeMX + μVision 5.14)

 

①arm_cos_f32.c,arm_sin_f32.c位于:

Drivers\CMSIS\DSP\Source\FastMathFunctions\

 ②arm_cortexM4lf_math.lib位于:

Drivers\CMSIS\Lib\ARM\

3.编译器Options for... -> C/C++ define 添加

ARM_MATH_CM4,__CC_ARM,__FPU_PRESENT

编译器warning  redefine __FPU_PRESENT in stm32f401xe.h:

屏蔽stm32f401xe.h:

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

 

第2步加与不加的区别:解算速度更快。

AHRS稳定可用。