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 <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9462
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2026-01-30 09:37:47 +01:00
parent 687dd5c5df
commit a5a9121ad6
5 changed files with 10 additions and 2 deletions

View File

@@ -119,6 +119,8 @@ $_CHIPNAME.ap1 configure -event reset-assert-post {
$_CHIPNAME.ap1 configure -event reset-deassert-pre { $_CHIPNAME.ap1 configure -event reset-deassert-pre {
adapter deassert srst deassert trst adapter deassert srst deassert trst
catch {dap init}
catch {$::_CHIPNAME.dap apid 1}
$::_CHIPNAME.ap1 arp_examine $::_CHIPNAME.ap1 arp_examine
_handshake_with_wrapper $halt _handshake_with_wrapper $halt
_enable_debug _enable_debug

View File

@@ -175,6 +175,8 @@ $_CHIPNAME.ap1 configure -event reset-assert-post {
$_CHIPNAME.ap1 configure -event reset-deassert-pre { $_CHIPNAME.ap1 configure -event reset-deassert-pre {
adapter deassert srst deassert trst adapter deassert srst deassert trst
catch {dap init}
catch {$::_CHIPNAME.dap apid 1}
$::_CHIPNAME.ap1 arp_examine $::_CHIPNAME.ap1 arp_examine
_handshake_with_wrapper $halt _handshake_with_wrapper $halt
if { $::EN_CA7_0 } { if { $::EN_CA7_0 } {

View File

@@ -182,6 +182,8 @@ $_CHIPNAME.axi configure -event reset-assert-post {
$_CHIPNAME.axi configure -event reset-deassert-pre { $_CHIPNAME.axi configure -event reset-deassert-pre {
adapter deassert srst deassert trst adapter deassert srst deassert trst
catch {dap init}
catch {$::_CHIPNAME.dap apid 0}
$::_CHIPNAME.axi arp_examine $::_CHIPNAME.axi arp_examine
set is_dev_boot [_enable_dbgmcu_on_devboot] set is_dev_boot [_enable_dbgmcu_on_devboot]
if { !$is_dev_boot } { if { !$is_dev_boot } {

View File

@@ -171,7 +171,8 @@ $_CHIPNAME.axi configure -event reset-assert-post {
$_CHIPNAME.axi configure -event reset-deassert-pre { $_CHIPNAME.axi configure -event reset-deassert-pre {
adapter deassert srst deassert trst adapter deassert srst deassert trst
catch {dap init}
catch {$::_CHIPNAME.dap apid 0}
$::_CHIPNAME.ap0 arp_examine $::_CHIPNAME.ap0 arp_examine
_handshake_with_wrapper $halt _handshake_with_wrapper $halt

View File

@@ -191,7 +191,8 @@ $_CHIPNAME.axi configure -event reset-assert-post {
$_CHIPNAME.axi configure -event reset-deassert-pre { $_CHIPNAME.axi configure -event reset-deassert-pre {
adapter deassert srst deassert trst adapter deassert srst deassert trst
catch {dap init}
catch {$::_CHIPNAME.dap apid 0}
$::_CHIPNAME.ap0 arp_examine $::_CHIPNAME.ap0 arp_examine
_handshake_with_wrapper $halt _handshake_with_wrapper $halt