Third Party library
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-28 3:42 AM - last edited on ‎2024-03-05 1:59 AM by Amel NASRI
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 |
Without Library build project.
Solved! Go to Solution.
- Labels:
-
STM32CubeIDE
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-28 4:48 AM - edited ‎2024-02-28 8: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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-28 3:47 AM - edited ‎2024-02-28 3: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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-28 3:52 AM
I just include the library at main.C file. i didn't use any function of the library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-28 3: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
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-28 3: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-28 4: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.
I didn't find anything here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-28 4:48 AM - edited ‎2024-02-28 8: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:
