2024-02-28 03:42 AM - last edited on 2024-03-05 01:59 AM by Amel NASRI
Hello,
I am trying to compare a third party libraries size on my STM32 project.
Methodology
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 |
2024-02-28 03:47 AM - edited 2024-02-28 03:54 AM
You have to check the map file (.map in \STM32CubeIDE\Debug): so are you really calling the library APIs?
Example:
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:
2024-02-28 03:52 AM
I just include the library at main.C file. i didn't use any function of the library.
2024-02-28 03:52 AM
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 binutils: https://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
2024-02-28 03:56 AM
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.
2024-02-28 04:01 AM
I just directly copy the source file added into library folder and then give path into C/C++ General and paths and symbols.
2024-02-28 04:48 AM - edited 2024-02-28 08:04 AM
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: