IRAM segment overflows when external PSRAM enabled

BennoTr
Posts: 5
Joined: Fri Mar 02, 2018 9:53 am

IRAM segment overflows when external PSRAM enabled

Postby BennoTr » Wed May 13, 2020 3:56 pm

Hi.

I have a ESP32 project based on ESP-IDF branch /release/v4.0, which uses Wifi and BLE (Nimble stack). Until now I built the project with disabled external RAM and idf.py size-components gave the following sizes:

Code: Select all

Total sizes:
 DRAM .data size:   17816 bytes
 DRAM .bss  size:   49064 bytes
Used static DRAM:   66880 bytes (  57700 available, 53.7% used)
Used static IRAM:  122821 bytes (   8251 available, 93.7% used)
      Flash code:  966401 bytes
    Flash rodata:  255272 bytes
Total image size:~1362310 bytes (.bin may be padded larger)
Per-archive contributions to ELF file:
            Archive File DRAM .data & .bss   IRAM Flash code & rodata   Total
              libcloud.a       1564  12724      0     111723    61595  187606
           libnet80211.a        971   9190  11383      96843    23460  141847
               liblwip.a         21   4422      0     101501    20434  126378
                 libbt.a        197   6044    494      76654    13473   96862
                  libc.a        364     20      0      86472     8430   95286
         libmbedcrypto.a         64     85     30      81602    11637   93418
           libbtdm_app.a        347   2386  21281      61422     4136   89572
     libwpa_supplicant.a          8    800      0      57343    22397   80548
                 libpp.a       1317   5415  22950      36015     4280   69977
             libdriver.a        168    122   3051      37785    12162   53288
               libmain.a        123   1939    228      24810    13671   40771
                libphy.a       1604    930   6483      30567        0   39584
            libmbedtls.a         60    200      0      26447     5206   31913
           libfreertos.a       4140    776  15574          0     2114   22604
              libesp32.a       2570    133   7592       7052     4252   21599
          libnvs_flash.a          0     32      0      15297     3523   18852
             libnghttp.a          0      0      0      14246     4002   18248
                libsoc.a        184      4   7024        935     4220   12367
    libesp_http_client.a          0      0      0       8314     3321   11635
          libspi_flash.a        808    294   6488       1747     1522   10859
            libcoexist.a       2042     28   3842       4402      325   10639
            libconsole.a          4     52      0       8725     1334   10115
                libvfs.a        308     48      0       7697     1038    9091
           libmbedx509.a          0      0      0       7487     1406    8893
          libesp_event.a          0      4      0       4911     3875    8790
 libbootloader_support.a          0      4   1020       4473     3050    8547
         libesp_common.a         16   2240   1060       1362     3410    8088
      libtcpip_adapter.a          4    161      0       5039     1863    7067
           libesp_wifi.a         28     42    262       3279     2940    6551
                libgcc.a          4     12    193       5383      872    6464
            libesp-tls.a          0      4      0       4007     2298    6309
               libheap.a        301      8   3396       1439      766    5910
            libcmd_nvs.a         16     64      0       3162     2095    5337
                  libm.a          4      0      0       4969       69    5042
        libesp_ringbuf.a          0      0   4318          0      559    4877
      libtcp_transport.a          0      0      0       3517     1000    4517
             libstdc++.a          8     20      0       2554     1044    3626
      libesp_https_ota.a          0      0      0       1732     1370    3102
         libapp_update.a          1     20    190       1648      977    2836
             libnewlib.a        152    272    820       1342       85    2671
              libefuse.a         52      4      0       1323      938    2317
                librtc.a          0      4   2243          0        0    2247
        libesp_adc_cal.a          0      0      0        999      658    1657
                liblog.a          8    268    491        698       96    1561
            libpthread.a         16     12    243        783      503    1557
               libcore.a          0     29      0        607      228     864
                libhal.a          0      0    519          0       32     551
             libxtensa.a          0      0    225          0        0     225
            libesp_eth.a          4      0      0          0       10      14
                libcxx.a          0      0      0         11        0      11
                   (exe)          0      0      0          0        0       0
               libmesh.a          0      0      0          0        0       0
I enabled the external PSRAM and now the linker gives the following error:

Code: Select all

tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/ld.exe: c0020.elf section `.iram0.text' will not fit in region `iram0_0_seg'
tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/ld.exe: IRAM0 segment data does not fit.
tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/ld.exe: region `iram0_0_seg' overflowed by 19617 bytes
How can I get the project built with enabled external RAM?

Regards,
Benno

BennoTr
Posts: 5
Joined: Fri Mar 02, 2018 9:53 am

Re: IRAM segment overflows when external PSRAM enabled

Postby BennoTr » Thu May 14, 2020 9:08 am

Hi.

I disabled now the two options CONFIG_ESP32_WIFI_IRAM_OPT and CONFIG_ESP32_WIFI_RX_IRAM_OPT. With this there is enough space in the IRAM segment. According to the idf.py size-components the libc.a and libesp32.a need much more space in IRAM when the external PSRAM is enabled. Also the total image size increases by almost 130KiB without changing anything the application.

Regards,
Benno

Code: Select all

Total sizes:
 DRAM .data size:   19104 bytes
 DRAM .bss  size:   49264 bytes
Used static DRAM:   68368 bytes (  56212 available, 54.9% used)
Used static IRAM:  118037 bytes (  13035 available, 90.1% used)
      Flash code: 1079425 bytes
    Flash rodata:  274040 bytes
Total image size:~1490606 bytes (.bin may be padded larger)
Per-archive contributions to ELF file:
            Archive File DRAM .data & .bss   IRAM Flash code & rodata   Total
              libcloud.a       1564  12724      0     117688    61595  193571
           libnet80211.a        971   9190     44     107607    23460  141272
               liblwip.a         21   4422      0     113224    20434  138101
                 libbt.a        261   6044    493      85090    13473  105361
                  libc.a       1563     62  14779      98900     8430  123734
         libmbedcrypto.a         64     85     30      88479    11637  100295
           libbtdm_app.a        347   2386  21241      61226     4136   89336
     libwpa_supplicant.a          8    800      0      62034    22397   85239
                 libpp.a       1317   5415   1604      56467     4280   69083
             libdriver.a        171    134   3581      43534    12275   59695
               libmain.a        123   1939    256      27688    13671   43677
                libphy.a       1604    930   6483      30583        0   39600
            libmbedtls.a         60    200      0      29450     5206   34916
           libfreertos.a       4148    776  17679          0     2332   24935
              libesp32.a       2578    182  16649      18090    22478   59977
          libnvs_flash.a          0     32      0      16878     3523   20433
             libnghttp.a          0      0      0      15469     4002   19471
                libsoc.a        184      4   8291       1068     4382   13929
    libesp_http_client.a          0      0      0       9369     3321   12690
          libspi_flash.a        808    294   6811       1878     1522   11313
            libcoexist.a       2042     28   3834       4402      325   10631
            libconsole.a          4     52      0       9504     1334   10894
                libvfs.a        308     48      0       8129     1038    9523
           libmbedx509.a          0      0      0       7959     1406    9365
          libesp_event.a          0      4      0       5254     3875    9133
 libbootloader_support.a          0      4      0       4753     3062    7819
         libesp_common.a         16   2332   1112       1534     3410    8404
      libtcpip_adapter.a          4    161      0       5483     1863    7511
           libesp_wifi.a         28     42    266       3615     2623    6574
                libgcc.a          4     12    193       5751      872    6832
            libesp-tls.a          0      4      0       4188     2298    6490
               libheap.a        301      8   3552       1555      766    6182
            libcmd_nvs.a         16     64      0       3253     2095    5428
                  libm.a          4      0      0       5207       69    5280
        libesp_ringbuf.a          0      0   4830          0      559    5389
      libtcp_transport.a          0      0      0       3864     1000    4864
             libstdc++.a          8     20      0       2646     1044    3718
      libesp_https_ota.a          0      0      0       1752     1370    3122
         libapp_update.a          1     20    216       1720      977    2934
             libnewlib.a        152    272    869       1430       85    2808
              libefuse.a         52      4      0       1367      938    2361
                librtc.a          0      4   2243          0        0    2247
        libesp_adc_cal.a          0      0      0       1033      658    1691
                liblog.a          8    268    519        758       96    1649
            libpthread.a         16     12    243        827      503    1601
               libcore.a          0     29      0        623      228     880
                libhal.a          0      0    519          0       32     551
             libxtensa.a          0      0    245          0        0     245
            libesp_eth.a          4      0      0          0       10      14
                libcxx.a          0      0      0         11        0      11
                   (exe)          0      0      0          0        0       0
               libmesh.a          0      0      0          0        0       0

sanketa
Posts: 2
Joined: Mon Aug 31, 2020 6:35 am

Re: IRAM segment overflows when external PSRAM enabled

Postby sanketa » Mon Aug 31, 2020 6:39 am

Hi,
I'm also same NimBLE , Wifi and MQTT.
1. Can u please tell me how u have integrated pSRAM with ESP32 ?
2. I have gone through https://docs.espressif.com/projects/esp ... config-bss.---- But not getting 1st and 4th mode.
3. As u have already implemented ESP32 and pSRAM.... can u suggest me the most efficient way to use pSRAM ?


Awaiting for your reply.

Who is online

Users browsing this forum: No registered users and 339 guests