OpenOCD on Freescale i.MX6

Hello,

i have a “SABRE Board for Smart Devices Based on the i.MX 6 Series”. And I tried to get OpenOCD to work with it.

This is my OpenOCD configuration file for the i.MX6. Which is included in OpenOCD v0.7-dev.

scripts/target/imx6.cfg

# Freescale i.MX6 series single/dual/quad core processor

if { [info exists CHIPNAME] } {
   set  _CHIPNAME $CHIPNAME
} else {
   set  _CHIPNAME imx6
}

# CoreSight Debug Access Port
if { [info exists DAP_TAPID] } {
        set _DAP_TAPID $DAP_TAPID
} else {
        set _DAP_TAPID 0x4ba00477
}

jtag newtap $_CHIPNAME dap -irlen 4 -ircapture 0x01 -irmask 0x0f \
        -expected-id $_DAP_TAPID

# SDMA / no IDCODE
jtag newtap $_CHIPNAME sdma -irlen 4 -ircapture 0x00 -irmask 0x0f

# System JTAG Controller
if { [info exists SJC_TAPID] } {
        set _SJC_TAPID SJC_TAPID
} else {
        set _SJC_TAPID 0x0191c01d
}
set _SJC_TAPID2 0x2191c01d

jtag newtap $_CHIPNAME sjc -irlen 5 -ircapture 0x01 -irmask 0x1f \
        -expected-id $_SJC_TAPID -expected-id $_SJC_TAPID2

# GDB target: Cortex-A9, using DAP, configuring only one core
# Base addresses of cores:
# core 0  -  0x82150000
# core 1  -  0x82152000
# core 2  -  0x82154000
# core 3  -  0x82156000
set _TARGETNAME $_CHIPNAME.cpu.0
target create $_TARGETNAME cortex_a8 -chain-position $_CHIPNAME.dap \
        -coreid 0 -dbgbase 0x82150000

# some TCK cycles are required to activate the DEBUG power domain
jtag configure $_CHIPNAME.sjc -event post-reset "runtest 100"

proc imx6_dbginit {target} {
        # General Cortex A8/A9 debug initialisation
        cortex_a8 dbginit
}

# Slow speed to be sure it will work
jtag_rclk 1000
$_TARGETNAME configure -event reset-start { jtag_rclk 1000 }

$_TARGETNAME configure -event reset-assert-post "imx6_dbginit $_TARGETNAME"
$_TARGETNAME configure -event gdb-attach { halt }

scripts/interface/openocd-usb-hs.cfg

#
# embedded projects openocd usb adapter v3
#
# http://shop.embedded-projects.net/index.php?module=artikel&action=artikel&id=14
#

interface ft2232
ft2232_vid_pid 0x0403 0x6010
ft2232_device_desc "Dual RS232-HS"
ft2232_layout "oocdlink"
ft2232_latency 2

This is the output when i run openocd:

$ openocd -f scripts/interface/openocd-usb-hs.cfg -f scripts/target/imx6.cfg 
Open On-Chip Debugger 0.7.0-dev-00204-g1da9e59 (2013-03-27-09:22)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Warn : imx6.sdma: nonstandard IR value
RCLK - adaptive
Info : max TCK change to: 30000 kHz
Info : RCLK (adaptive clock speed)
Polling target imx6.cpu.0 failed, GDB will be halted. Polling again in 100ms
Polling target imx6.cpu.0 failed, GDB will be halted. Polling again in 300ms
Error: couldn't read enough bytes from FT2232 device (0 < 81)
Error: couldn't read from FT2232
in procedure 'runtest'
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: couldn't read enough bytes from FT2232 device (0 < 3)
Error: couldn't read from FT2232
Warn : Bypassing JTAG setup events due to errors
Error: couldn't read enough bytes from FT2232 device (0 < 12)
Error: couldn't read from FT2232
Polling target imx6.cpu.0 failed, GDB will be halted. Polling again in 700ms
Polling target imx6.cpu.0 failed, GDB will be halted. Polling again in 1500ms
Polling target imx6.cpu.0 failed, GDB will be halted. Polling again in 3100ms

