GitHub - Wren6991/CodeSizer: Why is that binary so big? · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
Wren6991
CodeSizer
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star<br>45
master
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>9 Commits<br>9 Commits
.gitignore
.gitignore
LICENSE
LICENSE
README.md
README.md
codesizer.py
codesizer.py
View all files
Repository files navigation
CodeSizer
Why is that binary so big?
What
CodeSizer is a static code size profiling tool.
In size-focused embedded firmware development, the final binary is heavily inlined and link-time-optimised. A single function symbol may cover dozens of inlinees. CodeSizer uses objdump and addr2line to unwind the inline call stack at every instruction address, so code size can be attributed to the correct node in the inline call tree within each function.
The output is a static HTML report file, with a small amount of JavaScript for UI features like toggling expand/collapse of the tree view.
How
From the interactive help:
usage: codesizer.py [-h] [--cross-prefix CROSS_PREFIX] [--section SECTION]<br>elf output
Analyse static code size of an ELF file. Disassemble via objdump, unwind inline<br>call stacks via addr2line, and emit a static HTML report.
positional arguments:<br>elf input ELF file<br>output output HTML file
options:<br>-h, --help show this help message and exit<br>--cross-prefix CROSS_PREFIX<br>prefix for objdump and addr2line (default: riscv32-unknown-<br>elf-)<br>--section, -j SECTION<br>Specify ELF section. Pass multiple times for multiple<br>sections. If unspecified, .text is used.
The correct toolchain must be present on your $PATH with the given prefix, or you must specify a full file path to the toolchain binaries. For example:
If you've installed the gcc-arm-none-eabi package on Ubuntu, then use --cross-prefix=arm-none-eabi-.
If you've installed a riscv-gnu-toolchain build at /opt/riscv/gcc15, then use --cross-prefix=/opt/riscv/gcc15/bin/riscv32-unknown-elf-.
Example Output
This HTML report was generated by the following command:
./codesizer.py --cross-prefix arm-none-eabi- arm-bootrom.elf arm-bootrom.html -j .text -j .secure_gateways
The ELF file comes from the RP2350 A4 bootrom release.
About
Why is that binary so big?
Resources
Readme
License
CC0-1.0 license
Uh oh!
There was an error while loading. Please reload this page.
Activity
Stars
45<br>stars
Watchers
watching
Forks
forks
Report repository
Releases
v0.1
Latest
Jul 18, 2026
Packages
Uh oh!
There was an error while loading. Please reload this page.
Contributors
Uh oh!
There was an error while loading. Please reload this page.
Languages
Python<br>100.0%
You can’t perform that action at this time.