Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFT init function take so much memory #91

Closed
Hoseinbme opened this issue Feb 17, 2023 · 3 comments
Closed

FFT init function take so much memory #91

Hoseinbme opened this issue Feb 17, 2023 · 3 comments
Labels
DONE Issue done but not yet closed question Further information is requested

Comments

@Hoseinbme
Copy link

Hoseinbme commented Feb 17, 2023

I wanted to get a Fourier transform on the stm32 MCU With the help of cmsis functions

But I encountered the problem of lack of memory while the buffer size was small.
even when set the length of FFT 32 .
After a lot of trouble, by checking the map file, I realized that a function consumes a lot of memory when called, about 150 KB. arm_rfft_fast_init_f32()
Do you have any suggestions to reduce the memory size? This function sets the initial conditions, but it requires a lot of memory.
Now, I am not in a position to quickly provide hardware with more memory.

tester for fft.zip

HERE IS THE MAP FILE SERCH FOR arm_common_tables.o AND YOU SEE PARTS THAT CONSUME MEMMORY

image

@Hoseinbme Hoseinbme changed the title FFT init function teke so much memmory FFT init function take so much memory Feb 17, 2023
@christophe0606 christophe0606 added the review Under review label Feb 20, 2023
@christophe0606
Copy link
Contributor

@Hoseinbme By default, all FFTs tables are included.
You need to define some flags for the compiler so that useless FFTs tables are not included. Like that you can tune the size of the library for what you want.

For instance, those flags should enable all interpolation tables (like used from computing sine) and only the tables for RFFT FAST F32. Float16 is also disabled since you probably don't need it:

-DARM_DSP_CONFIG_TABLES -DARM_FAST_ALLOW_TABLES -DARM_FFT_ALLOW_TABLES -DARM_TABLE_TWIDDLECOEF_F32_16 -DARM_TABLE_BITREVIDX_FLT_16 -DARM_TABLE_TWIDDLECOEF_RFFT_F32_32 -DARM_ALL_FAST_TABLES -DDISABLEFLOAT16

You can use Python to generate those flags:
pip install streamlit

and from CMSIS-DSP folder:

streamlit run cmsisdspconfig.py

@christophe0606 christophe0606 added question Further information is requested DONE Issue done but not yet closed and removed review Under review labels Feb 20, 2023
@Hoseinbme
Copy link
Author

Hoseinbme commented Feb 25, 2023

@christophe0606 I did this, but the problem is still there, did I make a mistake?

---------------------------------------------------*/

#define ARM_DSP_CONFIG_TABLES
#define ARM_TABLE_TWIDDLECOEF_F32_16            
#define ARM_TABLE_BITREVIDX_FLT_16
#define ARM_TABLE_TWIDDLECOEF_RFFT_F32_32
#define ARM_FFT_ALLOW_TABLES

#include "main.h"
#include <math.h>
#include "arm_math.h"
#include <stdio.h>
.
.
.
 

also, i add question https://electronics.stackexchange.com/questions/655565/delete-modules-and-variables-that-are-not-used-in-iar here For more guidance

@christophe0606
Copy link
Contributor

@Hoseinbme Those options must be defined at the global level when you compile all of CMSIS-DSP.
So you need to pass those options on the compiler command line :
-DARM_DSP_CONFIG_TABLES -DARM_TABLE_TWIDDLECOEF_F32_16 ...

Otherwise those options are not seen when the CMSIS-DSP is compiled and the tables are still included.

Depending on how you build the library, there are different way to do this.
In general in an IDE you'll have a way to define this in the project options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DONE Issue done but not yet closed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants