Moved double nSRST workaround from script to XDS110 and CMSIS-DAP drivers master OpenOCD-0.10.0_TI-1.1
authorEdward Fewell <efewell@ti.com>
Thu, 21 Jun 2018 01:22:04 +0000 (20:22 -0500)
committerEdward Fewell <efewell@ti.com>
Thu, 21 Jun 2018 01:22:04 +0000 (20:22 -0500)
openocd/src/jtag/drivers/cmsis_dap_usb.c
openocd/src/jtag/drivers/xds110.c
openocd/src/target/startup.tcl
openocd/tcl/target/ti_msp432.cfg

index dd37522ad169e595cc05cedd0a2f3caed93e0cdb..d1a98576afbba2abffb9d2037ef6b22328d1d224 100644 (file)
@@ -1003,11 +1003,25 @@ static void cmsis_dap_execute_reset(struct jtag_command *cmd)
         * there's no way to tristate them */
        uint8_t pins = 0;
 
-       if (!cmd->cmd.reset->srst)
-               pins |= SWJ_PIN_SRST;
+       static bool first = true;
+
        if (!cmd->cmd.reset->trst)
                pins |= SWJ_PIN_TRST;
 
+       if (!cmd->cmd.reset->srst)
+               pins |= SWJ_PIN_SRST;
+       else if (swd_mode) {
+               /* Always assert nSRST in SWD mode */
+               /* pin = 0 */
+       } else if (first) {
+               /* Assert nSRST in JTAG mode on first call */
+               first = false;
+       } else {
+               /* Do not assert nSRST in JTAG mode on second call */
+               pins |= SWJ_PIN_SRST;
+               first = true;
+       }
+
        int retval = cmsis_dap_cmd_DAP_SWJ_Pins(pins,
                        SWJ_PIN_TRST | SWJ_PIN_SRST, 0, NULL);
        if (retval != ERROR_OK)
index 4a20f943bb0fdb685710a831d3f79ca9413ba70c..fe975a7de9e13d9569e8735155fdc41224c63900 100644 (file)
@@ -1594,6 +1594,8 @@ static void xds110_execute_reset(struct jtag_command *cmd)
        char trst;
        char srst;
 
+       static bool first = true;
+
        if (cmd->cmd.reset->trst != -1) {
                if (cmd->cmd.reset->trst == 0) {
                        /* Deassert nTRST (active low) */
@@ -1610,8 +1612,19 @@ static void xds110_execute_reset(struct jtag_command *cmd)
                        /* Deassert nSRST (active low) */
                        srst = 1;
                } else {
-                       /* Assert nSRST (active low) */
-                       srst = 0;
+                       /* TODO: Workaround for double nSRST reset in JTAG mode */
+                       if (xds110.is_swd_mode) {
+                               /* Always assert nSRST in SWD mode (active low) */
+                               srst = 0;
+                       } else if (first) {
+                               /* Assert nSRST first time in JTAG mode (active low) */
+                               srst = 0;
+                               first = false;
+                       } else {
+                               /* Do not assert nSRST second time in JTAG mode (active low) */
+                               srst = 1;
+                               first = true;
+                       }
                }
                (void)xds_set_srst(srst);
 
index 6290b3a5516e2b1c4c9830faeddb84955334a7e6..247eff7fc7ebcbd83614f5d36db74efc47f74efb 100644 (file)
@@ -80,14 +80,7 @@ proc ocd_process_reset_inner { MODE } {
        foreach t $targets {
                # C code needs to know if we expect to 'halt'
                if {![using_jtag] || [jtag tapisenabled [$t cget -chain-position]]} {
-                       # TODO: Workaround for double nSRST pulse issue. The call to 
-                       # init_reset above will assert and deassert nSRST. But the 
-                       # steps to examine and restore debug connection only happen just
-                       # after that point. This arp_reset call will assert nSRST again
-                       # but examination will not happen again. Also, some of the events
-                       # that fire need the target scan chain to be examined.
-                       # So comment out this second nSRST assert as a quick workaround.
-                       # $t arp_reset assert $halt
+                       $t arp_reset assert $halt
                }
        }
        foreach t $targets {
index 523371da54cdfa500ddefde767883437255a4714..47ae8b7ee08be3d6ada5d6e6f7349e5c42148430 100644 (file)
@@ -46,6 +46,5 @@ $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE
 set _FLASHNAME $_CHIPNAME.flash
 flash bank $_FLASHNAME msp432 0 0 0 0 $_TARGETNAME
 
-if { ![using_hla] } {
-       cortex_m reset_config sysresetreq
-}
+reset_config srst_only
+adapter_nsrst_delay 100