Skip to content

adding Handler serveStatic cause : region `iram0_0_seg' overflowed ESP32 #223

@johnnytolengo

Description

@johnnytolengo

Platform

ESP32

IDE / Tooling

PlatformIO

What happened?

Hi, my ENV:

Chip is ESP32-D0WDQ6

[env:dkdev]
platform = espressif32@6.11.0
framework = arduino
lib_compat_mode = strict
lib_ldf_mode = chain

After calling:
web_server->serveStatic("/", LittleFS, "/www");

I got the following error:

/home/mm/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/dk_st15_v3/firmware.elf section `.iram0.text' will not fit in region `iram0_0_seg'
/home/mm/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: IRAM0 segment data does not fit.
/home/mm/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: region `iram0_0_seg' overflowed by 660 bytes
collect2: error: ld returned 1 exit status

I tried to edit the ~/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/memory.ld
and increase the iram0_0_seg Memory , after that the compile success, no errors. The uploaded code runs badly in a very weird way, eg. printf not working anymore, the web server runs in an extrange way (runs some old version written API)

if I remove the web_server->serveStatic("/", LittleFS, "/www"); line the ESP32 is again working and even compliles without iram0_0_seg oveflow error but without web.

I've been days trying to debug that without success, I have not clue where is the issue.

Stack Trace

/home/mm/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/dk_st15_v3/firmware.elf section .iram0.text' will not fit in region iram0_0_seg'
/home/mm/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: IRAM0 segment data does not fit.
/home/mm/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: region `iram0_0_seg' overflowed by 660 bytes
collect2: error: ld returned 1 exit status

Minimal Reproductible Example (MRE)

#include <Arduino.h>
#include <MyMain.h> //<--Webserver declared here
#include <MainCode.h>

using namespace std;
MyMain myMain;
MainCode mainCode(myMain);

void setup() {
Serial.begin(115200);
vTaskDelay(1000/portTICK_PERIOD_MS);
mainCode.begin(); //<-- Webserver started here from another class
}

void loop() {
}

I confirm that:

  • I have read the documentation.
  • I have searched for similar discussions.
  • I have searched for similar issues.
  • I have looked at the examples.
  • I have upgraded to the lasted version of ESPAsyncWebServer (and AsyncTCP for ESP32).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions