stm32h7x: Fix reset with non-HLA interfaces on macOS
[openocd.git] / tcl / target / stm32h7x.cfg
index 4a04929aa580830d200169ff0e081e85038ef0d9..763a7857a08cb6cffc104658d93805a66b7dc9f7 100644 (file)
@@ -175,10 +175,19 @@ $_CHIPNAME.cpu0 configure -event reset-init {
        adapter speed 4000
 }
 
+# get _CHIPNAME from current target
+proc stm32h7x_get_chipname {} {
+       set t [target current]
+       set sep [string last "." $t]
+       if {$sep == -1} {
+               return $t
+       }
+       return [string range $t 0 [expr $sep - 1]]
+}
+
 if {[set $_CHIPNAME.DUAL_CORE]} {
        $_CHIPNAME.cpu1 configure -event examine-end {
-               # get _CHIPNAME from the current target
-               set _CHIPNAME [regsub ".cpu\\d$" [target current] ""]
+               set _CHIPNAME [stm32h7x_get_chipname]
                global $_CHIPNAME.USE_CTI
 
                # Stop watchdog counters during halt
@@ -214,8 +223,7 @@ proc stm32h7x_mmw {used_target reg setbits clearbits} {
 proc stm32h7x_dbgmcu_mmw {reg_offset setbits clearbits} {
        # use $_CHIPNAME.ap2 if possible, and use the proper dbgmcu base address
        if {![using_hla]} {
-               # get _CHIPNAME from the current target
-               set _CHIPNAME [regsub ".(cpu|ap)\\d*$" [target current] ""]
+               set _CHIPNAME [stm32h7x_get_chipname]
                set used_target $_CHIPNAME.ap2
                set reg_addr [expr 0xE00E1000 + $reg_offset]
        } {
@@ -238,8 +246,7 @@ if {[set $_CHIPNAME.USE_CTI]} {
        $_CHIPNAME.cpu1 configure -event debug-halted { stm32h7x_cti_prepare_restart_all }
 
        proc stm32h7x_cti_start {} {
-               # get _CHIPNAME from the current target
-               set _CHIPNAME [regsub ".cpu\\d$" [target current] ""]
+               set _CHIPNAME [stm32h7x_get_chipname]
 
                # Configure Cores' CTIs to halt each other
                # TRIGIN0 (DBGTRIGGER) and TRIGOUT0 (EDBGRQ) at CTM_CHANNEL_0
@@ -254,8 +261,7 @@ if {[set $_CHIPNAME.USE_CTI]} {
        }
 
        proc stm32h7x_cti_stop {} {
-               # get _CHIPNAME from the current target
-               set _CHIPNAME [regsub ".cpu\\d$" [target current] ""]
+               set _CHIPNAME [stm32h7x_get_chipname]
 
                $_CHIPNAME.cti0 enable off
                $_CHIPNAME.cti1 enable off
@@ -267,8 +273,7 @@ if {[set $_CHIPNAME.USE_CTI]} {
        }
 
        proc stm32h7x_cti_prepare_restart {cti} {
-               # get _CHIPNAME from the current target
-               set _CHIPNAME [regsub ".cpu\\d$" [target current] ""]
+               set _CHIPNAME [stm32h7x_get_chipname]
 
                # Acknowlodge EDBGRQ at TRIGOUT0
                $_CHIPNAME.$cti write INACK 0x01

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)