I tested it with Openocd 0.6.1 and now I am on Open On-Chip Debugger 0.7.0-dev-00204-g1da9e59 (2013-03-27-09:22)

I know i allready posted it on the iMX Forum but did not got any response…

Do you have any idea what’s the problem? If you need further information or if i did something wrong please let me know!

Thank you! I hope you can help me!

MaTT

Hello Matt,

Have you been able to verify that the openocd-usb-hs is working OK?

-Hugh

(apologies if it is built into the Sabre - too lazy to research today.)

Hello Hugh,

thank you for your reply. The openocd-usb-hs is working with other Hardware.

The Output with the Sabre is very confusing to me, because there is absoulute no response from the board, if i am right.

The Board is only resetting but after that nothing happens.

Regards

MaTT

Matt,

I would try two things:

  1. use a fixed jtag clock rather than adaptive, starting slow, eg. adapter_khz 100

  2. use the newer ftdi driver, configure OpenOCD with --enable-ftdi. It uses libusb-1.0 or libusbx and is the preferred driver moving forward.

The only other change to your config is to the interface script used, note the added ftdi directory.

scripts/interface/ftdi/openocd-usb-hs.cfg

Cheers

Spen

Hello Spen,

Hello Spen,

Thank you for your quick answer.

  1. I allready tried it with different adapter_khz speeds but I had no success.

  2. this is how i set up openocd

  • git clone git://git.code.sf.net/p/openocd/code openocd-code

  • git checkout v0.6.1

  • ./bootstrap

  • ./configure --enable-ft2232_libftdi --enable-ftdi --enable-maintainer-mode --prefix=/usr/local

  • make

  • sudo make install

ft2232 mode

sudopenocd -f /usr/local/share/openocd/scripts/interface/openocd-usb-hs.cfg \
-f /usr/local/share/openocd/scripts/target/imx6.cfg 
Open On-Chip Debugger 0.6.1 (2013-03-28-13:32)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Warn : imx6.sdma: nonstandard IR value
RCLK - adaptive
Info : max TCK change to: 30000 kHz
Info : RCLK (adaptive clock speed)
Polling target failed, GDB will be halted. Polling again in 100ms
Polling target failed, GDB will be halted. Polling again in 300ms
Error: couldn't read enough bytes from FT2232 device (0 < 81)
Error: couldn't read from FT2232
in procedure 'runtest'
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: couldn't read enough bytes from FT2232 device (0 < 3)
Error: couldn't read from FT2232
Warn : Bypassing JTAG setup events due to errors
Error: couldn't read enough bytes from FT2232 device (0 < 12)
Error: couldn't read from FT2232
Polling target failed, GDB will be halted. Polling again in 700ms
Polling target failed, GDB will be halted. Polling again in 1500ms
Polling target failed, GDB will be halted. Polling again in 3100ms

nothing happens…

ftdi mode

sudo openocd -f /usr/local/share/openocd/scripts/interface/ftdi/openocd-usb-hs.cfg \
-f /usr/local/share/openocd/scripts/target/imx6.cfg 
Open On-Chip Debugger 0.6.1 (2013-03-28-13:32)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Warn : imx6.sdma: nonstandard IR value
RCLK - adaptive
Info : RCLK (adaptive clock speed)
Polling target failed, GDB will be halted. Polling again in 100ms
Polling target failed, GDB will be halted. Polling again in 300ms

nothing happens…

It can be a very stupid failure… I am not a professional on OpenOCD/Embedded World (just a beginner but I am interested in learning).

Thank you for your help

MaTT

Please try with latest master, eg, ‘git checkout master’ rather than use 0.6.1 release.

Also enable full debug log (-d3) and set jtag speed manually, disable rclk.

I would also disable using the older ftdi driver - remove ‘–enable-ft2232_libftdi’ from configure line.

Spen

Thank you, I read a bit through the output but I do not know what I am searching for…

  • I use “Open On-Chip Debugger 0.7.0-dev-00204-g1da9e59 (2013-03-28-14:04)”

  • Configured with ./configure --enable-ftdi --enable-maintainer-mode --prefix=/usr/local

sol@sol:~$ sudo openocd -d3 -f /usr/local/share/openocd/scripts/interface/ftdi/openocd-usb-hs.cfg -f /usr/local/share/openocd/scripts/target/imx6.cfg
[sudo] password for sol: 
Open On-Chip Debugger 0.7.0-dev-00204-g1da9e59 (2013-03-28-14:04)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
User : 13 1 command.c:549 command_print(): debug_level: 3
Debug: 14 1 configuration.c:45 add_script_search_dir(): adding /home/sol/.openocd
Debug: 15 1 configuration.c:45 add_script_search_dir(): adding /usr/local/share/openocd/site
Debug: 16 1 configuration.c:45 add_script_search_dir(): adding /usr/local/share/openocd/scripts
Debug: 17 1 configuration.c:86 find_file(): found /usr/local/share/openocd/scripts/interface/ftdi/openocd-usb-hs.cfg
Debug: 18 1 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_interface ftdi
Debug: 19 1 command.c:145 script_debug(): command - interface ocd_interface ftdi
Debug: 21 1 command.c:369 register_command_handler(): registering 'ocd_ftdi_device_desc'...
Debug: 22 1 command.c:369 register_command_handler(): registering 'ocd_ftdi_serial'...
Debug: 23 1 command.c:369 register_command_handler(): registering 'ocd_ftdi_channel'...
Debug: 24 1 command.c:369 register_command_handler(): registering 'ocd_ftdi_layout_init'...
Debug: 25 1 command.c:369 register_command_handler(): registering 'ocd_ftdi_layout_signal'...
Debug: 26 1 command.c:369 register_command_handler(): registering 'ocd_ftdi_set_signal'...
Debug: 27 1 command.c:369 register_command_handler(): registering 'ocd_ftdi_vid_pid'...
Info : 28 1 transport.c:118 allow_transports(): only one transport option; autoselect 'jtag'
Debug: 29 1 command.c:369 register_command_handler(): registering 'ocd_jtag_flush_queue_sleep'...
Debug: 30 1 command.c:369 register_command_handler(): registering 'ocd_jtag_rclk'...
Debug: 31 1 command.c:369 register_command_handler(): registering 'ocd_jtag_ntrst_delay'...
Debug: 32 1 command.c:369 register_command_handler(): registering 'ocd_jtag_ntrst_assert_width'...
Debug: 33 2 command.c:369 register_command_handler(): registering 'ocd_scan_chain'...
Debug: 34 2 command.c:369 register_command_handler(): registering 'ocd_jtag_reset'...
Debug: 35 2 command.c:369 register_command_handler(): registering 'ocd_runtest'...
Debug: 36 2 command.c:369 register_command_handler(): registering 'ocd_irscan'...
Debug: 37 2 command.c:369 register_command_handler(): registering 'ocd_verify_ircapture'...
Debug: 38 2 command.c:369 register_command_handler(): registering 'ocd_verify_jtag'...
Debug: 39 2 command.c:369 register_command_handler(): registering 'ocd_tms_sequence'...
Debug: 40 2 command.c:369 register_command_handler(): registering 'ocd_wait_srst_deassert'...
Debug: 41 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 42 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 43 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 44 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 45 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 46 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 47 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 48 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 49 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 50 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 51 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 52 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 53 2 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 54 2 command.c:369 register_command_handler(): registering 'ocd_svf'...
Debug: 55 2 command.c:369 register_command_handler(): registering 'ocd_xsvf'...
Debug: 56 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_ftdi_device_desc Dual RS232-HS
Debug: 57 2 command.c:145 script_debug(): command - ftdi_device_desc ocd_ftdi_device_desc Dual RS232-HS
Debug: 59 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_ftdi_vid_pid 0x0403 0x6010
Debug: 60 2 command.c:145 script_debug(): command - ftdi_vid_pid ocd_ftdi_vid_pid 0x0403 0x6010
Debug: 62 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_init 0x0508 0x0f1b
Debug: 63 2 command.c:145 script_debug(): command - ftdi_layout_init ocd_ftdi_layout_init 0x0508 0x0f1b
Debug: 65 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_signal nTRST -data 0x0200 -noe 0x0100
Debug: 66 2 command.c:145 script_debug(): command - ftdi_layout_signal ocd_ftdi_layout_signal nTRST -data 0x0200 -noe 0x0100
Debug: 68 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_signal nSRST -data 0x0800 -noe 0x0400
Debug: 69 2 command.c:145 script_debug(): command - ftdi_layout_signal ocd_ftdi_layout_signal nSRST -data 0x0800 -noe 0x0400
Debug: 71 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_adapter_khz 100
Debug: 72 2 command.c:145 script_debug(): command - adapter_khz ocd_adapter_khz 100
Debug: 74 2 core.c:1648 jtag_config_khz(): handle jtag khz
Debug: 75 2 core.c:1615 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 76 2 core.c:1615 adapter_khz_to_speed(): convert khz to interface specific speed value
User : 77 2 command.c:549 command_print(): adapter speed: 100 kHz
Debug: 78 2 configuration.c:86 find_file(): found /usr/local/share/openocd/scripts/target/imx6.cfg
Debug: 79 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_jtag newtap imx6 dap -irlen 4 -ircapture 0x01 -irmask 0x0f -expected-id 0x4ba00477
Debug: 80 2 command.c:145 script_debug(): command - ocd_jtag ocd_jtag newtap imx6 dap -irlen 4 -ircapture 0x01 -irmask 0x0f -expected-id 0x4ba00477
Debug: 81 2 tcl.c:554 jim_newtap_cmd(): Creating New Tap, Chip: imx6, Tap: dap, Dotted: imx6.dap, 8 params
Debug: 82 2 tcl.c:571 jim_newtap_cmd(): Processing option: -irlen
Debug: 83 2 tcl.c:571 jim_newtap_cmd(): Processing option: -ircapture
Debug: 84 2 tcl.c:571 jim_newtap_cmd(): Processing option: -irmask
Debug: 85 2 tcl.c:571 jim_newtap_cmd(): Processing option: -expected-id
Debug: 86 2 core.c:1323 jtag_tap_init(): Created Tap: imx6.dap @ abs position 0, irlen 4, capture: 0x1 mask: 0xf
Debug: 87 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_jtag newtap imx6 sdma -irlen 4 -ircapture 0x00 -irmask 0x0f
Debug: 88 2 command.c:145 script_debug(): command - ocd_jtag ocd_jtag newtap imx6 sdma -irlen 4 -ircapture 0x00 -irmask 0x0f
Debug: 89 2 tcl.c:554 jim_newtap_cmd(): Creating New Tap, Chip: imx6, Tap: sdma, Dotted: imx6.sdma, 6 params
Debug: 90 2 tcl.c:571 jim_newtap_cmd(): Processing option: -irlen
Debug: 91 2 tcl.c:571 jim_newtap_cmd(): Processing option: -ircapture
Warn : 92 2 tcl.c:500 jim_newtap_ir_param(): imx6.sdma: nonstandard IR value
Debug: 93 2 tcl.c:571 jim_newtap_cmd(): Processing option: -irmask
Debug: 94 2 core.c:1323 jtag_tap_init(): Created Tap: imx6.sdma @ abs position 1, irlen 4, capture: 0x0 mask: 0xf
Debug: 95 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_jtag newtap imx6 sjc -irlen 5 -ircapture 0x01 -irmask 0x1f -expected-id 0x0191c01d -expected-id 0x2191c01d
Debug: 96 2 command.c:145 script_debug(): command - ocd_jtag ocd_jtag newtap imx6 sjc -irlen 5 -ircapture 0x01 -irmask 0x1f -expected-id 0x0191c01d -expected-id 0x2191c01d
Debug: 97 2 tcl.c:554 jim_newtap_cmd(): Creating New Tap, Chip: imx6, Tap: sjc, Dotted: imx6.sjc, 10 params
Debug: 98 2 tcl.c:571 jim_newtap_cmd(): Processing option: -irlen
Debug: 99 2 tcl.c:571 jim_newtap_cmd(): Processing option: -ircapture
Debug: 100 2 tcl.c:571 jim_newtap_cmd(): Processing option: -irmask
Debug: 101 2 tcl.c:571 jim_newtap_cmd(): Processing option: -expected-id
Debug: 102 2 tcl.c:571 jim_newtap_cmd(): Processing option: -expected-id
Debug: 103 2 core.c:1323 jtag_tap_init(): Created Tap: imx6.sjc @ abs position 2, irlen 5, capture: 0x1 mask: 0x1f
Debug: 104 2 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_target create imx6.cpu.0 cortex_a8 -chain-position imx6.dap -coreid 0 -dbgbase 0x82150000
Debug: 105 2 command.c:145 script_debug(): command - ocd_target ocd_target create imx6.cpu.0 cortex_a8 -chain-position imx6.dap -coreid 0 -dbgbase 0x82150000
Debug: 106 2 target.c:1615 target_free_all_working_areas_restore(): freeing all working areas
Debug: 107 2 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 108 3 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 109 3 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 110 3 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 111 3 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 112 3 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 113 3 command.c:369 register_command_handler(): registering 'ocd_dap'...
Debug: 114 3 command.c:369 register_command_handler(): registering 'ocd_dap'...
Debug: 115 3 command.c:369 register_command_handler(): registering 'ocd_dap'...
Debug: 116 3 command.c:369 register_command_handler(): registering 'ocd_dap'...
Debug: 117 3 command.c:369 register_command_handler(): registering 'ocd_dap'...
Debug: 118 3 command.c:369 register_command_handler(): registering 'ocd_cache_config'...
Debug: 119 3 command.c:369 register_command_handler(): registering 'ocd_cortex_a8'...
Debug: 120 3 command.c:369 register_command_handler(): registering 'ocd_cortex_a8'...
Debug: 121 3 command.c:369 register_command_handler(): registering 'ocd_cortex_a8'...
Debug: 122 3 command.c:369 register_command_handler(): registering 'ocd_cortex_a8'...
Debug: 123 3 command.c:369 register_command_handler(): registering 'ocd_cortex_a8'...
Debug: 124 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 125 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 126 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 127 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 128 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 129 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 130 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 131 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 132 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 133 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 134 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 135 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 136 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 137 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 138 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 139 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 140 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 141 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 142 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 143 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 144 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 145 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 146 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 147 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 148 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 149 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 150 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 151 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 152 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 153 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 154 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 155 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 156 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 157 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 158 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 159 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 160 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 161 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 162 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 163 3 command.c:369 register_command_handler(): registering 'ocd_imx6.cpu.0'...
Debug: 164 3 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_jtag configure imx6.sjc -event post-reset runtest 100
Debug: 165 3 command.c:145 script_debug(): command - ocd_jtag ocd_jtag configure imx6.sjc -event post-reset runtest 100
Debug: 166 3 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_jtag_rclk 1000
Debug: 167 3 command.c:145 script_debug(): command - jtag_rclk ocd_jtag_rclk 1000
Debug: 169 3 core.c:1657 jtag_config_rclk(): handle jtag rclk
Debug: 170 3 core.c:1615 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 171 3 core.c:1615 adapter_khz_to_speed(): convert khz to interface specific speed value
User : 172 26 command.c:549 command_print(): RCLK - adaptive
Debug: 173 26 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_imx6.cpu.0 configure -event reset-start  jtag_rclk 1000 
Debug: 174 26 command.c:145 script_debug(): command - ocd_imx6.cpu.0 ocd_imx6.cpu.0 configure -event reset-start  jtag_rclk 1000 
Debug: 175 26 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_imx6.cpu.0 configure -event reset-assert-post imx6_dbginit imx6.cpu.0
Debug: 176 26 command.c:145 script_debug(): command - ocd_imx6.cpu.0 ocd_imx6.cpu.0 configure -event reset-assert-post imx6_dbginit imx6.cpu.0
Debug: 177 26 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_imx6.cpu.0 configure -event gdb-attach  halt 
Debug: 178 26 command.c:145 script_debug(): command - ocd_imx6.cpu.0 ocd_imx6.cpu.0 configure -event gdb-attach  halt 
Debug: 179 26 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_init
Debug: 180 26 command.c:145 script_debug(): command - init ocd_init
Debug: 182 26 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_target init
Debug: 183 26 command.c:145 script_debug(): command - ocd_target ocd_target init
Debug: 185 26 target.c:1178 handle_target_init_command(): Initializing targets...
Debug: 186 26 command.c:369 register_command_handler(): registering 'ocd_target_request'...
Debug: 187 26 command.c:369 register_command_handler(): registering 'ocd_trace'...
Debug: 188 26 command.c:369 register_command_handler(): registering 'ocd_trace'...
Debug: 189 26 command.c:369 register_command_handler(): registering 'ocd_fast_load_image'...
Debug: 190 26 command.c:369 register_command_handler(): registering 'ocd_fast_load'...
Debug: 191 26 command.c:369 register_command_handler(): registering 'ocd_profile'...
Debug: 192 26 command.c:369 register_command_handler(): registering 'ocd_virt2phys'...
Debug: 193 26 command.c:369 register_command_handler(): registering 'ocd_reg'...
Debug: 194 26 command.c:369 register_command_handler(): registering 'ocd_poll'...
Debug: 195 26 command.c:369 register_command_handler(): registering 'ocd_wait_halt'...
Debug: 196 26 command.c:369 register_command_handler(): registering 'ocd_halt'...
Debug: 197 26 command.c:369 register_command_handler(): registering 'ocd_resume'...
Debug: 198 26 command.c:369 register_command_handler(): registering 'ocd_reset'...
Debug: 199 26 command.c:369 register_command_handler(): registering 'ocd_soft_reset_halt'...
Debug: 200 26 command.c:369 register_command_handler(): registering 'ocd_step'...
Debug: 201 26 command.c:369 register_command_handler(): registering 'ocd_mdw'...
Debug: 202 26 command.c:369 register_command_handler(): registering 'ocd_mdh'...
Debug: 203 26 command.c:369 register_command_handler(): registering 'ocd_mdb'...
Debug: 204 26 command.c:369 register_command_handler(): registering 'ocd_mww'...
Debug: 205 27 command.c:369 register_command_handler(): registering 'ocd_mwh'...
Debug: 206 27 command.c:369 register_command_handler(): registering 'ocd_mwb'...
Debug: 207 27 command.c:369 register_command_handler(): registering 'ocd_bp'...
Debug: 208 27 command.c:369 register_command_handler(): registering 'ocd_rbp'...
Debug: 209 27 command.c:369 register_command_handler(): registering 'ocd_wp'...
Debug: 210 27 command.c:369 register_command_handler(): registering 'ocd_rwp'...
Debug: 211 27 command.c:369 register_command_handler(): registering 'ocd_load_image'...
Debug: 212 27 command.c:369 register_command_handler(): registering 'ocd_dump_image'...
Debug: 213 27 command.c:369 register_command_handler(): registering 'ocd_verify_image'...
Debug: 214 27 command.c:369 register_command_handler(): registering 'ocd_test_image'...
Debug: 215 27 command.c:369 register_command_handler(): registering 'ocd_reset_nag'...
Debug: 216 27 command.c:369 register_command_handler(): registering 'ocd_ps'...
Debug: 217 27 ftdi.c:630 ftdi_initialize(): ftdi interface using shortest path jtag state transitions
Debug: 218 34 mpsse.c:361 mpsse_purge(): -
Debug: 219 34 mpsse.c:626 mpsse_loopback_config(): off
Debug: 220 34 core.c:1615 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 221 34 core.c:1618 adapter_khz_to_speed(): have interface set up
Debug: 222 34 mpsse.c:667 mpsse_set_frequency(): target 0 Hz
Debug: 223 34 mpsse.c:660 mpsse_rtck_config(): on
Debug: 224 34 core.c:1615 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 225 34 core.c:1618 adapter_khz_to_speed(): have interface set up
Info : 226 34 core.c:1406 adapter_init(): RCLK (adaptive clock speed)
Debug: 227 34 openocd.c:132 handle_init_command(): Debug Adapter init complete
Debug: 228 34 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_transport init
Debug: 229 35 command.c:145 script_debug(): command - ocd_transport ocd_transport init
Debug: 231 35 transport.c:240 handle_transport_init(): handle_transport_init
Debug: 232 35 core.c:719 jtag_add_reset(): SRST line released
Debug: 233 35 core.c:743 jtag_add_reset(): TRST line released
Debug: 234 35 core.c:323 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 235 35 tcl.c:630 jtag_tap_handle_event(): JTAG tap: imx6.sjc event: 0 (post-reset)
	action: runtest 100
