Skip to content

Conversation

etienne-lms
Copy link
Contributor

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, change the OpenCOD configuration files for non-ST boards that use ST-Link to interface target debug and/or flash programming support. Use the already existing are still maintained interface/stlink-dap.cfg config script file together with dapdirect_swd transport interface.

One may potentially face connection issues if using both a recent OpenOCD firmware and using a ST-Link adapter that embeds a ST-Link firmware v1.x. This may happen 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 (refer to STM32CubeProgrammer guide), or revert the change made here to explicitly use hla_swd transport based on stlink-hla.cfg.

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

Note: This P-R addresses board from other vendors than ST. ST boards are addressed through #97638 that also adds an entry in the migration guide.

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,
change the OpenCOD configuration files for non-ST boards that use
ST-Link to interface target debug and/or flash programming support.
Use the already existing are still maintained interface/stlink-dap.cfg
config script file together with dapdirect_swd transport interface.

One may potentially face connection issues if using both a recent
OpenOCD firmware and using a ST-Link adapter that embeds a ST-Link
firmware v1.x. This may happen 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 (refer to STM32CubeProgrammer
guide), or revert the change made here to explicitly use hla_swd
transport based on stlink-hla.cfg.

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

Signed-off-by: Etienne Carriere <[email protected]>
@sonarqubecloud
Copy link

@etienne-lms
Copy link
Contributor Author

I created this unique P-R to address various board vendors. If someone prefers I split these change per vendor, either through board vendor specific commits or even through board vendor specific P-Rs, please tell me.

May I ask feedback of board maintainers regarding this change. Especially regarding whether or not there are some obligation of being backward compatible with ST-Link firmware v1.0 (that mandate the ST-Link HLA interface.
If you have concerns regarding these changes, please tell. Sorry for the noise if you're not expected to maintain the files I modified.
@pillo79, @facchinm for Arduino boards?
@pyhys for Adafruit?
@Bucknalla for Blues/CygNet?
@parthitce for Dragino boards?
@paulwedeck for Fanke/k723m1_zgt?
@everedero for SteelSeries Apex Pro Mini?
I could not find recent enough code owners for the other boards...

@etienne-lms etienne-lms added the platform: Arduino Arduino boards and shields label Oct 15, 2025
# 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.

The board doesn't have an embedded debugger.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this openocd config applies when one uses the ST-Link adapter between the host and the target.
In such case, the inline comments above apply to the firmware in the ST-Link adapter. Maybe should I rephrase the description.

Or more simply: do you assume one using an ST-Link adapter to debug fk723m1_zgt6 would use a recent ST-Link adapter product so that this inline comment can be simply removed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I was a bit confused when I wrote this.
The new config works on my side and I doubt that a lot of people will use legacy ST-Links.
Maybe you want to extend the documentation page for debug probes instead of adding the same notice a bunch of times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Boards/SoCs platform: Arduino Arduino boards and shields platform: Seeed Studio Seeed Studio platforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants