feat(FOC): 集成ARM数学库优化FOC算法实现

- 引入arm_math.h库以使用ARM优化的数学函数
- 将角度归一化从弧度制改为角度制,使用360.0f替代2*PI
- 使用arm_sin_cos_f32替代查找表实现正弦余弦计算
- 移除注释中的ARM Clark和Park变换函数调用
- 修正机械角度计算中的时间常量为TIMER2_FREQUENCY倒数
- 移除传感器角度到弧度的转换,保持原始角度值
- 激活电流环控制中的Iq/Id计算并发送CAN数据
This commit is contained in:
cbb
2026-01-07 23:13:21 +08:00
parent fccb93dd41
commit 72506ce87d
14 changed files with 133 additions and 452 deletions
+3
View File
@@ -59,6 +59,7 @@ project:
- component: Device:GD32C10x_StdPeripherals:BKP
- component: Device:GD32C10x_StdPeripherals:CRC
- component: Device:GD32C10x_StdPeripherals:RTC
- component: CMSIS:DSP
output:
type:
- elf
@@ -76,6 +77,7 @@ project:
- -D__MICROLIB
- -Wno-register
- -O3 # 添加优化级别
- -DARM_MATH_CM4 # Cortex-M4核心定义
C:
- -D__packed=__attribute__((packed))
ASM:
@@ -86,3 +88,4 @@ project:
- --entry=Reset_Handler
- --remove # 移除未使用的代码段
- --diag_suppress=L6207,L6210,L6218,L6220,L6222,L6224,L6226,L6228,L6230,L6232,L6234,L6236,L6238,L6240,L6242,L6244,L6246,L6248,L6308,L6329,L6310,L6312,L6314,L6316,L6318,L6320,L6322,L6324,L6326,L6328,L6330,L6332,L6334,L6336,L6338,L6340,L6342,L6344,L6346,L6348,L6350,L6352,L6354,L6311,L6313,L6315,L6317,L6319,L6321,L6323,L6325,L6327,L6329,L6331,L6333,L6335,L6337,L6339,L6341,L6343,L6345,L6347,L6349,L6351,L6353
# 移除了 __TARGET_FPU_VFP,因为它不是链接器参数