cancel
Showing results for 
Search instead for 
Did you mean: 

What is the proper way to include the DSP library in a CMake project?

Rob.Riggs
Senior II

I am using STM32CubeMX 6.12.0 to generate a CMake project for VSCode on Linux. In the Software Packs Component Selector, I have chosen to include the DSP library.

RobRiggs_0-1721155690475.png

STM32CubeMX includes the library and headers when generating code. So far, so good.

However, the include path, linker path and library are not specified in the the generated CMake files. I would expect these to be included by STM32CubeMX. But, not a problem. I can add them myself.


target_include_directories(stm32cubemx INTERFACE
...
../../Drivers/CMSIS/DSP/Include
)
...

target_link_directories(stm32cubemx INTERFACE
../../Drivers/CMSIS/DSP/Lib/GCC
)

target_link_libraries(stm32cubemx INTERFACE
arm_cortexM4lf_math
)
 
The problem with this approach is that when making changes to the IOC file and regenerating code, the CMake files are overwritten and these changes are not preserved.
 
First, I expect that STM32CubeMX will add the necessary paths and libraries to the CMake files when specifiying additional software packs. Is this unreasonable?
Second, I expect that STM32CubeMX provides a way for developers to add customizations to the generated CMake files, and that STM32CubeMX preserves those customizations. Is there a proper way to do this that I am missing?
 
How are developers expected to interact with STM32CubeMX and the generated CMake files when adding additional software packs to a build? I have not seen this spelled out clearly anywhere.
 
1 ACCEPTED SOLUTION

Accepted Solutions
Rob.Riggs
Senior II

In case this helps anyone else, there are two steps required to use the DSP library.

  1. Enable the DSP library in the Software Component Selector as shown above.
  2. Enable the "DSP Library Library" [sic] "Mode" of the X-CUBE-ALGOBUILD component in the Middleware and Software Packs configuration section.

RobRiggs_0-1721169443913.png

To say that the requirement for the second step is a bit confusing would be an understatement. It would seem to me that enabling this component should be the default when the software pack is selected, considering it is the only option available for that component.

View solution in original post

1 REPLY 1
Rob.Riggs
Senior II

In case this helps anyone else, there are two steps required to use the DSP library.

  1. Enable the DSP library in the Software Component Selector as shown above.
  2. Enable the "DSP Library Library" [sic] "Mode" of the X-CUBE-ALGOBUILD component in the Middleware and Software Packs configuration section.

RobRiggs_0-1721169443913.png

To say that the requirement for the second step is a bit confusing would be an understatement. It would seem to me that enabling this component should be the default when the software pack is selected, considering it is the only option available for that component.