Hi Kees,

do you kindly like to have a look to urjtag patch in attachment? I'm not sure about it and like to hear your expertise!

The patch applies against an already configured urjtag (it patches the Makefiles created by configure) and introduces an additional 'omap3' command. Executing it, output is:

-- cut --
jtag> cable Flyswatter
Connected to libftdi driver.
jtag> omap3
Running OMAP3 init ...
OMAP3 ICEPICK IDCODE: 00001011011110101110000000101111 (0x0B7AE02F)
OMAP3 ICEPICK IDCODE: 00010110111101011100000001011110 (0x16F5C05E)
jtag>
-- cut --

If you look at the code in src/tap/omap3.c in omap3() function the first IDCODE is output _before_ and the second _after_ my understanding of TI's ICEPICK sequence is done.

As you can see second IDCODE is shifted by one bit! This might mean that additional DR with bit length 1 is inserted (?). What do you think?

Next test would be to try to read ARM's IDCODE, but I don't know at what DR to look for this (assuming that ARM TAP is really inserted). From

-- cut --
## Function  : Update the JTAG preamble and post-amble counts.
   Parameter : The IR pre-amble count is '0'.
   Parameter : The IR post-amble count is '6'.
   Parameter : The DR pre-amble count is '0'.
   Parameter : The DR post-amble count is '1'.
   Parameter : The IR main count is '4'.
   Parameter : The DR main count is '1'.
-- cut --

we know that ARM's IR register length is 4, but at what DR number to look for?

Sorry if I misunderstood something ;)

Many thanks

Dirk

P.S.: urjtag developers: This is nothing to be applied, it is only an experimental proof of concept. Sorry for hacking urjtag code this way ;)
Subject: [PATCH] Hack to configure OMAP3 ICEPICK

From: Dirk Behme <[email protected]>

This patch adds an additional hackish 'omap3' command to urjtag
which tries to perform OMAP3 ICEPICK initialization.

Signed-off-by: Dirk Behme <[email protected]>

--
 src/cmd/Makefile |    6 +-
 src/cmd/cmd.c    |    2 
 src/cmd/omap3.c  |   59 +++++++++++++++++++++++
 src/tap/Makefile |    6 +-
 src/tap/detect.c |    3 +
 src/tap/omap3.c  |  138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 208 insertions(+), 6 deletions(-)

