Search code examples
gccfftstm32f4fpucmsis

Why the FFT function can only be activated through the Preprocessor of MCU GCC Compiler (STM32CubeIDE)?


As introduced in many website, if we want to active the FFT/FPU of the STM32 board, then we have to active:

__FPU_USED=1; __FPU_PRESENT=1; ARM_MATH_CMx.

Instead of typing these words in the Preprocessor of MCU GCC Compiler(which works 100%), I have tried to add these 3 lines in my main.h file:

#define __FPU_USED=1

#define __FPU_PRESENT=1

#define ARM_MATH_CMx

However, if so, it doesn't work. The IDE will feedback many problems, for example:

"error: unknown type name 'uint32_t'; did you mean 'uint32_t'?" in the DSP files.

I understand such problems as "the DSP files are not connected to my main files now".

Here is my question:

If I insist to declare/define these 3 lines in my file system, not in the Preprocessor of my STM32CubeIDE, what should I do? Many thanks in advance.


Solution

  • If I insist to declare/define these 3 lines in my file system, not in the Preprocessor of my STM32CubeIDE, what should I do?

    To achieve the same affect as defining the macros using your compiler command line options, you should define them on the first lines of all C and assembly source files that are used in compilation.

    Why the FFT function can only be activated through the Preprocessor of MCU GCC Compiler (STM32CubeIDE)?

    The question lost it's sense, because as stated above, there is another (very unpractical) way.