ipdbg: fix double free of virtual-ir data
[openocd.git] / tcl / target / psoc4.cfg
index eb51847ce3a4334ad9cc6c66dac12bc5b7b1068b..baa2c83f4160e0d1896d1e78b8bf3155b4cca7b3 100644 (file)
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
 # script for Cypress PSoC 4 devices
 
 #
@@ -36,7 +38,7 @@ $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE
 set _FLASHNAME $_CHIPNAME.flash
 flash bank $_FLASHNAME psoc4 0 0 0 0 $_TARGETNAME
 
-adapter_khz 1500
+adapter speed 1500
 
 # Reset, bloody PSoC 4 reset
 #
@@ -60,7 +62,7 @@ adapter_khz 1500
 #
 # Newer families like PSoC 4000, 4100M, 4200M, 4100L, 4200L and PSoC 4 BLE
 # clear TEST_MODE flag during device reset so workaround is not possible.
-# Use a KitProg adapter for theese devices or "reset halt" will not stop
+# Use a KitProg adapter for these devices or "reset halt" will not stop
 # before executing user code.
 #
 # 3) SWD cannot be connected during system initialization after reset.
@@ -74,22 +76,22 @@ if {![using_hla]} {
 }
 
 proc psoc4_get_family_id {} {
-       set err [catch "mem2array romtable_pid 32 0xF0000FE0 3"]
+       set err [catch {set romtable_pid [read_memory 0xF0000FE0 32 3]}]
        if { $err } {
                return 0
        }
-       if { [expr $romtable_pid(0) & 0xffffff00 ]
-         || [expr $romtable_pid(1) & 0xffffff00 ]
-         || [expr $romtable_pid(2) & 0xffffff00 ] } {
+       if { [expr {[lindex $romtable_pid 0] & 0xffffff00 }]
+         || [expr {[lindex $romtable_pid 1] & 0xffffff00 }]
+         || [expr {[lindex $romtable_pid 2] & 0xffffff00 }] } {
                echo "Unexpected data in ROMTABLE"
                return 0
        }
-       set designer_id [expr (( $romtable_pid(1) & 0xf0 ) >> 4) | (( $romtable_pid(2) & 0xf ) << 4 ) ]
+       set designer_id [expr {(( [lindex $romtable_pid 1] & 0xf0 ) >> 4) | (( [lindex $romtable_pid 2] & 0xf ) << 4 ) }]
        if { $designer_id != 0xb4 } {
                echo [format "ROMTABLE Designer ID 0x%02x is not Cypress" $designer_id]
                return 0
        }
-       set family_id [expr ( $romtable_pid(0) & 0xff ) | (( $romtable_pid(1) & 0xf ) << 8 ) ]
+       set family_id [expr {( [lindex $romtable_pid 0] & 0xff ) | (( [lindex $romtable_pid 1] & 0xf ) << 8 ) }]
        return $family_id
 }
 
@@ -118,7 +120,7 @@ proc ocd_process_reset_inner { MODE } {
        }
 
        if { ! [info exists PSOC4_USE_ACQUIRE] } {
-               if { 0 == [string compare [adapter_name] kitprog ] } {
+               if { 0 == [string compare [adapter name] kitprog ] } {
                        set PSOC4_USE_ACQUIRE 1
                } else {
                        set PSOC4_USE_ACQUIRE 0
@@ -138,7 +140,7 @@ proc ocd_process_reset_inner { MODE } {
        $t invoke-event reset-assert-pre
 
        if { $halt && $PSOC4_USE_ACQUIRE } {
-               catch { [adapter_name] acquire_psoc }
+               catch { [adapter name] acquire_psoc }
                $t arp_examine
        } else {
                if { $PSOC4_TEST_MODE_WORKAROUND } {
@@ -179,7 +181,7 @@ proc ocd_process_reset_inner { MODE } {
                }
 
                # Check if PSoC CPU is stopped in system ROM
-               set pc [ocd_reg pc]
+               set pc [reg pc]
                regsub {pc[^:]*: } $pc "" pc
                if { $pc < 0x10000000 || $pc > 0x1000ffff } {
                        set hint ""
@@ -193,9 +195,9 @@ proc ocd_process_reset_inner { MODE } {
                }
 
                # Set registers to reset vector values
-               mem2array value 32 0 2
-               reg pc [expr $value(1) & 0xfffffffe ]
-               reg msp $value(0)
+               set value [read_memory 0x0 32 2]
+               reg pc [expr {[lindex $value 1] & 0xfffffffe}]
+               reg msp [lindex $value 0]
 
                if { $PSOC4_TEST_MODE_WORKAROUND } {
                        catch { mww $TEST_MODE 0 }

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)