esp-idf-size

Firmware size analysis for ESP-IDF


Keywords
espressif, embedded, project, size
License
Apache-2.0
Install
pip install esp-idf-size==1.5.0

Documentation

esp-idf-size

In the field of IoT development, memory constraints are a common challenge, often requiring developers to optimize their application size. Whether it involves ensuring the firmware fits within available flash memory or analyzing impact of code changes on the final binary size, effective firmware size management is essential for resource efficiency. The esp-idf-size tool provides developers with the means to explore statically allocated RAM used by the final binary firmware image generated by ESP-IDF SDK for Espressif devices.

The esp-idf-size tool is included in the ESP-IDF and is installed automatically. It can be accessed using the idf.py command or the idf_size.py wrapper. The idf.py command provides access to the most commonly used esp-idf-size commands and automatically sets some options for user convenience, while the idf_size.py wrapper allows full access to all esp-idf-size features. For more information on using esp-idf-size in ESP-IDF, please refer to Minimizing Binary Size.

The esp-idf-size package comes in two versions: legacy and refactored. The refactored version, which is the default version used in ESP_IDF v5.3 and later, retains backward compatibility with the options, making it easy to switch between the two by setting the ESP_IDF_SIZE_NG environment variable, available from ESP-IDF v5.0 onwards. However, the size report output formats are different in the refactored version. You can also use the refactored version by specifying the --ng option or by directly using the esp_idf_size.ng subpackage. Here are some examples of how to use the refactored version:

python -m esp_idf_size --ng --help
python -m esp_idf_size.ng --help
export ESP_IDF_SIZE_NG=1
python -m esp_idf_size --help

For more detailed information about the refactored version, please refer to the documentation available here.