cancel
Showing results for 
Search instead for 
Did you mean: 

How can I identify libraries in STMCubeIDE?

TomC1
Associate II

I have recently picked up an old project which was build by a developer who has left the company.  For various security and compliance reasons, I need to know which specific libraries are linked to the project.  I can see from the project properties and the makefile, that it is using arm-gnu-toolchain 13.1, but this contains a lot of libraries and my customer needs to know which specific libraries are linked into the binary.  Can anyone point me towards how I can find this information?

I am using STMCubeIDE 1.16.0.  Though I do not believe that this was the original version used to build the project. (To say that documentation is a bit sparse would be generous!)

1 ACCEPTED SOLUTION

Accepted Solutions

Go to:

 

# Project Properties -> C/C++ Build -> Settings -> MCU G++ Linker -> Libraries

 

For all third party libraries that are explicitly linked.
In my case it was only ":libtouchgfx-float-abi-hard.a"

It also links against the standard library for C and/or C++.

Go to

 

# Project Properties -> C/C++ Build -> Settings -> MCU G++ Linker -> General

 

And check "Verbose". The clean and build.
It should list all O-files that are linked by the linker.

 

attempt to open PATH_TO_o_FILE.o succeeded
...
attempt to open PATH_TO_a_FILE.a succeeded
...

 

 

Of course there could be C/C++ code or macros inside header files that are compiled inside all your source files. Those don't show up in the linker.

Using regex I was able to extract this list of linked external libraries from my project:

 

crt0.o
crtbegin.o
crtend.o
crti.o
crtn.o
libc.a
libc_nano.a
libgcc.a
libm.a
libnosys.a
libstdc++_nano.a
libsupc++_nano.a

 

 You can also check your .map file in your build folder. In it you can see which function from which library gets put at which address.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

View solution in original post

4 REPLIES 4
TDK
Guru

If you have the makefile, it should list which libraries are linked in at the linker stage. Use google to search for them by name.

If you feel a post has answered your question, please click "Accept as Solution".

Go to:

 

# Project Properties -> C/C++ Build -> Settings -> MCU G++ Linker -> Libraries

 

For all third party libraries that are explicitly linked.
In my case it was only ":libtouchgfx-float-abi-hard.a"

It also links against the standard library for C and/or C++.

Go to

 

# Project Properties -> C/C++ Build -> Settings -> MCU G++ Linker -> General

 

And check "Verbose". The clean and build.
It should list all O-files that are linked by the linker.

 

attempt to open PATH_TO_o_FILE.o succeeded
...
attempt to open PATH_TO_a_FILE.a succeeded
...

 

 

Of course there could be C/C++ code or macros inside header files that are compiled inside all your source files. Those don't show up in the linker.

Using regex I was able to extract this list of linked external libraries from my project:

 

crt0.o
crtbegin.o
crtend.o
crti.o
crtn.o
libc.a
libc_nano.a
libgcc.a
libm.a
libnosys.a
libstdc++_nano.a
libsupc++_nano.a

 

 You can also check your .map file in your build folder. In it you can see which function from which library gets put at which address.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
TomC1
Associate II

Hi, thanks for the response.

I did consider this myself, but the "LIBS = " statement in the makefile is blank

TomC1_0-1727872279535.png

Is there another statement in the makefile that you think would be relevant?

 


 You can also check your .map file in your build folder. In it you can see which function from which library gets put at which address.

 


Great idea, thanks. This worked for me!