Skip to content

Conversation

etienne-lms
Copy link
Contributor

@etienne-lms etienne-lms commented Oct 15, 2025

This change aims to address a compatibility issue with recent OpenOCD pre-release and what is planned in OpenOCD v1.0.0 planned end of 2025. OpenOCD commit 34ec5536c0ba ("stlink: deprecate HLA support") [1] was merged in December 2024 after release tag 0.12.0 and before coming release v1.0.0. It deprecates the legacy HLA driver interface (also called transport) in favor to the generic DAP interface that is supported by ST-Link firmware v2.1 and later.

Since the referred commit, OpenOCD config script must source a new config file (interface/stlink-hla.cfg) in order to select hla_swd transport. This change breaks many ST-Link based OpenOCD config files of Zephyr. Alternatively, already existing interface/stlink-dap.cfg can be used with dapdirect_swd interface to use direct DAP/SWD interface.

To overcome the issue and support older and newer OpenOCD releases, this change uses OpenOCD native board config script files when available or if none, we select the dapdirect_swd transport ID that is supported since a long time and still maintained thank to OpenOCD native interface/stlink-dap.cfg config script file.

One may potentially face connection issues if using both a recent OpenOCD tool and an ST-Link adapter that embeds a old ST-Link firmware v1.x. This ST-Link firmware only supports HLA interface. This situation may happen with old STM32 L0/L1/L4/F4 Nucleo/Discovery boards or with old ST-Link adapter devices. ST-Link firmware v1.0 do not support DAP direct SWD interface. In such a case, either upgrade the ST-Link firmware (see STM32CubeProgrammer guide), or revert the change made here to explicitly use hla_swd transport based on stlink-hla.cfg. Alternatively, use an older OpenOCD release which may not be desired.

Link: https://sourceforge.net/p/openocd/code/ci/34ec5536c0ba3315bc5a841244bbf70141ccfbb4/ [1]

@etienne-lms
Copy link
Contributor Author

I plan to create dedicated P-Rs, per board vendor, for non-ST boards also affected by this OpenOCD change.
I initially plan to create 1 P-R per board vendor. If a single P-R to cover them all is preferred, feel free to tell me.

Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In last paragraph of the first commit message:

You should probably mention that such fw version is not shipped since X years.
Also, providing a first good version would allow users to quickly recognize they are in the
good case (v2j24 as provided in openocd commit message) would be nice.


transport select hla_swd
# If you use a recent OpenOCD release (strictly after release tag v0.12.0)
# and your targets embeds an ST-Link firmware v1 and you cannot upgrade it,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# and your targets embeds an ST-Link firmware v1 and you cannot upgrade it,
# and your targets embeds an ST-Link firmware earlier than v2j24 and you cannot upgrade it,

Apply everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks. I've updated, also taking @mathieuchopstm proposal into consideration.

