-
Notifications
You must be signed in to change notification settings - Fork 8.1k
boards: st: address recent OpenOCD deprecation of HLA interface #97638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
boards: st: address recent OpenOCD deprecation of HLA interface #97638
Conversation
I plan to create dedicated P-Rs, per board vendor, for non-ST boards also affected by this OpenOCD change. |
3720fe4
to
5e77d4f
Compare
There was a problem hiding this 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 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
There was a problem hiding this comment.
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.
doc/releases/migration-guide-4.3.rst
Outdated
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Is it merely recommended or is it necessary?
- If I use a not recent OpenOCD release, what happens?
Proposed rework:
# 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency:
# OpenOCD nucleo_wb55/cfg matches stm32wb55mmg support | |
# OpenOCD st_nucleo_wb55k.cfg matches stm32wb55mmg support |
doc/releases/migration-guide-4.3.rst
Outdated
* 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. |
There was a problem hiding this comment.
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
* 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?
There was a problem hiding this comment.
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]>
5e77d4f
to
6dd2f3e
Compare
Updated with review comments addressed. |
|
There was a problem hiding this 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
There was a problem hiding this 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 |
There was a problem hiding this comment.
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)
# http://openocd.zylin.com/#/c/5829/ was merged in 2020 |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
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)
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
# 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)
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]