Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to check final binary size? #25

Open
acedogblast opened this issue Jun 11, 2024 · 2 comments
Open

How to check final binary size? #25

acedogblast opened this issue Jun 11, 2024 · 2 comments
Labels
question Further information is requested

Comments

@acedogblast
Copy link

acedogblast commented Jun 11, 2024

Cargo build generates an ELF executable file as a output format which contains many additional data that will not be transferred to the CH32XXX chip. Is there a way for me to know the exact size of my firmware binary so I can keep track of how much flash is being used?

So far I found that cargo bloat can give me the size of the .text section of the binary's ELF format. Is there a better way?

@romainreignier
Copy link
Contributor

You can use cargo size:

cargo install cargo-binutils
rustup component add llvm-tools
cargo size --release

@andelf
Copy link
Contributor

andelf commented Jun 12, 2024

The traditional method is objcopy -O binary.
In Rust, many new tools are invented.

wlink and wchisp also print firmware info when flashing.

@andelf andelf added the question Further information is requested label Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants