Compiling the usermod results an error "section `.text1' will not fit in region `iram1_0_seg'"

Dear community,

I have enabled BME280 usermod on WLED v0.14.0 this way:

[env:usermod_bme280_d1_mini]
extends = env:d1_mini
build_flags =
  ${common.build_flags_esp8266}
  -D USERMOD_BME280
lib_deps =
  ${esp8266.lib_deps}
  finitespace/BME280@^3.0.0
  Wire

and that results the error during linking:

Linking .pio\build\usermod_bme280_d1_mini\firmware.elf
c:/users/test/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\usermod_bme280_d1_mini\firmware.elf section `.text1' will not fit in region `iram1_0_seg'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\usermod_bme280_d1_mini\firmware.elf] Error 1
=== [FAILED] Took 36.77 seconds ===

It seems like the firmware does not fit the available memory :sleepy:
I am a bit puzzled, it used to compile fine with WLED v0.13.3.

ESP8266 support has become more and more difficult now that WLED has grown.

I did find an attempt someone used to shoehorn the code into a smaller than normal 8266, but it may help free space by dropping features if you add:

-D WLED_DISABLE_ALEXA
-D WLED_DISABLE_BLYNK
-D WLED_DISABLE_HUESYNC
-D WLED_DISABLE_INFRARED
-D WLED_DISABLE_2D

And in the worst case, even :

-D WLED_DISABLE_OTA

Although that last one will mean you have to do your updates manually, no more Over The Air WiFi updates. Someone else may pop in with suggestions to “drop something else” to allow a BME280 build.

Unfortunately, the writing is on the wall for the 8266 and it will end up being unsupported eventually (not yet).

Use -DPIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48

1 Like

Thanks, -D WLED_DISABLE_INFRARED worked just fine.

Great! -DPIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48 worked as well! Actually that was present in platformio.ini, but I failed to Google that solution.

@blazoncek has far more knowledge than me (or many, many others) on these topics. You would do well to heed his suggestions :wink:

Something interesting was happening. I have tried to upload the compiled firmware to WLED

curl -v -F update=@firmware.bin http://wled.home/update

but it replied Update failed! Please check your file and retry!
When I tried to upload the official firmware

curl -v -F update=@WLED_0.14.0_ESP8266.bin http://wled.home/update

it replied Update successful! Rebooting...
Now two issues:

  • Not clear why my custom firmware was not accepted.
  • After flashing the official firmware, WLED lighted only one LED and didn’t connect to WiFi and neither created a WiFi AP, sort of left in unpredictable state. Are the settings erased during the flashing? Any idea how to recover?