From c4f88aeb4d1f88f908f96ba252995c5ba247b737 Mon Sep 17 00:00:00 2001 From: Tarek BOCHKATI Date: Fri, 24 Sep 2021 13:47:14 +0100 Subject: 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 Reported-by: Patrik Bachan Fixes: https://sourceforge.net/p/openocd/tickets/317/ Reviewed-on: https://review.openocd.org/c/openocd/+/6546 Reviewed-by: Tomas Vanek Reviewed-by: Antonio Borneo Tested-by: jenkins --- tcl/target/stm32x5x_common.cfg | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'tcl') diff --git a/tcl/target/stm32x5x_common.cfg b/tcl/target/stm32x5x_common.cfg index 321abff..fb3aeb1 100644 --- a/tcl/target/stm32x5x_common.cfg +++ b/tcl/target/stm32x5x_common.cfg @@ -58,7 +58,9 @@ if {[using_jtag]} { 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 # perform a soft reset cortex_m reset_config sysresetreq @@ -71,13 +73,18 @@ proc stm32x5x_is_secure {} { } proc stm32x5x_ahb_ap_non_secure_access {} { - # SPROT=1=Non Secure access, Priv=1 - [[target current] cget -dap] apcsw 0x4B000000 0x4F000000 + # in HLA mode, non-secure debugging is possible without changing the AP CSW + if {![using_hla]} { + # SPROT=1=Non Secure access, Priv=1 + [[target current] cget -dap] apcsw 0x4B000000 0x4F000000 + } } proc stm32x5x_ahb_ap_secure_access {} { - # SPROT=0=Secure access, Priv=1 - [[target current] cget -dap] apcsw 0x0B000000 0x4F000000 + if {![using_hla]} { + # SPROT=0=Secure access, Priv=1 + [[target current] cget -dap] apcsw 0x0B000000 0x4F000000 + } } $_TARGETNAME configure -event reset-start { -- cgit v1.1