cancel
Showing results for 
Search instead for 
Did you mean: 

How to add external libraries in STM32CubeIDE

EBonv
Associate III

Hi, I'd like to know if it is possible to add external libraries on STM32CubeIDE and if yes, how.

In particular, I'd like to use cryptographic functions on my NUCLEO-H753ZI. And I found a library on the web I could use in the form of an archive file (.a) + a header file. How can I integrate this archive in my project so I can use the functions of the library ?

Thank you in advance for your answer.

20 REPLIES 20
PHolt.1
Senior III

"under Project > Properties > C/C++ Build > Settings > Tool Settings > MCU GCC Linker > Libraries add the .a library name and the path to that file. This shall make the linker happy. Note that you don't enter the "lib" prefix and the extension .a, e.g. when the filename is libmylib.a, enter mylib

Besides, under MCU GCC Compiler > Include paths add the path to the header files to make the compiler happy."

This may have worked in 2019 but it does not appear to work now, Cube IDE v1.10.1.

I have a file called libc-weakened.a (basically the old libc.a but with the mutex symbols weakened using objcopy, so the completely useless empty mutex functions can be replaced with real ones) and can't get it to be recognised. It appears on the LD command line ok, although there is no space after the -l (it shows cannot find -lC:/KDE485/Project1/LIBC/libc-weakened.a) so I tried double quotes and a leading space, still with no luck.

0693W00000QMAdLQAX.png 

0693W00000QMAe9QAH.png