IRAM0 segment data does not fit

HighVoltage
Posts: 54
Joined: Mon Oct 24, 2022 9:37 pm

IRAM0 segment data does not fit

Postby HighVoltage » Fri Jan 10, 2025 10:33 pm

I am adding a BlueTooth feature to my application, and now during linking I am getting link errors:

Code: Select all

ld.exe: myapp.elf section `.iram0.text' will not fit in region `iram0_0_seg'
ld.exe: IRAM0 segment data does not fit.
ld.exe: region `iram0_0_seg' overflowed by 6712 bytes
It looks like the BT library is the largest. Does this all need to be in IRAM? Or any of these others can be configured not to?

This is the size-components:

Code: Select all

            Archive File DRAM .data & 0.bss .rtc_noinit IRAM0 .text & 0.vectors ram_st_total Flash .text & .rodata & .rodata_noload & .appdesc flash_total
                 libbt.a       4485    9279           0         344           0        14108      158730     45027                0          0      208586
               libmain.a        290   55685           2        1043           0        57020      110641     84306                0          0      196282
           libnet80211.a        758    6906           0        5186           0        12850      103318     11859             8073          0      129194
           libbtdm_app.a        957    2851           0       30978           0        34786       88287      5451                0          0      125673
            libarduino.a        326     643           0           0           0          969       88786     29709                0          0      118821
               liblwip.a         21    3840           0           0           0         3861      102578     15544                0          0      118143
                  libc.a          8       0           0           0           0            8       83893      7181                0          0       91082
                 libpp.a       2447    1348           0       18349           0        22144       35120      4817              100          0       60833
         libmbedcrypto.a         64      33           0          30           0          127       52608      5818                0          0       58520
     libwpa_supplicant.a         12    1436           0           0           0         1448       45791      1423                0          0       47226
             libdriver.a        239     168           0        5478           0         5885       27441      9075                0          0       42233
                libphy.a       2361     640           0        8890           0        11891       28989         0                0          0       40240
       libesp_littlefs.a          8      16           0           0           0           24       27582      5522                0          0       33112
           libfreertos.a       4224     741           0       17643         424        23032         337      4566                0          0       27194
          libspi_flash.a       1485     294           0        9622           0        11401        2189      2643                0          0       15939
        libespcoredump.a       5336     972           0           0           0         6308        8602      1177                0          0       15115
          libnvs_flash.a          0      24           0           0           0           24       14526       476                0          0       15002
         libesp_system.a        205     211           0        3487           0         3903        6958      4078                0          0       14728
             libstdc++.a          8      52           0           0           0           60        4219     10025                0          0       14252
                libhal.a        194       0           0        7851           0         8045        4185      1075                0          0       13305
               libheap.a          4       8           0        4880           0         4892        3039      4514                0          0       12437
     libesp_hw_support.a        192      46          16        4590           0         4844        4751      1226                0          0       10775
                libvfs.a        308      60           0           0           0          368        9399       672                0          0       10379
 libbootloader_support.a          0       4           0        1650           0         1654        5170      3335                0          0       10155
          libesp_netif.a         12      24           0           0           0           36        7300      2419                0          0        9731
            libcoexist.a       1737      33           0        2837           0         4607        3666       293                0          0        8533
         libesp_common.a          0       0           0           0           0            0          53      7799                0          0        7852
           libesp_wifi.a        568      36           0         496           0         1100        4643      1979                0          0        7686
              libefuse.a        144     140           0           0           0          284        4893      2220                0          0        7257
        libesp_ringbuf.a          0       0           0        4536           0         4536           0      2544                0          0        7080
          libesp_event.a          0       4           0           0           0            4        3592      1134                0          0        4726
  libwifi_provisioning.a          4       8           0           0           0           12        2803      1123                0          0        3930
          libesp_timer.a         32      24           0        1630           0         1686        1292       942                0          0        3896
            libesp_phy.a         16      25           0         220           0          261        1955      1336                0          0        3527
             libnewlib.a        237     440           0        1476           0         2153        1117       340                0          0        3170
                librtc.a          0       4           0        2199           0         2203           0         0                0          0        2199
         libapp_update.a          1      12           0         194           0          207         991       480                0        256        1922
                libsoc.a         40       0           0         274           0          314           0      1510                0          0        1824
        libsmartconfig.a          2     266           0           0           0          268        1134       520                0          0        1656
            libpthread.a         16      12           0         231           0          259         885       462                0          0        1594
             libxtensa.a       1024       0           0          77           0         1101         126        35                0          0        1262
                liblog.a          8     272           0         277           0          557         831       143                0          0        1259
            libesp_ipc.a         20      72           0         337           0          429         538        98                0          0         993
                libcxx.a          8      16           0           0           0           24         662       225                0          0         895
             libxt_hal.a          0       0           0         443           0          443           0        32                0          0         475
                libgcc.a          0       0           0           0           0            0         210       160                0          0         370
               libcore.a          0      33           0           0           0           33         247        48                0          0         295
      libtcpip_adapter.a          0      17           0           0           0           17         228         0                0          0         228
            libesp_rom.a          0       0           0         212           0          212           0         0                0          0         212
               libjson.a         12       0           0           0           0           12          77         0                0          0          89
          libprotocomm.a          0       0           0           0           0            0          66         0                0          0          66
                   (exe)          0       0           0           0           3            3           3        12                0          0          18
            libesp_eth.a          4       0           0           0           0            4           0        10                0          0          14
                  libm.a          0       0           0           0           0            0          12         0                0          0          12
             libesp_pm.a          0       0           0           0           0            0           8         0                0          0           8
            libmbedtls.a          0       0           0           0           0            0           0         0                0          0           0
           libmbedx509.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
         libprotobuf-c.a          0       0           0           0           0            0           0         0                0          0           0
             libspiffs.a          0       0           0           0           0            0           0         0                0          0           0
This is the size-files

Code: Select all

Total sizes:
Used static DRAM:  115080 bytes (   9500 remain, 92.4% used)
      .data size:   28104 bytes
      .bss  size:   86976 bytes
Used static IRAM:  137782 bytes (  -6710 remain, 105.1% used) Overflow detected!
      .text size:  136755 bytes
   .vectors size:    1027 bytes
Used Flash size : 1360868 bytes
      .text     : 1063263 bytes
      .rodata   :  297349 bytes
Total image size: 1526754 bytes (.bin may be padded larger)
Per-file contributions to ELF file:
             Object File DRAM .data & 0.bss .rtc_noinit IRAM0 .text & 0.vectors ram_st_total Flash .text & .rodata & .rodata_noload & .appdesc flash_total
...
(too large to include)

expresspotato
Posts: 33
Joined: Fri May 28, 2021 1:58 pm

Re: IRAM0 segment data does not fit

Postby expresspotato » Sun Jan 12, 2025 4:26 pm

You can use some of static DRAM as IRAM instead, see:

https://docs.espressif.com/projects/esp ... 1-for-iram

HighVoltage
Posts: 54
Joined: Mon Oct 24, 2022 9:37 pm

Re: IRAM0 segment data does not fit

Postby HighVoltage » Sun Jan 12, 2025 6:52 pm

Thanks for that tip. It seems BlueTooth uses both a lot of static IRAM and DRAM. Probably I will have to switch to a chip with some SPRAM and I can move some DRAM usage to that and then some IRAM can move to DRAM.

Do you know why BlueTooth uses so much of this RAM? Seems to use about 14K DRAM and 31K IRAM. It would be nice if it could be configured not to.

Here is pre BT code added:

Code: Select all

Used static DRAM:  101660 bytes (  22920 remain, 81.6% used)
      .data size:   27100 bytes
      .bss  size:   74560 bytes
Used static IRAM:  106526 bytes (  24546 remain, 81.3% used)
      .text size:  105499 bytes
   .vectors size:    1027 bytes
Used Flash size : 1021832 bytes
      .text     :  778107 bytes
      .rodata   :  243469 bytes
Total image size: 1155458 bytes (.bin may be padded larger)
Per-archive contributions to ELF file:
            Archive File DRAM .data & 0.bss .rtc_noinit IRAM0 .text & 0.vectors ram_st_total Flash .text & .rodata & .rodata_noload & .appdesc flash_total
               libmain.a        290   55468           2        1043           0        56803      109988     84065                0          0      195388
           libnet80211.a        758    6906           0        5186           0        12850      103318     11859             8073          0      129194
               liblwip.a         21    3843           0           0           0         3864      102547     15556                0          0      118124
            libarduino.a        318     613           0           0           0          931       80270     28149                0          0      108737
                  libc.a          8       0           0           0           0            8       58998      6524                0          0       65530
                 libpp.a       2447    1348           0       18353           0        22148       35116      4817              100          0       60833
         libmbedcrypto.a         64      33           0          30           0          127       52592      5818                0          0       58504
     libwpa_supplicant.a         12    1436           0           0           0         1448       45737      1423                0          0       47172
             libdriver.a        239     168           0        5478           0         5885       27481      9075                0          0       42273
                libphy.a       2361     637           0        8894           0        11892       28936         0                0          0       40191
       libesp_littlefs.a          8      16           0           0           0           24       27570      5522                0          0       33100
           libfreertos.a       4224     741           0       17643         424        23032         325      4566                0          0       27182
          libspi_flash.a       1485     294           0        9622           0        11401        2193      2643                0          0       15943
        libespcoredump.a       5336     972           0           0           0         6308        8578      1177                0          0       15091
          libnvs_flash.a          0      24           0           0           0           24       14402       476                0          0       14878
         libesp_system.a        205     211           0        3487           0         3903        6886      4078                0          0       14656
                libhal.a        194       0           0        7851           0         8045        4213      1075                0          0       13333
             libstdc++.a          8      52           0           0           0           60        2856     10001                0          0       12865
               libheap.a          4       8           0        4880           0         4892        3035      4514                0          0       12433
     libesp_hw_support.a        192      46          16        4590           0         4844        4703      1226                0          0       10727
                libvfs.a        308      60           0           0           0          368        9315       672                0          0       10295
 libbootloader_support.a          0       4           0        1650           0         1654        5178      3335                0          0       10163
          libesp_netif.a         12      24           0           0           0           36        7252      2419                0          0        9683
            libcoexist.a       1737      33           0        2849           0         4619        3670       293                0          0        8549
         libesp_common.a          0       0           0           0           0            0          53      7799                0          0        7852
           libesp_wifi.a        568      36           0         496           0         1100        4601      1979                0          0        7644
              libefuse.a        144     140           0           0           0          284        4897      2220                0          0        7261
        libesp_ringbuf.a          0       0           0        4536           0         4536           0      2544                0          0        7080
                 libbt.a       4444       0           0         336           0         4780           0        32                0          0        4812
          libesp_event.a          0       4           0           0           0            4        3596      1134                0          0        4730
  libwifi_provisioning.a          4       8           0           0           0           12        2787      1123                0          0        3914
          libesp_timer.a         32      24           0        1630           0         1686        1288       942                0          0        3892
            libesp_phy.a         16      25           0         220           0          261        1947      1336                0          0        3519
             libnewlib.a        237     440           0        1476           0         2153        1117       340                0          0        3170
         libapp_update.a          1      12           0         194           0          207         991       480                0        256        1922
                libsoc.a         40       0           0         274           0          314           0      1510                0          0        1824
                librtc.a          0       4           0        1673           0         1677           0         0                0          0        1673
        libsmartconfig.a          2     266           0           0           0          268        1134       520                0          0        1656
            libpthread.a         16      12           0         231           0          259         885       462                0          0        1594
             libxtensa.a       1024       0           0          77           0         1101         126        35                0          0        1262
                liblog.a          8     272           0         277           0          557         827       143                0          0        1255
            libesp_ipc.a         20      72           0         337           0          429         518        98                0          0         973
                libcxx.a          8      16           0           0           0           24         662       225                0          0         895
           libbtdm_app.a          6       0           0         428           0          434           0        77                0          0         511
             libxt_hal.a          0       0           0         443           0          443           0        32                0          0         475
                libgcc.a          0       0           0           0           0            0         210       160                0          0         370
               libcore.a          0      33           0           0           0           33         247        48                0          0         295
      libtcpip_adapter.a          0      17           0           0           0           17         216         0                0          0         216
            libesp_rom.a          0       0           0         212           0          212           0         0                0          0         212
               libjson.a         12       0           0           0           0           12          77         0                0          0          89
          libprotocomm.a          0       0           0           0           0            0          66         0                0          0          66
                   (exe)          0       0           0           0           3            3           3        12                0          0          18
            libesp_eth.a          4       0           0           0           0            4           0        10                0          0          14
             libesp_pm.a          0       0           0           0           0            0           8         0                0          0           8
                  libm.a          0       0           0           0           0            0           0         0                0          0           0
            libmbedtls.a          0       0           0           0           0            0           0         0                0          0           0
           libmbedx509.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
         libprotobuf-c.a          0       0           0           0           0            0           0         0                0          0           0
             libspiffs.a          0       0           0           0           0            0           0         0                0          0           0
After adding BT: (very small amount / trivial application code)

Code: Select all

Used static DRAM:  115080 bytes (   9500 remain, 92.4% used)
      .data size:   28104 bytes
      .bss  size:   86976 bytes
Used static IRAM:  137782 bytes (  -6710 remain, 105.1% used) Overflow detected!
      .text size:  136755 bytes
   .vectors size:    1027 bytes
Used Flash size : 1360868 bytes
      .text     : 1063263 bytes
      .rodata   :  297349 bytes
Total image size: 1526754 bytes (.bin may be padded larger)
Per-archive contributions to ELF file:
            Archive File DRAM .data & 0.bss .rtc_noinit IRAM0 .text & 0.vectors ram_st_total Flash .text & .rodata & .rodata_noload & .appdesc flash_total
                 libbt.a       4485    9279           0         344           0        14108      158730     45027                0          0      208586
               libmain.a        290   55685           2        1043           0        57020      110641     84306                0          0      196282
           libnet80211.a        758    6906           0        5186           0        12850      103318     11859             8073          0      129194
           libbtdm_app.a        957    2851           0       30978           0        34786       88287      5451                0          0      125673
            libarduino.a        326     643           0           0           0          969       88786     29709                0          0      118821
               liblwip.a         21    3840           0           0           0         3861      102578     15544                0          0      118143
                  libc.a          8       0           0           0           0            8       83893      7181                0          0       91082
                 libpp.a       2447    1348           0       18349           0        22144       35120      4817              100          0       60833
         libmbedcrypto.a         64      33           0          30           0          127       52608      5818                0          0       58520
     libwpa_supplicant.a         12    1436           0           0           0         1448       45791      1423                0          0       47226
             libdriver.a        239     168           0        5478           0         5885       27441      9075                0          0       42233
                libphy.a       2361     640           0        8890           0        11891       28989         0                0          0       40240
       libesp_littlefs.a          8      16           0           0           0           24       27582      5522                0          0       33112
           libfreertos.a       4224     741           0       17643         424        23032         337      4566                0          0       27194
          libspi_flash.a       1485     294           0        9622           0        11401        2189      2643                0          0       15939
        libespcoredump.a       5336     972           0           0           0         6308        8602      1177                0          0       15115
          libnvs_flash.a          0      24           0           0           0           24       14526       476                0          0       15002
         libesp_system.a        205     211           0        3487           0         3903        6958      4078                0          0       14728
             libstdc++.a          8      52           0           0           0           60        4219     10025                0          0       14252
                libhal.a        194       0           0        7851           0         8045        4185      1075                0          0       13305
               libheap.a          4       8           0        4880           0         4892        3039      4514                0          0       12437
     libesp_hw_support.a        192      46          16        4590           0         4844        4751      1226                0          0       10775
                libvfs.a        308      60           0           0           0          368        9399       672                0          0       10379
 libbootloader_support.a          0       4           0        1650           0         1654        5170      3335                0          0       10155
          libesp_netif.a         12      24           0           0           0           36        7300      2419                0          0        9731
            libcoexist.a       1737      33           0        2837           0         4607        3666       293                0          0        8533
         libesp_common.a          0       0           0           0           0            0          53      7799                0          0        7852
           libesp_wifi.a        568      36           0         496           0         1100        4643      1979                0          0        7686
              libefuse.a        144     140           0           0           0          284        4893      2220                0          0        7257
        libesp_ringbuf.a          0       0           0        4536           0         4536           0      2544                0          0        7080
          libesp_event.a          0       4           0           0           0            4        3592      1134                0          0        4726
  libwifi_provisioning.a          4       8           0           0           0           12        2803      1123                0          0        3930
          libesp_timer.a         32      24           0        1630           0         1686        1292       942                0          0        3896
            libesp_phy.a         16      25           0         220           0          261        1955      1336                0          0        3527
             libnewlib.a        237     440           0        1476           0         2153        1117       340                0          0        3170
                librtc.a          0       4           0        2199           0         2203           0         0                0          0        2199
         libapp_update.a          1      12           0         194           0          207         991       480                0        256        1922
                libsoc.a         40       0           0         274           0          314           0      1510                0          0        1824
        libsmartconfig.a          2     266           0           0           0          268        1134       520                0          0        1656
            libpthread.a         16      12           0         231           0          259         885       462                0          0        1594
             libxtensa.a       1024       0           0          77           0         1101         126        35                0          0        1262
                liblog.a          8     272           0         277           0          557         831       143                0          0        1259
            libesp_ipc.a         20      72           0         337           0          429         538        98                0          0         993
                libcxx.a          8      16           0           0           0           24         662       225                0          0         895
             libxt_hal.a          0       0           0         443           0          443           0        32                0          0         475
                libgcc.a          0       0           0           0           0            0         210       160                0          0         370
               libcore.a          0      33           0           0           0           33         247        48                0          0         295
      libtcpip_adapter.a          0      17           0           0           0           17         228         0                0          0         228
            libesp_rom.a          0       0           0         212           0          212           0         0                0          0         212
               libjson.a         12       0           0           0           0           12          77         0                0          0          89
          libprotocomm.a          0       0           0           0           0            0          66         0                0          0          66
                   (exe)          0       0           0           0           3            3           3        12                0          0          18
            libesp_eth.a          4       0           0           0           0            4           0        10                0          0          14
                  libm.a          0       0           0           0           0            0          12         0                0          0          12
             libesp_pm.a          0       0           0           0           0            0           8         0                0          0           8
            libmbedtls.a          0       0           0           0           0            0           0         0                0          0           0
           libmbedx509.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
         libprotobuf-c.a          0       0           0           0           0            0           0         0                0          0           0
             libspiffs.a          0       0           0           0           0            0           0         0                0          0           0

Who is online

Users browsing this forum: Baidu [Spider], Bytespider, PetalBot, Qwantbot and 14 guests