Arm Mbed OS support forum

Using CubeIDE libs

Hello,

I’m trying to port an STM32CubeIDE project to Mbed OS. I was able to replace all the similar header files, but unable to build and link the libraries for the project (files with “.a” extension). Is there a build configuration where I can add that library and link it to my code? I’m getting linking errors for functions defined in that library, Any suggestions on how can I do it? Thanks

What functionality are you looking to port?

If you set up Mbed for STM target, all HAL libraries are already included for it, and you can call them however you like.

I am not quite sure what can be done for middlewares, but there may be Mbed alternatives.

Can you tell me what libraries are you looking to port?

I’m trying to use a precompiled static library (with “.a” extension). The library has been precompiled using gcc so I’m using GCC_ARM as my tool chain. But it fails to link this static library after compiling the code. Is there any way to add it to the build configuration?

Which library are you talking about?

Using Mbed-cli or Mbed Studio?

There is this thread that suggests that you rename the extension to .ar, worht a try.

Another option, but requires some setup is to move to mbed-cmake toolchain.

Hello Yash,

This thread might help.

Best regards, Zoltan

1 Like

The library has been precompiled using gcc so I’m using GCC_ARM as my tool chain. But it fails to link this static library after compiling the code.

Hello Ash,

Make sure the library was built for the same target with the same mbed-os revision and same toolchain as your project.

  • Copy the library .a binary and .h files into root directory of your project.
  • Open a terminal (command) window in the root directory of your project and execute the following command:
mbed compile -m Your_Target -t GCC_ARM --source . --source PATH_to_mbed-os

Best regards, Zoltan