This is an automated email from Gerrit.

"Jacob Repp <[email protected]>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/7703

-- gerrit

commit 09af2867b334a5bfac0954d429242d1fee47c272
Author: Jacob Repp <[email protected]>
Date:   Tue Jun 27 23:25:52 2023 +0200

    stlink: add support for V3-PWR
    
    The STLink/V3-PWR presents with a version ID of 4 and a new PID.
    
    Otherwise the interface "just works" using hla_swd and assuming it is a V3 
device.
    
    Change-Id: I927f0e689cf05dc61f84598a2b377d58e549b71b
    Signed-off-by: Jacob Repp <[email protected]>

diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c
index ee629542ba..9690f845b1 100644
--- a/src/jtag/drivers/stlink_usb.c
+++ b/src/jtag/drivers/stlink_usb.c
@@ -83,6 +83,7 @@
 #define STLINK_V3E_PID          (0x374E)
 #define STLINK_V3S_PID          (0x374F)
 #define STLINK_V3_2VCP_PID      (0x3753)
+#define STLINK_V3_PWR_PID       (0x3757)
 #define STLINK_V3E_NO_MSD_PID   (0x3754)
 
 /*
@@ -1298,7 +1299,7 @@ static int stlink_usb_version(void *handle)
        }
 
        /* STLINK-V3 requires a specific command */
-       if (v == 3 && x == 0 && y == 0) {
+       if ((v == 3 || v == 4) && x == 0 && y == 0) {
                stlink_usb_init_buffer(handle, h->rx_ep, 16);
 
                h->cmdbuf[h->cmdidx++] = STLINK_APIV3_GET_VERSION_EX;
@@ -1379,6 +1380,7 @@ static int stlink_usb_version(void *handle)
 
                break;
        case 3:
+       case 4: // V3PWR identifies as V4
                /* all STLINK-V3 use api-v3 */
                h->version.jtag_api = STLINK_JTAG_API_V3;
 
@@ -3402,6 +3404,7 @@ static int stlink_usb_usb_open(void *handle, struct 
hl_interface_param_s *param)
                        case STLINK_V3S_PID:
                        case STLINK_V3_2VCP_PID:
                        case STLINK_V3E_NO_MSD_PID:
+                       case STLINK_V3_PWR_PID:
                                h->version.stlink = 3;
                                h->tx_ep = STLINK_V2_1_TX_EP;
                                h->trace_ep = STLINK_V2_1_TRACE_EP;
@@ -3419,6 +3422,7 @@ static int stlink_usb_usb_open(void *handle, struct 
hl_interface_param_s *param)
                                h->tx_ep = STLINK_TX_EP;
                                h->trace_ep = STLINK_TRACE_EP;
                                break;
+
                }
 
                /* get the device version */
diff --git a/tcl/interface/stlink.cfg b/tcl/interface/stlink.cfg
index e4906b74ed..94f808576e 100644
--- a/tcl/interface/stlink.cfg
+++ b/tcl/interface/stlink.cfg
@@ -8,7 +8,7 @@
 adapter driver hla
 hla_layout stlink
 hla_device_desc "ST-LINK"
-hla_vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 
0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 0x0483 0x3754
+hla_vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 
0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 0x0483 0x3754 0x0483 0x3757
 
 # Optionally specify the serial number of ST-LINK/V2 usb device.  ST-LINK/V2
 # devices seem to have serial numbers with unreadable characters.  ST-LINK/V2

-- 

Reply via email to