Binary size increased

rosenrot
Posts: 25
Joined: Wed Jan 01, 2020 9:28 pm

Binary size increased

Postby rosenrot » Tue May 05, 2020 12:17 am

I'm using the VCode extension to build my project. Recently I saw an increase of my binary from 524kb to 557kb from one moment to the next. Removing 10 variables from the code doesn't change the size of the binary file. I think this is because variables are rather small.

Any ideas what I can remove from menuconfig to save space?

User avatar
ESP_Roland
Posts: 257
Joined: Tue Oct 09, 2018 10:28 am

Re: Binary size increased

Postby ESP_Roland » Tue May 05, 2020 9:32 am

Hi rosenrot,

tools/idf_size.py has a new --diff option which can be used together with the other options to see differences between MAP files. It might give you an idea what is causing the increase in size.

For further info please run:

Code: Select all

tools/idf_size.py --help

rosenrot
Posts: 25
Joined: Wed Jan 01, 2020 9:28 pm

Re: Binary size increased

Postby rosenrot » Thu May 07, 2020 11:39 am

Thanks for the hint. So the flash code increased by almost 30'000 bytes. Where do I have to search?

Code: Select all

(base) C:\>C:\small.map
Total sizes:
 DRAM .data size:   14664 bytes
 DRAM .bss  size:   11768 bytes
Used static DRAM:   26432 bytes (  98148 available, 21.2% used)
Used static IRAM:   89828 bytes (  41244 available, 68.5% used)
      Flash code:  355795 bytes
    Flash rodata:   74332 bytes
Total image size:~ 546387 bytes (.bin may be padded larger)

Code: Select all

(base) C:\>C:\big.map
Total sizes:
 DRAM .data size:   14072 bytes
 DRAM .bss  size:   13520 bytes
Used static DRAM:   27592 bytes (  96988 available, 22.1% used)
Used static IRAM:   89308 bytes (  41764 available, 68.1% used)
      Flash code:  381179 bytes
    Flash rodata:   84720 bytes
Total image size:~ 582799 bytes (.bin may be padded larger)

User avatar
ESP_Roland
Posts: 257
Joined: Tue Oct 09, 2018 10:28 am

Re: Binary size increased

Postby ESP_Roland » Thu May 07, 2020 12:46 pm

Running these commands could give a little more information:

Code: Select all

$IDF_PATH/tools/idf_size.py --files big.map --diff small.map
$IDF_PATH/tools/idf_size.py --archives big.map --diff small.map
If you identify an archive then you can get more information about which functions caused the increase:

Code: Select all

$IDF_PATH/tools/idf_size.py --archive_details libesp32.a big.map --diff small.map
After that you can find the given component in the menuconfig and look for options which can decrease the size.

Who is online

Users browsing this forum: No registered users and 130 guests