esp-web-tools: Bug when using ESP32 with Arduino ESP32 V2.0.2 (based on esp-idf v4.4)

Flashing using esp tool is OK esptool.exe --chip esp32 --port COM6 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0xe000 boot_app0.bin 0x1000 Programm.ino.bootloader.bin 0x10000 Programm.ino.bin 0x8000 Programm.ino.partitions.bin

But when esp web tools are used (V6.1.1, V5.3.0 tested too) the endless reset loop is shown in terminal log:

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12804
ho 0 tail 12 room 4
load:0x40080400,len:3032
entry 0x400805e4

Manifest file used:

{
  "name": "Program",
  "version": "11",
  "builds": [
    {
      "chipFamily": "ESP32",
      "parts": [
        { "path": "Programm.ino.bootloader.bin", "offset": 4096 },
        { "path": "Programm.ino.partitions.bin", "offset": 32768 },
        { "path": "boot_app0.bin", "offset": 57344 },
        { "path": "Programm.ino.bin", "offset": 65536 }
      ]
    }
  ]
}

Flashing with ESP32 download tool (V3.8.8) is also OK:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:12804
ho 0 tail 12 room 4
load:0x40080400,len:3032
entry 0x400805e4
Booting...

Another important observation:

  1. If I flash Arduino-ESP32 V1.0.6 based software using esptool or esp32 downloader, then I can update via OTA to Arduino-ESP32 V2.0.2 based software and it works.
  2. If I flash Arduino-ESP32 V1.0.6 based software using web tools, then I can update via OTA to Arduino-ESP32 V2.0.2 based software BUT it doesnt work (the same error as above).

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (7 by maintainers)

Most upvoted comments

There is the information from espressif (https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/bootloader.html)

Now it is clear why the behaviour is different for Arduino-ESP32 V2.0.2 (esp-idf 4.4) based SW and Arduino-ESP32 V1.0.x (esp-idf 3.x) based SW. This is also a clear argument to remove this code (because just changing the boatloader header is meaningles since esp-idf V4.0).

"Each ESP-IDF application or bootloader .bin file contains a header with CONFIG_ESPTOOLPY_FLASHMODE, CONFIG_ESPTOOLPY_FLASHFREQ, CONFIG_ESPTOOLPY_FLASHSIZE embedded in it. These are used to configure the SPI flash during boot.

The First stage bootloader in ROM reads the Second stage bootloader header information from flash and uses this infomation to load the rest of the Second stage bootloader from flash. However, at this time the system clock speed is lower than configured and not all flash modes are supported. When the Second stage bootloader then runs, it will reconfigure the flash using values read from the currently selected app binary’s header (and NOT from the Second stage bootloader header). This allows an OTA update to change the SPI flash settings in use.

Bootloaders prior to ESP-IDF V4.0 used the bootloader’s own header to configure the SPI flash, meaning these values could not be changed in an update. To maintain compatibility with older bootloaders, the app re-initializes the flash settings during app startup using the configuration found in the app header."