Skip to main content
Stephen28
Associate III
May 6, 2019
Question

How to get STM32CubeMX to include DSP Header files?

  • May 6, 2019
  • 23 replies
  • 6770 views

I have searched, but I cannot find any information how to get the newer STM32CubeMX 5+ or the STM32CubeIDE to include the DSP header files arm_math.h, arm_const_structs.h, and arm_common_tables.h. They were copied on the older versions. How do I tell CubeMX that I want these files included? They exist in the Repository under Drivers/CMSIS/DSP/Include, but they no longer get added to the project when files are generated.

This topic has been closed for replies.

23 replies

Nesrine.JLASSI
Visitor II
May 14, 2019

Hi @Stephen28​ 

It's a CubeIDE limitation and it has no impact on the generated code.

Best regards,

Nesrine

Stephen28
Stephen28Author
Associate III
May 14, 2019

Nesrine,

I feel like we are going in circles now. I opened the project file in CubeMX and the box is still grayed out, and what is the reason that you suggested these settings if "it has not impact on the generated code"?

It appears to me that this is an issue with version 5+ of CubeMX/CubeIDE where it does not include the DSP files, but it did work in version 4 and earlier. I have discovered that if I copy over the CMSIS/DSP/Include directory that CubeMX/CubeIDE leaves it in place when it regenerates the code.

Please pass this issue over to the development team so that they can fix it in the next release.

Nesrine.JLASSI
Visitor II
May 15, 2019

Stephen,

That's not a bug, CubeIDE works like that and it has no impact on the generated code: if you need the DSP header files arm_math.h, arm_const_structs.h, and arm_common_tables.h. CubeIDE will get information from firmware in reference (STM32Cube\Repository\STM32Cube_FW_F4_V1.24.1\Drivers\CMSIS\DSP\Include) without generating it in the project file.

Best regards,

Nesrine

Stephen28
Stephen28Author
Associate III
May 15, 2019
Nesrine,
Please try this in CubeIDE:
File->New->STM Project
Select STM32F722RE
Set Project Name and Finish
Open main.c and add
/* USER CODE BEGIN Includes */
#include "arm_math.h"
/* USER CODE END Includes */
and
/* USER CODE BEGIN 2 */
float32_t A = 2.0f;
/* USER CODE END 2 */
CubeIDE flags "arm_math.h" because it cannot find it, and "float32_t" cannot be resolved because it is defined in arm_math.h.
Attempt to build the project and you get "fatal error: arm_math.h: No such file or directory"
CubeIDE did not "get information from firmware" as you suggested.
To make this work I must copy the DSP Include files to Drivers/CMSIS/DSP/Include
Then add the DSP/Include directory to Properties->C/C++ General->Paths and Symbols->Includes
And finally I must add ARM_MATH_CM7 to Properties->C/C++ General ->Paths and Symbols->Symbols
Now the program compiles with a simple warning of "unused variable 'A'", which is expected because A is not used anywhere in main.c.
How do I get CubeIDE/CubeMX to include the DSP files, add the directory to the include path, and add ARM_MATH_CM7 to the symbols list so that the project compiles cleanly when code is generated? Please provide detailed steps.
Nesrine.JLASSI
Visitor II
May 16, 2019

Hi @Stephen28​ 

In CubeIDE you must copy the DSP Include files to Drivers/CMSIS/DSP/Include as soon as you add another include (#include "arm_math.h", #include "const_structs.h", and #include "arm_common_tables.h").

It's not like CubeMX mode.

Best regards,

Nesrine

Stephen28
Stephen28Author
Associate III
May 16, 2019
Please forward this conversation to the development team as a feature enhancement request.
May 28, 2019

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.

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!

PVon
Visitor II
June 1, 2019

I'm having the same problem. Had to manually copy over / link the DSP library to get cube IDE to build the project.

Now I'm trying to get a project with FreeRTOS working and it's proving to be a massive headache.

Simi
Visitor II
November 19, 2019

Hi all together

I had a similar problem recently and asked ST directly with STM32CubeIDE V1.1.0, I use a STM32F303.

The following was the Answer:

"... The package feature for third party pack is not yet fully implemented in CubeMX. This is reason why it is partially working.

Also currently is no possible to select this in CubeMX. But is possible to add this library manually.

You can find it in you HAL package in

STM32Cube_FW_F3_V1.11.0\Drivers\CMSIS\Lib\GCC\

And you must add it into your project on disc.

And then in project properties -> C/C++ Build -> Settings -> Tool Settings -> Libraries

Sect path where is your library and select name of this library. 

"

This worked.

I copied the library and the headerfiles to my project and added the library as in the picture below.

further did I had to define the symbol(this is MCU dependend) also as in the picture below.

0690X00000AsBdgQAF.jpg0690X00000AsBdbQAF.jpg0690X00000AsBdWQAV.jpg

caleb
Associate III
November 20, 2019

This is the one that works for me. But rather than copy into the current workspace, I just link over to the ~/STM32Cube files.

Thanks for the answer.

JMill.1
Associate III
February 5, 2020

I have another answer that worked for me. Go to the "Addition Software" link on the .ioc. Then filter for ARM CMSIS

0690X00000ByaxmQAB.png

Install this SW package and you will then see an option in the configuration to turn on DSP functions:

0690X00000Byb0WQAR.png

Enable this and regenerate the code. You will then have a new folder in your project titled "Middleware". Dig down deep and you will find the arm_math.h include:

0690X00000Byb1ZQAR.png

SMall.1
Associate
March 18, 2020

This solved the problem. Also make sure to include the required arm math source files into the main Src folder. You can get these from the DSP Source mentioned in the above diagram.

Cartu38 OpenDev
Graduate II
March 19, 2020

According to me STM32CubeMX has never promoted such DSP lib files. But yes if relying on non under root mode (<=> under root box unchecked) then such files are part of included resources because copy all option is available then.

STM32CubeIDE is not allowing to create project asking for non under root mode but is fully supporting it. Way of working so if required is to create your project from STM32CubeMX standalone then to open it within STM32CubeIDE. Once opened in STM32CubeIDE you can remain in without any issue.