OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / tools / misc / ivpn.gdb
1 #
2 #       VyberGuard iVPN IXP425 target gdbinit script.
3 #
4
5
6 #
7 #       UART functions
8 #
9
10 define uart-init
11 set *((long*) 0xc800000c) = 0x83
12 #set *((long*) 0xc8000000) = 0x56
13 set *((long*) 0xc8000000) = 0x07
14 set *((long*) 0xc8000004) = 0x00
15 set *((long*) 0xc800000c) = 0x03
16 set *((long*) 0xc8000004) = 0x40
17 end
18
19 define uart-print
20 set *((long*) 0xc8000000) = $arg0
21 end
22
23
24 #
25 #       Memory functions
26 #
27
28 define mem-init
29 # set for 32MB (3CAS, 3RAS)
30 set *((long*) 0xcc000000) = 0x18
31
32 # disable refresh
33 set *((long*) 0xcc000004) = 0
34
35 # send NOP command
36 set *((long*) 0xcc000008) = 0x03
37 shell sleep 1
38
39 # set refresh count
40 set *((long*) 0xcc000004) = 0x384
41 shell sleep 1
42
43 # send PRECHARGE-ALL command
44 set *((long*) 0xcc000008) = 0x02
45 shell sleep 1
46
47 # send AUTO-REFRESH command
48 set $num = 8
49 while ($num > 0)
50         set *((long*) 0xcc000008) = 0x04
51         shell sleep 1
52         set $num = $num - 1
53 end
54
55 # send MODE (CAS3) command
56 set *((long*) 0xcc000008) = 0x01
57 shell sleep 1
58
59 # send NORMAL-OPERATION command
60 set *((long*) 0xcc000008) = 0x06
61 shell sleep 1
62
63 end
64
65
66
67 #
68 #       Switch memory and expansion regions
69 #
70 define mem-switch
71 set *((unsigned long *) 0x10000000) = 0xe3a01331
72 set *((unsigned long *) 0x10000004) = 0xe3811020
73 set *((unsigned long *) 0x10000008) = 0xe5912000
74 set *((unsigned long *) 0x1000000c) = 0xe3c22102
75 set *((unsigned long *) 0x10000010) = 0xe5812000
76 set $pc = 0x10000000
77 stepi 5
78 end
79
80
81 define mem-fill
82 set $num = 0
83 set $addr = $arg0
84 set $val = $arg1
85 while ($num < 0x1000)
86         set *((unsigned long *) $addr) = $val
87         set $addr = $addr + 4
88         set $num = $num + 1
89 end
90 end
91
92
93 define mem-check
94 set $num = 0
95 set $addr = $arg0
96 set $val = $arg1
97 while ($num < 0x1000)
98         set $rd = *((unsigned long *) $addr)
99         if ($rd != $val)
100                 print $addr
101         end
102         set $addr = $addr + 4
103         set $num = $num + 1
104 end
105 end
106
107
108 #
109 #       Set BIG endian mode
110 #
111 define big
112 set *((unsigned long *) 0x10000000) = 0xee110f10
113 set *((unsigned long *) 0x10000004) = 0xe3800080
114 set *((unsigned long *) 0x10000008) = 0xee010f10
115 set *((unsigned long *) 0x1000000c) = 0xee120f10
116 set *((unsigned long *) 0x10000010) = 0xe1a00000
117 set *((unsigned long *) 0x10000010) = 0xe24ff004
118 set $pc = 0x10000000
119 stepi 6
120 end
121
122 #
123 #       Enable the caches.
124 #
125 define cache
126 set *((unsigned long *) 0x10000000) = 0xee110f10
127 set *((unsigned long *) 0x10000004) = 0xe3800a01
128 set *((unsigned long *) 0x10000008) = 0xe380000c
129 set *((unsigned long *) 0x1000000c) = 0xee010f10
130 set *((unsigned long *) 0x10000010) = 0xee120f10
131 set *((unsigned long *) 0x10000014) = 0xe1a00000
132 set *((unsigned long *) 0x10000018) = 0xe24ff004
133 set *((unsigned long *) 0x1000001c) = 0xee071f15
134 set *((unsigned long *) 0x10000020) = 0xee120f10
135 set *((unsigned long *) 0x10000024) = 0xe1a00000
136 set *((unsigned long *) 0x10000028) = 0xe24ff004
137 set $pc = 0x10000000
138 stepi 0xb
139 end
140
141 #
142 #       Enable the PCI clock (which is on GPIO14)
143 #
144 define pci-clock
145 set *((unsigned long *) 0xc8004004) = 0x00003fff
146 set *((unsigned long *) 0xc8004018) = 0x000001ff
147 set *((unsigned long *) 0xc8004000) = 0x00004000
148 end
149
150 #
151 #       Configure the flash region to be writable.
152 #
153 define writable
154 set *((unsigned long *) 0x10000000) = 0xe3a01331
155 set *((unsigned long *) 0x10000004) = 0xe5912000
156 set *((unsigned long *) 0x10000008) = 0xe3822002
157 set *((unsigned long *) 0x1000000c) = 0xe5812000
158 set $pc = 0x10000000
159 stepi 4
160 end
161
162
163 #
164 #       FLASH writing code
165 #
166 define flash-erase1
167 set *((unsigned long *) 0x10000000) = 0xe3a01205
168 set *((unsigned long *) 0x10000004) = 0xe3a02020
169 set *((unsigned long *) 0x10000008) = 0xe3822a02
170 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
171 set *((unsigned long *) 0x10000010) = 0xe3a020d0
172 set *((unsigned long *) 0x10000014) = 0xe3822a0d
173 set *((unsigned long *) 0x10000018) = 0xe1c120b0
174 set $pc = 0x10000000
175 stepi 7
176 shell sleep 2
177 set *((unsigned long *) 0x10000000) = 0xe3a020ff
178 set *((unsigned long *) 0x10000004) = 0xe3822cff
179 set *((unsigned long *) 0x10000008) = 0xe1c120b0
180 set $pc = 0x10000000
181 stepi 3
182 end
183
184 define flash-erase2
185 set *((unsigned long *) 0x10000000) = 0xe3a01205
186 set *((unsigned long *) 0x10000004) = 0xe3811802
187 set *((unsigned long *) 0x10000008) = 0xe3a02020
188 set *((unsigned long *) 0x1000000c) = 0xe3822a02
189 set *((unsigned long *) 0x10000010) = 0xe1c120b0
190 set *((unsigned long *) 0x10000014) = 0xe3a020d0
191 set *((unsigned long *) 0x10000018) = 0xe3822a0d
192 set *((unsigned long *) 0x1000001c) = 0xe1c120b0
193 set $pc = 0x10000000
194 stepi 8
195 shell sleep 2
196 set *((unsigned long *) 0x10000000) = 0xe3a020ff
197 set *((unsigned long *) 0x10000004) = 0xe3822cff
198 set *((unsigned long *) 0x10000008) = 0xe1c120b0
199 set $pc = 0x10000000
200 stepi 3
201 end
202 define flash-id
203 set *((unsigned long *) 0x10000000) = 0xe3a01205
204 set *((unsigned long *) 0x10000004) = 0xe3a02090
205 set *((unsigned long *) 0x10000008) = 0xe3822a09
206 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
207 set $pc = 0x10000000
208 stepi 4
209 end
210
211 define flash-program
212 set *((unsigned long *) 0x10100000) = 0xe3a01205
213 set *((unsigned long *) 0x10100004) = 0xe3a02040
214 set *((unsigned long *) 0x10100008) = 0xe3822901
215 set *((unsigned long *) 0x1010000c) = 0xe3a03080
216 set *((unsigned long *) 0x10100010) = 0xe3a040ff
217 set *((unsigned long *) 0x10100014) = 0xe3844cff
218 set *((unsigned long *) 0x10100018) = 0xe3a05000
219 set *((unsigned long *) 0x1010001c) = 0xe3a06701
220 set *((unsigned long *) 0x10100020) = 0xe1c120b0
221 set *((unsigned long *) 0x10100024) = 0xe1d570b0
222 set *((unsigned long *) 0x10100028) = 0xe1c170b0
223 set *((unsigned long *) 0x1010002c) = 0xe1d170b0
224 set *((unsigned long *) 0x10100030) = 0xe1170003
225 set *((unsigned long *) 0x10100034) = 0x0afffffc
226 set *((unsigned long *) 0x10100038) = 0xe1c140b0
227 set *((unsigned long *) 0x1010003c) = 0xe2811002
228 set *((unsigned long *) 0x10100040) = 0xe2855002
229 set *((unsigned long *) 0x10100044) = 0xe1550006
230 set *((unsigned long *) 0x10100048) = 0x1afffff4
231 set *((unsigned long *) 0x1010004c) = 0xe1a00000
232 set *((unsigned long *) 0x10100050) = 0xe1a00000
233 set *((unsigned long *) 0x10100054) = 0xeafffffe
234 set $pc = 0x10100000
235 end
236
237 #
238 #       Set debugger into big endian mode.
239 #
240 define gdb-big
241 set endian big
242 monitor endian big
243 end
244
245
246 define flash-redboot
247 mem-init
248 mem-switch
249 writable
250 flash-erase1
251 flash-erase2
252 load redboot-swap.elf
253 flash-program
254 c
255 end
256
257 define flash-boot
258 mem-init
259 mem-switch
260 writable
261 flash-erase1
262 flash-erase2
263 load boot/boot-swap.elf
264 flash-program
265 c
266 end
267
268 #
269 #       Startup commands...
270 #
271 set output-radix 16
272 set input-radix 16
273
274 target remote localhost:8888
275
276 #set endian big
277 #monitor endian big
278
279 set print pretty
280 set print asm-demangle
281 #display/i $pc
282