electro-smith / libDaisy

Hardware Library for the Daisy Audio Platform
https://www.electro-smith.com/daisy
MIT License
312 stars 131 forks source link

Trouble linking CMSIS / using arm_rfft_fast_f32 #547

Open malloyca opened 1 year ago

malloyca commented 1 year ago

Hello,

I've had a lot of trouble trying to link and use arm_rfft_fast_f32. The problem seems to be centered around the arm_bitreversal2.S file.

At first it wasn't linking, but I finally got things to compile by adding: C_SOURCES = $(wildcard ../../libDaisy/Drivers/CMSIS/DSP/Source/*/*.c) ASM_SOURCES = $(wildcard ../../libDaisy/Drivers/CMSIS/DSP/Source/*/*.s) to the makefile and changing the filename to arm_bitreversal2.s since the makefile doesn't handle files with ".S" instead of ".s".

The program seems to compile successfully at this point, but nothing gets passed through the FFT/IFFT no matter what I do. Even a simple program like this in the audio callback will only pass audio through the right channel and there's nothing on the left.

for (size_t i = 0; i < size; i++){
    fft_buf_256[i] = in[0][i];
}
arm_rfft_fast_f32(&fft_256, fft_buf_256, fft_buff_256_inner, 0);
arm_rfft_fast_f32(&fft_256, fft_buff_256_inner, fft_buf_256, 1);

for (size_t i = 0; i < size; i++){
    out[0][i] = fft_buf_256[i];
    out[1][i] = in[1][i];
}

I'm declaring the FFT instance with: arm_rfft_fast_instance_f32 fft_256; and initializing with in main() with: arm_rfft_fast_init_f32(&fft_256, 256);.

Am I missing something? Is there any reason why the CMSIS FFT shouldn't be working at this point? Could arm_bitreversal2.s not be building or linking correctly for some reason? I've not really use makefiles before so I admit that I'm taking tips from forums and trying to hack a solution together. I'm completely at a loss for what to try next to get this to work. Thank you for the help.