Loading...
 
Skip to main content

System Workbench for STM32


DSP functions on System Workbench and CubeMX

Hi, I'm trying to setup a project using System Workbench and CubeMX on an Nucleo Board (411RE).
Could someone tell me a step by step on how to do that?
I have an example from STM32Cube\Repository\STM32Cube_FW_F4_V1.5.0\Drivers\CMSIS\DSP_Lib\Examples\arm_fft_bin_example\ARM arm_fft_bin_example_f32 and can't make it compile.

I add ARM_MATH_CM4 symbol on project properties, I've enable fpu hardware on project properties too, I've add __FPU_PRESENT symbol, but nothing of it seems to solve my problem:

10:36:37 **** Incremental Build of configuration Debug for project FFT_01 ****
make all
'Building target: FFT_01.elf'
'Invoking: MCU GCC Linker'
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -L"C:\Users\Leo Garbe\workspace_stdlib\nucleo-f411re_hal_lib\Debug" -L"C:\Users\Leo Garbe\STM32Cube\Repository\STM32Cube_FW_F4_V1.5.0\Drivers\CMSIS\Lib\ARM" -T"C:\Users\Leo Garbe\workspace_stdlib\FFT_01\LinkerScript.ld" -Wl,-Map=output.map -Wl,--gc-sections -lm -o "FFT_01.elf" @"objects.list" -lnucleo-f411re_hal_lib
src/main.o: In function `main':
C:\Users\Leo Garbe\workspace_stdlib\FFT_01\Debug/../src/main.c:49: undefined reference to `arm_cfft_f32'
C:\Users\Leo Garbe\workspace_stdlib\FFT_01\Debug/../src/main.c:53: undefined reference to `arm_cmplx_mag_f32'
C:\Users\Leo Garbe\workspace_stdlib\FFT_01\Debug/../src/main.c:56: undefined reference to `arm_max_f32'
C:\Users\Leo Garbe\workspace_stdlib\FFT_01\Debug/../src/main.c:73: undefined reference to `arm_cfft_sR_f32_len1024'
collect2.exe: error: ld returned 1 exit status
make: *** FFT_01.elf Error 1

On the source code I have a bug symbol on
/* Process the data through the CFFT/CIFFT module */
arm_cfft_f32(&arm_cfft_sR_f32_len1024, testInput_f32_10khz, ifftFlag, doBitReverse);

I put the cursor on arm_cfft_f32 and press F3 and took me to arm_math.h:

void arm_cfft_f32(
const arm_cfft_instance_f32 * S,
float32_t * p1,
uint8_t ifftFlag,
uint8_t bitReverseFlag);

but I don't figure out where the source code of this function is. Is on a arm_cortexM4XX_math.lib file on STM32Cube\Repository\STM32Cube_FW_F4_V1.5.0\Drivers\CMSIS\Lib\ARM ?

if it is, I have a couple of them:
arm_cortexM4b_math.lib
arm_cortexM4bf_math.lib
arm_cortexM4l_math.lib
arm_cortexM4lf_math.lib
wich one should I use?
and how to add them to the project?

Thank and best regards!

Hi Leo,
I'm not sure if I understand what you are trying to do or if I can help, but since no one else has offered anything I'll take a shot at it. I am also not sure of your level of knowledge so please excuse me if I point out things that are obvious to you.

First, the example projects are structured differently than MX generated projects. I wish that ST would have at least some projects that are generated using MX but I am not aware of any. (It's not clear to me if you are trying to mix MX and any of the examples but AFAIK it is not feasible.)

I see that the most recent Cube libraries include project configuration for SW4STM32 which is a huge step forward for openstm32. I have not tried any of them so I do not know how well they have been tested. (From the release notes for Templates project I read "Validation using latest toolchains version: EWARM v7.30 and TrueSTUDIO v5.1.1" If you are not using the latest version (MX 4.8, Cube 1.6.0) you should probably upgrade.

Of three alternatives for generating a project for openstm32 (MX, example/demo/template, openstm32) I think the highest chance of success is the openstm32 generated project. I would try producing a project using that which includes the features you wish to use and see which libraries it uses.

I have not tried to use floating point on any of my projects so I remain ignorant of what needs to be done to get that to work.

HTH,
hank


I don't explain my self clear.
I want to make a project on SW, with Hal library and CMSIS DSP functions. I would like to know how to link to CMSIS DSP functions (FFT in fact).

Regards!


HI
Did you find a solution ?
I made a new project in openstm32 and get sound to work perfect...
Now i want to add FFT from cmsis and i did ;

  1. include "stm32f7xx.h"
  2. include "stm32746g_discovery.h"
  3. include "main.h"
  4. include "math.h"
  5. include "arm_math.h"


but iit fails here

arm_fir_init_q15 (&SFIRleft, NUM_TAPS, firCoeff, pFIRStateLeft, NUM_SAMPLES);

and i did add ARM_MATH_CM7 to the SYMBOLS tab in project properties paths and symbols

What did i miss ?

hjalmar


Hi

Thanks .... I will figure out to night and check what you have done ....i do use a stm32f7-discovery so can not use your code right away but learn from that ;o)

thanks

Hjalmar


My board is STM32F429I-DISCO. In my case program compiles after:

1) I add arm_common_tables.h, arm_const_struct.h, arm_math.h to project (eg. to "inc" directory)
2) I add arm_bitreversal2.S, arm_bitreversal.c, arm_cfft_f32.c, arm_cfft_radix8_f32.c, arm_cmplx_mag_f32.c, arm_common_tables.c, arm_const_structs.c, arm_max_f32.c (eg. to "src" directory)
3) I add ARM_MATH_CM4, __FSU_PRESENT=1 to preprocessor http://s8.postimg.org/s4hxlhzqt/macros.png
4) (optional but recommended I guess) I remove old arm_common_tables.h, arm_const_struct.h, arm_math.h from CMSIS/core folder

Files from points 1), 2) were taken from https://github.com/MaJerle/stm32f429 (00-STM32F4xx_STANDARD_PERIPHERAL_DRIVERS/CMSIS)

In my case linking to arm_cortexM4lf_math library produced errors and was needless.

Many thanks to @elgarbe, he gave me the clue here to try adding source files and compile them instead of linking do the library.

Cheers

I came across similar problem today. I know the original post is 2 years old but this is what I figured out.
For some reason STM32Cube does not include the binaries of appropriate DSP libraries. So you just need to link it in.
For gcc I used these from the CMSIS github repo
https://github.com/ARM-software/CMSIS/tree/master/CMSIS/Lib/GCC
They should be generic for any ARM devices.
I created a Lib folder in my project, put the repo and configure the imports in my eclipse project, similar to this post

http://www.openstm32.org/forumthread5901
In “Properties->C/C++ General->Paths and Symbols->Library Path”, add “Lib/”
In “Properties->C/C++ General->Paths and Symbols->Libraries”, add “arm_cortexM4lf_math” (the “lib” prefix and the extension are not required)

Hope this helps other people.


Combining @elgarbe and @zerohertz answers worked for me on STM32F7 (I had to link the library AND the c and s files)