Index: jtag/src/tap/detect.c
===================================================================
--- jtag.orig/src/tap/detect.c
+++ jtag/src/tap/detect.c
@@ -244,6 +244,9 @@ detect_parts( chain_t *chain, const char
        chain->parts = ps;
        chain->active_part = 0;
 
+       chain_set_trst( chain, 0 );
+       chain_set_trst( chain, 1 );
+
        /* Detect parts */
        tap_reset( chain );
        tap_capture_dr( chain );
Index: jtag/src/cmd/Makefile
===================================================================
--- jtag.orig/src/cmd/Makefile
+++ jtag/src/cmd/Makefile
@@ -102,7 +102,7 @@ ARFLAGS = cru
 libcmd_a_AR = $(AR) $(ARFLAGS)
 libcmd_a_LIBADD =
 am__libcmd_a_SOURCES_DIST = frequency.c cable.c reset.c discovery.c \
-       idcode.c detect.c detectflash.c help.c quit.c scan.c signal.c \
+       idcode.c omap3.c detect.c detectflash.c help.c quit.c scan.c signal.c \
        salias.c bit.c register.c initbus.c print.c part.c bus.c \
        instruction.c shift.c dr.c get.c test.c debug.c shell.c set.c \
        endian.c parse.c peekpoke.c pod.c readmem.c writemem.c \
@@ -112,7 +112,7 @@ am__objects_1 = svf.$(OBJEXT)
 am__objects_2 = bsdl.$(OBJEXT)
 am_libcmd_a_OBJECTS = frequency.$(OBJEXT) cable.$(OBJEXT) \
        reset.$(OBJEXT) discovery.$(OBJEXT) idcode.$(OBJEXT) \
-       detect.$(OBJEXT) detectflash.$(OBJEXT) help.$(OBJEXT) \
+       omap3.$(OBJEXT) detect.$(OBJEXT) detectflash.$(OBJEXT) help.$(OBJEXT) \
        quit.$(OBJEXT) scan.$(OBJEXT) signal.$(OBJEXT) \
        salias.$(OBJEXT) bit.$(OBJEXT) register.$(OBJEXT) \
        initbus.$(OBJEXT) print.$(OBJEXT) part.$(OBJEXT) bus.$(OBJEXT) \
@@ -256,7 +256,7 @@ top_builddir = ../..
 top_srcdir = ../..
 noinst_LIBRARIES = libcmd.a
 libcmd_a_SOURCES = frequency.c cable.c reset.c discovery.c idcode.c \
-       detect.c detectflash.c help.c quit.c scan.c signal.c salias.c \
+       detect.c omap3.c detectflash.c help.c quit.c scan.c signal.c salias.c \
        bit.c register.c initbus.c print.c part.c bus.c instruction.c \
        shift.c dr.c get.c test.c debug.c shell.c set.c endian.c \
        parse.c peekpoke.c pod.c readmem.c writemem.c flashmem.c \
Index: jtag/src/tap/Makefile
===================================================================
--- jtag.orig/src/tap/Makefile
+++ jtag/src/tap/Makefile
@@ -170,7 +170,7 @@ ARFLAGS = cru
 libtap_a_AR = $(AR) $(ARFLAGS)
 libtap_a_LIBADD =
 am__libtap_a_SOURCES_DIST = tap.c register.c state.c chain.c detect.c \
-       discovery.c idcode.c parport.c usbconn.c cable.c \
+       discovery.c omap3.c idcode.c parport.c usbconn.c cable.c \
        cable/generic.h cable/generic.c cable/generic_usbconn.h \
        cable/generic_usbconn.c cable/generic_parport.h \
        cable/generic_parport.c cable/cmd_xfer.h cable/cmd_xfer.c \
@@ -206,7 +206,7 @@ am__objects_21 = ppdev.$(OBJEXT)
 #am__objects_22 = ppi.$(OBJEXT)
 #am__objects_23 = vision_ep9307.$(OBJEXT)
 am_libtap_a_OBJECTS = tap.$(OBJEXT) register.$(OBJEXT) state.$(OBJEXT) \
-       chain.$(OBJEXT) detect.$(OBJEXT) discovery.$(OBJEXT) \
+       chain.$(OBJEXT) detect.$(OBJEXT) omap3.$(OBJEXT) discovery.$(OBJEXT) \
        idcode.$(OBJEXT) parport.$(OBJEXT) usbconn.$(OBJEXT) \
        cable.$(OBJEXT) generic.$(OBJEXT) generic_usbconn.$(OBJEXT) \
        generic_parport.$(OBJEXT) cmd_xfer.$(OBJEXT) $(am__objects_1) \
@@ -350,7 +350,7 @@ top_builddir = ../..
 top_srcdir = ../..
 noinst_LIBRARIES = libtap.a
 libtap_a_SOURCES = tap.c register.c state.c chain.c detect.c \
-       discovery.c idcode.c parport.c usbconn.c cable.c \
+       discovery.c omap3.c idcode.c parport.c usbconn.c cable.c \
        cable/generic.h cable/generic.c cable/generic_usbconn.h \
        cable/generic_usbconn.c cable/generic_parport.h \
        cable/generic_parport.c cable/cmd_xfer.h cable/cmd_xfer.c \
Index: jtag/src/cmd/omap3.c
===================================================================
--- /dev/null
+++ jtag/src/cmd/omap3.c
@@ -0,0 +1,59 @@
+/*
+ *  Copyright (C) 2009 Dirk Behme <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ */
+
+#include "sysdep.h"
+
+#include <stdio.h>
+
+#include "jtag.h"
+
+#include "cmd.h"
+
+static int
+cmd_omap3_run( chain_t *chain, char *params[] )
+{
+       if (cmd_params( params ) != 1)
+               return -1;
+
+       if (!cmd_test_cable( chain ))
+               return 1;
+
+       omap3( chain );
+
+       return 1;
+}
+
+static void
+cmd_omap3_help( void )
+{
+       printf( _(
+               "Usage: %s\n"
+               "Do proper OMAP3 initialization.\n"
+               "\n"
+               "'%s' does special TAP initialization for OMAP3 devices\n"
+       ), "omap3", "omap3" );
+}
+
+cmd_t cmd_omap3 = {
+       "omap3",
+       N_("do proper OMAP3 initialization"),
+       cmd_omap3_help,
+       cmd_omap3_run
+};
Index: jtag/src/tap/omap3.c
===================================================================
--- /dev/null
+++ jtag/src/tap/omap3.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2009 Dirk Behme <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ */
+
+#include "sysdep.h"
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "cable.h"
+#include "tap.h"
+#include "chain.h"
+
+#include "jtag.h"
+
+extern void jtag_reset(chain_t *);
+extern uint64_t bits_to_uint64(tap_register *);
+
+void
+omap3( chain_t *chain )
+{
+       int irlen, drlen;
+       tap_register *ir;
+       tap_register *drin, *drout;
+
+       printf( _("Running OMAP3 init ...\n") );
+
+       /* Switch TAP to Run-Test/Idle */
+       jtag_reset( chain );
+
+       /*
+        * Get ID code to test basic accessibility
+        */
+
+       /* Switch to DR 0x4, should be 32bit IDCODE register */
+       irlen = 6;
+       ir = register_init( register_alloc( irlen ), "000100" );
+       tap_capture_ir( chain );
+       tap_shift_register( chain, ir, NULL, EXITMODE_IDLE);
+
+       /* Read DR 0x4 */
+       drlen = 32;
+       drin = register_fill( register_alloc( drlen ), 0 );
+       drout = register_duplicate( drin );
+       tap_capture_dr( chain );
+       tap_shift_register( chain, drin, drout, EXITMODE_IDLE);
+
+       printf( _("OMAP3 ICEPICK IDCODE: %s (0x%08X)\n"),
+               register_get_string( drout ),
+               (unsigned int)bits_to_uint64( drout ));
+
+       register_free( drin );
+       register_free( drout );
+
+       /*
+        * ===> Start of 'TI' sequence
+        */
+
+       /* Switch to DR 0x7, should be 8 bit register */
+       register_init( ir, "000111" );
+       tap_capture_ir( chain );
+       tap_shift_register( chain, ir, NULL, EXITMODE_UPDATE);
+
+       /* Write 0x89 to DR 0x7 */
+       drlen = 8;
+        drin = register_init( register_alloc( drlen ), "10001001" );
+       tap_capture_dr( chain );
+       tap_shift_register( chain, drin, NULL, EXITMODE_UPDATE);
+       register_free( drin );
+
+       /* Switch to DR 0x2 */
+       register_init( ir, "000010" );
+       tap_capture_ir( chain );
+       tap_shift_register( chain, ir, NULL, EXITMODE_UPDATE);
+
+       /* Write 0xa3002108 to DR 0x2 */
+       drlen = 32;
+       drin = register_init( register_alloc( drlen ), 
"10100011000000000010000100001000" );
+       tap_capture_dr( chain );
+       tap_shift_register( chain, drin, NULL, EXITMODE_UPDATE);
+       register_free( drin );
+
+       /* Switch IR to 'all-ones' */
+       register_init( ir, "111111" );
+       tap_capture_ir( chain );
+       tap_shift_register( chain, ir, NULL, EXITMODE_IDLE);
+
+       /* Clock at least 10 TCLK in run test idle */
+       chain_defer_clock( chain, 0, 0, 10 );
+
+       /*
+        * <=== End of 'TI' sequence
+        */
+
+       /*
+        * Try to read ID code to check what happens
+        * If scan chain was changed by above commands, this shouldn't
+        * work any more (?)
+        */
+
+       /* Switch to DR 0x4, should be 32bit IDCODE register */
+       register_init( ir, "000100" );
+       tap_capture_ir( chain );
+       tap_shift_register( chain, ir, NULL, EXITMODE_IDLE);
+
+       /* Read DR 0x4 */
+       drlen = 32;
+       drin = register_fill( register_alloc( drlen ), 0 );
+       drout = register_duplicate( drin );
+       tap_capture_dr( chain );
+       tap_shift_register( chain, drin, drout, EXITMODE_IDLE);
+
+       printf( _("OMAP3 ICEPICK IDCODE: %s (0x%08X)\n"),
+               register_get_string( drout ),
+               (unsigned int)bits_to_uint64( drout ));
+
+       register_free( drin );
+       register_free( drout );
+
+       register_free( ir );
+}
Index: jtag/src/cmd/cmd.c
===================================================================
--- jtag.orig/src/cmd/cmd.c
+++ jtag/src/cmd/cmd.c
@@ -71,6 +71,7 @@ extern cmd_t cmd_script;
 extern cmd_t cmd_include;
 extern cmd_t cmd_addpart;
 extern cmd_t cmd_usleep;
+extern cmd_t cmd_omap3;
 #ifdef ENABLE_SVF
 extern cmd_t cmd_svf;
 #endif
@@ -117,6 +118,7 @@ const cmd_t *cmds[] = {
        &cmd_include,
        &cmd_addpart,
        &cmd_usleep,
+       &cmd_omap3,
 #ifdef ENABLE_SVF
        &cmd_svf,
 #endif
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to