Skip to main content
leonardo
Associate III
May 7, 2017
Solved

How to add arm_cfft_q31

  • May 7, 2017
  • 2 replies
  • 1521 views
Posted on May 08, 2017 at 00:27

I have a CubeMX generated project and need to made a FFT in Q31 format on a STM32F103RB nucleo board.

I have add this includes

#include <math.h>

#include 'arm_math.h'

#include 'arm_const_structs.h'

and add a defin ition for ARM_MATH_CM3

But as soon as I use

q15_t ADC_samples[2048];

arm_cfft_q15(&arm_cfft_sR_q31_len64, ADC_samples, 0, 1);

I get this error:

arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft '-D__weak=__attribute__((weak))' -DARM_MATH_CM3 '-D__packed=__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32F103xB -I'E:/Cartel_RGB/WS_F103/01_Cartel_F103/Inc' -I'E:/Cartel_RGB/Cartel_Lib' -I'E:/Cartel_RGB/WS_F103/01_Cartel_F103/Drivers/STM32F1xx_HAL_Driver/Inc' -I'E:/Cartel_RGB/WS_F103/01_Cartel_F103/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy' -I'E:/Cartel_RGB/WS_F103/01_Cartel_F103/Drivers/CMSIS/Device/ST/STM32F1xx/Include' -I'E:/Cartel_RGB/WS_F103/01_Cartel_F103/Drivers/CMSIS/Include'  -Og -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF'Src/main.d' -MT'Src/main.o' -o 'Src/main.o' '../Src/main.c'

../Src/main.c:77:14: error: expected declaration specifiers or '...' before '&' token

 arm_cfft_q15(&arm_cfft_sR_q31_len64, ADC_samples, 0, 1);

              ^

../Src/main.c:77:38: error: expected declaration specifiers or '...' before 'ADC_samples'

 arm_cfft_q15(&arm_cfft_sR_q31_len64, ADC_samples, 0, 1);

                                      ^

../Src/main.c:77:51: error: expected declaration specifiers or '...' before numeric constant

 arm_cfft_q15(&arm_cfft_sR_q31_len64, ADC_samples, 0, 1);

                                                   ^

../Src/main.c:77:54: error: expected declaration specifiers or '...' before numeric constant

 arm_cfft_q15(&arm_cfft_sR_q31_len64, ADC_samples, 0, 1);

                                                      ^

make: *** [Src/main.o] Error 1

Can some one explain how to add CMSIS-DSP lib to my project?

Thank

    This topic has been closed for replies.
    Best answer by Jeanne Joly
    Posted on January 16, 2018 at 11:36

    Hi

    Garberoglio.Leon

    ,

    In the following doc

    https://community.st.com/0D50X00009bMM6QSAW

    , it is described how to add BSP in the generated CubeMX code... and especially how to add a folder in the CubeMX project.

    I hope it will help you.

    BR. Jeanne

    2 replies

    leonardo
    leonardoAuthor
    Associate III
    May 7, 2017
    Posted on May 08, 2017 at 01:24

    The problems seems to be around de CubeMX generated project.

    In systemWorkbench I create a new empty project with HAL firmware, then add ARM_MATH_CM3 and add arm_cortexM3l_math library path and reference in Linker properties, finally I add this code:

    #include 'stm32f1xx.h'

    #include 'stm32f1xx_nucleo.h'

    #include <math.h>

    #include 'arm_math.h'

    #include 'arm_const_structs.h'

    int main(void)

    {

        q31_t ADC_samples[2048];

        arm_cfft_q31(&arm_cfft_sR_q31_len64, ADC_samples, 0, 1);

        q31_t MAG_of_fft[1024];

        //arm_cmplx_mag_q15(ADC_samples, MAG_of_fft, 1024);

        for(;;);

    }

    and everithing compile ok.

    So what could be happend with cube generated prject?

    Rob.Riggs
    Senior
    May 8, 2017
    Posted on May 08, 2017 at 04:28

    I have always had to manually copy the DSP library into my CubeMX projects.

    Technical Moderator
    May 8, 2017
    Posted on May 08, 2017 at 16:57

    Hi

    Garberoglio.Leon

    ,

    Which CubeMx/SW4STM32 version are you using ? You can share you .ioc file to check this issue.

    Imen

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
    leonardo
    leonardoAuthor
    Associate III
    May 9, 2017
    Posted on May 09, 2017 at 03:02

    Is not a CubeMX problem.

    I try with a new CubeMX generated project and simply add  arm_cortexM3l_math library and the include files and when I add a call to arm_cfft_q31 the program compile just fine.

    So, the problem is when I add (link) a driver folder to the CubeMX generated project. I'm trying to identify the problem.

    Whay os the best way to add a foolder with .c/.h files to a CubeMX project?

    Thank

    Jeanne Joly
    Jeanne JolyBest answer
    Associate
    January 16, 2018
    Posted on January 16, 2018 at 11:36

    Hi

    Garberoglio.Leon

    ,

    In the following doc

    https://community.st.com/0D50X00009bMM6QSAW

    , it is described how to add BSP in the generated CubeMX code... and especially how to add a folder in the CubeMX project.

    I hope it will help you.

    BR. Jeanne