tcl/target: add CC2538 and CC26xx target files (with cJTAG procedure)
[openocd.git] / tcl / target / icepick.cfg
1 #
2 # Copyright (C) 2011 by Karl Kurbjun
3 # Copyright (C) 2009 by David Brownell
4 #
5
6 # Utilities for TI ICEpick-C/D used in most TI SoCs
7 # Details about the ICEPick are available in the the TRM for each SoC
8 # and http://processors.wiki.ti.com/index.php/ICEPICK
9
10 # create "constants"
11 proc CONST { key } {
12
13 array set constant {
14 # define ICEPick instructions
15 IR_BYPASS 0x00
16 IR_ROUTER 0x02
17 IR_CONNECT 0x07
18 IF_BYPASS 0x3F
19 }
20 return $constant($key)
21 }
22
23 # Instruction to connect to the icepick module
24 proc icepick_c_connect {jrc} {
25
26 # Send CONNECT instruction in IR state
27 irscan $jrc [CONST IR_CONNECT] -endstate IRPAUSE
28
29 # Send write and connect key
30 drscan $jrc 8 0x89 -endstate DRPAUSE
31 }
32
33 # Instruction to disconnect to the icepick module
34 proc icepick_c_disconnect {jrc} {
35
36 # Send CONNECT instruction in IR state
37 irscan $jrc [CONST IR_CONNECT] -endstate IRPAUSE
38
39 # Send write and connect key
40 drscan $jrc 8 0x86 -endstate DRPAUSE
41 }
42
43 #
44 # icepick_c_router:
45 # this function is for sending router commands
46 # arguments are:
47 # jrc: TAP name for the ICEpick
48 # rw: read/write (0 for read, 1 for write)
49 # block: icepick or DAP
50 # register: which register to read/write
51 # payload: value to read/write
52 # this function is for sending router commands
53 #
54 proc icepick_c_router {jrc rw block register payload} {
55
56 set new_dr_value \
57 [expr ( ($rw & 0x1) << 31) | ( ($block & 0x7) << 28) | \
58 ( ($register & 0xF) << 24) | ( $payload & 0xFFFFFF ) ]
59
60 # echo "\tNew router value:\t0x[format %x $new_dr_value]"
61
62 # select router
63 irscan $jrc [CONST IR_ROUTER] -endstate IRPAUSE
64
65 # ROUTER instructions are 32 bits wide
66 set old_dr_value [drscan $jrc 32 $new_dr_value -endstate DRPAUSE]
67 }
68
69 # Configure the icepick control register
70 proc icepick_c_setup {jrc} {
71
72 # send a router write, block is 0, register is 1, value is 0x2100
73 icepick_c_router $jrc 1 0x0 0x1 0x001000
74 }
75
76 # jrc == TAP name for the ICEpick
77 # port == a port number, 0..15
78 proc icepick_c_tapenable {jrc port} {
79
80 # First CONNECT to the ICEPick
81 # echo "Connecting to ICEPick"
82 icepick_c_connect $jrc
83
84 # echo "Configuring the ICEpick"
85 icepick_c_setup $jrc
86
87 # NOTE: it's important not to enter RUN/IDLE state until
88 # done sending these instructions and data to the ICEpick.
89 # And never to enter RESET, which will disable the TAPs.
90
91 # first enable power and clock for TAP
92 icepick_c_router $jrc 1 0x2 $port 0x100048
93
94 # TRM states that the register should be read back here, skipped for now
95
96 # enable debug "default" mode
97 icepick_c_router $jrc 1 0x2 $port 0x102048
98
99 # TRM states that debug enable and debug mode should be read back and
100 # confirmed - skipped for now
101
102 # Finally select the tap
103 icepick_c_router $jrc 1 0x2 $port 0x102148
104
105 # Enter the bypass state
106 irscan $jrc [CONST IR_BYPASS] -endstate RUN/IDLE
107 runtest 10
108 }
109
110 # jrc == TAP name for the ICEpick
111 # port == a port number, 0..15
112 # Follow the sequence described in
113 # http://processors.wiki.ti.com/images/f/f6/Router_Scan_Sequence-ICEpick-D.pdf
114 proc icepick_d_tapenable {jrc port} {
115 # First CONNECT to the ICEPick
116 icepick_c_connect $jrc
117
118 # Select the port
119 irscan $jrc [CONST IR_ROUTER] -endstate IRPAUSE
120 drscan $jrc 32 [expr 0xa0002108 + ($port << 24)] -endstate DRPAUSE
121
122 # Set 4 bit core ID to the Cortex-A
123 irscan $jrc [CONST IR_ROUTER] -endstate IRPAUSE
124 drscan $jrc 32 0xe0002008 -endstate DRPAUSE
125
126 # Enter the bypass state
127 irscan $jrc [CONST IF_BYPASS] -endstate RUN/IDLE
128 runtest 10
129 }
130
131 # This function uses the ICEPick to send a warm system reset
132 proc icepick_c_wreset {jrc} {
133
134 # send a router write, block is 0, register is 1, value is 0x2100
135 icepick_c_router $jrc 1 0x0 0x1 0x002101
136 }
137

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)