For months I haven't been able to install basic firmware on any ESP32 device

I have tried many different board versions, brand new, very basic config, but it just won’t work.
I have 7 ESP32 boards that have been working flawlessly for over a year, but for some reason, at some point, I started getting errors when trying to setup new boards.
Setting up new boards using ESPHome web install works, but once compiling a new very basic config in HA, I get this everytime:

INFO ESPHome 2024.12.2
INFO Reading configuration /config/esphome/esphome-web-ddfbc8.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esphome-web-ddfbc8 (board: esp32dev; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
Removing unused dependencies...
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- WiFi @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- Update @ 2.0.0
|-- noise-c @ 0.1.6
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/api/api_connection.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/api/api_frame_helper.cpp.o
during RTL pass: final
In file included from src/esphome/components/api/api_frame_helper.cpp:1:
src/esphome/components/api/api_frame_helper.h: In member function 'virtual std::__cxx11::string esphome::api::APINoiseFrameHelper::getpeername()':
src/esphome/components/api/api_frame_helper.h:88:77: internal compiler error: in gen_decl_die, at dwarf2out.c:26475
   std::string getpeername() override { return this->socket_->getpeername(); }
                                                                             ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
*** [.pioenvs/esphome-web-ddfbc8/src/esphome/components/api/api_frame_helper.cpp.o] Error 1
during RTL pass: final
In file included from src/esphome/components/api/api_connection.h:7,
                 from src/esphome/components/api/api_connection.cpp:1:
src/esphome/components/api/api_pb2_service.h: In member function 'virtual void esphome::api::APIServerConnectionBase::on_get_time_response(const esphome::api::GetTimeResponse&)':
src/esphome/components/api/api_pb2_service.h:94:67: internal compiler error: in gen_decl_die, at dwarf2out.c:26475
   virtual void on_get_time_response(const GetTimeResponse &value){};
                                                                   ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
*** [.pioenvs/esphome-web-ddfbc8/src/esphome/components/api/api_connection.cpp.o] Error 1
========================== [FAILED] Took 0.97 seconds ==========================

I have bought numerous different board versions but it’s the same thing everytime.
I only get this error when the framework type is set to arduino. Whe it’s set to esp-idf it compiles fine.
I saw a few posts with the same issue but none of the solutions worked.
I have so many projects waiting, but I’m stuck.

Edit:
Example of very basic config:

esphome:
  name: esp32-no10
  friendly_name: ESP32 no10
  min_version: 2024.11.0
  name_add_mac_suffix: false

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret esp32no10_api_key

# Allow Over-The-Air updates
ota:
- platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.86.194
    gateway: 192.168.86.1
    subnet: 255.255.255.0
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: !secret esp32no10_ap_ssid
    password: !secret esp32no10_ap_password

Just updated ESPHome Device Builder tyo the latest version and now I cannot update any of my devices because they all throw that error. I have no idea what to do :sob:

hello,

do you have enough RAM?
what is your setup?

1 Like

Hi, yeah I’m pretty sure I have enough ram because when framework type is set to esp-idf, it compiles like it should. See:

esp32:
  board: esp32dev
  framework:
    type: esp-idf

Compiling:

Summary
INFO ESPHome 2024.12.4
INFO Reading configuration /config/esphome/esphome-web-ddfbc8.yaml...
INFO Generating C++ source...
INFO Updating https://github.com/espressif/[email protected]
INFO Compiling app...
Processing esphome-web-ddfbc8 (board: esp32dev; framework: espidf; platform: https://github.com/pioarduino/platform-espressif32.git#51.03.07)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.50105.0 (5.1.5) 
 - tool-cmake @ 3.21.3 
 - tool-esptoolpy @ 4.8.1 
 - tool-mklittlefs @ 3.2.0 
 - tool-ninja @ 1.7.1 
 - tool-riscv32-esp-elf-gdb @ 12.1.0+20221002 
 - tool-xtensa-esp-elf-gdb @ 12.1.0+20221002 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-xtensa-esp32 @ 12.2.0+20230208
Creating a new virtual environment for IDF Python dependencies
Installing ESP-IDF's Python dependencies
Collecting wheel>=0.35.1
  Downloading wheel-0.45.1-py3-none-any.whl (72 kB)

[...]

Installing collected packages: wheel, urllib3, typing-extensions, tqdm, pyyaml, python-dotenv, pyparsing, pycparser, kconfiglib, jsonref, idna, future, colorama, click, charset-normalizer, certifi, annotated-types, requests, pydantic-core, esp-idf-kconfig, cffi, requests-toolbelt, requests-file, pydantic, cryptography, pydantic-settings, idf-component-manager
Successfully installed annotated-types-0.7.0 certifi-2024.12.14 cffi-1.17.1 charset-normalizer-3.4.1 click-8.1.8 colorama-0.4.6 cryptography-41.0.7 esp-idf-kconfig-1.5.0 future-1.0.0 idf-component-manager-2.0.4 idna-3.10 jsonref-1.1.0 kconfiglib-14.1.0 pycparser-2.22 pydantic-2.10.5 pydantic-core-2.27.2 pydantic-settings-2.7.1 pyparsing-3.2.1 python-dotenv-1.0.1 pyyaml-6.0.2 requests-2.32.3 requests-file-2.1.0 requests-toolbelt-1.0.0 tqdm-4.67.1 typing-extensions-4.12.2 urllib3-1.26.20 wheel-0.45.1
Reading CMake configuration...
Generating assembly for certificate bundle...
No dependencies
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/api/api_connection.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/api/api_frame_helper.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/api/api_pb2.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/api/api_pb2_service.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/api/api_server.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/api/list_entities.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/api/proto.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/api/subscribe_state.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/api/user_services.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/esp32/core.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/esp32/gpio.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/esp32/preferences.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/esphome/ota/ota_esphome.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/logger/logger.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/logger/logger_esp32.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/logger/logger_esp8266.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/logger/logger_host.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/logger/logger_libretiny.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/logger/logger_rp2040.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/md5/md5.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/mdns/mdns_component.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/mdns/mdns_esp32.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/mdns/mdns_esp8266.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/mdns/mdns_host.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/mdns/mdns_libretiny.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/mdns/mdns_rp2040.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/network/util.cpp.o

[...]

Linking .pioenvs/esphome-web-ddfbc8/bootloader.elf
Building .pioenvs/esphome-web-ddfbc8/bootloader.bin
Creating esp32 image...
Successfully created esp32 image.
Generating partitions .pioenvs/esphome-web-ddfbc8/partitions.bin
Generating an empty partition .pioenvs/esphome-web-ddfbc8/ota_data_initial.bin
Linking .pioenvs/esphome-web-ddfbc8/firmware.elf
RAM:   [=         ]   9.8% (used 32228 bytes from 327680 bytes)
Flash: [====      ]  44.5% (used 816901 bytes from 1835008 bytes)
Building .pioenvs/esphome-web-ddfbc8/firmware.bin
Creating esp32 image...
Successfully created esp32 image.
esp32_create_combined_bin([".pioenvs/esphome-web-ddfbc8/firmware.bin"], [".pioenvs/esphome-web-ddfbc8/firmware.elf"])
Wrote 0xd90b0 bytes to file /data/build/esphome-web-ddfbc8/.pioenvs/esphome-web-ddfbc8/firmware.factory.bin, ready to flash to offset 0x0
esp32_copy_ota_bin([".pioenvs/esphome-web-ddfbc8/firmware.bin"], [".pioenvs/esphome-web-ddfbc8/firmware.elf"])
======================== [SUCCESS] Took 118.41 seconds ========================
INFO Successfully compiled program.
INFO Connecting to 192.168.86.194 port 3232...
INFO Connected to 192.168.86.194
INFO Uploading /data/build/esphome-web-ddfbc8/.pioenvs/esphome-web-ddfbc8/firmware.bin (823472 bytes)
Uploading: [============================================================] 100% Done...

INFO Upload took 15.65 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.86.194 using esphome API
INFO Successfully connected to esphome-web-ddfbc8 @ 192.168.86.194 in 19.358s
INFO Successful handshake with esphome-web-ddfbc8 @ 192.168.86.194 in 0.024s

The HAOS VM has 8192MB of memory, 2 cores, 216GB (SSD) drive space on a machine that has 32GB of memory on a Windows 11 host.
When compiling, memory usage reported by HA tops at 18% while CPU tops at 98%.

Actually, I was wrong, the problem is not the api file, because when I try compiling after deleting the api reference from the config file I get this:

INFO ESPHome 2024.12.4
INFO Reading configuration /config/esphome/esphome-web-ddfbc8.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esphome-web-ddfbc8 (board: esp32dev; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- WiFi @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- Update @ 2.0.0
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/esp32/core.cpp.o
Compiling .pioenvs/esphome-web-ddfbc8/src/esphome/components/esp32/gpio.cpp.o
during RTL pass: vartrack
In file included from src/esphome/core/hal.h:4,
                 from src/esphome/components/esp32/gpio.h:4,
                 from src/esphome/components/esp32/gpio.cpp:3:
src/esphome/core/gpio.h: In member function 'virtual bool esphome::InternalGPIOPin::is_internal()':
src/esphome/core/gpio.h:91:46: internal compiler error: Segmentation fault
   bool is_internal() override { return true; }
                                              ^
xtensa-esp32-elf-g++: internal compiler error: Segmentation fault signal terminated program cc1plus
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
*** [.pioenvs/esphome-web-ddfbc8/src/esphome/components/esp32/gpio.cpp.o] Error 4
during RTL pass: final
src/esphome/components/esp32/core.cpp: In function 'void esphome::delayMicroseconds(uint32_t)':
src/esphome/components/esp32/core.cpp:28:82: internal compiler error: in gen_decl_die, at dwarf2out.c:26475
 void IRAM_ATTR HOT delayMicroseconds(uint32_t us) { delay_microseconds_safe(us); }
                                                                                  ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
*** [.pioenvs/esphome-web-ddfbc8/src/esphome/components/esp32/core.cpp.o] Error 1
========================== [FAILED] Took 1.55 seconds ==========================

Looks like the problem always happens after compiling core.cpp. Or it’s always the second file to be compiled whatever it is?

Hello,

don’t know in this case.

Try to limit the processes with compile process limit:

esphome:
  name: $hostname
  platform: $platform
  board: $board
  compile_process_limit: 1

No luck.
At this point, there must be something corrupted. Compiling on a different Windows machine worked, no errors. I’ll try uninstalling the device builder and reinstalling. Hopefully that will clean everything and start the whole thing over. I believe backing up my yaml files and adding them back after should be enough…?

Hi,

Don’t know your installation but in the esphome\config you find the yaml of your devices.
You have to restore these in the new installation config folder.
The rest should not be necessary, as per my experience.

So, some files got corrupted because uninstalling then reinstalling the Device Builder fixed the issue!
It was an easier task than I thought it would be. When uninstalling, everything got deleted but the yaml files. Reinstalling picked up the yaml files right away and everything was like it was before, minus de headaches.