Debug: 236 35 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_runtest 100
Debug: 237 35 command.c:145 script_debug(): command - runtest ocd_runtest 100
User : 238 35 target.c:2234 handle_target(): Polling target imx6.cpu.0 failed, GDB will be halted. Polling again in 100ms
Debug: 239 35 target.c:1294 target_call_event_callbacks(): target event 0 (gdb-halt)
Debug: 241 35 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_jtag arp_init
Debug: 242 35 command.c:145 script_debug(): command - ocd_jtag ocd_jtag arp_init
Debug: 243 35 core.c:1417 jtag_init_inner(): Init JTAG chain
Debug: 244 35 core.c:323 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 245 35 tcl.c:630 jtag_tap_handle_event(): JTAG tap: imx6.sjc event: 0 (post-reset)
	action: runtest 100
Debug: 246 35 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_runtest 100
Debug: 247 35 command.c:145 script_debug(): command - runtest ocd_runtest 100
Debug: 249 35 core.c:1048 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
Debug: 250 35 core.c:323 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 251 35 tcl.c:630 jtag_tap_handle_event(): JTAG tap: imx6.sjc event: 0 (post-reset)
	action: runtest 100
Debug: 252 35 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_runtest 100
Debug: 253 35 command.c:145 script_debug(): command - runtest ocd_runtest 100
User : 254 35 target.c:2234 handle_target(): Polling target imx6.cpu.0 failed, GDB will be halted. Polling again in 300ms
Debug: 255 35 target.c:1294 target_call_event_callbacks(): target event 0 (gdb-halt)

