This is an automated email from Gerrit. "Tarek BOCHKATI <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/6546
-- gerrit commit 4dedc9e1452f9bb74f35cd2ba94c22d75aba055e Author: Tarek BOCHKATI <[email protected]> Date: Mon Sep 6 13:38:11 2021 +0100 tcl/stm32l5x: support HLA adapters in non-secure mode only instrument "target/stm32l5x.cfg" to work with HLA adapters like "interface/stlink.cfg" in non-secure mode only. 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/ diff --git a/tcl/target/stm32l5x.cfg b/tcl/target/stm32l5x.cfg index 0616df1cb..295767854 100644 --- a/tcl/target/stm32l5x.cfg +++ b/tcl/target/stm32l5x.cfg @@ -72,7 +72,9 @@ if {[using_jtag]} { reset_config srst_nogate -if {![using_hla]} { +if {[using_hla]} { + echo "Warn : The selected transport do not support debbuging this device in secure mode" +} else { # if srst is not fitted use SYSRESETREQ to # perform a soft reset cortex_m reset_config sysresetreq @@ -81,7 +83,13 @@ if {![using_hla]} { proc is_secure {} { # read Debug Security Control and Status Regsiter (DSCSR) and check CDS (bit 16) set DSCSR [mrw 0xE000EE08] - return [expr {($DSCSR & (1 << 16)) != 0}] + set secure [expr {($DSCSR & (1 << 16)) != 0}] + if {$secure && [using_hla]} { + echo "Error: The selected transport do not support debbuging this device in secure mode" + shutdown + } + + return $secure } proc clock_config_110_mhz {} { @@ -112,11 +120,18 @@ proc clock_config_110_mhz {} { } proc 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 ahb_ap_secure_access {} { + if {[using_hla]} { + echo "Error: The selected transport do not support debbuging this device in secure mode" + shutdown + } # SPROT=0=Secure access, Priv=1 [[target current] cget -dap] apcsw 0x0B000000 0x4F000000 } @@ -170,7 +185,7 @@ $_TARGETNAME configure -event gdb-flash-erase-start { if {[expr {$FLASH_OPTR & 0x80000000}] == 0} { echo "TZEN option bit disabled" ahb_ap_non_secure_access - } { + } else { ahb_ap_secure_access echo "TZEN option bit enabled" @@ -185,7 +200,7 @@ $_TARGETNAME configure -event gdb-flash-erase-start { if {$use_secure_workarea} { set workarea_addr [expr {$workarea_addr | 0x10000000}] - } { + } else { set workarea_addr [expr {$workarea_addr & ~0x10000000}] } --
