Skip to content

Commit 420f637

Browse files
committed
stlink: simplify the use of deprecated HLA transport
Commit 34ec553 ("stlink: deprecate HLA support") makes hard to use the still functional HLA transport with the stlink listed in board config files. Now that the prefixes 'hla_' and 'dapdirect_' has been dropped from the transport name, allow overriding the transport by using the 'stlink-hla' script in front of the board file, e.g.: openocd -f interface/stlink-hla.cfg -f board/st_nucleo_f4.cfg Revert the documentation changes of the change above. Improve the documentation to explain how to use the compatibility HLA mode. Improve the error message in stlink driver to guide the user to update the stlink firmware and to use the compatibility HLA mode. Change-Id: I5d0bc7954511692cebe024bda2aaa72767b97681 Signed-off-by: Antonio Borneo <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/8679 Tested-by: jenkins
1 parent ad53fe6 commit 420f637

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

doc/openocd.texi

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,7 +2497,7 @@ This command is only available if your libusb1 is at least version 1.0.16.
24972497
Specifies the @var{serial_string} of the adapter to use.
24982498
If this command is not specified, serial strings are not checked.
24992499
Only the following adapter drivers use the serial string from this command:
2500-
arm-jtag-ew, cmsis_dap, esp_usb_jtag, ft232r, ftdi, hla (ti-icdi), jlink, kitprog, opendus,
2500+
arm-jtag-ew, cmsis_dap, esp_usb_jtag, ft232r, ftdi, hla (stlink, ti-icdi), jlink, kitprog, opendus,
25012501
openjtag, osbdm, presto, rlink, st-link, usb_blaster (ublast2), usbprog, vsllink, xds110.
25022502
@end deffn
25032503

@@ -3205,23 +3205,35 @@ that OpenOCD would normally use to access the target.
32053205

32063206
Currently supported adapters include the STMicroelectronics ST-LINK, TI ICDI
32073207
and Nuvoton Nu-Link.
3208+
32083209
ST-LINK firmware version >= V2.J21.S4 recommended due to issues with earlier
32093210
versions of firmware where serial number is reset after first use. Suggest
32103211
using ST firmware update utility to upgrade ST-LINK firmware even if current
32113212
version reported is V2.J21.S4.
3213+
The ST-LINK firmware update utility is available for download from
3214+
@url{https://www.st.com/en/development-tools/stsw-link007.html, ST website}.
32123215

32133216
@deffn {Config Command} {hla device_desc} description
32143217
Currently Not Supported.
32153218
@end deffn
32163219

3217-
@deffn {Config Command} {hla layout} (@option{icdi}|@option{nulink})
3220+
@deffn {Config Command} {hla layout} (@option{stlink}|@option{icdi}|@option{nulink})
32183221
Specifies the adapter layout to use.
32193222
@end deffn
32203223

32213224
@deffn {Config Command} {hla vid_pid} [vid pid]+
32223225
Pairs of vendor IDs and product IDs of the device.
32233226
@end deffn
32243227

3228+
@deffn {Config Command} {hla stlink_backend} (usb | tcp [port])
3229+
@emph{ST-Link only:} Choose between 'exclusive' USB communication (the default backend) or
3230+
'shared' mode using ST-Link TCP server (the default port is 7184).
3231+
3232+
@emph{Note:} ST-Link TCP server is a binary application provided by ST
3233+
available from @url{https://www.st.com/en/development-tools/st-link-server.html,
3234+
ST-LINK server software module}.
3235+
@end deffn
3236+
32253237
@deffn {Command} {hla command} command
32263238
Execute a custom adapter-specific command. The @var{command} string is
32273239
passed as is to the underlying adapter layout handler.
@@ -3236,6 +3248,11 @@ directly access the arm ADIv5 DAP.
32363248

32373249
The older API that requires HLA transport is deprecated and will be dropped
32383250
from OpenOCD. In mean time it's still available by using @file{interface/stlink-hla.cfg}.
3251+
The HLA interface file can be put as first command line argument to
3252+
force using is in place of the default DAP API.
3253+
@example
3254+
openocd -f interface/stlink-hla.cfg -f board/st_nucleo_f4.cfg
3255+
@end example
32393256

32403257
The new API provide access to multiple AP on the same DAP, but the
32413258
maximum number of the AP port is limited by the specific firmware version

src/jtag/drivers/stlink_usb.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5143,7 +5143,12 @@ static int stlink_dap_init(void)
51435143

51445144
if ((mode != STLINK_MODE_DEBUG_SWIM) &&
51455145
!(stlink_dap_handle->version.flags & STLINK_F_HAS_DAP_REG)) {
5146-
LOG_ERROR("ST-Link version does not support DAP direct transport");
5146+
LOG_ERROR("The firmware in the ST-Link adapter only supports deprecated HLA.");
5147+
LOG_ERROR("Please consider updating the ST-Link firmware with a version");
5148+
LOG_ERROR("newer that V2J24 (2015), available for downloading on ST website:");
5149+
LOG_ERROR(" https://www.st.com/en/development-tools/stsw-link007.html");
5150+
LOG_ERROR("In mean time, you can re-run OpenOCD for ST-Link HLA as:");
5151+
LOG_ERROR(" openocd -f interface/stlink-hla.cfg ...");
51475152
return ERROR_FAIL;
51485153
}
51495154
return ERROR_OK;

tcl/interface/stlink.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
# SWIM transport is natively supported
1111
#
1212

13+
if { [adapter name] == "hla" } {
14+
# Deprecated HLA adapter driver already selected.
15+
# Quit silently, as the ST-LINK driver already complains.
16+
return
17+
}
18+
1319
adapter driver st-link
1420
st-link vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 0x0483 0x3754 0x0483 0x3755 0x0483 0x3757
1521

0 commit comments

Comments
 (0)