Page 1 of 1

IRAM usage rising, especially libbtdm_app.a

Posted: Wed Aug 16, 2023 2:39 pm
by ErikCorry
When updating the Toit platform to the latest esp-idf 5.0, I notice that the IRAM usage has been increasing over the board.

See the changes from March to today at https://gist.github.com/erikcorry/f44c6 ... 89ab40b9dd

One big culprit is the bluetooth stack. Is there a way to make it use flash instead of IRAM? 30k is a lot of memory on a limited system.

My sdkconfig is at https://gist.github.com/erikcorry/ed93e ... b8feed4d12

Re: IRAM usage rising, especially libbtdm_app.a

Posted: Tue Sep 12, 2023 7:19 pm
by malachib
I second this

Some of my boilerplate test apps which only provision over BLE sometimes run out of IRAM, without even adding any app logic

Using esp-idf 5.1.1

Re: IRAM usage rising, especially libbtdm_app.a

Posted: Sat Jun 08, 2024 2:00 pm
by millim
Same for me!

No answer so for?! What is going on? Here is my feedback!

I don’t know what you crazy guys at ESP are doing !!? I was about to migrate my project from IDF 4.2 to IDF 5.2. I encountered that even your libraries including wifi+BT do not compile because IRAM gets exhausted! I mean, are you totally dumped! You are dealing with a resource constrained device and offer such a crappy library!! I mean, from where are you sourcing your engineers? Directly from high school? Do you ever test this?
Furthermore, CMAKE is a pain! I liked the gnu make, worked out of the box. Now you need to declare all the dependencies. What a shit and what a pain! Device configuration is a pain to get optimized performance. Currently in need a solution to fix this issue:
Used static IRAM: 140074 bytes ( -9002 remain, 106.9% used) Overflow detected!

Now, you crazy guys tell me how to fix this! But, don't tell me I need to enable the extra IRAM#1 to get another issue on runtime heap allocation!

millim

Code: Select all

Used static DRAM:  101916 bytes (  22664 remain, 81.8% used)
      .data size:   31524 bytes
      .bss  size:   70392 bytes
Used static IRAM:  140074 bytes (  -9002 remain, 106.9% used) Overflow detected!
      .text size:  139047 bytes
   .vectors size:    1027 bytes
Used Flash size : 2488891 bytes
           .text: 1425007 bytes
         .rodata: 1063628 bytes