deprecated recently (Decembrer 2024, see https://review.openocd.org/c/openocd/+/8523 and commit
https://sourceforge.net/p/openocd/code/ci/34ec5536c0ba3315bc5a841244bbf70141ccfbb4/). One may
face connection issues if using a recent OpenOCD tool (release tag stricly later v0.12.0) and
embeds an ST-Link firmware v1.x in its ST-Link adapter. In such a case, one needs to either
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/v1.x/earlier than v2j24

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 4 to 9
# If you use a recent OpenOCD release (strictly after release tag v0.12.0)
# and your targets embeds an ST-Link firmware v1 and you cannot upgrade it,
# it is recommended to replace the 2 lines above with:
#
# source [find interface/stlink-hla.cfg]
# transport select hla_swd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Is it merely recommended or is it necessary?
  2. If I use a not recent OpenOCD release, what happens?

Proposed rework:

Suggested change
# If you use a recent OpenOCD release (strictly after release tag v0.12.0)
# and your targets embeds an ST-Link firmware v1 and you cannot upgrade it,
# it is recommended to replace the 2 lines above with:
#
# source [find interface/stlink-hla.cfg]
# transport select hla_swd
# If you use an OpenOCD version higher than 0.12.0 and your target embeds
# an ST-Link with firmware v1.x, connection will not work. It is recommended
# to upgrade the ST-Link firmware of the target; however, if not possible,
# the 2 lines above can be replaced with the following to connect successfully:
#
# source [find interface/stlink-hla.cfg]
# transport select hla_swd

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the rewording. I'll applied it.

source [find target/stm32wbx.cfg]

reset_config srst_only
# OpenOCD nucleo_wb55/cfg matches stm32wb55mmg support
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency:

Suggested change
# OpenOCD nucleo_wb55/cfg matches stm32wb55mmg support
# OpenOCD st_nucleo_wb55k.cfg matches stm32wb55mmg support

Comment on lines 59 to 67
* STM32 boards OpenOCD configuration files have been changed to support latest OpenOCD as well as
older OpenOCD (v0.12.0 or older). The issue addressed is that HLA/SWD transport has been
deprecated recently (Decembrer 2024, see https://review.openocd.org/c/openocd/+/8523 and commit
https://sourceforge.net/p/openocd/code/ci/34ec5536c0ba3315bc5a841244bbf70141ccfbb4/). One may
face connection issues if using a recent OpenOCD tool (release tag stricly later v0.12.0) and
embeds an ST-Link firmware v1.x in its ST-Link adapter. In such a case, one needs to either
update its ST-Link firmware (recommended, refer the STM32CubeProgrammer tool documentation)
or change the OpenOCD configuration script to source "interface/stlink-hla.cfg" and select
"hla_swd" interface explicitly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't say that files have been changed to support latest as well as older then 3 sentences later that old version don't work.

+ minor rewords

Suggested change
* STM32 boards OpenOCD configuration files have been changed to support latest OpenOCD as well as
older OpenOCD (v0.12.0 or older). The issue addressed is that HLA/SWD transport has been
deprecated recently (Decembrer 2024, see https://review.openocd.org/c/openocd/+/8523 and commit
https://sourceforge.net/p/openocd/code/ci/34ec5536c0ba3315bc5a841244bbf70141ccfbb4/). One may
face connection issues if using a recent OpenOCD tool (release tag stricly later v0.12.0) and
embeds an ST-Link firmware v1.x in its ST-Link adapter. In such a case, one needs to either
update its ST-Link firmware (recommended, refer the STM32CubeProgrammer tool documentation)
or change the OpenOCD configuration script to source "interface/stlink-hla.cfg" and select
"hla_swd" interface explicitly.
* STM32 boards OpenOCD configuration files have been changed to support latest OpenOCD versions
(> v0.12.0) in which the HLA/SWD transport has been deprecated (see
https://review.openocd.org/c/openocd/+/8523 and commit
https://sourceforge.net/p/openocd/code/ci/34ec5536c0ba3315bc5a841244bbf70141ccfbb4/).
Issues may be encountered when connecting to an ST-Link adapter running firmware v1.x
which does not support the new transport. In this case, the ST-Link firmware should
be upgraded or, if not possible, the OpenOCD configuration script should be changed to
source "interface/stlink-hla.cfg" and select the "hla_swd" interface explicitly.

+ maybe we should mention the latter must be done if running old OpenOCD?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for the proposal. I've append a last sentence: "Backward compatibility with OpenOCD v0.12.0 or older is maintained.".

This change aims to address a compatibility issue with recent OpenOCD
pre-release and what is planned in OpenOCD v1.0.0 planned end of 2025.
OpenOCD commit 34ec5536c0ba ("stlink: deprecate HLA support") [1] was
merged in December 2024 after release tag 0.12.0 and before coming
release v1.0.0. It deprecates the legacy HLA driver interface (also
called transport) in favor to the generic DAP interface that is
supported by ST-Link firmware v2.1 (that is version v2j24) and later.

Since the referred commit, OpenOCD config script must source a new
config file (interface/stlink-hla.cfg) in order to select hla_swd
transport. This change breaks many ST-Link based OpenOCD config files
of Zephyr. Alternatively, already existing interface/stlink-dap.cfg
can be used together with dapdirect_swd interface to use direct DAP
interface.

To overcome the issue and support older and newer OpenOCD releases,
this change uses OpenOCD native board config script files when
available or if none, we select the dapdirect_swd transport ID that
is supported since a long time and still maintained thank to
OpenOCD native interface/stlink-dap.cfg config script file.

One may potentially face connection issues if using both a recent
OpenOCD tool and an ST-Link adapter that embeds a old ST-Link
firmware v1.x. This ST-Link firmware only supports HLA interface.
It is not shipped by ST in ST-Link adapter since 2015. This situation
however may happen with old STM32 L0/L1/L4/F4 Nucleo/Discovery
boards or with old ST-Link adapter devices. ST-Link firmware v1.0 do not
support DAP direct SWD interface. In such a case, either upgrade the
ST-Link firmware (see STM32CubeProgrammer guide), or revert the change
made here to explicitly use hla_swd transport based on stlink-hla.cfg.
Alternatively, use an older OpenOCD release which may not be desired.

Link: https://sourceforge.net/p/openocd/code/ci/34ec5536c0ba3315bc5a841244bbf70141ccfbb4/ [1]

Signed-off-by: Etienne Carriere <[email protected]>
A recent change in OpenOCD deprecates ST-Link HLA interface requiring
changes in some board OpenOCD configuration files in the Zephyr tree.
Since this deprecation, in order to support old and recent OpenOCD
tool we needed to change of debug driver interface for these boards,
potentially causing trouble to user to have a recent OpenOCD and
an old ST-Link adapter firmware. Therefore add an entry in the migration
guide to give some hints on the potential issue and how to address
it.

Signed-off-by: Etienne Carriere <[email protected]>
@etienne-lms
Copy link
Contributor Author

Updated with review comments addressed.

@sonarqubecloud
Copy link

Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I first commit 2 ST-Link firmware v1.0 mentions remain which would be good to be fixed. Non blocking though

Copy link
Contributor

@mathieuchopstm mathieuchopstm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking remarks:

source [find target/stm32l1x_dual_bank.cfg]

reset_config srst_only
# http://openocd.zylin.com/#/c/5829/ was merged in 2020
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this could be dropped entirely (moved to commit message if anything)

Suggested change
# http://openocd.zylin.com/#/c/5829/ was merged in 2020

Comment on lines +63 to +67
Issues may be encountered when connecting to an ST-Link adapter running firmware prior
v2j24 which do not support the new transport. In this case, the ST-Link firmware should
be upgraded or, if not possible, the OpenOCD configuration script should be changed to
source "interface/stlink-hla.cfg" and select the "hla_swd" interface explicitly.
Backward compatibility with OpenOCD v0.12.0 or older is maintained.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
Issues may be encountered when connecting to an ST-Link adapter running firmware prior
v2j24 which do not support the new transport. In this case, the ST-Link firmware should
be upgraded or, if not possible, the OpenOCD configuration script should be changed to
source "interface/stlink-hla.cfg" and select the "hla_swd" interface explicitly.
Backward compatibility with OpenOCD v0.12.0 or older is maintained.
Issues may be encountered when connecting to an ST-Link adapter running firmware prior
to version V2J24 which do not support the new transport. In this case, the ST-Link firmware should
be upgraded or, if not possible, the OpenOCD configuration script should be changed to
source "interface/stlink-hla.cfg" and select the "hla_swd" interface explicitly.
Backward compatibility with OpenOCD v0.12.0 or older is maintained.

(I'll let you re-align paragraph to fit length limit)

Comment on lines +4 to +11
# If you use an OpenOCD version higher than 0.12.0 and your target embeds
# an ST-Link firmware earlier than v2j24, connection will not work.
# It is recommended to upgrade the ST-Link firmware of the target,
# however, if not possible, the 2 lines above can be replaced with the
# following to connect successfully:
#
# source [find interface/stlink-hla.cfg]
# transport select hla_swd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
# If you use an OpenOCD version higher than 0.12.0 and your target embeds
# an ST-Link firmware earlier than v2j24, connection will not work.
# It is recommended to upgrade the ST-Link firmware of the target,
# however, if not possible, the 2 lines above can be replaced with the
# following to connect successfully:
#
# source [find interface/stlink-hla.cfg]
# transport select hla_swd
# If you use an OpenOCD version higher than 0.12.0 and your target embeds
# an ST-Link adapter running a firmware earlier than version V2J24, connection will not work.
# It is recommended to upgrade the ST-Link firmware of the target adapter;
# however, if not possible, the 2 lines above can be replaced with the
# following to connect successfully:
#
# source [find interface/stlink-hla.cfg]
# transport select hla_swd

(ditto; I'll let you realign paragraphs to fit length limit)

@jhedberg jhedberg merged commit b6b75d9 into zephyrproject-rtos:main Oct 22, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Boards/SoCs platform: STM32 ST Micro STM32 Release Notes To be mentioned in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants