cancel
Showing results for 
Search instead for 
Did you mean: 

Using DSP libraries (e.g. arm_math.h) in STM32CubeIDE, STM32F4

Legacy member
Not applicable

Hi I need some help,

I am having the same problem using CubeIDE v1.0. I have copied the arm_math.h, const_structs.h and arm_common_tables.h into Drivers/CMSIS/DSP/Include.

I was not able to find arm_math.h until I went to Project > Properties > C/C++ General > Paths and Symbols > Includes and added in Drivers/CMSIS/DSP/Include. That fixed the problem of not finding arm_math.h

After which I get a whole bunch of errors:

 __uint32_t

../Drivers/CMSIS/DSP/Include/arm_math.h:6612:3: error: unknown type name 'uint32_t'; did you mean '__uint32_t'?

 uint32_t blockSize);

...

...

../Drivers/CMSIS/DSP/Include/arm_math.h:6873:16: error: unknown type name '__STATIC_INLINE'

 CMSIS_INLINE __STATIC_INLINE q15_t arm_bilinear_interp_q15(

    ^~~~~~~~~~~~~~~

../Drivers/CMSIS/DSP/Include/arm_math.h:6873:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'arm_bilinear_interp_q15'

 CMSIS_INLINE __STATIC_INLINE q15_t arm_bilinear_interp_q15(

          ^~~~~~~~~~~~~~~~~~~~~~~

../Drivers/CMSIS/DSP/Include/arm_math.h:6951:16: error: unknown type name '__STATIC_INLINE'

 CMSIS_INLINE __STATIC_INLINE q7_t arm_bilinear_interp_q7(

    ^~~~~~~~~~~~~~~

Thanks!

34 REPLIES 34
Legacy member
Not applicable

It seems that I need to define #ARM_MATH_CM4 in Project > Properties > C/C++ General > Paths and Symbols > Symbols. That will get rid of the errors above, but I will get a new error.

../Drivers/CMSIS/Include/core_cm4.h:105:8: error: #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"

    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"

Legacy member
Not applicable

This seems to go away if I include main.h which includes "stm32f4xx_hal.h" before I include "arm_math.h"

Can someone confirm that this is the right way to include the DSP libaries?

Legacy member
Not applicable

For some reason in main.h, stm32f4xx_hal.h is included twice. Feels like a auto-generated bug?

SShap
Associate

#include "arm_math.h" STM32CubeIDE

I'm use CMSIS 5.4.0 My Directory C:\CMSIS_5-5.4.0\CMSIS\DSP\Include

poroject ->properties->C/C++ General->path and Symbols->Includes-> Add library directory

Legacy member
Not applicable

yep I did that if you refer to my original post at the top. but I still faced some errors which I addressed in my following replies. Do you encounter them as well?

hmm, I guess my formatting for my original question may not be that clear. I have updated it to make it clearer.

Thanks for replying!

Alireza Safdari
Associate III

Did you get it working? I have the same problem.

Legacy member
Not applicable

yea, look at my comments above. still have stm32f4xx_hal.h included twice though.

I did what you explained and I keep getting this error:

I am using Nucleo-F767ZI

I have added ARM_MATH_CM7 with no value under the symbols

arm-none-eabi-gcc "../Drivers/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c" -mcpu=cortex-m7 -std=gnu11 -g3 -DUSE_HAL_DRIVER -DSTM32F767xx -DDEBUG -DARM_MATH_CM7 -c -I../Inc -I../Drivers/CMSIS/Include -I../Drivers/CMSIS/Device/ST/STM32F7xx/Include -I../Drivers/STM32F7xx_HAL_Driver/Inc -I../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy -I"C:/Users/alire/OneDrive/Desktop/New folder/1/Drivers/CMSIS/DSP/Include" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.d" -MT"Drivers/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.o" --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -o "Drivers/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.o"
In file included from C:/Users/alire/OneDrive/Desktop/New folder/1/Drivers/CMSIS/DSP/Include/arm_math.h:319:0,
                 from ../Drivers/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c:29:
../Drivers/CMSIS/Include/core_cm7.h:105:8: error: #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
       #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
        ^~~~~
make: *** [Drivers/CMSIS/DSP/Source/TransformFunctions/subdir.mk:112: Drivers/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.o] Error 1
make: *** Waiting for unfinished jobs....
"make -j4 all" terminated with exit code 2. Build might be incomplete.
 
09:56:57 Build Failed. 3 errors, 0 warnings. (took 24s.614ms)

Actually my code throws different error if I change ARM_MATH_CM7 to ARM_MATH_CM4

when using M4 it says some functions are duplicates (ex. QSUB, SMLADX, SMLDX) and so on.