Thank you for your help

MaTT

Can you disable rclk please and rerun, also try connecting via telnet and issue ‘reset halt’.

The support for this target has only just been added, so it may be worth asking on the [openocd-devel mailing list. You will need to subscribe to post.

As a side note you should really sort out your permissions (udev etc), so sudo is not required.

Cheers

Spen](openocd-devel List Signup and Options)

niedermaier:
Hello Spen,

Hello Spen,

Thank you for your quick answer.

  1. I allready tried it with different adapter_khz speeds but I had no success.

  2. this is how i set up openocd

  • git clone git://git.code.sf.net/p/openocd/code openocd-code

  • git checkout v0.6.1

  • ./bootstrap

  • ./configure --enable-ft2232_libftdi --enable-ftdi --enable-maintainer-mode --prefix=/usr/local

  • make

  • sudo make install

ft2232 mode

sudopenocd -f /usr/local/share/openocd/scripts/interface/openocd-usb-hs.cfg \

-f /usr/local/share/openocd/scripts/target/imx6.cfg
Open On-Chip Debugger 0.6.1 (2013-03-28-13:32)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
Info : only one transport option; autoselect ‘jtag’
Warn : imx6.sdma: nonstandard IR value
RCLK - adaptive
Info : max TCK change to: 30000 kHz
Info : RCLK (adaptive clock speed)
Polling target failed, GDB will be halted. Polling again in 100ms
Polling target failed, GDB will be halted. Polling again in 300ms
Error: couldn’t read enough bytes from FT2232 device (0 < 81)
Error: couldn’t read from FT2232
in procedure ‘runtest’
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway…
Error: couldn’t read enough bytes from FT2232 device (0 < 3)
Error: couldn’t read from FT2232
Warn : Bypassing JTAG setup events due to errors
Error: couldn’t read enough bytes from FT2232 device (0 < 12)
Error: couldn’t read from FT2232
Polling target failed, GDB will be halted. Polling again in 700ms
Polling target failed, GDB will be halted. Polling again in 1500ms
Polling target failed, GDB will be halted. Polling again in 3100ms



