EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1455 background imageLoading...
Page #1455 background image
Chapter 4. API Guides
The first step to reducing the total firmware binary size is measuring what is causing the size to increase.
Measuring Static Sizes To optimize both firmware binary size and memory usage its necessary to measure
statically allocated RAM (data, bss), code (text) and read-only data (rodata) in your project.
Using the idf.py sub-commands size, size-components and size-files provides a summary of memory
used by the project:
Size Summary (idf.py size)
$ idf.py size
[...]
Total sizes:
DRAM .data size: 11584 bytes
DRAM .bss size: 19624 bytes
Used static DRAM: 0 bytes ( 0 available, nan% used)
Used static IRAM: 0 bytes ( 0 available, nan% used)
Used stat D/IRAM: 136276 bytes ( 519084 available, 20.8% used)
Flash code: 630508 bytes
Flash rodata: 177048 bytes
Total image size:~ 924208 bytes (.bin may be padded larger)
This output breaks down the size of all static memory regions in the firmware binary:
DRAM .data size is statically allocated RAM that is assigned to non-zero values at startup. This uses
RAM (DRAM) at runtime and also uses space in the binary file.
DRAM .bss size is statically allocated RAM that is assigned zero at startup. This uses RAM (DRAM) at
runtime but doesnt use any space in the binary file.
Used static DRAM, Used static IRAM - these options are kept for compatibility with ESP32 target,
and currently read 0.
Used stat D/IRAM - This is total internal RAM usage, the sum of static DRAM .data + .bss, and also
static IRAM (Instruction RAM) used by the application for executable code. The available size is the
estimated amount of DRAM which will be available as heap memory at runtime (due to metadata overhead
and implementation constraints, and heap allocations done by ESP-IDF during startup, the actual free heap at
startup will be lower than this).
Flash code is the total size of executable code executed from flash cache (IROM). This uses space in the
binary file.
Flash rodata is the total size of read-only data loaded from flash cache (DROM). This uses space in the
binary file.
Total image size is the estimated total binary file size, which is the total of all the used memory types
except for .bss.
Component Usage Summary (idf.py size-components) The summary output provided by idf.py size does
not give enough detail to find the main contributor to excessive binary size. To analyze in more detail, use idf.py
size-components
$ idf.py size-components
[...]
Total sizes:
DRAM .data size: 14956 bytes
DRAM .bss size: 15808 bytes
Used static DRAM: 30764 bytes ( 149972 available, 17.0% used)
Used static IRAM: 83918 bytes ( 47154 available, 64.0% used)
Flash code: 559943 bytes
Flash rodata: 176736 bytes
Total image size:~ 835553 bytes (.bin may be padded larger)
Per-archive contributions to ELF file:
Archive File DRAM .data & .bss & other IRAM D/IRAM Flash code &
,rodata Total
(continues on next page)
Espressif Systems 1444
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish