esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 35 forks source link

"Error: The OTA partition on the ESP is too small" after updating to latest esphome version #5714

Open digaus opened 6 months ago

digaus commented 6 months ago

The problem

After updating esphome version I can no longer flash my ESP32-C3 which the current config.

Compiling indicates that it will take 98.8% of the available flash space. This should be enough for OTA?

Any way to get it working again without having to reduce features? Currently disabled logger to be able to upload.

Which version of ESPHome has the issue?

2024.4.0

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2024.4.3

What platform are you using?

ESP32-IDF

Board

Custom ESP32-C3

Component causing the issue

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

INFO ESPHome 2024.4.0
INFO Reading configuration /config/esphome/esphome-eqiva-fingerprint.yaml...
INFO Detected timezone 'Europe/Berlin'
WARNING GPIO2 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Compiling app...
Processing esphome-eqiva-fingerprint (board: seeed_xiao_esp32c3; framework: espidf; platform: platformio/espressif32@5.4.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.40406.240122 (4.4.6) 
 - tool-cmake @ 3.16.9 
 - tool-ninja @ 1.10.2 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
Reading CMake configuration...
Dependency Graph
|-- noise-c @ 0.1.4
|-- ArduinoJson @ 6.18.5
Compiling .pioenvs/esphome-eqiva-fingerprint/src/main.o
Linking .pioenvs/esphome-eqiva-fingerprint/firmware.elf
RAM:   [==        ]  16.0% (used 52560 bytes from 327680 bytes)
Flash: [==========]  98.8% (used 1813794 bytes from 1835008 bytes)
Building .pioenvs/esphome-eqiva-fingerprint/firmware.bin
Creating esp32c3 image...
Successfully created esp32c3 image.
esp32_create_combined_bin([".pioenvs/esphome-eqiva-fingerprint/firmware.bin"], [".pioenvs/esphome-eqiva-fingerprint/firmware.elf"])
Wrote 0x1d8ec0 bytes to file /data/build/esphome-eqiva-fingerprint/.pioenvs/esphome-eqiva-fingerprint/firmware-factory.bin, ready to flash to offset 0x0
========================= [SUCCESS] Took 18.83 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.3.47
INFO Uploading /data/build/esphome-eqiva-fingerprint/.pioenvs/esphome-eqiva-fingerprint/firmware.bin (1871552 bytes)
ERROR Error binary size: Error: The OTA partition on the ESP is too small. ESPHome needs to resize this partition, please flash over

Additional information

No response

HarvsG commented 3 months ago

I get he same on 2024.6.6 with the atom echo when I try and adopt it with the voice assistant pre-made project config. To be clear the premade project installs and runs ok, but I get the errors once I try and adopt the device through my ESP home add-on installation.

When I do a USB install (COM3 through the browser) I then get this:

[01:34:52]E (823) esp_image: Image length 1835744 doesn't fit in partition length 1835008
[01:34:52]E (823) boot: OTA app partition slot 0 is not bootable
[01:34:52]E (825) esp_image: image at 0x1d0000 has invalid magic byte (nothing flashed here?)
[01:34:52]E (833) boot: OTA app partition slot 1 is not bootable
[01:34:52]E (839) boot: No bootable app partitions in the partition table
[01:34:52]ets Jun  8 2016 00:22:57
[01:34:52]
[01:34:52]rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[01:34:52]configsip: 188777542, SPIWP:0xee
[01:34:52]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[01:34:52]mode:DIO, clock div:2
[01:34:52]load:0x3fff0030,len:6652
[01:34:52]ho 0 tail 12 room 4
[01:34:52]load:0x40078000,len:15052
[01:34:52]load:0x40080400,len:3836
[01:34:52]entry 0x4008069c
[01:34:52]I (57) boot: ESP-IDF 4.4.7 2nd stage bootloader
[01:34:52]I (57) boot: compile time 19:22:31
[01:34:52]I (58) boot: Multicore bootloader
[01:34:52]I (61) boot: chip revision: v1.1
[01:34:52]I (65) boot.esp32: SPI Speed      : 40MHz
[01:34:52]I (70) boot.esp32: SPI Mode       : DIO
[01:34:52]I (74) boot.esp32: SPI Flash Size : 4MB
[01:34:52]I (79) boot: Enabling RNG early entropy source...
[01:34:52]I (84) boot: Partition Table:
[01:34:52]I (88) boot: ## Label            Usage          Type ST Offset   Length
[01:34:52]I (95) boot:  0 otadata          OTA data         01 00 00009000 00002000
[01:34:52]I (103) boot:  1 phy_init         RF data          01 01 0000b000 00001000
[01:34:52]I (110) boot:  2 app0             OTA app          00 10 00010000 001c0000
[01:34:52]I (118) boot:  3 app1             OTA app          00 11 001d0000 001c0000
[01:34:52]I (125) boot:  4 nvs              WiFi data        01 02 00390000 0006d000
[01:34:52]I (133) boot: End of partition table
[01:34:52]I (137) boot: No factory image, trying OTA 0
[01:34:52]I (142) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=65914h (416020) map
[01:34:52]I (301) esp_image: segment 1: paddr=0007593c vaddr=3ffbdb60 size=051bch ( 20924) load
[01:34:52]I (310) esp_image: segment 2: paddr=0007ab00 vaddr=40080000 size=05518h ( 21784) load
[01:34:52]I (319) esp_image: segment 3: paddr=00080020 vaddr=400d0020 size=136820h (1271840) map
[01:34:53]I (779) esp_image: segment 4: paddr=001b6848 vaddr=40085518 size=19a6ch (105068) load

Edit: I ran the install again with a direct UB connection to the raspberry running the ESPhome add-on, and it failed again logs_m5stack-atom-echo-b836b0_run.txt

Also I think #5824 might be related

As recommended in the logs I tried the following:

root@5c53de3b-esphome:/# esptool.py --before default_reset --after hard_reset --baud 460800 --port /dev/ttyUSB1 --chip esp32 write_flash -z --flash_size detect 0x10000 /data/build/m5stack-atom-echo-b836b0/.pioenvs/m5stack-atom-echo-b836b0/firmware.bin 0x1000 /data/build/m5stack-atom-echo-b836b0/.pioenvs/m5stack-atom-echo-b836b0/bootloader.bin 0x8000 /data/build/m5stack-atom-echo-b836b0/.pioenvs/m5stack-atom-echo-b836b0/partitions.bin 0x9000 /data/build/m5stack-atom-echo-b836b0/.pioenvs/m5stack-atom-echo-b836b0/ota_data_initial.bin
esptool.py v4.7.0
Serial port /dev/ttyUSB1
Connecting...............
Chip is ESP32-PICO-D4 (revision v1.1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 64:b7:08:b8:36:b0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.

A fatal error occurred: Unable to verify flash chip connection (No serial data received.).

I know this makes it all look like a hardware issue, but https://esphome.io/projects/index.html still works.

Forum post of someone with the same issue: https://community.home-assistant.io/t/m5-stack-atom-echo-installation/746641/2

mrtnkhl commented 3 months ago

I see the same behavior as @HarvsG does but after trying to adopt an Atom Echo once it has been flashed from esphome.io with the Atom Echo voice assistant config. Tried flashing via USB on the HA Yellow after wireless OTA did not work since a partition resize was necessary. Erased the Atom Echo before with a blank ESPWeb config and retried this several times.

Frederick-G764 commented 3 months ago

same issue

HarvsG commented 3 months ago

Workaround that worked for me: https://github.com/esphome/firmware/issues/227#issuecomment-2211758801

steveof2620 commented 3 months ago

I have the same issue. I ended up installing via these instructions by Mostly Chris.

orywig commented 3 months ago

I am seeing this with my M5Stack Atom Echo when I tried updating it to 2024.7

HarvsG commented 3 months ago

I am seeing this with my M5Stack Atom Echo when I tried updating it to 2024.7

Please post your environment details in: https://github.com/esphome/firmware/issues/227

orywig commented 2 months ago

I am seeing this with my M5Stack Atom Echo when I tried updating it to 2024.7

Please post your environment details in: esphome/firmware#227

Done.. https://github.com/esphome/firmware/issues/227#issuecomment-2240060942