Total image size: 2660489 bytes (.bin may be padded larger)
Per-archive contributions to ELF file:
            Archive File DRAM .data & 0.bss .rtc.text IRAM0 .text & 0.vectors ram_st_total Flash .text & .rodata & .rodata_noload & .appdesc flash_total
           libbinaries.a          0       0         0           0           0            0           0    600726                0          0      600726
                 libbt.a       4736    2047         0        1700           0         8483      227359     14741                0          0      248536
             libplayer.a        308   21860         0           0           0        22168      107775     92171                0          0      200254
           libnet80211.a        853    8133         0           0           0         8986      120754     12152            10554          0      133759
         libmbedcrypto.a        128      81         0           0           0          209       88544     35412                0          0      124084
            libpthread.a         16      12         0           0           0           28        1451    122301                0          0      123768
           libbtdm_app.a        957    2851         0       30862           0        34670       88437      1143                0          0      121399
             libaacdec.a          0       0         0           0           0            0       84474     33031                0          0      117505
               liblwip.a         12    3725         0           0           0         3737       95690      3471                0          0       99173
                  libc.a        432     320         0        7935           0         8687       83686      5188                0          0       97241
            libmbedtls.a         72     664         0           0           0          736       27302     65923                0          0       93297
      liblibjpeg-turbo.a          0       0         0           0           0            0       75533      3004                0          0       78537
                 libpp.a       2459    1448         0        1528           0         5435       54615      4784              150          0       63386
     libwpa_supplicant.a          8    1316         0           0           0         1324       59226      1680                0          0       60914
             libwnpmp3.a       6684    4096         0        2500           0        13280       30679     19886                0          0       59749
             libdriver.a        292     174         0        5311           0         5777       36760      2901                0          0       45264
                libphy.a        592     640         0        8882           0        10114       33871         0                0          0       43345
               libupnp.a        112    8744         0           0           0         8856       28993        10                0          0       29115
     libesp_hw_support.a        388     135       102       13234           0        13859       12576      1262                0          0       27562
           libhardware.a         24    2257         0          71           0         2352       20216      4353                0          0       24664
           libfreertos.a       3108    1045         0       17374           0        21527         764      1481                0          0       22727
          libnvs_flash.a          0      24         0           0           0           24       16342      4785                0          0       21127
                libhal.a       4498       8         0        8404           0        12910        7873       161                0          0       20936
            libcoexist.a       1685      61         0        2995           0         4741        4097      9506                0          0       18283
             libstdc++.a          8      49         0           0           0           57        4944     10205                0          0       15157
                  libm.a          0       0         0           0           0            0       13951       560                0          0       14511
         libesp_system.a        536     323         0        5015           0         5874        8313       588                0          0       14452
               libheap.a         12       8         0        6517           0         6537        3295      1652                0          0       11476
          libspi_flash.a       1166      16         0        8455           0         9637         832       466                0          0       10919
              libsdmmc.a          0       0         0           0           0            0        9737       769                0          0       10506
                libvfs.a        308      72         0           0           0          380        7682       437                0          0        8427
           libmbedx509.a          0       0         0           0           0            0        8248        45                0          0        8293
          libesp_psram.a          9     100         0        4565           0         4674        2298       166                0          0        7038
                libgcc.a          8       8         0         104           0          120        5913       872                0          0        6897
          libesp_netif.a          8      29         0           0           0           37        6499       119                0          0        6626
            libesp-tls.a          0       4         0           0           0            4        5376        44                0          0        5420
           libesp_wifi.a        472      51         0         384           0          907        3463        70                0          0        4389
             libesp_mm.a         37     124         0         823           0          984        2933       298                0          0        4091
               libmain.a          0    8948         0           0           0         8948        4004         0                0          0        4004
          libesp_event.a          0       4         0           0           0            4        3547       163                0          0        3710
 libbootloader_support.a          0       4         0         794           0          798        2716        88                0          0        3598
             libxtensa.a       1044       0         0        1853         424         3321         104        36                0          0        3461
             libnewlib.a        152     200         0        1612           0         1964        1506        95                0          0        3365
          libesp_timer.a         32      24         0        1503           0         1559        1528       114                0          0        3177
            libesp_phy.a         16      20         0         189           0          225        1875       244                0          0        2324
             libesp_pm.a         12     115         0         923           0         1050        1261        49                0          0        2245
                librtc.a          0       4         0        2195           0         2199           0         0                0          0        2195
                libsoc.a         40       0         0          33           0           73          43      1854                0          0        1970
         libesp_common.a          0       0         0           0           0            0          47      1742                0          0        1789
      libesp_partition.a          0       8         0           0           0            8        1552       168                0          0        1720
              libefuse.a         60       4         0           0           0           64        1226       125                0          0        1411
                liblog.a          8     272         0         312           0          592        1023        39                0          0        1382
            libesp_adc.a          0       0         0           0           0            0         852       500                0          0        1352
        libesp_ringbuf.a          0       0         0         947           0          947           0        97                0          0        1044
         libapp_update.a          0       4         0           0           0            4         658        62                0          0         720
           libesp_coex.a         88       0         0         151           0          239         281         0                0          0         520
             libxt_hal.a          0       0         0         443           0          443           0        32                0          0         475
     libesp_app_format.a          0      10         0           0           0           10         162         4                0        256         422
               libcore.a          0      33         0           0           0           33         247        43                0          0         290
            libesp_rom.a          0       0         0         147           0          147          44         0                0          0         191
                libdsp.a          0       0         0           0           0            0         132         0                0          0         132
                libcxx.a          0       0         0           0           0            0           5       112                0          0         117
                   (exe)          0       0         0           0           3            3           3        12                0          0          18
   libnvs_sec_provider.a          0       0         0           0           0            0           5         0                0          0           5
        libhttp_parser.a          0       0         0           0           0            0           0         0                0          0           0
               libmesh.a          0       0         0           0           0            0           0         0                0          0           0