This is an automated email from Gerrit.

Ake Rehnman ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/4265

-- gerrit

commit 773d6e12f943acf72288135f8fdfeafe285db75a
Author: Ake Rehnman <[email protected]>
Date:   Tue Oct 24 19:22:36 2017 +0200

    Changes to make connect_under_reset work
    
    Change-Id: I35444ec0e6caace3e072c60085059602f4cdf0a4
    Signed-off-by: Ake Rehnman <[email protected]>

diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c
index 9e86b09..6813bb5 100644
--- a/src/jtag/drivers/stlink_usb.c
+++ b/src/jtag/drivers/stlink_usb.c
@@ -921,12 +921,6 @@ static int stlink_usb_init_mode(void *handle, bool 
connect_under_reset)
                return ERROR_FAIL;
        }
 
-       if (connect_under_reset) {
-               res = stlink_usb_assert_srst(handle, 0);
-               if (res != ERROR_OK)
-                       return res;
-       }
-
        res = stlink_usb_mode_enter(handle, emode);
 
        if (res != ERROR_OK)
@@ -939,6 +933,13 @@ static int stlink_usb_init_mode(void *handle, bool 
connect_under_reset)
 
        LOG_DEBUG("MODE: 0x%02X", mode);
 
+       /* reset can only be asserted after mode change */
+       if (connect_under_reset) {
+               res = stlink_usb_assert_srst(handle, 0);
+               if (res != ERROR_OK)
+                       return res;
+       }
+
        return ERROR_OK;
 }
 
diff --git a/src/target/stm8.c b/src/target/stm8.c
index b8d2684..838c345 100644
--- a/src/target/stm8.c
+++ b/src/target/stm8.c
@@ -1615,6 +1615,9 @@ static int stm8_examine(struct target *target)
                        retval = stm8_set_speed(target, 1);
                        if (retval == ERROR_OK)
                                stm8->swim_configured = true;
+                       /* now is the time to deassert reset if 
connect_under_reset */
+                       if (adapter->param.connect_under_reset)
+                               stm8_reset_deassert(target);
                } else {
                        LOG_INFO("trying to reconnect");
 
diff --git a/tcl/target/stm8.cfg b/tcl/target/stm8.cfg
index fc47899..b4115ef 100644
--- a/tcl/target/stm8.cfg
+++ b/tcl/target/stm8.cfg
@@ -79,3 +79,5 @@ adapter_khz 0
 
 reset_config srst_only
 
+#uncomment this line to connect under reset
+#reset_config srst_nogate connect_assert_srst

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to