From: OpenOCD-Gerrit <ope...@us...> - 2021-08-26 06:22:03
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via e609d5a5de84b3daf8b9524143e41a6c0713fd8f (commit) from c9d40366ad55ea3a83f2ff438aab1e62da653169 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e609d5a5de84b3daf8b9524143e41a6c0713fd8f Author: Tarek BOCHKATI <tar...@gm...> Date: Fri Jan 22 13:15:52 2021 +0100 flash/stm32l4x: STM32L5 support programming when TZEN=1 and RDP=0x55 when RDP level is 0.5 the provided work-area should reside in non-secure RAM to ensure that: - add a hint in the driver level - reduce the usage of secure RAM only when TZEN=1 and RDP is not 0.5 (check the target configuration file) Change-Id: Idbf2325e609b84ef8480eefdb49a176fdf7e07c7 Signed-off-by: Tarek BOCHKATI <tar...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/6035 Reviewed-by: Antonio Borneo <bor...@gm...> Reviewed-by: Oleksij Rempel <li...@re...> Tested-by: jenkins diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c index db8d5e78d..de36d56c7 100644 --- a/src/flash/nor/stm32l4x.c +++ b/src/flash/nor/stm32l4x.c @@ -1434,6 +1434,13 @@ static int stm32l4_write(struct flash_bank *bank, const uint8_t *buffer, if (retval != ERROR_OK) goto err_lock; + /* For TrustZone enabled devices, when TZEN is set and RDP level is 0.5, + * the debug is possible only in non-secure state. + * Thus means the flashloader will run in non-secure mode, + * and the workarea need to be in non-secure RAM */ + if (stm32l4_info->tzen && (stm32l4_info->rdp == RDP_LEVEL_0_5)) + LOG_INFO("RDP level is 0.5, the work-area should reside in non-secure RAM"); + retval = stm32l4_write_block(bank, buffer, offset, count / 8); err_lock: diff --git a/tcl/target/stm32l5x.cfg b/tcl/target/stm32l5x.cfg index 02297e369..0616df1cb 100644 --- a/tcl/target/stm32l5x.cfg +++ b/tcl/target/stm32l5x.cfg @@ -173,7 +173,11 @@ $_TARGETNAME configure -event gdb-flash-erase-start { } { ahb_ap_secure_access echo "TZEN option bit enabled" - set use_secure_workarea 1 + + # check if FLASH_OPTR.RDP is not Level 0.5 + if {[expr {$FLASH_OPTR & 0xFF}] != 0x55} { + set use_secure_workarea 1 + } } set workarea_addr [$_TARGETNAME cget -work-area-phys] ----------------------------------------------------------------------- Summary of changes: src/flash/nor/stm32l4x.c | 7 +++++++ tcl/target/stm32l5x.cfg | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |