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 <tarek.bouchkati@gmail.com>
Reported-by: Patrik Bachan <diggit@users.sourceforge.net>
Fixes: https://sourceforge.net/p/openocd/tickets/317/
Reviewed-on: https://review.openocd.org/c/openocd/+/6546
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Tarek BOCHKATI 2021-09-24 13:47:14 +01:00 committed by Antonio Borneo
parent 535de48ca6
commit c4f88aeb4d
1 changed files with 12 additions and 5 deletions

View File

@ -58,7 +58,9 @@ if {[using_jtag]} {
reset_config srst_nogate reset_config srst_nogate
if {![using_hla]} { if {[using_hla]} {
echo "Warn : The selected adapter does not support debugging this device in secure mode"
} else {
# if srst is not fitted use SYSRESETREQ to # if srst is not fitted use SYSRESETREQ to
# perform a soft reset # perform a soft reset
cortex_m reset_config sysresetreq cortex_m reset_config sysresetreq
@ -71,13 +73,18 @@ proc stm32x5x_is_secure {} {
} }
proc stm32x5x_ahb_ap_non_secure_access {} { proc stm32x5x_ahb_ap_non_secure_access {} {
# in HLA mode, non-secure debugging is possible without changing the AP CSW
if {![using_hla]} {
# SPROT=1=Non Secure access, Priv=1 # SPROT=1=Non Secure access, Priv=1
[[target current] cget -dap] apcsw 0x4B000000 0x4F000000 [[target current] cget -dap] apcsw 0x4B000000 0x4F000000
}
} }
proc stm32x5x_ahb_ap_secure_access {} { proc stm32x5x_ahb_ap_secure_access {} {
if {![using_hla]} {
# SPROT=0=Secure access, Priv=1 # SPROT=0=Secure access, Priv=1
[[target current] cget -dap] apcsw 0x0B000000 0x4F000000 [[target current] cget -dap] apcsw 0x0B000000 0x4F000000
}
} }
$_TARGETNAME configure -event reset-start { $_TARGETNAME configure -event reset-start {