Skip to main content
Associate II
February 28, 2024
Solved

Third Party library

  • February 28, 2024
  • 6 replies
  • 2504 views

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.

 

 

This topic has been closed for replies.
Best answer by mƎALLEm

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

 

 

 

6 replies

mƎALLEm
ST Technical Moderator
February 28, 2024

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 "Best answer" on the reply which solved your issue or answered your question.
Hardik02Author
Associate II
February 28, 2024

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

mƎALLEm
ST Technical Moderator
February 28, 2024

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 "Best answer" on the reply which solved your issue or answered your question.
Andrew Neil
Super User
February 28, 2024

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 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.