elf-size-analyze
elf-size-analyze is a Python tool that uses regular binutils programs (readelf, nm, c++filt) to extract information about symbols and sections from an ELF file and filters them. Information is presented in a tree based on paths to files where the symbols have been defined.
It's main usage is optimization of memory usage (FLASHH/RAM/etc.) by inspecting which modules/symbols in code contribute the most to final size. Main output format is an ASCII tree, but it supports other formats, e.g. JSON (for usage in other scripts), or HTML-based visualization (e.g. static HTML or Plotly graph).
This script was initially based on size_report from Zephyr Project scripts (some old version), but it has been almost fully rewritten but the idea is the same.
Gallery
| Plotly treemap | Plotly sunburst | HTML table |
|---|---|---|
Requirements
- Python 3
- binutils: readelf, nm, c++filt (optional)
Installation
For normal usage it's best to install from PyPI:
pip install elf-size-analyze
There are some optional dependencies not installed by default, e.g. to include support for Plotly graphs output use
pip insatll elf-size-analyze[plotly]
For development it's recommended to install from sources in virtual environment in editable mode:
python -m venv venv
source ./venv/bin/activate
git clone https://github.com/jedrzejboczar/elf-size-analyze.git
pip install -e ./elf-size-analyze[dev,plotly]
Usage
Select the ELF file to be analyzed. To be able to extract path information about symbols from the ELF file, the program should be compiled with debug information (gcc -g).
If installed using pip then the package provides an entry point and you can just use the elf-size-analyze command.
Otherwise use python -m elf_size_analyze from the source directory.
Example usage (assumes that we're using arm-none-eabi-gcc toolchain):
elf-size-analyze -t arm-none-eabi- -w 120 -HaF build/myapp
For more options see help:
elf-size-analyze -h
For HTML output:
elf-size-analyze -t arm-none-eabi- -w 120 -HaF build/myapp -W > /tmp/index.html
firefox /tmp/index.html # or other browser / xdg-open
For Plotly output (for big executables you might want to use --plotly-max-depth):
elf-size-analyze -t arm-none-eabi- -w 120 -HaF build/myapp --plotly --plotly-type treemap
Metadata
Release files for elf-size-analyze 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| elf_size_analyze-0.3.1.tar.gz | 25.7 kB | Without provenance | Details for elf_size_analyze-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| elf_size_analyze-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for elf_size_analyze-0.3.1-py3-none-any.whl |
Total release size: 54.0 kB
Release files / elf_size_analyze-0.3.1.tar.gz
| Download URL | elf_size_analyze-0.3.1.tar.gz |
|---|---|
| Size | 25.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f14eb62da3d77cbf08ba2234447fb8fbeec61ce0d2eb82f5dd749300a5958445
|
|
BLAKE2b-256 checksum How to use checksums |
b999a18b49eb42443a250334873ba94c02e5f2be5af4349a933bb2aa2908f038
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / elf_size_analyze-0.3.1-py3-none-any.whl
| Download URL | elf_size_analyze-0.3.1-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a066b2cc42981473268359767f0d29ee6040fce0208d6bbe1a008e8d33165b6
|
|
BLAKE2b-256 checksum How to use checksums |
846747730e5efc784b4477b65c315984ab6b27d71d836f352c658bfaa74a7e72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for elf-size-analyze 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.