Giter Site home page Giter Site logo

binsize's Introduction

Binsize tool

Tool for analyzing the sizes of symbols in binaries.

It can be used to find out which symbols are taking up the most space in a binary.

It requires bloaty and nm tools to be installed.

It analyzes the .elf file and optionally also the .map file from the binary creation process.

Tool basic usage

Installable by pip install binsize - see PyPI.

Installing this package creates binsize command, which has a lot of subcommands seeable by binsize --help. For example

$ binsize get firmware.elf -d
$ binsize compare firmware.elf other_firmware.elf
$ binsize tree firmware.elf

--help can be used even on the subcommands, for example binsize get --help - to see all available options.

Result will be usually printed into terminal, unless specifying --output option which some commands support.

Setting root directory

To resolve all the files properly, the project's root directory needs to be set correctly.

There are couple of possibilities how to do it.

In the end, all of them are changing the root value in settings.json, from where everything else gets the value. It needs to be an absolute path.

settings.json will be created in a user's home directory, based on platformdirs library (~/.config/binsize/settings.json on linux).

Manually

Just modifying the root in the settings.json file.

Via environmental variable

BINSIZE_ROOT_DIR env variable is checked and when not empty, it will set the root directory.

e.g. BINSIZE_ROOT_DIR=/home/user/project binsize tree /path/to/file.elf

Via CLI argument

binsize accepts -r / --root-dir argument, which can be used to set the root directory.

It has lower priority than the environmental variable.

e.g. binsize -r /home/user/project tree /path/to/file.elf

Via exposed function

binsize exposes set_root_dir function, which can be called from any python script.

e.g. binsize.set_root_dir("/home/user/project")


TODO: document all the CLI commands, exportable symbols, basic functioning, ways to extend it, etc.

binsize's People

Contributors

grdddj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.