Page 1 of 1

Successful connection of Segger J-Link for JTAG use

Posted: Fri Jul 21, 2017 3:57 am
by justinmreina
I am trying to get ESP32 JTAG debugging working, and I am having a hard time establishing connection. I am using the following setup & instructions:

Setup Instructions Problem
At Step 3.3.3 I cannot get my Segger to be recognized & used in OpenOCD. It is attached to my Virtualbox as follows (from dmesg):

dmesg output from connected Segger
[ 73.722856] usb 2-2: new full-speed USB device number 3 using ohci-pci
[ 74.270737] usb 2-2: New USB device found, idVendor=1366, idProduct=0101
[ 74.270741] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 74.270744] usb 2-2: Product: J-Link
[ 74.270746] usb 2-2: Manufacturer: SEGGER
[ 74.270748] usb 2-2: SerialNumber: 000269402770

How do you get the Segger to work for OpenOCD here, what is the target value to use for Step 3.3.3? Are there any examples that use the Segger for reference?

So excited to get JTAG working here, please let me know! :)

Re: Successful connection of Segger J-Link for JTAG User

Posted: Fri Jul 21, 2017 7:02 am
by ESP_Sprite
Edit the copied esp32.cfg file. Most importantly, change the source [find interface/ftdi/tumpa.cfg] line to reflect the physical JTAG adapter connected. (Note that this step is not needed when using the ESP-WROVER-KIT
What did you do at this step?

Re: Successful connection of Segger J-Link for JTAG User

Posted: Fri Jul 21, 2017 1:41 pm
by justinmreina
Nothing yet, that is where I got stuck!

Re: Successful connection of Segger J-Link for JTAG use

Posted: Fri Jul 21, 2017 2:59 pm
by ESP_Sprite
If you change that line to '[find tcl/interface/jlink.cfg]', it should work.

Re: Successful connection of Segger J-Link for JTAG use

Posted: Fri Jul 21, 2017 4:29 pm
by justinmreina
what is 'esp108', how do I get this working?

Now I see -
./esp32.cfg:48: Error: invalid command name "esp108"
in procedure 'script'
at file "embedded:startup.tcl", line 60
at file "./esp32.cfg", line 48

Re: Successful connection of Segger J-Link for JTAG use

Posted: Mon Aug 21, 2017 3:08 pm
by caco666
Hi Justin,

Did you manage to make this work?
I kind of managed OpenOCD work with JLink but then (for some reason) after updating to the latest changes in OpenOCD repository this stopped working correctly.

[Sorry, this is my first post here]

I am using this post as a reference because the previous 'esp108' command stopped working: http://bbs.esp32.com/viewtopic.php?f=2&t=2404


Then, when running the result is:

Code: Select all

src/openocd -s tcl -f ./tcl/interface/jlink.cfg -f ./tcl/board/esp-wroom-32.cfg Open On-Chip Debugger 0.10.0-dev-gcc5b0f7 (2017-08-21-15:36)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
force hard breakpoints
Info : No device selected, using first device.
Info : J-Link ARM V8 compiled Nov 28 2014 13:44:46
Info : Hardware version: 8.00
Info : VTarget = 3.306 V
Info : Reduced speed from 20000 kHz to 12000 kHz (maximum).
Info : Reduced speed from 20000 kHz to 12000 kHz (maximum).
Info : clock speed 20000 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 : Target halted. PRO_CPU: PC=0x4014689C (active)    APP_CPU: PC=0x00000000
Then, after that I can only connect to port 3333 (port 3334 is not open).
When connecting with GDB, I get this:

Code: Select all

xtensa-esp32-elf-gdb -ex 'target remote localhost:3333' ./build/abb-esp32-fw.elf 
GNU gdb (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./build/abb-esp32-fw.elf...done.
Remote debugging using localhost:3333
0x00000000 in ?? ()
(gdb) monitor targets
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* esp32              esp32      little esp32.cpu0         halted
(gdb) 
Before updating to the latest changes I could connect to both CPUs and this command showed two items, one per CPU.
I see some changes were done on esp32.cfg and a esp108.cfg file was added for the case of using one CPU.

Could anyone give some hing on what could be the problem?

Thank you.

Cheers