2019-09-10 06:05 AM
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.
Solved! Go to Solution.
2019-09-10 07:21 PM
Hi,
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.
You may keep copies of the .a and .h files within the project folder tree or "out-of-tree" in a separate folder as you prefer.
Note that .a files may exist for different MCU/CPU architectures and ABIs like floating point. Make sure that you get the correct libray linked in.
2019-09-10 07:21 PM
Hi,
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.
You may keep copies of the .a and .h files within the project folder tree or "out-of-tree" in a separate folder as you prefer.
Note that .a files may exist for different MCU/CPU architectures and ABIs like floating point. Make sure that you get the correct libray linked in.
2019-09-11 07:38 AM
Thank you for your very clear answer.
However I still have a problem, building fails with the following error message :
[...]mylib.a: error adding symbols: File format not recognized
Do you, by any chance, have any input on this error ? Maybe there's still something missing with the configuration or something wrong with my archive file.
2019-09-11 08:38 AM
maybe the .a file is not for the machine type you are using, or it is broken?
> And I found a library on the web
There is an optimized X-CUBE-CRYPTOLIB available from ST, it should support what you need.
2019-09-11 08:46 AM
Yes maybe, I don't see anything else.
I will test the library you proposed, I already tested the STM32-CRYP-LIB but it didn't seem to be made for my board.
2019-09-12 04:08 AM
Here is an update for other users who might run into the similar issue : for cryptography on the H7 generation of the nucleo boards, it is necessary to download the patch of the X-CUBE-CRYPTOLIB to find the necessary library. The libraries are not compatible between different generations and libraries other than ST ones do not seem to be compatible with ST products either.
Thank you KnarfB for your help.
2020-03-05 02:47 AM
What if there are no .a files in the library?
I would like to add following library but am uncertain how.
Adding it to the Project Directory within "Middlewares/Thrid_Party/"
and adding it within Project Properties -> C/C++ Build -> Settings -> Tool Setings-> MCU G++ Linker -> Libraries (Search path & Libraries using the Workspace path
Ends in Errors when building "no such file or directory"
Any help what I am doing wrong?
2020-03-05 05:27 AM
> What if there are no .a files in the library?
What else is in the library?
Note that if the file name is libBlaBla.a you only enter BlaBal . The lib prefix and the .a suffix will be added by the tools. See https://en.wikipedia.org/wiki/Library_(computing)#Most_modern_Unix-like_systems
2020-03-05 05:43 AM
Sorry was missing infos in my last post.
Library: https://github.com/epsilonrt/libmodbuspp
OS: Windows
IDE: STM32CubeIDE v1.3
2020-03-10 05:50 AM
Hi @RHug.1 have you managed to successfully integrate this library in the end? This is not a TouchGFX issue but I am interested in the answer and the good continuity of your project.