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

Hi @Romain DIELEMAN​ I successfully included the library configuring following:

  • Properties -> C/C++ General -> Paths and Symbols -> Source Location -> Middlewares -> Edit
  • Properties -> C/C++ General -> Paths and Symbols -> Library Paths
  • Properties -> C/C++ General -> Paths and Symbols -> Includes -> Assembly
  • Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C
  • Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C++
  • Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Assembler -> Include Paths
  • Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Compiler-> Include Paths & files
  • Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU G++ Compiler -> Include Paths & files
  • Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU G++ Linker -> Include Paths

 

EDIT: I am uncertain if I chose the correct Folder to add the library to, I would appreciate if you could reply with the correct folder to add "external" libraries" to:

  • \TouchGFXProjects\ProjectName\Middlewares\Third_Party\

EDIT2: I ended up only getting a shared library (.so) which is not possible to flash on the MCU since it has to be a static library as I read.

(I am still a beginner therefore such basic mistakes...)

/Rafael

Wladimir
Associate II

Hello!

How can i include cryptolyb library .a files into STM32CubeIDE project?

Project doesn't recognize them for now. I put them in source directory in project files catalog.

0693W00000ANemuQAD.jpg 

0693W00000ANeo2QAD.jpg 

The following errors occur:

" ../Src/main.c:313: undefined reference to `RSA_PKCS1v15_Encrypt' "

" ../Src/main.c:297: undefined reference to `RNGinit' "

Then i followed instructions from best answer of this topic

0693W00000ANflJQAT.jpg 

And i got another errors:

" c:\st\stm32cubeide_1.4.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: error: STM32L476RG-Nucleo_PollingTagDetect_rbld.elf uses VFP register arguments, C:\git_repos\STM32L476RG-Nucleo_PollingTagDetect_rbld\Middlewares\ST\STM32_Cryptographic\Lib\libSTM32CryptographicV3.0.0_CM4_GCC.a(crypto.o) does not "

" :\st\stm32cubeide_1.4.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: failed to merge target specific data of file C:\git_repos\STM32L476RG-Nucleo_PollingTagDetect_rbld\Middlewares\ST\STM32_Cryptographic\Lib\libSTM32CryptographicV3.0.0_CM4_GCC.a(crypto.o) "

Best regards!

@Wladimir​ My 2 cents looking at your snashot. If 'Libraries (-l)' area takes care.

1) To add ':' char as first character of your library file

2) To add '.a' libray file extension ... full file name including extension as to be provided

Then possibly if linker process still fail reorder our library files ... GCC is order sensitive here ...

Hello Cartu38 OpenDev,

Unfortunately, it didn't help, the error has changed, now can't find the library file. The path to the library file I tried is both absolute and relative to the workspace.

0693W00000ANiJNQA1.png 

The error is:

" c:\st\stm32cubeide_1.3.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: cannot find -l:STM32CryptographicV3.0.0_CM4_GCC.a "

Best regards, Vladimir

Have a try about relative path ... works for me

0693W00000ANikJQAT.jpg

Wladimir
Associate II

Hello,

It doesn't help, same error, "can't find -l:STM32CryptographicV3.0.0_CM4_GCC.a"

0693W00000ANjYnQAL.png 

I entered the path string manually

@Wladimir​ works for me doing hash computation. Please get a try based on attached project (Please just add back to such delivery middlewares part I've removed because such crypto pack content delivery is under special legal terms ... just copy/paste from pack you have)

Note: I rely on STM32CubeIDE 1.6.1

0693W00000ANl42QAD.png

Thanks, its builded without errors.

Don't understand what is my issue, i'll try to figure it out.

Hello Cartu38 OpenDev,

Do the same in my project and have this errors again:

" c:\st\stm32cubeide_1.4.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: error: STM32L476RG-Nucleo_PollingTagDetect_rbld.elf uses VFP register arguments, C:\git_repos\STM32L476RG-Nucleo_PollingTagDetect_rbld\Middlewares\ST\STM32_Cryptographic\Lib\libSTM32CryptographicV3.0.0_CM4_GCC.a(crypto.o) does not "

" :\st\stm32cubeide_1.4.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: failed to merge target specific data of file C:\git_repos\STM32L476RG-Nucleo_PollingTagDetect_rbld\Middlewares\ST\STM32_Cryptographic\Lib\libSTM32CryptographicV3.0.0_CM4_GCC.a(crypto.o) "

Then i changed floating point settings and it works!)

0693W00000ANlU4QAL.png 

Have changed from hardware implementation to mixed.

And my project building ok for now!

Best regards!

Yep about VFP message such is right setup to do (by the way part of project I've shared to you).

Such message was not primary one you've shared ... first ones were really archive '.a' file access issue. VFP error is coming when '.a' is linked (found so :-))

Happy you're now able to move on ! Well done.