在ST更新STM32 DSP库之前,需要用到256点和1024点FFT运算的同学,不妨用以下的补丁打上。
1. 现有的DSP库函数中,64点FFT是正确的。 2. 256/1024点需要更改以下几个地方 (1)NPT的定义
IAR assembly file: #define NPT 64 => #define NPT 256/1024 Keil assembly file: NPT EQU 64 => NPT EQU 256/1024 RIDE assembly file: .equ NPT, 64 => .equ NPT, 256/1024
(2)修改一些汇编代码 IAR assembly file:
BUTFLY4ZERO_OPT MACRO pIN,offset, pOUT LDRSH Ai, [pIN, #2] LDRSH Ar, [pIN],#NPT LDRSH Ci, [pIN, #2] LDRSH Cr, [pIN],#NPT LDRSH Bi, [pIN, #2] LDRSH Br, [pIN],#NPT LDRSH Di, [pIN, #2] LDRSH Dr, [pIN],#NPT
改成: BUTFLY4ZERO_OPT MACRO pIN,offset, pOUT LDRSH Ai, [pIN, #2] LDRSH Ar, [pIN] ADD pIN, pIN, #NPT LDRSH Ci, [pIN, #2] LDRSH Cr, [pIN] ADD pIN, pIN, #NPT LDRSH Bi, [pIN, #2] LDRSH Br, [pIN] ADD pIN, pIN, #NPT LDRSH Di, [pIN, #2] LDRSH Dr, [pIN] ADD pIN, pIN, #NPT
Keil assembly file: MACRO BUTFLY4ZERO_OPT $pIN,$offset, $pOUT LDRSH Ai, [$pIN, #2] LDRSH Ar, [$pIN],#NPT LDRSH Ci, [$pIN, #2] LDRSH Cr, [$pIN],#NPT LDRSH Bi, [$pIN, #2] LDRSH Br, [$pIN],#NPT LDRSH Di, [$pIN, #2] LDRSH Dr, [$pIN],#NPT
改成: MACRO BUTFLY4ZERO_OPT $pIN,$offset, $pOUT LDRSH Ai, [$pIN, #2] LDRSH Ar, [$pIN] ADD $pIN, #NPT LDRSH Ci, [$pIN, #2] LDRSH Cr, [$pIN] ADD $pIN, #NPT LDRSH Bi, [$pIN, #2] LDRSH Br, [$pIN] ADD $pIN, #NPT LDRSH Di, [$pIN, #2] LDRSH Dr, [$pIN] ADD $pIN, #NPT
RIDE assembly file:
preloop_v7: ADD r14, r1, r12, LSR#24 /*256pts*/ LDRSH r5, [r14, #2] LDRSH r4, [r14],#NPT LDRSH r9, [r14, #2] LDRSH r8, [r14],#NPT LDRSH r7, [r14, #2] LDRSH r6, [r14],#NPT LDRSH r11, [r14, #2] LDRSH r10, [r14],#NPT 改成:
preloop_v7: ADD r14, r1, r12, LSR#24 /*256pts*/ LDRSH r5, [r14, #2] LDRSH r4, [r14] ADD r14, #NPT LDRSH r9, [r14, #2] LDRSH r8, [r14] ADD r14, #NPT LDRSH r7, [r14, #2] LDRSH r6, [r14] ADD r14, #NPT LDRSH r11, [r14, #2] LDRSH r10, [r14] ADD r14, #NPT
|