Migration from 4.1.1 to 4.4.4 IRAM usage increases over 175%

User avatar
Alexandr
Posts: 2
Joined: Thu Mar 30, 2023 9:27 am

Migration from 4.1.1 to 4.4.4 IRAM usage increases over 175%

Postby Alexandr » Thu Mar 30, 2023 10:12 am

After change ESP-IDF from 4.1.1 to 4.4.4 and compile project, I was very surprised by the increased volume of IRAM usage from ~54Kb to ~123Kb. Comparsion table is below:

  1. Component               IDF 4.1.1   IDF 4.4.4   DIFF
  2. libapp_update.a         154         371         -217
  3. libbootloader_support.a 863         2657        -1794
  4. libbutton.a             22          76          -54
  5. libcharge_status.a      40          102         -62
  6. libcoexist.a            3700        3185        515
  7. libesp_ringbuf.a        3398        5705        -2307
  8. libesp_wifi.a           469         840         -371
  9. libfreertos.a           14870       28327       -13457
  10. libhal.a                443         9806        -9363
  11. libheap.a               1740        17483       -15743
  12. liblis2dh12_routine.a   34          95          -61
  13. liblog.a                258         43          215
  14. libnewlib.a             804         2298        -1494
  15. libpthread.a            186         287         -101
  16. libqma7981_routine.a    18          28          -10
  17. librtc.a                2239        2211        28
  18. libspi_flash.a          5667        15657       -9990
  19. libxtensa.a             145         117         28
  20. libdriver.a             1907        0           1907
  21. libesp_common.a         932         0           932
  22. libesp32.a              8104        0           8104
  23. libgcc.a                193         0           193
  24. libsoc.a                8194        0           8194
  25. libactive.a             0           46          -46
  26. libaht10.a              0           46          -46
  27. libcoap_urls.a          0           46          -46
  28. libdebug_console.a      0           46          -46
  29. libesp_hw_support.a     0           14907       -14907
  30. libesp_ipc.a            0           890         -890
  31. libesp_phy.a            0           221         -221
  32. libesp_pm.a             0           1823        -1823
  33. libesp_rom.a            0           303         -303
  34. libesp_system.a         0           4834        -4834
  35. libesp_timer.a          0           2296        -2296
  36. libfailure.a            0           46          -46
  37. libgsm.a                0           92          -92
  38. libindication.a         0           46          -46
  39. liblogic_event_processor0           46          -46
  40. libmultisensor.a        0           46          -46
  41. libota.a                0           46          -46
  42. libphy.a                0           7762        -7762
  43. libqma7981.a            0           46          -46
  44. libservice.a            0           46          -46
  45. libsettings.a           0           46          -46
  46. libsntp_runner.a        0           46          -46
  47. libsystem_info.a        0           46          -46
  48. libwho_am_i.a           0           46          -46
  49. libxt_hal.a             0           443         -443
  50. TOTAL:                  54380       123549      -69169

According to the table, you can see that the amount of IRAM memory usage has increased by 69.1 Kb. The source codes were changed minimally, only for compilation complete successful. Only names of some types and structures have changed, for example:

it was coap_tid_t, it became coap_mid_t, and so on.

I have not found any new IDF settings regarding IRAM. Is the new IDF that fat? What then is in version 5.x.x?

Link result:

Code: Select all

xtensa-esp32-elf/bin/ld: region `iram0_0_seg' overflowed by 32380 bytes
Are there any compilation options or settings that can quickly minimize the use of IRAM ??

ESP_Mahavir
Posts: 188
Joined: Wed Jan 24, 2018 6:51 am

Re: Migration from 4.1.1 to 4.4.4 IRAM usage increases over 175%

Postby ESP_Mahavir » Sun Apr 02, 2023 3:48 pm

Are there any compilation options or settings that can quickly minimize the use of IRAM ??

We have a guide to optimize on the IRAM usage: https://docs.espressif.com/projects/esp ... iram-usage

User avatar
Alexandr
Posts: 2
Joined: Thu Mar 30, 2023 9:27 am

Re: Migration from 4.1.1 to 4.4.4 IRAM usage increases over 175%

Postby Alexandr » Mon Apr 03, 2023 6:27 am

ESP_Mahavir wrote:
Sun Apr 02, 2023 3:48 pm
Are there any compilation options or settings that can quickly minimize the use of IRAM ??

We have a guide to optimize on the IRAM usage: https://docs.espressif.com/projects/esp ... iram-usage
The application of all the recommendations gave an insignificant result...
Overflows IRAM changed from 32380 to 30672.

First of all, I wonder where so much memory comes from in the new versions of these components?

Code: Select all

Component               IDF 4.1.1I  DF4.4.4	DIFF
libfreertos.a           14870       28327       -13457
libhal.a                443         9806        -9363
libheap.a               1740        17483       -15743
libspi_flash.a          5667        15657       -9990
libesp_hw_support.a     0           14907       -14907
For example libspi_flash.a, it was 5667 bytes, it became 15657 bytes???
I didn't find any settings that affect the memory of the SPI_Flash component so much, as well as libhal and others.

Do you have any ideas on the components above?

ESP_Mahavir
Posts: 188
Joined: Wed Jan 24, 2018 6:51 am

Re: Migration from 4.1.1 to 4.4.4 IRAM usage increases over 175%

Postby ESP_Mahavir » Thu Apr 06, 2023 5:59 am

Hello,

Would it be possible for you to compare any IDF example that is close to your use-case and compare its memory numbers against 4.1.1 and 4.4.4 release? Please share the application and sdk configuration, I will take a look..

Note: Tool `idf_size.py` also supports `--diff` command where it can present the difference in the memory numbers between 2 application map files.

Thanks.

Who is online

Users browsing this forum: ESP_rrtandler and 129 guests