How to get CMSIS 6.0 + DSP running in CubeIDE?

118 views Asked by At

Until now I always used CMSIS 5.7 plus the DSP library in CubeIDE. Unfortunately this version has no arm_atan2_f32 function, which I need for my actual project. So I tried to update to a newer version of CMSIS. I tried 5.9 and 6.0 plus the DSP library(s).

Problem: I can't get it working. There are always missing includes, e.g.

... ctions/TransformFunctions.c:29:10: fatal error: arm_bitreversal.c: No such file or directory

If I disable one particular file/folder from build, other "no such file or directory"-errors pop up. To me it looks like the whole DSP source code is missing somehow.

What did I do: I downloaded CMSIS 5.9 and 6.0 Packs from github.com/ARM-software/CMSIS_5/releases/tag/5.9.0 and github.com/ARM-software/CMSIS_6/releases, and I downloaeded CMSIS-DSP 1.14 and 1.15 from github.com/ARM-software/CMSIS-DSP/releases. I installed the packages in CubeIDE using "manage software packs" (CubeIDE 1.14.1)

I created a new project, using an H7 MCU, I added CMSIS and CMSIS-DSP into the project, let the Code generator do it's job and hit the compile button. The result is: tons of missing dependencies in the ARM CMSIS files.

I tried several combinations of versions, e.g. CMSIS 5.9 core + DSP 1.14 and DSP 1.15, but whatever I try, there are files missing. It happend - mostly by accident - that CubeMX created a "CMSIS-DSP" folder in "middleware/Third-Party" and filled it with *.c files, but that happened only once and I have no idea, how to reproduce that. But even then the project did not compile due to missing dependencies, however there were less *.c files marked with errors.

I downloaded the source of CMSIS-DSP from github, created a CMSIS-DSP-Folder and added the source files to this folder, added this folder to the source and include path in the project properties, but this did not resolve the missing dependencies folder - even if I could see the missing files exist. So for me, even the sources from github seem to be inconsistent - which is somehow pretty strange.

The question: Which steps are necessary to include CMSIS 6.0 + DSP 1.15 into a CubeMX project, without having issues with missing dependencies? My expectation was until now - because it worked that way with CMSIS 5.7 + DPS Library: download the software packs, install them into CubeMX/CubeIDE and select the components you want to use. But that's obviously no longer the case.

Workaround question: is there any tutorial how to compile a static library from CMSIS-DSP 1.15 or 1.14 in CubeIDE which I could follow so that I could get to a state as I had with CMSIS 5.7?

1

There are 1 answers

1
MarkSouls On

I had a same problem. While I couldn't find a proper and working way to include software components unfortunately, I was able to build CMSIS-DSP to static library and use in my project.

Here's what I did. Note that the process might have unneccesary works; I'm quite new to these parts and don't want to mess the process finding the "best" way.

  1. STM32CubeIde, File > New > STM32 Project. Select your board and create a project. This is a temporary project that'll be removed later.

  2. In .ioc configuration UI > Pinout & Configuration > Middleware and Software Packs, select CMSIS CORE and CMSIS DSP. In my case:

  • CMSIS DSP 1.15.0;
  • CMSIS CORE 6.0.0;

No need to configure other peripherals. Generate code and make sure you have Middlewares > Third_Party > ARM_CMSIS and bunch of files in there.

  1. Somehow most function .c files are missing in generated code and you have to manually add them. Download CMSIS-DSP 1.15.0 source code zip. Copy and paste the whole Source folder in it(including bunch of ~~Functions folders) to Middlewares > Third_Party > ARM_CMSIS. There might be a few files which are already there; you can overwrite or skip them.

  2. When you try to build at this point, there are tons of multiple definitions error. That's because files like "BaseMathFunctions.c" is including other c files in same folder, so you have to delete them. For example in "BaseMathFunctions" folder, there are 68 c files named "arm_something.c" and two files "BaseMathFunctions.c" and "BaseMathFunctionsF16.c". You have to delete latter two files. Do this for all other folders.

4-1. For sanity check, you can try building at this point and ensure it doesn't give errors.

  1. Create a new project. This time after selecting your board, set Targeted Binary Type to Static Library. This project will be your static library project.

  2. Copy Middlewares > Third_Party > ARM_CMSIS from previous project to new library project.

  3. In project properties:

  • Add ARM_CMSIS/Include to include

  • Add ARM_CMSIS/PrivateInclude to include

  • Add ARM_CMSIS/CMSIS/Core/Include to include

  • Add ARM_CMSIS to Source Location

  • Set optimization to -Ofast as suggested in readme

  1. Build the project!

You can probably just use source files after step 4, too(hadn't tested).

It took quite a time to make this working and OP might already figured the answer out, but I hope this helps someone as well.