|
From: openocd-gerrit <ope...@us...> - 2026-07-08 18:55:12
|
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 16b9eae804f394e72a1ba6eccba9bcb461a0230a (commit)
from 2ed9f231a47300c39c2573f3a98266aceebc7dd0 (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 16b9eae804f394e72a1ba6eccba9bcb461a0230a
Author: Tomas Vanek <va...@fb...>
Date: Wed Jul 9 09:38:37 2025 +0200
tcl/target/stm32u3x: fix voltage scale before flashing from gdb
The config files of Cortex-M33 based devices (L5, U5, U3) intentionally
dropped 'reset init' from the 'gdb-flash-erase-start' event to allow
programming of unsecure part of flash in 0.5 RDP level.
STM32U3 needs to set voltage range 1 before flash programming,
which was issued in the 'reset-init' event only before this patch.
If the application ran in voltage range 2 and gdb command 'load'
was issued, the flash operation failed due to voltage range 2.
Refactor 'gdb-flash-erase-start' event to use Tcl proc
'stm32x5x_gdb_flash_erase_start'
Add voltage range 1 setting (call 'config_voltage_range') to
'gdb-flash-erase-start' event of STM32U3
Change-Id: Ie910fef11d6737e34158cbb616721a1add72acd1
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9062
Reviewed-by: Ahmed Haoues <ahm...@st...>
Tested-by: jenkins
diff --git a/tcl/target/stm32u3x.cfg b/tcl/target/stm32u3x.cfg
index 449c04217..47c68935e 100644
--- a/tcl/target/stm32u3x.cfg
+++ b/tcl/target/stm32u3x.cfg
@@ -43,3 +43,8 @@ proc config_voltage_range {} {
$_TARGETNAME configure -event reset-init {
config_voltage_range
}
+
+$_TARGETNAME configure -event gdb-flash-erase-start {
+ stm32x5x_gdb_flash_erase_start
+ config_voltage_range
+}
diff --git a/tcl/target/stm32x5x_common.cfg b/tcl/target/stm32x5x_common.cfg
index b6370e493..61ef35d6d 100644
--- a/tcl/target/stm32x5x_common.cfg
+++ b/tcl/target/stm32x5x_common.cfg
@@ -88,6 +88,38 @@ proc stm32x5x_ahb_ap_secure_access {} {
}
}
+proc stm32x5x_gdb_flash_erase_start {} {
+ set use_secure_workarea 0
+ # check if FLASH_OPTR.TZEN is enabled
+ set FLASH_OPTR [mrw 0x40022040]
+ if {[expr {$FLASH_OPTR & 0x80000000}] == 0} {
+ echo "TZEN option bit disabled"
+ stm32x5x_ahb_ap_non_secure_access
+ } else {
+ stm32x5x_ahb_ap_secure_access
+ echo "TZEN option bit enabled"
+
+ # check if FLASH_OPTR.RDP is not Level 0.5
+ if {[expr {$FLASH_OPTR & 0xFF}] != 0x55} {
+ set use_secure_workarea 1
+ }
+ }
+
+ set _TARGETNAME [target current]
+ set workarea_addr [$_TARGETNAME cget -work-area-phys]
+ echo "workarea_addr $workarea_addr"
+
+ if {$use_secure_workarea} {
+ set workarea_addr [expr {$workarea_addr | 0x10000000}]
+ } else {
+ set workarea_addr [expr {$workarea_addr & ~0x10000000}]
+ }
+
+ $_TARGETNAME configure -work-area-phys $workarea_addr
+}
+
+$_TARGETNAME configure -event gdb-flash-erase-start stm32x5x_gdb_flash_erase_start
+
$_TARGETNAME configure -event reset-start {
# Reset clock is MSI (4 MHz)
adapter speed 480
@@ -124,36 +156,6 @@ $_TARGETNAME configure -event halted {
}
}
-$_TARGETNAME configure -event gdb-flash-erase-start {
- set use_secure_workarea 0
- # check if FLASH_OPTR.TZEN is enabled
- set FLASH_OPTR [mrw 0x40022040]
- if {[expr {$FLASH_OPTR & 0x80000000}] == 0} {
- echo "TZEN option bit disabled"
- stm32x5x_ahb_ap_non_secure_access
- } else {
- stm32x5x_ahb_ap_secure_access
- echo "TZEN option bit enabled"
-
- # check if FLASH_OPTR.RDP is not Level 0.5
- if {[expr {$FLASH_OPTR & 0xFF}] != 0x55} {
- set use_secure_workarea 1
- }
- }
-
- set _TARGETNAME [target current]
- set workarea_addr [$_TARGETNAME cget -work-area-phys]
- echo "workarea_addr $workarea_addr"
-
- if {$use_secure_workarea} {
- set workarea_addr [expr {$workarea_addr | 0x10000000}]
- } else {
- set workarea_addr [expr {$workarea_addr & ~0x10000000}]
- }
-
- $_TARGETNAME configure -work-area-phys $workarea_addr
-}
-
tpiu create $_CHIPNAME.tpiu -dap $_CHIPNAME.dap -ap-num 0 -baseaddr 0xE0040000
lappend _telnet_autocomplete_skip _proc_pre_enable_$_CHIPNAME.tpiu
-----------------------------------------------------------------------
Summary of changes:
tcl/target/stm32u3x.cfg | 5 ++++
tcl/target/stm32x5x_common.cfg | 62 ++++++++++++++++++++++--------------------
2 files changed, 37 insertions(+), 30 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|