Thanks for the suggestions, here are the results for size-components:
Code: Select all
Total sizes:
DRAM .data size: 14284 bytes
DRAM .bss size: 36056 bytes
Used static DRAM: 50340 bytes ( 130396 available, 27.9% used)
Used static IRAM: 89757 bytes ( 41315 available, 68.5% used)
Flash code: 914464 bytes
Flash rodata: 527256 bytes
Total image size:~1545761 bytes (.bin may be padded larger)
Per-archive contributions to ELF file:
Archive File DRAM .data & .bss IRAM Flash code & rodata Total
libutil.a 0 5 0 2126 276711 278842
libstdc++.a 149 5640 0 123292 72407 201488
libnet80211.a 937 9042 11532 111824 21666 155001
libmbedtls.a 100 264 30 105230 27961 133585
libc.a 0 4 0 96765 7811 104580
liblwip.a 21 3856 0 78436 15256 97569
libpp.a 1317 5411 23928 38623 5096 74375
liblogic.a 0 73 0 57188 9117 66378
libdriver.a 147 79 5458 24906 17971 48561
libperipheral.a 0 30 0 40569 6395 46994
libphy.a 1604 930 6487 30450 0 39471
libesp32.a 2342 464 7408 13514 8844 32572
libwpa.a 0 686 0 21417 2577 24680
libservice.a 4 91 0 14949 9451 24495
libnetwork.a 0 523 0 16949 3310 20782
libfreertos.a 4140 788 13138 0 1776 19842
libnetwork_real.a 156 3763 0 10873 4870 19662
libos_real.a 9 1094 170 11117 3886 16276
libwpa_supplicant.a 0 0 0 12894 2318 15212
libcloud.a 0 73 0 12318 2097 14488
libnvs_flash.a 0 32 0 10799 3066 13897
liblogger.a 0 1399 0 8948 2195 12542
libmodbus.a 0 11 0 9123 1782 10916
libsoc.a 160 4 4738 502 3955 9359
libspi_flash.a 24 291 5590 1262 928 8095
libethernet.a 8 279 322 5258 1649 7516
libcloud_real.a 0 1 0 5429 1961 7391
libgcc.a 4 20 104 5779 888 6795
libheap.a 1143 4 3051 737 932 5867
libbootloader_support.a 0 4 862 3074 1905 5845
libvfs.a 240 103 0 3680 413 4436
libmain.a 0 2 0 3126 1176 4304
libapp_update.a 0 12 85 2443 1336 3876
libesp_ringbuf.a 0 0 3234 0 582 3816
libcoexist.a 1278 28 0 2227 0 3533
libstatistics.a 0 5 0 2936 470 3411
libtcpip_adapter.a 0 124 0 2571 370 3065
libefuse.a 36 4 0 849 2052 2941
libjson.a 12 8 0 2248 40 2308
libm.a 4 0 0 2157 11 2172
libnewlib.a 152 272 774 787 96 2081
libupdate.a 0 2 0 1629 417 2048
libpthread.a 16 12 236 823 645 1732
libutil_real.a 0 6 0 914 630 1550
libos.a 0 46 0 1269 168 1483
libupdate_real.a 0 1 0 669 642 1312
liblog.a 8 268 434 359 117 1186
libcore.a 0 29 0 825 302 1156
libcxx.a 12 16 0 681 443 1152
libsmartconfig_ack.a 0 1 0 809 299 1109
libhal.a 0 0 519 0 32 551
librtc.a 0 0 484 0 0 484
libBase64.a 0 25 0 383 73 481
libmesh.a 1 1 0 43 0 45
libwpa2.a 0 1 0 0 0 1
libwps.a 0 1 0 0 0 1
My understanding of how to interpret this is rather limited to be honest. As far as I know, esp_get_free_heap_size() reports the number of free bytes in IRAM
plus the number of free bytes in DRAM, right?
This line confuses me:
Code: Select all
Used static IRAM: 89757 bytes ( 41315 available, 68.5% used)
If there's 41k of IRAM available and I am using 90k, how is that 68.5% usage? My math would suggest that I'm overusing at 217%..., even though we only have a few functions marked with IRAM_ATTR.
What are you doing to use 20KB+ heap?
Allocating stuff I guess
Our app is quite complex - it's the firmware for a home battery controller with lots of custom components. We're doing TLS-Encrypted Websocket communication, Modbus RTU communication, UART communication, lots of internal calculations based on sensor readings, state of charge calculation, use of NVS for local buffering...
A big chunk of dynamically allocated memory are std::stringstreams used to generate JSON strings (multiple kB in size).
Ethernet/lwip RX/TX buffer settings might help (but loose some performance).
Sure, but thing is that these RAM issues only came up after updating ESP-IDF. On 3.1.x it was completely fine and 3.2.x seems okay as well. Did other people experience the same decrease of available RAM as we did after upgrading?
Thanks!