The attached patch adds a reset_config option "srst_gates_jtag".

arm7_9 will try to program embedded ice while SRST is asserted,
but handle srst pulls trst and srst gates jtag.

Comments?

-- 
Øyvind Harboe
Embedded software and hardware consulting services
http://www.zylin.com
### Eclipse Workspace Patch 1.0
#P openocd
Index: src/jtag/jtag.h
===================================================================
--- src/jtag/jtag.h     (revision 2714)
+++ src/jtag/jtag.h     (working copy)
@@ -277,6 +277,7 @@
        RESET_TRST_PULLS_SRST = 0x8,
        RESET_TRST_OPEN_DRAIN = 0x10,
        RESET_SRST_PUSH_PULL  = 0x20,
+       RESET_SRST_GATES_JTAG = 0x40,
 };
 
 enum reset_types jtag_get_reset_config(void);
Index: src/target/arm7_9_common.c
===================================================================
--- src/target/arm7_9_common.c  (revision 2714)
+++ src/target/arm7_9_common.c  (working copy)
@@ -1021,6 +1021,17 @@
                return ERROR_FAIL;
        }
 
+       /* at this point trst has been asserted/deasserted once. We want to
+        * program embedded ice while SRST is asserted, but some CPUs gate
+        * the JTAG clock while SRST is asserted
+        */
+       bool srst_asserted = false;
+       if (((jtag_reset_config & RESET_SRST_PULLS_TRST) == 0) && 
((jtag_reset_config & RESET_SRST_GATES_JTAG) == 0))
+       {
+               jtag_add_reset(0, 1);
+               srst_asserted = true;
+       }
+
        if (target->reset_halt)
        {
                /*
@@ -1053,7 +1064,7 @@
        if (jtag_reset_config & RESET_SRST_PULLS_TRST)
        {
                jtag_add_reset(1, 1);
-       } else
+       } else if (!srst_asserted)
        {
                jtag_add_reset(0, 1);
        }
Index: src/jtag/tcl.c
===================================================================
--- src/jtag/tcl.c      (revision 2714)
+++ src/jtag/tcl.c      (working copy)
@@ -845,6 +845,14 @@
                int tmp = 0;
                int m;
 
+               m = 0;
+               tmp = 0;
+               if (strcmp(*args, "srst_gates_jtag") == 0)
+               {
+                       tmp = RESET_NONE;
+                       goto next;
+               }
+
                /* signals */
                m = RESET_HAS_TRST | RESET_HAS_SRST;
                if (strcmp(*args, "none") == 0)
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to