Page 1 of 1

Binary size increased

Posted: Tue May 05, 2020 12:17 am
by rosenrot
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?

Re: Binary size increased

Posted: Tue May 05, 2020 9:32 am
by ESP_Roland
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

Re: Binary size increased

Posted: Thu May 07, 2020 11:39 am
by rosenrot
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)

Re: Binary size increased

Posted: Thu May 07, 2020 12:46 pm
by ESP_Roland
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.