Page 1 of 3

Question about esp32 Flash download through JTAG

Posted: Tue Jan 03, 2017 7:17 am
by jeromeh
Hi,

I'm trying to program flash through JTAG for esp32, but getting error message: "Error: timed out while waiting for target halted".

I have GND/TMS/TCK/TDI/TDO connected, the JTAG log is like below:

Code: Select all

$ openocd -f esp32.cfg -c "program ../helloworld/build/helloworld.elf verify reset exit"
Open On-Chip Debugger 0.10.0-dev-g90071eb (2017-01-01-22:30)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 200 kHz
force hard breakpoints
Info : clock speed 200 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Error: esp32.cpu0: esp108_fetch_all_regs (line 673): DSR (000000FF) indicates target still busy!
Error: esp32.cpu0: esp108_fetch_all_regs (line 673): DSR (000000FF) indicates DIR instruction generated an exception!
Error: esp32.cpu0: esp108_fetch_all_regs (line 673): DSR (000000FF) indicates DIR instruction generated an overrun!
Info : esp32.cpu0: Target halted, pc=0x00000000
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Core was reset (pwrstat=0x1F, after clear 0x1F).
Info : esp32.cpu0: Debug controller was reset (pwrstat=0x5F, after clear 0x1F).
Error: timed out while waiting for target halted
TARGET: esp32.cpu0 - Not halted
in procedure 'program' 
in procedure 'reset' called at file "embedded:startup.tcl", line 478
in procedure 'ocd_bouncer'

** Unable to reset target **
shutdown command invoked
By adding a connection of SRST to CH_PU of esp32, I can see a print of "esp32.cpu0: target state: halted", but still have similar error as below:

Code: Select all

$ openocd -f esp32.cfg -c "program ../helloworld/build/helloworld.elf verify reset exit"
Open On-Chip Debugger 0.10.0-dev-g90071eb (2017-01-01-22:30)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 200 kHz
force hard breakpoints
Info : clock speed 200 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Target halted, pc=0x40000400
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Core was reset (pwrstat=0x1F, after clear 0x0F).
Info : esp32.cpu0: Target halted, pc=0x40000400
esp32.cpu0: target state: halted
Error: timed out while waiting for target halted
TARGET: esp32.cpu1 - Not halted
in procedure 'program' 
in procedure 'reset' called at file "embedded:startup.tcl", line 478
in procedure 'ocd_bouncer'

** Unable to reset target **
shutdown command invoked
Does anybody managed successfully program flash through JTAG? Any hint will be appreciated. Thanks,

Re: Question about esp32 Flash download through JTAG

Posted: Tue Jan 03, 2017 8:11 am
by ESP_Sprite
That is not supported yet; the code needed to support it has not even been written yet so it's no surprise you run into errors. Sorry, for now you'll have to re-flash over serial.

Re: Question about esp32 Flash download through JTAG

Posted: Tue Jan 03, 2017 9:56 am
by jeromeh
Thanks for confirming that...

any idea about what is the time frame I can expect to have this supported officially? Say in a few weeks or months?

Re: Question about esp32 Flash download through JTAG

Posted: Tue Jan 03, 2017 3:59 pm
by ESP_igrr
We plan to work on this in February.

Re: Question about esp32 Flash download through JTAG

Posted: Tue Feb 21, 2017 10:35 am
by nigaspa
Hi, because I'm having the same problem of jeromeh, any more precise news about "what you plan" to do in Febrary?

I thank you.

Re: Question about esp32 Flash download through JTAG

Posted: Thu Feb 23, 2017 12:43 am
by armink
+1 the same problem for me

Re: Question about esp32 Flash download through JTAG

Posted: Thu Feb 23, 2017 1:25 am
by ESP_igrr
Because the release of 2.0 has been delayed, we haven't started working on flashing via openocd yet. The plan is to modify openocd to upload a flashing stub into IRAM and run it, and then communicate with the stub to send it the data to be uploaded.

Re: Question about esp32 Flash download through JTAG

Posted: Mon Feb 27, 2017 9:23 am
by roctwo
ESP_igrr wrote:Because the release of 2.0 has been delayed, we haven't started working on flashing via openocd yet. The plan is to modify openocd to upload a flashing stub into IRAM and run it, and then communicate with the stub to send it the data to be uploaded.
Can esp32 flash download through JTAG now? :D :D :D

Re: Question about esp32 Flash download through JTAG

Posted: Tue Feb 28, 2017 5:59 am
by ESP_Sprite
No, sorry. I have been not able to work on JTAG for now because of other priorities. The good news is that we however have attracted a new dev, and he's working on several new features for debugging. I think JTAG flashing is also somewhere on his list.

Re: Question about esp32 Flash download through JTAG

Posted: Tue Apr 11, 2017 12:29 pm
by rezasurmar
Does jtag programming already work?