Different memory mapping for ESP32 and ESP32S3 (section `.dram0.bss' will not fit in region `dram0_0_seg')

copych
Posts: 20
Joined: Tue Mar 07, 2023 6:04 pm

Different memory mapping for ESP32 and ESP32S3 (section `.dram0.bss' will not fit in region `dram0_0_seg')

Postby copych » Thu Mar 21, 2024 6:39 am

I have a project that is compiled and run with no problems when target is ESP32S3, but won't compile when I set ESP32.
It sais

Code: Select all

c:/users/x/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\x\AppData\Local\Temp\arduino\sketches\FB7E891079563933D93E7E44B6280E7E/x.ino.elf section `.dram0.bss' will not fit in region `dram0_0_seg'
c:/users/x/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: DRAM segment data does not fit.
c:/users/x/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: DRAM segment data does not fit.
c:/users/x/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: region `dram0_0_seg' overflowed by 41496 bytes
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1
Is it possible to fix generally? I mean to make it compile not just for me, but for anybody. AFAIK ESP32 has even slightly more RAM than S3.

copych
Posts: 20
Joined: Tue Mar 07, 2023 6:04 pm

Re: Different memory mapping for ESP32 and ESP32S3 (section `.dram0.bss' will not fit in region `dram0_0_seg')

Postby copych » Thu Mar 21, 2024 12:44 pm

Ok... for those interested. I still wonder how I can change the size of memory segments in Arduino (if possible at all).
The solution for me right now is declaring members of a class as pointer types instead of typed variables, and then initializing them in runtime with new or malloc() etc. Some are arrays, some are structs and they quickly get tens of kBytes. For some reason ESP32S3 can handle it, while ESP32 can't.

MicroController
Posts: 1734
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Different memory mapping for ESP32 and ESP32S3 (section `.dram0.bss' will not fit in region `dram0_0_seg')

Postby MicroController » Thu Mar 21, 2024 2:51 pm

The ESP32's RAM is somewhat 'segmented' in hardware (see e.g. here); there's Instruction RAM (IRAM) and Data RAM (DRAM), where 192kb of IRAM are not available as general data storage, and there's a limit of 160kb for static allocations according to https://docs.espressif.com/projects/esp ... m-data-ram
The -S3 is more flexible in this regard, where 400+kb of contiguous addresses in RAM can be used for instructions or data as the application desires.
I don't think there's much one could do to overcome the limits on the ESP32.

copych
Posts: 20
Joined: Tue Mar 07, 2023 6:04 pm

Re: Different memory mapping for ESP32 and ESP32S3 (section `.dram0.bss' will not fit in region `dram0_0_seg')

Postby copych » Fri Mar 22, 2024 8:01 am

MicroController wrote: The ESP32's RAM is somewhat 'segmented' in hardware (see e.g. here); there's Instruction RAM (IRAM) and Data RAM (DRAM), where 192kb of IRAM are not available as general data storage, and there's a limit of 160kb for static allocations according to https://docs.espressif.com/projects/esp ... m-data-ram
The -S3 is more flexible in this regard, where 400+kb of contiguous addresses in RAM can be used for instructions or data as the application desires.
I don't think there's much one could do to overcome the limits on the ESP32.
Thank you so much for such an explanation! Now I understand what is the root of my suffering ))))

Who is online

Users browsing this forum: No registered users and 61 guests