cancel
Showing results for 
Search instead for 
Did you mean: 

Third Party library

Hardik02
Associate II

Hello, 

I am trying to compare a third party libraries size on my STM32 project. 

Methodology 

  • Firstly, i build a project without including a third party library and build it. 
  • Secondly i build a project after including a third party library and compare memory usage with build analyzer and surprisingly i get the same result.

How i can know the exact memory size used by library? 

i used below libraries.

 

No.
1

Micro CBOR

JavaScript

2

NanoCBOR

C

3

QCBOR

C

4

TinyCBOR

C

5

libCBOR

C

 

Hardik02_0-1709118846997.pngHardik02_1-1709118854451.png

Without Library build project.Without Library build project.

 

 

6 REPLIES 6
SofLit
ST Employee

You have to check the map file (.map in \STM32CubeIDE\Debug): so are you really calling the library APIs?

Example:

SofLit_0-1709120992902.png

Also when you say you add a library, you mean a pre-build library or in source files? Because in the first case you need to add the library and its path here:

SofLit_1-1709121246157.png

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I just include the library at main.C file. i didn't use any function of the library. 

Andrew Neil
Evangelist III

If parts of a library are not used, it's possible (likely?) that the unused code is not added to the final image - so you'd need a test case which actually used all the library's features.

 


@Hardik02 wrote:

How i can know the exact memory size used by library? 


Analyse the Map file (aka the Linker listing).

nm is a tool to do that: https://en.wikipedia.org/wiki/Nm_(Unix)

Part of GCC binutilshttps://ftp.gnu.org/old-gnu/Manuals/binutils-2.12/html_node/binutils_4.html

Some articles:

https://www.embeddedrelated.com/showarticle/900.php

https://interrupt.memfault.com/blog/get-the-most-out-of-the-linker-map-file 

If you just included the .h file without any call from the library, as you you didn't add anything. So you must call something from the library.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I just directly copy the source file added into library folder and then give path into C/C++ General and paths and symbols. 

Hardik02_0-1709121614937.png

Hardik02_1-1709121623349.pngI didn't find anything here.I didn't find anything here.

 

 

Since we don't have a visibility of what kind of library you are using we cannot help you.

If you have a .a library file you need to add it in library section as shown before.

If you have .c files you need to add them in the in project explorer using drug and drop function here:

SofLit_0-1709124480702.png

 

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.