Wokwi: Simulation of ESP32 fails with invalid header: 0xffffffff

Wokwi is able to simulate ESP32 chips also in VS Code or CLion.

It’s sufficient to add wokwi.toml and diagram.json to the project.

wokwi.toml contains path to binary files with the application:

[wokwi]
version = 1
gdbServerPort = 3333
elf = "build/example.bin"
firmware = "build/example.bin"

When starting the simulation the project might fail with following error message:

invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff

The problem is caused by missing bootloader. To solve the problem you can generate UF2 image and point the simulator to UF2 file.

Build UF2 by ESP-IDF:

idf.py uf2

Update wokwi.toml:

[wokwi]
version = 1
gdbServerPort = 3333
elf = "build/uf2.bin"
firmware = "build/uf2.bin"