This is an automated email from Gerrit. "Antonio Borneo <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9462
-- gerrit commit 5934125d8bae0169007519b7bedfda1b408bae8b Author: Antonio Borneo <[email protected]> Date: Fri Jan 30 09:37:47 2026 +0100 target: stm32mpxxx: fix return to SWD after reset A target reset can cause a power cycle, causing the DAP to switch from SWD to JTAG. The adapter can loose the connection because it keeps using SWD, triggering error messages. While some ST-Link FW can automatically reconnect the lost SWD connection, this is not possible with older FW nor with other adapters. Force a DAP initialization after reset to eventually switch it back to SWD. Change-Id: I29ea49d2d5ee013ad33371265fd6996353f391d6 Signed-off-by: Antonio Borneo <[email protected]> diff --git a/tcl/target/st/stm32mp13x.cfg b/tcl/target/st/stm32mp13x.cfg index 164e0ff1fa..acd2ce0ed0 100644 --- a/tcl/target/st/stm32mp13x.cfg +++ b/tcl/target/st/stm32mp13x.cfg @@ -119,6 +119,8 @@ $_CHIPNAME.ap1 configure -event reset-assert-post { $_CHIPNAME.ap1 configure -event reset-deassert-pre { adapter deassert srst deassert trst + catch {dap init} + catch {$::_CHIPNAME.dap apid 1} $::_CHIPNAME.ap1 arp_examine _handshake_with_wrapper $halt _enable_debug diff --git a/tcl/target/st/stm32mp15x.cfg b/tcl/target/st/stm32mp15x.cfg index 979a5a491e..3d7225271e 100644 --- a/tcl/target/st/stm32mp15x.cfg +++ b/tcl/target/st/stm32mp15x.cfg @@ -175,6 +175,8 @@ $_CHIPNAME.ap1 configure -event reset-assert-post { $_CHIPNAME.ap1 configure -event reset-deassert-pre { adapter deassert srst deassert trst + catch {dap init} + catch {$::_CHIPNAME.dap apid 1} $::_CHIPNAME.ap1 arp_examine _handshake_with_wrapper $halt if { $::EN_CA7_0 } { diff --git a/tcl/target/st/stm32mp21x.cfg b/tcl/target/st/stm32mp21x.cfg index f4073a9f5c..9a102c6d9b 100644 --- a/tcl/target/st/stm32mp21x.cfg +++ b/tcl/target/st/stm32mp21x.cfg @@ -182,6 +182,8 @@ $_CHIPNAME.axi configure -event reset-assert-post { $_CHIPNAME.axi configure -event reset-deassert-pre { adapter deassert srst deassert trst + catch {dap init} + catch {$::_CHIPNAME.dap apid 0} $::_CHIPNAME.axi arp_examine set is_dev_boot [_enable_dbgmcu_on_devboot] if { !$is_dev_boot } { diff --git a/tcl/target/st/stm32mp23x.cfg b/tcl/target/st/stm32mp23x.cfg index 015f816e43..7ca1830e30 100644 --- a/tcl/target/st/stm32mp23x.cfg +++ b/tcl/target/st/stm32mp23x.cfg @@ -171,7 +171,8 @@ $_CHIPNAME.axi configure -event reset-assert-post { $_CHIPNAME.axi configure -event reset-deassert-pre { adapter deassert srst deassert trst - + catch {dap init} + catch {$::_CHIPNAME.dap apid 0} $::_CHIPNAME.ap0 arp_examine _handshake_with_wrapper $halt diff --git a/tcl/target/st/stm32mp25x.cfg b/tcl/target/st/stm32mp25x.cfg index 6807d64a1d..92410c7b54 100644 --- a/tcl/target/st/stm32mp25x.cfg +++ b/tcl/target/st/stm32mp25x.cfg @@ -191,7 +191,8 @@ $_CHIPNAME.axi configure -event reset-assert-post { $_CHIPNAME.axi configure -event reset-deassert-pre { adapter deassert srst deassert trst - + catch {dap init} + catch {$::_CHIPNAME.dap apid 0} $::_CHIPNAME.ap0 arp_examine _handshake_with_wrapper $halt --
