Skip to content

Commit c4f88ae

Browse files
tarek-bochkatiborneoa
authored andcommitted
tcl/stm32l5x|u5x: support HLA adapters in non-secure mode only
instrument "target/stm32x5x_common.cfg" used by both STM32L5x/U5x to support HLA adapters like "interface/stlink.cfg" in non-secure mode if the device switches to secure mode, the debug session will be stopped immediately (with an explanatory message). Change-Id: I645fdd55e3448ef82d0ddcc396f42fd7b2f39ac3 Signed-off-by: Tarek BOCHKATI <[email protected]> Reported-by: Patrik Bachan <[email protected]> Fixes: https://sourceforge.net/p/openocd/tickets/317/ Reviewed-on: https://review.openocd.org/c/openocd/+/6546 Reviewed-by: Tomas Vanek <[email protected]> Reviewed-by: Antonio Borneo <[email protected]> Tested-by: jenkins
1 parent 535de48 commit c4f88ae

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tcl/target/stm32x5x_common.cfg

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ if {[using_jtag]} {
5858

5959
reset_config srst_nogate
6060

61-
if {![using_hla]} {
61+
if {[using_hla]} {
62+
echo "Warn : The selected adapter does not support debugging this device in secure mode"
63+
} else {
6264
# if srst is not fitted use SYSRESETREQ to
6365
# perform a soft reset
6466
cortex_m reset_config sysresetreq
@@ -71,13 +73,18 @@ proc stm32x5x_is_secure {} {
7173
}
7274

7375
proc stm32x5x_ahb_ap_non_secure_access {} {
74-
# SPROT=1=Non Secure access, Priv=1
75-
[[target current] cget -dap] apcsw 0x4B000000 0x4F000000
76+
# in HLA mode, non-secure debugging is possible without changing the AP CSW
77+
if {![using_hla]} {
78+
# SPROT=1=Non Secure access, Priv=1
79+
[[target current] cget -dap] apcsw 0x4B000000 0x4F000000
80+
}
7681
}
7782

7883
proc stm32x5x_ahb_ap_secure_access {} {
79-
# SPROT=0=Secure access, Priv=1
80-
[[target current] cget -dap] apcsw 0x0B000000 0x4F000000
84+
if {![using_hla]} {
85+
# SPROT=0=Secure access, Priv=1
86+
[[target current] cget -dap] apcsw 0x0B000000 0x4F000000
87+
}
8188
}
8289

8390
$_TARGETNAME configure -event reset-start {

0 commit comments

Comments
 (0)