cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX CMSIS-DSP Include problems

OSala.1
Associate II

Hello,

I am including the CMSIS-DSP library on my CubeMX project on Additional Software. Using the Library setting instead of Source. However, when I am trying to call a function from arm_math.h the compiler throws an error that it is not possible to find that function call.

Any ideas? How can I include CMSIS-DSP.

I am using GCC compiler and STMCubeIDE

1 ACCEPTED SOLUTION

Accepted Solutions
oe3arc
Associate II

I had the same issue with CubeMX 5.5.5, one has to check on this screen the CMSIS packages:0690X00000Bwda8QAB.png

Then arm_math.h will appear:

0690X00000BwdaXQAR.png

You can compile then, but the linker will miss the libraries. Lost a lot of time and figured out, that it worked for me as follows:

Copy both arm_cortexM4lf_math.lib and libarm_cortexM4lf_math.a to a manually created subfolder:

0690X00000BwdarQAB.png

Set the Path for libraries then:

0690X00000BwdbBQAR.png

And specify the library to be used - without extension!!!!:

0690X00000BwdbGQAR.png

Don't know, why I have to copy both arm_cortexM4lf_math.lib and libarm_cortexM4lf_math.a, took a long time to figure out, which type of libray is the right (I have a STM32F4 - it looks like it's little endian, with FPU). Don't know why I have to specify the library name without an extions. But it seems to work now.

Would be fine, if CubeMX takes the decision and does all the work for me.

The documentation state is bad as well.

Or maybe, I'm just too stupid and/or missed any good document...

hth

Andy

View solution in original post

7 REPLIES 7

Hello @OSala.1​ 

Which cubeMX version did you use ?

Please try with the lasted version (5.5.0).

Best regards,

Nesrine

oe3arc
Associate II

I had the same issue with CubeMX 5.5.5, one has to check on this screen the CMSIS packages:0690X00000Bwda8QAB.png

Then arm_math.h will appear:

0690X00000BwdaXQAR.png

You can compile then, but the linker will miss the libraries. Lost a lot of time and figured out, that it worked for me as follows:

Copy both arm_cortexM4lf_math.lib and libarm_cortexM4lf_math.a to a manually created subfolder:

0690X00000BwdarQAB.png

Set the Path for libraries then:

0690X00000BwdbBQAR.png

And specify the library to be used - without extension!!!!:

0690X00000BwdbGQAR.png

Don't know, why I have to copy both arm_cortexM4lf_math.lib and libarm_cortexM4lf_math.a, took a long time to figure out, which type of libray is the right (I have a STM32F4 - it looks like it's little endian, with FPU). Don't know why I have to specify the library name without an extions. But it seems to work now.

Would be fine, if CubeMX takes the decision and does all the work for me.

The documentation state is bad as well.

Or maybe, I'm just too stupid and/or missed any good document...

hth

Andy

DLim.16
Associate II

Hi @OSala.1​ 

I'd like to add to Andy's helpful answer and suggest that you also check out this thread to make sure your libraries are valid:

https://www.avrfreaks.net/forum/problem-including-cmsis-dsp-library-atmel-studio-using-atsame54

Good luck.

Correction:

> Copy both arm_cortexM4lf_math.lib and libarm_cortexM4lf_math.a to a manually created subfolder:

It is sufficient to copy only libarm_cortexM4lf_math.a.

> And specify the library to be used - without extension!!!!:

Without extension and without the prefix 'lib', i.e. the file namend libarm_cortexM4lf_math.a has to be specified as libarm_cortexM4lf_math.a in the Path and Symbols dialog.

hth

Andy

P.S.: All this should be a nobrainer, if the CubeMX would work correctly :(

OSala.1
Associate II

Thanks Andy! That worked well for me.

In older versions I had to manually add CMSIS DSP just like you stated, I thought that in this new CubeMX version they managed to do the work for the user...

I copied the libarm_cortexM4lf_math.a into a Lib folder inside my project directory.

And specified the library in the linker settings as shown in the picture below.

But I still get an error message saying that, the library was not found.

08:24:46 **** Incremental Build of configuration Debug for project CMSIS_DSP_PID_Test ****
make -j12 all 
arm-none-eabi-gcc -o "CMSIS_DSP_PID_Test.elf" @"objects.list"  -llibarm_cortexM4lf_math -mcpu=cortex-m4 -T"/home/sandhan/Projects/STM32CubeIDE/workspace_1.3.0/[Nucleo-64 STM32G474RE] Projects/CMSIS_DSP_PID_Test/STM32G474RETX_FLASH.ld" --specs=nosys.specs -Wl,-Map="CMSIS_DSP_PID_Test.map" -Wl,--gc-sections -static -L"/home/sandhan/Projects/STM32CubeIDE/workspace_1.3.0/[Nucleo-64 STM32G474RE] Projects/CMSIS_DSP_PID_Test/Middlewares/Third_Party/ARM_CMSIS/CMSIS/DSP/Lib" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
/opt/st/stm32cubeide_1.3.0/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.linux64_1.0.0.201904181610/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: cannot find -llibarm_cortexM4lf_math
collect2: error: ld returned 1 exit status
make: *** [makefile:44: CMSIS_DSP_PID_Test.elf] Error 1
"make -j12 all" terminated with exit code 2. Build might be incomplete.
 
08:24:47 Build Failed. 1 errors, 0 warnings. (took 470ms)

0693W000000UAYNQA4.png0693W000000UAV9QAO.png

PHoll.1
Associate II

Answer for me was given in this link. gnu linker adds the lib prefix. So without the lib starting in the name it worked for mer

https://electronics.stackexchange.com/questions/486679/stm32cubeide-issues-with-cmsis-dsp-library-files