psoc4: add support for Cypress CCG1 family
[openocd.git] / src / flash / startup.tcl
1 # Defines basic Tcl procs for OpenOCD flash module
2
3 #
4 # program utility proc
5 # usage: program filename
6 # optional args: verify, reset, exit and address
7 #
8
9 proc program_error {description exit} {
10 if {$exit == 1} {
11 echo $description
12 shutdown error
13 }
14
15 error $description
16 }
17
18 proc program {filename args} {
19 set exit 0
20
21 foreach arg $args {
22 if {[string equal $arg "verify"]} {
23 set verify 1
24 } elseif {[string equal $arg "reset"]} {
25 set reset 1
26 } elseif {[string equal $arg "exit"]} {
27 set exit 1
28 } else {
29 set address $arg
30 }
31 }
32
33 # make sure init is called
34 if {[catch {init}] != 0} {
35 program_error "** OpenOCD init failed **" 1
36 }
37
38 # reset target and call any init scripts
39 if {[catch {reset init}] != 0} {
40 program_error "** Unable to reset target **" $exit
41 }
42
43 # start programming phase
44 echo "** Programming Started **"
45 if {[info exists address]} {
46 set flash_args "$filename $address"
47 } else {
48 set flash_args "$filename"
49 }
50
51 if {[catch {eval flash write_image erase $flash_args}] == 0} {
52 echo "** Programming Finished **"
53 if {[info exists verify]} {
54 # verify phase
55 echo "** Verify Started **"
56 if {[catch {eval verify_image $flash_args}] == 0} {
57 echo "** Verified OK **"
58 } else {
59 program_error "** Verify Failed **" $exit
60 }
61 }
62
63 if {[info exists reset]} {
64 # reset target if requested
65 # also disable target polling, we are shutting down anyway
66 poll off
67 echo "** Resetting Target **"
68 reset run
69 }
70 } else {
71 program_error "** Programming Failed **" $exit
72 }
73
74 if {$exit == 1} {
75 shutdown
76 }
77 return
78 }
79
80 add_help_text program "write an image to flash, address is only required for binary images. verify, reset, exit are optional"
81 add_usage_text program "<filename> \[address\] \[verify\] \[reset\] \[exit\]"
82
83 # stm32f0x uses the same flash driver as the stm32f1x
84 # this alias enables the use of either name.
85 proc stm32f0x args {
86 eval stm32f1x $args
87 }
88
89 # stm32f3x uses the same flash driver as the stm32f1x
90 # this alias enables the use of either name.
91 proc stm32f3x args {
92 eval stm32f1x $args
93 }
94
95 # stm32f4x uses the same flash driver as the stm32f2x
96 # this alias enables the use of either name.
97 proc stm32f4x args {
98 eval stm32f2x $args
99 }
100
101 # ease migration to updated flash driver
102 proc stm32x args {
103 echo "DEPRECATED! use 'stm32f1x $args' not 'stm32x $args'"
104 eval stm32f1x $args
105 }
106
107 proc stm32f2xxx args {
108 echo "DEPRECATED! use 'stm32f2x $args' not 'stm32f2xxx $args'"
109 eval stm32f2x $args
110 }

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)