nothing happens..



ftdi mode


sudo openocd -f /usr/local/share/openocd/scripts/interface/ftdi/openocd-usb-hs.cfg
-f /usr/local/share/openocd/scripts/target/imx6.cfg
Open On-Chip Debugger 0.6.1 (2013-03-28-13:32)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
Info : only one transport option; autoselect ‘jtag’
Warn : imx6.sdma: nonstandard IR value
RCLK - adaptive
Info : RCLK (adaptive clock speed)
Polling target failed, GDB will be halted. Polling again in 100ms
Polling target failed, GDB will be halted. Polling again in 300ms



nothing happens..



It can be a very stupid failure.. I am not a professional on OpenOCD/Embedded World (just a beginner but I am interested in learning).



Thank you for your help 



MaTT

Not many “beginners” drop $500 on a dev board. I have one of these, but we aren’t using openocd.

The app guys using kdevelop with gdb over the console/network for now. Its simple enough once the environment works.

Also other work intrudes,and I likely won’t be back on this board for a few weeks.

What ocd hardware are you using? arm-usb from olimex?

Hello,

thank you for your hints/advices! I connected a Logic Analyzer to the JTAG Port. In my opinion it is not normal that the RESET stuck to ground, isn’t it?

[<LINK_TEXT text=“http://s1.directupload.net/images/13040 … 945t9m.png”>http://s1.directupload.net/images/130403/temp/5v945t9m.png</LINK_TEXT>

What ocd hardware are you using? arm-usb from olimex?

I use a openocd-usb-hs from embedded-projects.net/

Can you disable rclk please and rerun, also try connecting via telnet and issue ‘reset halt’.

How do i disable rclk?

Regards

MaTT](http://s1.directupload.net/file/d/3214/5v945t9m_png.htm)

First of all! Thank you very much for your help!!!

I have “solved” the Problem! I removed the RESET wire between openocd-usb and the target board. Now i have basic jtag access. But i do not know why the RESET stuck to ground? Any Ideas?

Cheers

MaTT

Matt,

Glad it is partially working.

rclk is disabled by setting a adapter speed, eg. replace jtag_rclk 1000 with adapter_khz 100 as a start.

The speed can be changed back once we have proved rclk is not causing issues.

As to why the srst is causing issues i have no idea, the adapter may be damaged or the driver may have issues.

I cannot find any info on this adapter so not much i can do to help further.

To test, the srst lines can be manually changed, eg.

# jtag_reset trst srst
jtag_reset 0 1 # asserts srst
jtag_reset 0 0 # releasees srst

Spen

Thanks Span,

this is the output from jtag_rest. If i test the openocd-usb-hs debugger with a other dev-board the RESET works fine. So it is only a phenomen of this constellation (software/hardware).

openocd-usb-hs with i.MX6qsabresd

> jtag_reset 0 1
BUG: can't assert SRST
in procedure 'jtag_reset'

Regards

MaTT

To use jtag_reset you do need a srst fitted and configured, eg. reset_config srst_only

Spen

Thanks Span,

I added this to my configuration:

reset_config srst_only

Now if i try there is no failure, but also no output on the digital pin!

> jtag_reset 0 0
> jtag_reset 0 1
> jtag_reset 1 0
> jtag_reset 1 1

Regards

MaTT

I had the same problem. It turned out that pins 6 and 7 of the wandboard’s jtag header were shorted out when I soldered in the header.