cancel
Showing results for 
Search instead for 
Did you mean: 

How do I go about adding the CMSIS DSP to do FFT on STM32L072 without compile errors.

LauraCx
ST Employee

@Community member​ 

What works:

Using STM32CubeIDE 1.6.1 and created a .ioc for the F750 I have used the library with arm_math version V1.4.5 b in my previous project with the STM32F750 without a problem, adding __FPU_PRESENT and using ARM_MATH_CM7 using hal drivers. I don't have any libraries linked. and it compiles and FFT works. Intruction set is THumb2, Floating point Abi-hard, unit = FPv5-D6. using 9-2020-q2-update GNU tools for STM32 toolchain. GNU11 ISOC11 compiler

What does not work:

  1. Using STM32CubeIDE and created a .ioc project using the STM32L072cz. I am trying to include the same DSP CMSIS library to do a little vibration anaysis. The exact same settings except for no FPU and FPU uinti is Software and I am using ARM_MATH_CM0PLUS .

In Release compile I get

Error __SSAT already defined

In file included from ../Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_f32.c:41:

../Drivers/CMSIS/DSP_Lib/Include/arm_math.h:666:25: error: redefinition of '__SSAT'

 666 |  static __INLINE q31_t __SSAT(

   |             ^~~~~~

In file included from ../Drivers/CMSIS/Include/cmsis_compiler.h:48,

         from ../Drivers/CMSIS/Include/core_cm0plus.h:115,

         from ../Drivers/CMSIS/DSP_Lib/Include/arm_math.h:311,

         from ../Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_f32.c:41:

../Drivers/CMSIS/Include/cmsis_gcc.h:1299:30: note: previous definition of '__SSAT' was here

 1299 | __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)

   |               ^~~~~~

In file included from ../Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_bitr

and at the end I get

make: *** [Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/subdir.mk:120: Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_f32.o] Error 1

In Debug Compile I get additional failure messages

arm-none-eabi-gcc "../Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q15.c" -mcpu=cortex-m0plus -std=gnu11 -g3 '-DDEBUG=1' '-DUSE_HAL_DRIVER=1' '-DSTM32L072xx=1' '-DREGION_EU868=1' '-DLoRa_Sensor_Node=1' '-DUSE_STM32L0XX_NUCLEO=1' '-DLOW_POWER_DISABLE=1' '-DARM_MATH_CM0PLUS=1' -c -I../Core/Inc -I../Drivers/STM32L0xx_HAL_Driver/Inc -I../Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L0xx/Include -I../Drivers/CMSIS/Include -I../Drivers/CMSIS/DSP_Lib/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q15.d" -MT"Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q15.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q15.o"

../Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_bitreversal2.S: Assembler messages:

../Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_bitreversal2.S:140: Error: selected processor does not support `it LS' in Thumb mode

../Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_bitreversal2.S:141: Error: thumb conditional instruction should be in IT block -- `bxls lr'

../Drivers/CMSIS/DSP_Lib/Source/TransformFunctions/arm_bitreversal2.S:142: Error: cannot honor width suffix -- `push {r4-r9}'

useing the CMSIS DSP Version 5 with lib arm ( I get multiple LD.exe errors )

1 ACCEPTED SOLUTION

Accepted Solutions
ChahinezC
Lead

Hello @Community member​,

I recommend you following the Configuring DSP libraries on STM32CubeIDE article, it should help you.

Chahinez.

View solution in original post

7 REPLIES 7
Robin Aproskie
Associate II

Thanks for the Help

What I did Wrong in the First instance was include the Source of all the math ( which was not a problem in my previous project ) and it was trying to build the C files. I also could not understand where to find the repository every document was refering to. Tada. and I upgraded my IDE which helps.

Robin

ChahinezC
Lead

Hello @Community member​,

I recommend you following the Configuring DSP libraries on STM32CubeIDE article, it should help you.

Chahinez.

Robin Aproskie
Associate II

Thanks I did follow the Document but I did not have any repository for DSP installed on my machine so was using and old projects Files from 2016. And then I eventualy managed to install them through Cube IDE.

GPaul.4
Associate

Hello Robin,

could you tell me how you fixed this error.

I'm using a device very similar to yours, the model I use is the STM32L072KZT6. And when trying to include the arm_math.h library I get the same errors you reported above.

Present YOUR error/build log​

Probably got the wrong command line defines, or pulling wrong DSP version.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Robin Aproskie
Associate II

I had to delete the Libraries I had copied from another project and Install them from the IDE in the configuration of the Micro's package manager. Then you need to set your Compile Directive's, eg I had to add #ARM_MATH_CM0PLUS = 1 ( this is done in the paths and Symbols of the Project Properties. In libraries the arm_cortexM0I_math is autonaticaly added I think. In Includes Drivers/CMSIS/DSP/Include is also added.

GPaul.4
Associate

Thank you very much for your help, I read the article Configuring DSP libraries in STM32CubeIDE and saw that my error was when inserting the library as I was inserting it as libarm_cortexM4lf_math and in the article it is mentioned that it must be inserted only as arm_cortexM4lf_math.

Thank you all for your help.