Page 1 of 1

How to reduce IRAM usage

Posted: Wed Nov 14, 2018 3:35 pm
by gunar.kroeger
I tried to move to stable version of idf v3.2, but my code would not fit in IRAM anymore,

so I returned to the master branch, commit [a8754cc], I was working on and checked usage with command make size-components:

Code: Select all

Python requirements from C:/msys32/home/gunar.kroeger/esp/esp-idf/requirements.txt are satisfied.
Total sizes:
DRAM .data size: 15828 bytes
DRAM .bss size: 82184 bytes
Used static DRAM: 98012 bytes ( 26568 available, 78.7% used)
Used static IRAM: 127880 bytes ( 3192 available, 97.6% used)
Flash code: 1140241 bytes
Flash rodata: 272148 bytes
Total image size:~1556097 bytes (.bin may be padded larger)
Per-archive contributions to ELF file:
Archive File DRAM .data & .bss IRAM Flash code & rodata Total
libbt.a 195 43448 1512 304343 82618 432116
libnet80211.a 321 9213 3577 112174 14045 139330
libmbedtls.a 92 264 0 109091 21354 130801
liblwip.a 19 4172 0 100100 16939 121230
libc-psram-workaround.a 1804 62 15946 85626 6349 109787
libesp32.a 3153 2642 19873 27292 30237 83197
libdriver.a 119 183 4031 43679 31417 79429
libpp.a 1229 5286 13407 45710 4208 69840
libmain.a 142 9637 0 40341 16971 67091
libbtdm_app.a 255 2203 19607 40838 3617 66520
libphy.a 1284 915 5710 29799 0 37708
libspiffs.a 0 12 0 24450 1407 25869
libwpa.a 0 682 0 21016 2312 24010
libminiz.a 0 0 0 18407 5113 23520
libfreertos.a 4156 776 15958 0 2166 23056
libfatfs.a 4 47 0 19995 2184 22230
libnghttp.a 0 0 0 15226 4141 19367
libnvs_flash.a 0 32 0 13382 3261 16675
libwpa_supplicant.a 0 0 0 13524 2318 15842
libsoc.a 245 4 8139 727 4145 13260
libsdmmc.a 0 0 0 9190 3687 12877
libspi_flash.a 36 323 7036 1561 1791 10747
libesp_http_client.a 0 0 0 7113 2047 9160
libvfs.a 240 103 0 8245 559 9147
libm-psram-workaround.a 4 0 0 6994 541 7539
libheap.a 884 8 3867 1546 920 7225
libcoexist.a 1365 106 3704 1523 0 6698
libgcc.a 4 20 104 5564 888 6580
libesp_ringbuf.a 0 0 0 4643 594 5237
libstdc++.a 8 20 0 2689 1253 3970
libbootloader_support.a 0 4 0 2585 1268 3857
libtcpip_adapter.a 0 124 0 3094 353 3571
libtcp_transport.a 0 0 0 2513 610 3123
libapp_update.a 0 80 0 2136 725 2941
libnewlib.a 152 272 830 1155 167 2576
libesp-tls.a 0 0 0 1735 770 2505
librtc.a 0 4 2304 0 0 2308
libesp_adc_cal.a 0 0 0 1014 674 1688
libpthread.a 16 12 178 874 607 1687
liblog.a 8 268 478 810 98 1662
libsd_logging.a 0 1028 0 279 73 1380
libcore.a 0 5 0 821 415 1241
libsmartconfig_ack.a 0 1 0 766 257 1024
libhal.a 0 0 515 0 32 547
libcxx.a 0 0 0 11 0 11
libxtensa-debug-module.a 0 0 8 0 0 8
libwpa2.a 0 1 0 0 0 1
libwps.a 0 1 0 0 0 1
libethernet.a 0 0 0 0 0 0
libmesh.a 0 0 0 0 0 0
And it shows that IRAM region is almost full already!
Can you see anything out of the ordinary from this info? Is there a way to reduce IRAM usage? I'm using the WROVER module

Re: How to reduce IRAM usage

Posted: Thu Nov 15, 2018 7:14 pm
by fly135
Are you using Bluetooth? If not then you can free up some internal memory that may help.

Code: Select all

esp_bt_controller_mem_release(ESP_BT_MODE_BTDM);
John A

Re: How to reduce IRAM usage

Posted: Fri Nov 16, 2018 12:32 pm
by gunar.kroeger
Yes, I am using SPP to transfer files and did the release memory for BLE, but eventually I will also need the BLE feature.
I'm also using WiFi with Https client.

I already changed from debug to release mode to gain a bit of memory and to allow me to use the v3.2 release with 93% of memory used, but that is not a final solution, I fear.