Loading image via JTAG adapter

Superkurt
Posts: 11
Joined: Thu Mar 03, 2016 11:38 pm

Loading image via JTAG adapter

Postby Superkurt » Thu Feb 16, 2017 12:29 am

I'm debugging the ESP32 with Eclipse, OpenOCD and an Olimex ARM-USB-OCD-H JTAG adapter. Normal debugging works fine, but during startup I can't load the executable into the ESP32. I'm using the GNU ARM Eclipse plugin from http://gnuarmeclipse.github.io/ to get the debugging working. In the startup settings of the debugger I can't check the "Load executable" option which loads the image into the ESP32. If I check this option and start debugging I get the following output from OpenOCD:

Code: Select all

Open On-Chip Debugger 0.10.0-dev-g90071eb (2017-02-12-00:28)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html
adapter speed: 2000 kHz
force hard breakpoints
Started by GNU ARM Eclipse
Info : clock speed 2000 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: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32.cpu0: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : accepting 'gdb' connection on tcp/3333
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 'reset'
in procedure 'ocd_bouncer'


Info : Halt timed out, wake up GDB.
Error: timed out while waiting for target halted

Info : Auto-detected RTOS: FreeRTOS
Error: esp32.cpu0: xtensa_write_memory (line 1024): DSR (8020CC13) indicates DIR instruction generated an exception!
Warn : esp32.cpu0: Failed writing 4096 bytes at address 0x3F400010
Error: esp32.cpu0: xtensa_write_memory (line 1024): DSR (8020CC13) indicates DIR instruction generated an exception!
Warn : esp32.cpu0: Failed writing 4096 bytes at address 0x3F401010
Info : dropped 'gdb' connection


Should it be possible to load the executable during OpenOCD startup into the flash? Or why do I get the error:

Code: Select all

Error: esp32.cpu0: xtensa_write_memory (line 1024): DSR (8020CC13) indicates DIR instruction generated an exception!

ESP_Angus
Posts: 812
Joined: Sun May 08, 2016 4:11 am

Re: Loading image via JTAG adapter

Postby ESP_Angus » Thu Feb 16, 2017 1:34 am

At the moment the esp32 openocd driver doesn't include a flash driver, so you can't yet write to flash over JTAG. You have to flash via serial with esptool.py, then you can attach JTAG for debugging.

Superkurt
Posts: 11
Joined: Thu Mar 03, 2016 11:38 pm

Re: Loading image via JTAG adapter

Postby Superkurt » Fri Feb 17, 2017 7:30 pm

Thanks for the explanation. By the way I've created a list of steps what I've done to get on-chip-debugging working with Eclipse. I've also a ready to use Virtual Box appliance. Maybe someone could use the information from here:

https://www.matthias-jentsch.de/2017/02/16/on-chip-debugging-on-esp32-with-eclipse-and-openocd/

zhivko
Posts: 14
Joined: Tue Dec 01, 2015 12:02 pm

Re: Loading image via JTAG adapter

Postby zhivko » Mon May 08, 2017 3:40 pm

Flashing over JTAG would be really neat. Using 2 cables is not fancy ;).
@ESP_Angus: do you see this could be implemented in near future? I think it would help the platform to become mature and allow users to easier catch all this possible nasty bugs thata could happen during devel cycle.

f.h-f.s.
Posts: 187
Joined: Thu Dec 08, 2016 2:53 pm

Re: Loading image via JTAG adapter

Postby f.h-f.s. » Tue May 09, 2017 8:25 am

VisualGDB can program the esp32 over JTAG, their version of openOCD https://github.com/sysprogs/openocd-esp32 has some extra functions. See https://esp32.com/viewtopic.php?f=2&t=854

I was thinking about trying to use their version of openOCD to do the same, but since debugging is not working for me at all, I stopped.

Who is online

Users browsing this forum: michprev, vateriim and 7 guests