stm32h7x: Fix reset with non-HLA interfaces on macOS
regsub doesn't work correctly on macOS Catalina, which results in an incorrect CHIPNAME derived from the current target. Since regsub is only used by this target, replace it with a simple string search for '.' followed by a substring. This is funcionally equivalent to what the regular expression was doing, but instead relies in simpler string operations that should have little to no differences between systems. Also, refactor CHIPNAME detection into proc stm32h7x_chipname, so it's always retrieved in the same way without duplicating the code. Change-Id: Ia9f63f56b508688e74278b022eaec47e503916e7 Signed-off-by: Alberto Garcia Hierro <alberto@garciahierro.com> Reviewed-on: http://openocd.zylin.com/5872 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
92ea7e41b9
commit
535f5309ba
|
@ -175,10 +175,19 @@ $_CHIPNAME.cpu0 configure -event reset-init {
|
||||||
adapter speed 4000
|
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]} {
|
if {[set $_CHIPNAME.DUAL_CORE]} {
|
||||||
$_CHIPNAME.cpu1 configure -event examine-end {
|
$_CHIPNAME.cpu1 configure -event examine-end {
|
||||||
# get _CHIPNAME from the current target
|
set _CHIPNAME [stm32h7x_get_chipname]
|
||||||
set _CHIPNAME [regsub ".cpu\\d$" [target current] ""]
|
|
||||||
global $_CHIPNAME.USE_CTI
|
global $_CHIPNAME.USE_CTI
|
||||||
|
|
||||||
# Stop watchdog counters during halt
|
# 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} {
|
proc stm32h7x_dbgmcu_mmw {reg_offset setbits clearbits} {
|
||||||
# use $_CHIPNAME.ap2 if possible, and use the proper dbgmcu base address
|
# use $_CHIPNAME.ap2 if possible, and use the proper dbgmcu base address
|
||||||
if {![using_hla]} {
|
if {![using_hla]} {
|
||||||
# get _CHIPNAME from the current target
|
set _CHIPNAME [stm32h7x_get_chipname]
|
||||||
set _CHIPNAME [regsub ".(cpu|ap)\\d*$" [target current] ""]
|
|
||||||
set used_target $_CHIPNAME.ap2
|
set used_target $_CHIPNAME.ap2
|
||||||
set reg_addr [expr 0xE00E1000 + $reg_offset]
|
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 }
|
$_CHIPNAME.cpu1 configure -event debug-halted { stm32h7x_cti_prepare_restart_all }
|
||||||
|
|
||||||
proc stm32h7x_cti_start {} {
|
proc stm32h7x_cti_start {} {
|
||||||
# get _CHIPNAME from the current target
|
set _CHIPNAME [stm32h7x_get_chipname]
|
||||||
set _CHIPNAME [regsub ".cpu\\d$" [target current] ""]
|
|
||||||
|
|
||||||
# Configure Cores' CTIs to halt each other
|
# Configure Cores' CTIs to halt each other
|
||||||
# TRIGIN0 (DBGTRIGGER) and TRIGOUT0 (EDBGRQ) at CTM_CHANNEL_0
|
# TRIGIN0 (DBGTRIGGER) and TRIGOUT0 (EDBGRQ) at CTM_CHANNEL_0
|
||||||
|
@ -254,8 +261,7 @@ if {[set $_CHIPNAME.USE_CTI]} {
|
||||||
}
|
}
|
||||||
|
|
||||||
proc stm32h7x_cti_stop {} {
|
proc stm32h7x_cti_stop {} {
|
||||||
# get _CHIPNAME from the current target
|
set _CHIPNAME [stm32h7x_get_chipname]
|
||||||
set _CHIPNAME [regsub ".cpu\\d$" [target current] ""]
|
|
||||||
|
|
||||||
$_CHIPNAME.cti0 enable off
|
$_CHIPNAME.cti0 enable off
|
||||||
$_CHIPNAME.cti1 enable off
|
$_CHIPNAME.cti1 enable off
|
||||||
|
@ -267,8 +273,7 @@ if {[set $_CHIPNAME.USE_CTI]} {
|
||||||
}
|
}
|
||||||
|
|
||||||
proc stm32h7x_cti_prepare_restart {cti} {
|
proc stm32h7x_cti_prepare_restart {cti} {
|
||||||
# get _CHIPNAME from the current target
|
set _CHIPNAME [stm32h7x_get_chipname]
|
||||||
set _CHIPNAME [regsub ".cpu\\d$" [target current] ""]
|
|
||||||
|
|
||||||
# Acknowlodge EDBGRQ at TRIGOUT0
|
# Acknowlodge EDBGRQ at TRIGOUT0
|
||||||
$_CHIPNAME.$cti write INACK 0x01
|
$_CHIPNAME.$cti write INACK 0x01
|
||||||
|
|
Loading…
Reference in New Issue