probe-rs icon indicating copy to clipboard operation
probe-rs copied to clipboard

Failed to verify flash algorithm on esp32c3 with esp-idf std telf file.

Open Vollbrecht opened this issue 2 years ago • 1 comments

Describe the bug probe-rs run ~/esp-idf-test-elf --chip esp32c3 produces the following error

ERROR probe_rs::flashing::flasher: Failed to verify flash algorithm. Data mismatch at address 0x4038fff8
ERROR probe_rs::flashing::flasher: Original instruction: 0x100073
ERROR probe_rs::flashing::flasher: Readback instruction: 0x000000
ERROR probe_rs::flashing::flasher: Original: [100073, 100073, c6061141, 437c422, 45034039, ed090824, ffc70097, 70c080e7, 974581, 80e7ffc7, 450514a0, 8a40123, 40b24501, 1414422, 81418082, ffc70317, f030067, ffc70317, e430067, 367713, 513c701, 80820aa0, 85b286ae, 3178636, 67ffc7, 11410d63, 4505c606, 4503c42a, 89050081, 28c901, 974595, 80e7ffc7, d5750c60, 14140b2, 8082]
ERROR probe_rs::flashing::flasher: Readback: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0     Erasing sectors ⠁ [00:00:00] [########################]      0 B/     0 B @      0 B/s (eta 0s )Error: The flashing procedure failed for '/home/fred/rust/idf-probe-rs-test/out/idf-probe-rs-test'.

Caused by:
    The RAM contents did not match the expected contents after loading the flash algorithm.

To Reproduce An erased esp32 erased with espflash or coldboot a esp32 ( e.g an unpowerd esp and directly trying to use it with probe-rs). Try to flash a esp32 with probe-rs run

Last good know working commit a6aa404781a58781939db575272c2cb45577000a though reverting the changes on current master still produces the error.

Expected behavior In every state of the esp probe-rs should be able to flash it.

Desktop (please complete the following information):

  • Linux ( Debian 12)

Vollbrecht avatar Dec 16 '23 23:12 Vollbrecht

The issue is that we don't correctly reset the C3. We intentionally don't touch SRAM0 which can be reserved for cache, but esp-idf may turn on memory protection for (parts of) SRAM1 via the PMS, which can prevent probe-rs from downloading the flash loader. A correct system reset should be able to resolve this.

bugadani avatar Jan 28 '24 12:01 bugadani