espressif / qemu

Fork of QEMU with Espressif patches. See Wiki for details.
https://github.com/espressif/esp-toolchain-docs/blob/main/qemu/README.md
Other
220 stars 56 forks source link

Pre-encrypted firmware do not work on QEMU (QEMU-159) #82

Open artua opened 1 year ago

artua commented 1 year ago

Hello,

I tried to burn eFuses and firmware on both QEMU and physical chip (ESP ECO V3). Encrypted flash + Secure Boot v2

It is working ok on physical chip but not working on QEMU.

Generating eFuse bin with MAC and version bits set: gen_efuse.py qemu_efuse-mac.bin

Running QEMU in strapped mode:

    -machine esp32 \
    -drive file=qemu_flash_image.bin,if=mtd,format=raw \        
    -global driver=esp32.gpio,property=strap_mode,value=0x0f \
    -drive file=qemu_efuse-mac.bin,if=none,format=raw,id=efuse \
    -serial tcp::5555,server,nowait

Programming eFuses by the same script I use to program physical device, the only port changes. ... (Everything goes smooth, eFuse settings checked after burning)

Running QEMU in app mode:

build/qemu-system-xtensa -nographic \
    -machine esp32 \
   -drive file=qemu_flash_image.bin,if=mtd,format=raw \
   -drive file=qemu_efuse-mac.bin,if=none,format=raw,id=refuse

This gives me an error:

Adding SPI flash device
ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
invalid header: 0xb4296d8b
invalid header: 0xb4296d8b
invalid header: 0xb4296d8b
invalid header: 0xb4296d8b
invalid header: 0xb4296d8b
invalid header: 0xb4296d8b

The message repeats once per 4 seconds. CPU load is 100%. Host System: MacBook M2 (Apple silicon)

Any ideas?

mahavirj commented 1 year ago

@artua

Sorry for delayed reply. Can you please confirm if you had set the chip revision field in the efuse for ECO3, please see here https://github.com/espressif/esp-toolchain-docs/tree/main/qemu/esp32#emulating-esp32-eco3?

Also please share your efuse summary generated for the qemu.