Partition table overlaps

I have an ESP32-S3-DevkitC-1-N32R8V board

Its a Wroom-2 chip with 32Mb flash and 8Mb psram.
I have got it running with a webflashed image and I can send an OTA update too.
The problem is that the OTA update fails and the board just resets after the flash and boot up with te old image.
Looking at the log output from the flashing I can see that it complains about a partition table issue with overlapping partitions.

E (166) esp_image: Segment 3 0x3fce3808-0x3fce4e34 invalid: overlaps bootloader stack
E (175) boot: OTA app partition slot 1 is not bootable

The entire output looks like this:

I (32) boot: ESP-IDF 4.4.5 2nd stage bootloader
I (32) boot: compile time 09:26:54
I (32) boot: chip revision: v0.1
I (34) boot.esp32s3: Boot SPI Speed : 80MHz
I (38) boot.esp32s3: SPI Mode       : SLOW READ
I (44) boot.esp32s3: SPI Flash Size : 32MB
I (48) boot: Enabling RNG early entropy source...
I (54) boot: Partition Table:
I (57) boot: ## Label            Usage          Type ST Offset   Length
I (65) boot:  0 otadata          OTA data         01 00 00009000 00002000
I (72) boot:  1 phy_init         RF data          01 01 0000b000 00001000
I (80) boot:  2 app0             OTA app          00 10 00010000 00fc0000
I (87) boot:  3 app1             OTA app          00 11 00fd0000 00fc0000
I (95) boot:  4 nvs              WiFi data        01 02 01f90000 0006d000
I (102) boot: End of partition table
I (106) esp_image: segment 0: paddr=00fd0020 vaddr=3c090020 size=25d44h (154948) map
I (152) esp_image: segment 1: paddr=00ff5d6c vaddr=3fc96500 size=03f38h ( 16184) load
I (156) esp_image: segment 2: paddr=00ff9cac vaddr=40374000 size=0636ch ( 25452) load
I (165) esp_image: segment 3: paddr=01000020 vaddr=3fce3808 size=0162ch (  5676) load
E (166) esp_image: Segment 3 0x3fce3808-0x3fce4e34 invalid: overlaps bootloader stack
E (175) boot: OTA app partition slot 1 is not bootable
I (180) esp_image: segment 0: paddr=00010020 vaddr=3c090020 size=25d44h (154948) map
I (226) esp_image: segment 1: paddr=00035d6c vaddr=3fc96500 size=03f38h ( 16184) load
I (230) esp_image: segment 2: paddr=00039cac vaddr=40374000 size=0636ch ( 25452) load
I (239) esp_image: segment 3: paddr=00040020 vaddr=42000020 size=8c948h (575816) map
I (377) esp_image: segment 4: paddr=000cc970 vaddr=4037a36c size=0c18ch ( 49548) load
I (399) boot: Loaded app from partition at offset 0x10000
I (399) boot: Disabling RNG early entropy source...
I (400) opi psram: vendor id : 0x0d (AP)
I (404) opi psram: dev id    : 0x02 (generation 3)
I (409) opi psram: density   : 0x03 (64 Mbit)
I (414) opi psram: good-die  : 0x01 (Pass)
I (419) opi psram: Latency   : 0x01 (Fixed)
I (424) opi psram: VCC       : 0x00 (1.8V)
I (429) opi psram: SRF       : 0x01 (Fast Refresh)
I (434) opi psram: BurstType : 0x01 (Hybrid Wrap)
I (439) opi psram: BurstLen  : 0x01 (32 Byte)
I (444) opi psram: Readlatency  : 0x02 (10 cycles@Fixed)
I (450) opi psram: DriveStrength: 0x00 (1/1)
I (456) spiram: Found 64MBit SPI RAM device
I (460) spiram: SPI RAM mode: sram 80m
I (465) spiram: PSRAM initialized, cache is in normal (1-core) mode.
I (472) cpu_start: Pro cpu up.
I (475) cpu_start: Starting app cpu, entry point is 0x40375c78
I (458) cpu_start: App cpu up.
I (908) spiram: SPI SRAM memory test OK
I (917) cpu_start: Pro cpu start user code
I (917) cpu_start: cpu freq: 160000000
I (917) cpu_start: Application information:
I (917) cpu_start: Project name:     onkyo-amplifier
I (917) cpu_start: App version:      2024.2.2
I (918) cpu_start: Compile time:     Mar  9 2024 09:26:22
I (918) cpu_start: ELF file SHA256:  eb501780cc81b77e...
I (918) cpu_start: ESP-IDF:          4.4.5
I (918) cpu_start: Min chip rev:     v0.0
I (918) cpu_start: Max chip rev:     v0.99 
I (919) cpu_start: Chip rev:         v0.1
I (919) heap_init: Initializing. RAM available for dynamic allocation:
I (919) heap_init: At 3FC9E1E8 len 0004B528 (301 KiB): D/IRAM
I (919) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DIRAM
I (920) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (920) heap_init: At 600FE000 len 00002000 (8 KiB): RTCRAM
I (920) spiram: Adding pool of 8192K of external SPI memory to heap allocator
I (921) spi_flash: detected chip: mxic (opi)
I (921) spi_flash: flash io: opi_dtr
I (922) sleep: Configure to isolate all GPIO pins in sleep state
I (922) sleep: Enable automatic switching of GPIO sleep configuration
I (923) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
[I][logger:359]: Log initialized

My YAML is like this:

esphome:
  name: onkyo-amplifier
  friendly_name: Onkyo Amplifier
  platformio_options:
    board_upload.maximum_ram_size: 524288
    board_build.flash_mode: dout
    board_build.extra_flags:
      - "-DARDUINO_USB_MODE=0"
      - "-DARDUINO_USB_CDC_ON_BOOT=1"

esp32:
  board: esp32-s3-devkitc-1
  flash_size: 32MB
  framework:
    type: esp-idf
    platform_version: 5.4.0
    version: 4.4.5
    sdkconfig_options:
      CONFIG_ESPTOOLPY_OCT_FLASH: y
      CONFIG_ESPTOOLPY_FLASHSIZE_32MB: y
      CONFIG_SPIRAM_SPEED: SPIRAM_SPEED_80M

psram:
  mode: octal
  speed: 80MHz

# Enable logging
logger:
  level: VERY_VERBOSE

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


ota:
  password: !secret esphome_ota_pass

wifi:
  output_power: 20db
  fast_connect: true
  ssid: DWsh
  password: !secret dwsh_pass
  manual_ip:
    static_ip: 10.10.12.54
    subnet: 255.255.255.0
    gateway: 10.10.12.1
    dns1: 10.10.12.1

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    password: !secret esphome_fallback_wifi_pass

captive_portal:

I am not using a custom partition table.

Seems like setting the flash size to 16Mb makes it work and I do not really need the extra flash, so I will run with that. :slight_smile:

that helps,
for future reference,
this probably happened because you serial flashed with arduino and than tried to OTA flash to esp-idf.
if you want to do that you should serial flash again.
the other way around is now issue, so if you want to be able to swap frameworks you can serial flash esp-idf.

Not in this case.
I could not get it to boot at all with the arduino framework, so I am sure I flashed it with esp-idf over serial first and then tried to flash esp-idf over it again.

In the research on the board I stumbled on several threads about bugs when the entire memory was used. It seemed to be something with core 0 could cause a crash if it accessed the higher half of the ram and core 1 could do the same if it accessed the lower half.

1 Like