Reputation: 37
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.
Upvotes: 1
Views: 335
Reputation: 67820
Those macros are used by the system_stm32xxxx.c file where it checks if to enable math coprocessor or not. The problem is that this file (where xxxx
depends in your uC model) does not include main.h
.
You can edit it add #include "main.h"
line. Then you can set it up this way
Upvotes: 1
Reputation: 141523
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.
Upvotes: 1