Welcome, Guest

Author Topic: [OpenOCD] How to evaluate if a JTAG chain works correctly?  (Read 529 times)

pamon

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
[OpenOCD] How to evaluate if a JTAG chain works correctly?
« on: February 28, 2019, 06:56:04 PM »
I would like to know how to evaluate if a JTAG chain works correctly? Which methodologies might be used to evaluate it?

My JTAG chain is:


To test it, I try to flash a baremetal binary from TI StarterWare (http://software-dl.ti.com/dsps/dsps_public_sw/am_bu/starterware/latest/index_FDS.html) with OpenOCD.

This binary works well when it is launch with Uboot on a loadaddr 0x80000000.

But when I flash it across OpenOCD, it fails.

I don't understand why. I am newbie with OpenOCD. I don't understand how Openocd works. I do not know if my problem is due to a hardware incompatibility or if I apply a bad software configuration.

Someone can help me? Thank you in advance.

Logs:

Code: [Select]
Open On-Chip Debugger 0.10.0+dev-00567-gcea40152f (2018-11-03-20:42)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : JTAG tap: am335x.jrc tap/device found: 0x2b94402f (mfg: 0x017 (Texas Instruments), part: 0xb944, ver: 0x2)
Info : JTAG tap: am335x.tap enabled
Info : am335x.cpu: hardware has 6 breakpoints, 2 watchpoints
Info : am335x.cpu rev 2, partnum c08, arch f, variant 3, implementor 41
Error: MPIDR not in multiprocessor format
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections
Info : accepting 'telnet' connection on tcp/4444
Info : JTAG tap: am335x.jrc tap/device found: 0x2b94402f (mfg: 0x017 (Texas Instruments), part: 0xb944, ver: 0x2)
Info : JTAG tap: am335x.tap enabled
Error: Debug regions are unpowered, an unexpected reset might have happened
Error: JTAG-DP STICKY ERROR
Warn : am335x.cpu: ran after reset and before halt ...
Info : am335x.cpu rev 2, partnum c08, arch f, variant 3, implementor 41
target halted in Thumb state due to debug-request, current mode: Supervisor
cpsr: 0x400001b3 pc: 0x0002412a
MMU: disabled, D-Cache: disabled, I-Cache: disabled
Error: data abort at 0x80000000, dfsr = 0x00001808


Code: [Select]
init
reset init
halt
load_image /srv/tftp/uartEcho_ti.bin 0x80000000 bin
resume 0x80000000

I don't understand also, why after each reset:
  • the CPU is in Thumb state?
  • when I am in GDB interface the CPU target is am335x.m3 (cortex_m, Trust Zone, isn't it?) and when I am in telnet interface the CPU target is am335x.cpu (cortex_a)?
« Last Edit: March 04, 2019, 03:53:00 PM by pamon »

pamon

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: How to evaluate if a JTAG chain works correctly?
« Reply #1 on: March 02, 2019, 04:06:52 PM »
From the am335x TRM revP manual (27.1.1 Debug Resource Manager (DRM), P5082, https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf), it seem JTAG signals EMU0 and EMU1 have to be pulled high on target board to enter JTAG mode after reset.

How to do enable them with OpenOCD and ARM-USB-TINY-H?
« Last Edit: March 02, 2019, 04:10:58 PM by pamon »

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1906
  • Karma: +48/-2
Re: [OpenOCD] How to evaluate if a JTAG chain works correctly?
« Reply #2 on: March 05, 2019, 08:21:47 AM »
Something seems to work but to figure it out search for the error message: "Error: Debug regions are unpowered, an unexpected reset might have happened Error: JTAG-DP STICKY ERROR"

Make sure that you have placed the SWD adapter next to the JTAG (not next to the board). The order of connection matters.

EMU0 and EMU1 are not standard JTAG signals and are not part of the JTAG layout available at the connectors of ARM-USB-TINY-H so you might need to set them on the board as you mentioned ("have to be pulled high on target board"). However, I don't think this is the source of your problems. I am not sure if your commands to debug are correct, focus on that part, this seems to give some examples for commands: https://elinux.org/BeagleBoardOpenOCD

Edit: for some of our boards I have tested the following debug sequence

reset halt
wait_halt
sleep 100
poll
load_image main.bin 0x20000000

« Last Edit: March 05, 2019, 08:43:40 AM by LubOlimex »
Technical support and documentation manager at Olimex

pamon

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: [OpenOCD] How to evaluate if a JTAG chain works correctly?
« Reply #3 on: March 05, 2019, 03:50:32 PM »
BeagleBoard and BeagleBone Black are not the same boards (https://elinux.org/Beagleboard:Main_Page ).

The "Error: Debug regions are unpowered, an unexpected reset might have happened
Error: JTAG-DP STICKY ERROR" is done by the "reset" command.

I ran in the telnet session:
Code: [Select]
reset halt
wait_halt
sleep 100
poll
load_image /srv/tftp/uartEcho.bin 0x20000000

I obtained in the openocd session:
Code: [Select]
Open On-Chip Debugger 0.10.0+dev-00567-gcea40152f (2018-11-03-20:42)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : JTAG tap: am335x.jrc tap/device found: 0x2b94402f (mfg: 0x017 (Texas Instruments), part: 0xb944,ver: 0x2)
Info : JTAG tap: am335x.tap enabled
Info : am335x.cpu: hardware has 6 breakpoints, 2 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections
Info : accepting 'telnet' connection on tcp/4444
Info : JTAG tap: am335x.jrc tap/device found: 0x2b94402f (mfg: 0x017 (Texas Instruments), part: 0xb944,ver: 0x2)
Info : JTAG tap: am335x.tap enabled
Error: Debug regions are unpowered, an unexpected reset might have happened
Error: JTAG-DP STICKY ERROR
Warn : am335x.cpu: ran after reset and before halt ...
Info : am335x.cpu rev 2, partnum c08, arch f, variant 3, implementor 41
Error: MPIDR not in multiprocessor format
target halted in Thumb state due to debug-request, current mode: Supervisor
cpsr: 0x600001b3 pc: 0x0002412a
MMU: disabled, D-Cache: disabled, I-Cache: disabled
background polling: on
TAP: am335x.tap (enabled)
target halted in Thumb state due to debug-request, current mode: Supervisor
cpsr: 0x600001b3 pc: 0x0002412a
MMU: disabled, D-Cache: disabled, I-Cache: disabled
Info : DAP transaction stalled (WAIT) - slowing down
Error: Timeout during WAIT recovery
Error: Failed to write memory at 0x80001080
Error: JTAG-DP STICKY ERROR
Error: JTAG-DP STICKY ERROR
Error: Could not read DSCR register
Error: JTAG-DP STICKY ERROR
Error: Could not read DSCR register
Error: JTAG-DP STICKY ERROR
Polling target am335x.cpu failed, trying to reexamine
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the APB-AP
Examination failed, GDB will be halted. Polling again in 100ms
Error: JTAG-DP STICKY ERROR
Polling target am335x.cpu failed, trying to reexamine
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the APB-AP
Examination failed, GDB will be halted. Polling again in 300ms
Error: JTAG-DP STICKY ERROR
Polling target am335x.cpu failed, trying to reexamine
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the APB-AP
Examination failed, GDB will be halted. Polling again in 700ms
Error: JTAG-DP STICKY ERROR
Polling target am335x.cpu failed, trying to reexamine
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the APB-AP
Examination failed, GDB will be halted. Polling again in 1500ms
Error: JTAG-DP STICKY ERROR
Polling target am335x.cpu failed, trying to reexamine
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the APB-AP
Examination failed, GDB will be halted. Polling again in 3100ms
Error: JTAG-DP STICKY ERROR
Polling target am335x.cpu failed, trying to reexamine
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the APB-AP
Examination failed, GDB will be halted. Polling again in 6300ms
Error: JTAG-DP STICKY ERROR
Polling target am335x.cpu failed, trying to reexamine
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the APB-AP
Examination failed, GDB will be halted. Polling again in 6300ms
Error: JTAG-DP STICKY ERROR
Polling target am335x.cpu failed, trying to reexamine
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the APB-AP


New try with a new openocd session:

gdb session:
Code: [Select]
./gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gdb -q ./StarterWare/build/armv7a/gcc/am335x/beaglebone/uart/Debug/uartEcho.out
Reading symbols from ./StarterWare/build/armv7a/gcc/am335x/beaglebone/uart/Debug/uartEcho.out...done.
(gdb) target remote :3333
Remote debugging using :3333
0x00000000 in ?? ()
(gdb) mon reset halt
JTAG tap: am335x.jrc tap/device found: 0x2b94402f (mfg: 0x017 (Texas Instruments), part: 0xb944, ver: 0x2)
JTAG tap: am335x.tap enabled
Debug regions are unpowered, an unexpected reset might have happened
JTAG-DP STICKY ERROR
am335x.cpu: hardware has 6 breakpoints, 2 watchpoints
am335x.cpu: ran after reset and before halt ...
DSCR_DTR_RX_FULL, dscr 0x4b2f6003
Timeout waiting for read dcc
DSCR_DTR_RX_FULL, dscr 0x4b2f6003
Timeout waiting for read dcc
Register map is not available yet, the target is not fully initialised
data abort at 0xe59f009c, dfsr = 0x00001808
embedded:startup.tcl:21: Error:
in procedure 'reset'
in procedure 'ocd_bouncer'
in procedure 'ocd_process_reset'
in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 248
in procedure 'am335x.cpu' called at file "embedded:startup.tcl", line 388
in procedure 'ocd_bouncer'
in procedure 'am335x.cpu' called at file "embedded:startup.tcl", line 355
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 21
(gdb) mon wait_halt
embedded:startup.tcl:21: Error:
in procedure 'am335x.cpu' called at file "embedded:startup.tcl", line 355
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 21
(gdb) mon sleep 100
(gdb) mon poll
background polling: on
TAP: am335x.m3_tap (disabled)
(gdb) mon load_image /srv/tftp/uartEcho.bin 0x20000000
Target not examined yet
embedded:startup.tcl:21: Error:
in procedure 'am335x.cpu' called at file "embedded:startup.tcl", line 355
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 21

OpenOCD session:
Code: [Select]
openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -f board/ti_beaglebone_black.cfg
Open On-Chip Debugger 0.10.0+dev-00567-gcea40152f (2018-11-03-20:42)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : JTAG tap: am335x.jrc tap/device found: 0x2b94402f (mfg: 0x017 (Texas Instruments), part: 0xb944,ver: 0x2)
Info : JTAG tap: am335x.tap enabled
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the APB-AP
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Error: Target not examined yet
Info : New GDB Connection: 1, Target am335x.m3, state: unknown
undefined debug reason 7 - target needs reset
Error: Target not examined yet
Info : JTAG tap: am335x.jrc tap/device found: 0x2b94402f (mfg: 0x017 (Texas Instruments), part: 0xb944,ver: 0x2)
Info : JTAG tap: am335x.tap enabled
Error: Debug regions are unpowered, an unexpected reset might have happened
Error: JTAG-DP STICKY ERROR
Info : am335x.cpu: hardware has 6 breakpoints, 2 watchpoints
Warn : am335x.cpu: ran after reset and before halt ...
Error: DSCR_DTR_RX_FULL, dscr 0x4b2f6003
Error: Timeout waiting for read dcc
Error: DSCR_DTR_RX_FULL, dscr 0x4b2f6003
Error: Timeout waiting for read dcc
Error: Register map is not available yet, the target is not fully initialised
Error: data abort at 0xe59f009c, dfsr = 0x00001808
embedded:startup.tcl:21: Error:
in procedure 'reset'
in procedure 'ocd_bouncer'
in procedure 'ocd_process_reset'
in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 248
in procedure 'am335x.cpu' called at file "embedded:startup.tcl", line 388
in procedure 'ocd_bouncer'
in procedure 'am335x.cpu' called at file "embedded:startup.tcl", line 355
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 21
embedded:startup.tcl:21: Error:
in procedure 'am335x.cpu' called at file "embedded:startup.tcl", line 355
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 21
background polling: on
TAP: am335x.m3_tap (disabled)
Error: Target not examined yet
embedded:startup.tcl:21: Error:
in procedure 'am335x.cpu' called at file "embedded:startup.tcl", line 355
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 21


Please, could you give me more information about your debug sequence?
« Last Edit: March 05, 2019, 04:00:56 PM by pamon »

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1906
  • Karma: +48/-2
Re: [OpenOCD] How to evaluate if a JTAG chain works correctly?
« Reply #4 on: March 05, 2019, 04:33:36 PM »
Mmm my example sequence was for STM32F103 and you used the address without any change, we use that sequence in our ODS Eclispse package: https://www.olimex.com/Products/ARM/JTAG/_resources/OpenOCD/

From the logs it seems that the connection works fine until the flash sequence and the memory address are given. This part of your log is flawless and this probably means that the hardware connection is alright:

Quote
Open On-Chip Debugger 0.10.0+dev-00567-gcea40152f (2018-11-03-20:42)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : JTAG tap: am335x.jrc tap/device found: 0x2b94402f (mfg: 0x017 (Texas Instruments), part: 0xb944,ver: 0x2)
Info : JTAG tap: am335x.tap enabled
Info : am335x.cpu: hardware has 6 breakpoints, 2 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 3334 for gdb connections
Info : accepting 'telnet' connection on tcp/4444
Info : JTAG tap: am335x.jrc tap/device found: 0x2b94402f (mfg: 0x017 (Texas Instruments), part: 0xb944,ver: 0x2)
Info : JTAG tap: am335x.tap enabled
Technical support and documentation manager at Olimex

pamon

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: [OpenOCD] How to evaluate if a JTAG chain works correctly?
« Reply #5 on: March 10, 2019, 06:04:37 PM »
OK I have made some progresses from last post.

The TI StarterWare bootloader is need if we do not use any other bootloader as for example uboot.

Now, after reading the TI StarterWare Manual, I know how to boot the "TI StarterWare bootloader" + "TI StarterWare Application" from the uSD or from UART of my BBB.

I do not understand why in the case of uSD, I need used boot_ti.bin and "app"_ti.bin, whereas the boot.bin and "app".bin are enough when I boot from UART ?

So now, I have a clear base to work on the JTAG chain.

For the moment, I have not weld EMU0 or EMU1 pins of my ARM20cTI20 (https://web.archive.org/web/20150926030904/http://www.tincantools.com/_newsite2013/userfiles/file/ARM20cTI20_Rev-B_schematic.pdf) to enable Wait-In-Reset mode of the CPU.

From this article https://devel.rtems.org/wiki/Debugging/OpenOCD/BeagleBoneBlack I have launched the MLO with OpenOCD.

On telnet session connected to OpenOCD:
Code: [Select]
reset halt
bp 0x402f0400 4 hw
reset run
rbp 0x402f0400
load_image ./StarterWare/binary/armv7a/gcc/am335x/beaglebone/bootloader/Release_MMCSD/boot.bin 0x402f0400 bin
resume 0x402f0400

This launches the MLO. I can see the TI StarterWare message of the MLO on my UART terminal.
I can conclude to my JTAG chain works.

But above with OpenOCD, I launch only the MLO, when I try to launch the app binary on 0x8000_0000, I obtain this error "data abort at 0x00000000, dfsr = 0x00000808". What does it mean? I do not understand why I can not load binary to 0x8000_0000 also I can load it to 0x402f0400

From TRM:
"SRAM internal 0x402F_0400 0x402F_FFFF 32-bit (Ex/R/W)"
"EMIF0 SDRAM 0x8000_0000 0xBFFF_FFFF 1GB 8-/16-bit External Memory (Ex/R/W)"
and
"The DDR2/3/mDDR memory controller will remain fully functional during emulation halts to allow emulation access to external memory."

I do not found any restriction in the TRM documentation about the use of EMIF0 SDRAM. Why does it not works on the BBB DDR3 ? It do not seem any differences between these 2 kinds of RAMs, they are both in Ex/R/W.

Another point, launching the MLO with the telnet session is OK, but it is not the case with a GDB session connected to OpenOCD, I don't understand the difference for the moment, I use the same OpenOCD commands (with "monitor" key before in GDB) but it give a different results:
"no flash patch comparator unit available for hardware breakpoint
can't add breakpoint: resource not available
Failure setting breakpoint, the same address(IVA) is already used"

pamon

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: [OpenOCD] How to evaluate if a JTAG chain works correctly?
« Reply #6 on: March 14, 2019, 11:47:26 AM »
up

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1906
  • Karma: +48/-2
Re: [OpenOCD] How to evaluate if a JTAG chain works correctly?
« Reply #7 on: March 14, 2019, 11:58:28 AM »
Did you also post in the Texas Instruments forum and OpenOCD mail list? People at those locations are more likely to have extensive experience with OpenOCD for AM335x and/or TI StarterWare software packages.
Technical support and documentation manager at Olimex

pamon

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: [OpenOCD] How to evaluate if a JTAG chain works correctly?
« Reply #8 on: March 21, 2019, 04:19:49 PM »
I have done in parallel with TI here:

https://e2e.ti.com/support/processors/f/791/p/777331/2902002

But their answers are limited to tools currently available from TI

JohnS

  • Hero Member
  • *****
  • Posts: 1718
  • Karma: +33/-47
Re: [OpenOCD] How to evaluate if a JTAG chain works correctly?
« Reply #9 on: March 21, 2019, 10:13:46 PM »
Try the oocd ML, as already suggested.

They'll want -d3 output.

It may be that no-one has done what you are trying, of course.  Or has but is unable to comment.

John