Entering SWIM mode on ST-LINK does not update swim status word.
authorAke Rehnman <ake.rehnman@gmail.com>
Sun, 29 Mar 2020 10:13:18 +0000 (12:13 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 12 Apr 2020 21:06:29 +0000 (22:06 +0100)
As a consequence of a previous failed SWIM command any
subsequent attempts to enter SWIM mode fails. Change
stlink_usb_mode_enter to use stlink_usb_xfer_noerrcheck
instead.

Change-Id: I5c6a1a8e68d3dc77ec37264880383366fa6a75d9
Signed-off-by: Ake Rehnman <ake.rehnman@gmail.com>
Reviewed-on: http://openocd.zylin.com/5547
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/jtag/drivers/stlink_usb.c

index 45bb5019f95fefaac71d93caa845ed7abd8f08a2..a905576c89b37c9967a19855af4bd76b58f166fc 100644 (file)
@@ -1230,9 +1230,8 @@ static int stlink_usb_mode_enter(void *handle, enum stlink_mode type)
                case STLINK_MODE_DEBUG_SWIM:
                        h->cmdbuf[h->cmdidx++] = STLINK_SWIM_COMMAND;
                        h->cmdbuf[h->cmdidx++] = STLINK_SWIM_ENTER;
-                       /* no answer for this function... */
-                       rx_size = 0;
-                       break;
+                       /* swim enter does not return any response or status */
+                       return stlink_usb_xfer_noerrcheck(handle, h->databuf, 0);
                case STLINK_MODE_DFU:
                case STLINK_MODE_MASS:
                default: