Page 1 of 1

JTAG flashing on the ESP32-C6-DevKitC-1 V1.2

Posted: Tue Sep 24, 2024 7:21 am
by smoritz
Hi,

I am trying to use the JTAG port of my ESP32-C6-DevKitC-1 V1.2 for flashing.

I can connect to it just fine using:

Code: Select all

openocd -f board/esp32c6-builtin.cfg
But things go wrong when I do.

Code: Select all

openocd -f board/esp32c6-builtin.cfg -c "program_esp my_app.bin 0x10000 verify exit"
The output is:

Code: Select all

Open On-Chip Debugger v0.12.0-esp32-20240318 (2024-03-18-18:28)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselecting 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
** program_esp input args <0x10000 verify exit> **
Info : esp_usb_jtag: serial (40:4C:CA:40:2D:D4)
Info : esp_usb_jtag: Device found. Base speed 24000KHz, div range 1 to 255
Info : clock speed 24000 kHz
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] datacount=2 progbufsize=16
Info : [esp32c6] Examined RISC-V core; found 2 harts
Info : [esp32c6]  XLEN=32, misa=0x40903105
Info : [esp32c6] Examination succeed
Info : starting gdb server for esp32c6 on 3333
Info : Listening on port 3333 for gdb connections
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)
** Programming Started **
Info : [esp32c6] Found 4 triggers
Info : Flash mapping 0: 0x10020 -> 0x42010020, 10 KB
Info : Flash mapping 1: 0x18020 -> 0x42000020, 41 KB
Info : Auto-detected flash bank 'esp32c6.flash' size 8192 KB
Info : Using flash bank 'esp32c6.flash' size 8192 KB
Info : PROF: Erased 8323072 bytes in 11271.6 ms
Info : PROF: Data transferred in 47696.8 ms @ 170.41 KB/s
Info : PROF: Wrote 8323072 bytes in 48130.8 ms (data transfer time included)
Warn : Failed to get flash maps (-8)!
Warn : Invalid magic number in app image!
Warn : Failed to get flash mappings (-4)!
Info : Using flash bank 'esp32c6.irom' size 0 KB
Warn : Failed to get flash maps (-8)!
Warn : Invalid magic number in app image!
Warn : Failed to get flash mappings (-4)!
Info : Using flash bank 'esp32c6.drom' size 0 KB
Warn : no flash bank found for address 0x00800000
** Programming Finished in 61215 ms **
** Verify Started **
Warn : File content exceeds flash bank size. Only comparing the first 8323072 bytes of the file
Info : PROF: Flash verified in 3399.54 ms
** Verify OK **
shutdown command invoked
Some things I have found out:
- Different cables produce the same result.
- flashing with UART/esptool via

Code: Select all

ninja flash
works

Any ideas why this is isn't working as documented in https://docs.espressif.com/projects/esp ... -debugging?

Thanks
Moritz

Re: JTAG flashing on the ESP32-C6-DevKitC-1 V1.2

Posted: Tue Sep 24, 2024 9:57 am
by smoritz
Small update: The error persists even after upgrading to openocd v0.12.0-esp32-20240821

Re: JTAG flashing on the ESP32-C6-DevKitC-1 V1.2

Posted: Mon Sep 30, 2024 10:40 am
by smoritz
Answering my own question here:

The binary produced by

Code: Select all

idf_build_executable
does not have correct format. Build the target "gen_project_binary" internally defined by the IDF. This creates another .bin file that has the right format and can be flashed as described in the doc.