Skip to content

ESP32-C3 got "invalid header: 0xffffffff" and cannot erase-flash (IDFGH-7428) #9005

@AxelLin

Description

@AxelLin
  • Module or chip used: ESP32-C3 on a customized board
  • IDF version: v5.0-dev-3043-g70109e2393
  • Build System: idf.py
  • Compiler version: riscv32-esp-elf-gcc (crosstool-NG esp-2021r2-patch3) 8.4.0
  • Operating System: Linux
  • Power Supply: USB

It looks like "idf.py app-flash" can successfully download the firmware,
however, monitor shows "invalid header: 0xffffffff".

Also note "idf.py erase-flash" got error:
A fatal error occurred: ESP32-C3 ROM does not support function erase_flash.
esptool.py failed with exit code 2

See below log:

$ idf.py app-flash monitor
Executing action: app-flash
Serial port /dev/ttyACM0
Connecting....
Detecting chip type... ESP32-C3
Running ninja in directory /home/axel/esp/esp-idf-dev/apps/myproj/build
Executing "ninja app-flash"...
[1/2] cd /home/axel/esp/esp-idf-dev/apps/myproj/build/esp-idf/esptool_py && /home/axel/.espressif/p...ld/partition_table/partition-table.bin /home/axel/esp/esp-idf-dev/apps/myproj/build/myproj.bin
[1/2] cd /home/axel/esp/esp-idf/components/esptool_py && /usr/local/bin/cmake -D IDF_PATH=/home/axel/esp...esp-idf-dev/apps/myproj/build -P /home/axel/esp/esp-idf/components/esptool_py/run_serial_tool.cmake
esptool.py esp32c3 -p /dev/ttyACM0 -b 460800 --before=default_reset --after=hard_reset --no-stub write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x110000 myproj.bin
esptool.py v3.3.1
Serial port /dev/ttyACM0
Connecting...
Chip is ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:a4:93:28
Changing baud rate to 460800
Changed.
Enabling default SPI flash mode...
Configuring flash size...
Flash will be erased from 0x00110000 to 0x00214fff...
Erasing flash...
Took 5.33s to erase flash block
Writing at 0x00110000... (0 %)
Writing at 0x00110400... (0 %)
Writing at 0x00110800... (0 %)
Writing at 0x00110c00... (0 %)
Writing at 0x00111000... (0 %)
Writing at 0x00111400... (0 %)
Writing at 0x00111800... (0 %)
Writing at 0x00111c00... (0 %)
Writing at 0x00112000... (0 %)
Writing at 0x00112400... (0 %)
Writing at 0x00112800... (1 %)
Writing at 0x00112c00... (1 %)
Writing at 0x00113000... (1 %)
Writing at 0x00113400... (1 %)
Writing at 0x00113800... (1 %)
Writing at 0x00113c00... (1 %)
Writing at 0x00114000... (1 %)
Writing at 0x00114400... (1 %)
Writing at 0x00114800... (1 %)
Writing at 0x00114c00... (1 %)
Writing at 0x00115000... (2 %)
Writing at 0x00115400... (2 %)
...
Writing at 0x0020f400... (98 %)
Writing at 0x0020f800... (98 %)
Writing at 0x0020fc00... (98 %)
Writing at 0x00210000... (98 %)
Writing at 0x00210400... (98 %)
Writing at 0x00210800... (98 %)
Writing at 0x00210c00... (98 %)
Writing at 0x00211000... (98 %)
Writing at 0x00211400... (98 %)
Writing at 0x00211800... (99 %)
Writing at 0x00211c00... (99 %)
Writing at 0x00212000... (99 %)
Writing at 0x00212400... (99 %)
Writing at 0x00212800... (99 %)
Writing at 0x00212c00... (99 %)
Writing at 0x00213000... (99 %)
Writing at 0x00213400... (99 %)
Writing at 0x00213800... (99 %)
Writing at 0x00213c00... (99 %)
Writing at 0x00214000... (100 %)
Wrote 1065984 bytes at 0x00110000 in 16.0 seconds (533.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Executing action: monitor
Serial port /dev/ttyACM0
Connecting...
Detecting chip type... ESP32-C3
Running idf_monitor in directory /home/axel/esp/esp-idf-dev/apps/myproj
Executing "/home/axel/.espressif/python_env/idf5.0_py3.10_env/bin/python /home/axel/esp/esp-idf/tools/idf_monitor.py -p /dev/ttyACM0 -b 115200 --toolchain-prefix riscv32-esp-elf- --target esp32c3 --decode-panic backtrace /home/axel/esp/esp-idf-dev/apps/myproj/build/myproj.elf -m '/home/axel/.espressif/python_env/idf5.0_py3.10_env/bin/python' '/home/axel/esp/esp-idf/tools/idf.py'"...
--- idf_monitor on /dev/ttyACM0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x4004c728
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
....
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header:ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x4004c0d4
...

$ idf.py erase-flash
Executing action: erase-flash
Serial port /dev/ttyACM0
Connecting.....
Detecting chip type... ESP32-C3
Running esptool.py in directory /home/axel/esp/esp-idf-dev/apps/myproj/build
Executing "/home/axel/.espressif/python_env/idf5.0_py3.10_env/bin/python /home/axel/esp/esp-idf/components/esptool_py/esptool/esptool.py -p /dev/ttyACM0 -b 460800 --before default_reset --after hard_reset --chip esp32c3 --no-stub erase_flash"...
esptool.py v3.3.1
Serial port /dev/ttyACM0
Connecting...
Chip is ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:a4:93:28
Changing baud rate to 460800
Changed.
Enabling default SPI flash mode...
Erasing flash (this may take a while)...

A fatal error occurred: ESP32-C3 ROM does not support function erase_flash.
esptool.py failed with exit code 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions