OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / tools / misc / sg565.gdb
1 #
2 #       Intel 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) = 0x08
13 set *((long*) 0xc8000004) = 0x00
14 set *((long*) 0xc800000c) = 0x03
15 set *((long*) 0xc8000004) = 0x40
16 end
17
18 define uart-print
19 set *((long*) 0xc8000000) = $arg0
20 end
21
22
23 #
24 #       Memory functions
25 #
26
27 define mem-init
28 # set for 32MB (3CAS, 3RAS)
29 set *((long*) 0xcc000000) = 0x18
30
31 # disable refresh
32 set *((long*) 0xcc000004) = 0
33
34 # send NOP command
35 set *((long*) 0xcc000008) = 0x03
36 shell sleep 1
37
38 # set refresh count
39 set *((long*) 0xcc000004) = 0x384
40 shell sleep 1
41
42 # send PRECHARGE-ALL command
43 set *((long*) 0xcc000008) = 0x02
44 shell sleep 1
45
46 # send AUTO-REFRESH command
47 set $num = 8
48 while ($num > 0)
49         set *((long*) 0xcc000008) = 0x04
50         shell sleep 1
51         set $num = $num - 1
52 end
53
54 # send MODE (CAS3) command
55 set *((long*) 0xcc000008) = 0x01
56 shell sleep 1
57
58 # send NORMAL-OPERATION command
59 set *((long*) 0xcc000008) = 0x06
60 shell sleep 1
61
62 end
63
64
65
66 #
67 #       Switch memory and expansion regions
68 #
69 define mem-switch
70 set *((unsigned long *) 0x10000000) = 0xe3a01331
71 set *((unsigned long *) 0x10000004) = 0xe3811020
72 set *((unsigned long *) 0x10000008) = 0xe5912000
73 set *((unsigned long *) 0x1000000c) = 0xe3c22102
74 set *((unsigned long *) 0x10000010) = 0xe5812000
75 set $pc = 0x10000000
76 stepi 5
77 end
78
79
80 define mem-fill
81 set $num = 0
82 set $addr = $arg0
83 set $val = $arg1
84 while ($num < 0x1000)
85         set *((unsigned long *) $addr) = $val
86         set $addr = $addr + 4
87         set $num = $num + 1
88 end
89 end
90
91
92 define mem-check
93 set $num = 0
94 set $addr = $arg0
95 set $val = $arg1
96 while ($num < 0x1000)
97         set $rd = *((unsigned long *) $addr)
98         if ($rd != $val)
99                 print $addr
100         end
101         set $addr = $addr + 4
102         set $num = $num + 1
103 end
104 end
105
106
107 #
108 #       Set BIG endian mode
109 #
110 define big
111 set *((unsigned long *) 0x10000000) = 0xee110f10
112 set *((unsigned long *) 0x10000004) = 0xe3800080
113 set *((unsigned long *) 0x10000008) = 0xee010f10
114 set *((unsigned long *) 0x1000000c) = 0xee120f10
115 set *((unsigned long *) 0x10000010) = 0xe1a00000
116 set *((unsigned long *) 0x10000010) = 0xe24ff004
117 set $pc = 0x10000000
118 stepi 6
119 end
120
121 #
122 #       Enable the caches.
123 #
124 define cache
125 set *((unsigned long *) 0x10000000) = 0xee110f10
126 set *((unsigned long *) 0x10000004) = 0xe3800a01
127 set *((unsigned long *) 0x10000008) = 0xe380000c
128 set *((unsigned long *) 0x1000000c) = 0xee010f10
129 set *((unsigned long *) 0x10000010) = 0xee120f10
130 set *((unsigned long *) 0x10000014) = 0xe1a00000
131 set *((unsigned long *) 0x10000018) = 0xe24ff004
132 set *((unsigned long *) 0x1000001c) = 0xee071f15
133 set *((unsigned long *) 0x10000020) = 0xee120f10
134 set *((unsigned long *) 0x10000024) = 0xe1a00000
135 set *((unsigned long *) 0x10000028) = 0xe24ff004
136 set $pc = 0x10000000
137 stepi 0xb
138 end
139
140 #
141 #       Enable the PCI clock (which is on GPIO14)
142 #
143 define pci-clock
144 set *((unsigned long *) 0xc8004004) = 0x00003fff
145 set *((unsigned long *) 0xc8004018) = 0x000001ff
146 set *((unsigned long *) 0xc8004000) = 0x00004000
147 end
148
149 #
150 #       Configure the flash region to be writable.
151 #
152 define writable
153 set *((unsigned long *) 0x10000000) = 0xe3a01331
154 set *((unsigned long *) 0x10000004) = 0xe5912000
155 set *((unsigned long *) 0x10000008) = 0xe3822002
156 set *((unsigned long *) 0x1000000c) = 0xe5812000
157 set $pc = 0x10000000
158 stepi 4
159 end
160
161
162 #
163 #       FLASH writing code (16bit functions)
164 #
165 define flash-erase1
166 set *((unsigned long *) 0x10000000) = 0xe3a01205
167 set *((unsigned long *) 0x10000004) = 0xe3a02020
168 set *((unsigned long *) 0x10000008) = 0xe3822a02
169 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
170 set *((unsigned long *) 0x10000010) = 0xe3a020d0
171 set *((unsigned long *) 0x10000014) = 0xe3822a0d
172 set *((unsigned long *) 0x10000018) = 0xe1c120b0
173 set $pc = 0x10000000
174 stepi 7
175 shell sleep 2
176 set *((unsigned long *) 0x10000000) = 0xe3a020ff
177 set *((unsigned long *) 0x10000004) = 0xe3822cff
178 set *((unsigned long *) 0x10000008) = 0xe1c120b0
179 set $pc = 0x10000000
180 stepi 3
181 end
182
183 define flash-erase2
184 set *((unsigned long *) 0x10000000) = 0xe3a01205
185 set *((unsigned long *) 0x10000004) = 0xe3811802
186 set *((unsigned long *) 0x10000008) = 0xe3a02020
187 set *((unsigned long *) 0x1000000c) = 0xe3822a02
188 set *((unsigned long *) 0x10000010) = 0xe1c120b0
189 set *((unsigned long *) 0x10000014) = 0xe3a020d0
190 set *((unsigned long *) 0x10000018) = 0xe3822a0d
191 set *((unsigned long *) 0x1000001c) = 0xe1c120b0
192 set $pc = 0x10000000
193 stepi 8
194 shell sleep 2
195 set *((unsigned long *) 0x10000000) = 0xe3a020ff
196 set *((unsigned long *) 0x10000004) = 0xe3822cff
197 set *((unsigned long *) 0x10000008) = 0xe1c120b0
198 set $pc = 0x10000000
199 stepi 3
200 end
201
202 define flash-unlock1
203 set *((unsigned long *) 0x10000000) = 0xe3a01205
204 set *((unsigned long *) 0x10000004) = 0xe3a02060
205 set *((unsigned long *) 0x10000008) = 0xe3822a06
206 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
207 set *((unsigned long *) 0x10000010) = 0xe3a020d0
208 set *((unsigned long *) 0x10000014) = 0xe3822a0d
209 set *((unsigned long *) 0x10000018) = 0xe1c120b0
210 set *((unsigned long *) 0x1000001c) = 0xe3a020ff
211 set *((unsigned long *) 0x10000020) = 0xe3822cff
212 set *((unsigned long *) 0x10000024) = 0xe1c120b0
213 set $pc = 0x10000000
214 stepi 10
215 end
216
217 define flash-unlock2
218 set *((unsigned long *) 0x10000000) = 0xe3a01205
219 set *((unsigned long *) 0x10000004) = 0xe3811802
220 set *((unsigned long *) 0x10000008) = 0xe3a02060
221 set *((unsigned long *) 0x1000000c) = 0xe3822a06
222 set *((unsigned long *) 0x10000010) = 0xe1c120b0
223 set *((unsigned long *) 0x10000014) = 0xe3a020d0
224 set *((unsigned long *) 0x10000018) = 0xe3822a0d
225 set *((unsigned long *) 0x1000001c) = 0xe1c120b0
226 set *((unsigned long *) 0x10000020) = 0xe3a020ff
227 set *((unsigned long *) 0x10000024) = 0xe3822cff
228 set *((unsigned long *) 0x10000028) = 0xe1c120b0
229 set $pc = 0x10000000
230 stepi 11
231 end
232
233 define flash-id
234 set *((unsigned long *) 0x10000000) = 0xe3a01205
235 set *((unsigned long *) 0x10000004) = 0xe3a02090
236 set *((unsigned long *) 0x10000008) = 0xe3822a09
237 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
238 set $pc = 0x10000000
239 stepi 4
240 end
241
242 define flash-program
243 set *((unsigned long *) 0x10100000) = 0xe3a01205
244 set *((unsigned long *) 0x10100004) = 0xe3a02040
245 set *((unsigned long *) 0x10100008) = 0xe3822901
246 set *((unsigned long *) 0x1010000c) = 0xe3a03080
247 set *((unsigned long *) 0x10100010) = 0xe3a040ff
248 set *((unsigned long *) 0x10100014) = 0xe3844cff
249 set *((unsigned long *) 0x10100018) = 0xe3a05000
250 set *((unsigned long *) 0x1010001c) = 0xe3a06701
251 set *((unsigned long *) 0x10100020) = 0xe1c120b0
252 set *((unsigned long *) 0x10100024) = 0xe1d570b0
253 set *((unsigned long *) 0x10100028) = 0xe1c170b0
254 set *((unsigned long *) 0x1010002c) = 0xe1d170b0
255 set *((unsigned long *) 0x10100030) = 0xe1170003
256 set *((unsigned long *) 0x10100034) = 0x0afffffc
257 set *((unsigned long *) 0x10100038) = 0xe1c140b0
258 set *((unsigned long *) 0x1010003c) = 0xe2811002
259 set *((unsigned long *) 0x10100040) = 0xe2855002
260 set *((unsigned long *) 0x10100044) = 0xe1550006
261 set *((unsigned long *) 0x10100048) = 0x1afffff4
262 set *((unsigned long *) 0x1010004c) = 0xe1a00000
263 set *((unsigned long *) 0x10100050) = 0xe1a00000
264 set *((unsigned long *) 0x10100054) = 0xeafffffe
265 set $pc = 0x10100000
266 end
267
268 define flash-redboot
269 mem-init
270 mem-switch
271 writable
272 flash-unlock1
273 flash-erase1
274 flash-unlock2
275 flash-erase2
276 load boot/redboot/images/redboot-swap.elf
277 flash-program
278 c
279 end
280
281 define flash-boot
282 mem-init
283 mem-switch
284 writable
285 flash-unlock1
286 flash-erase1
287 flash-unlock2
288 flash-erase2
289 load boot/boot-swap.elf
290 mem-setmac
291 flash-program
292 c
293 end
294
295 #
296 #       FLASH writing code (8bit functions)
297 #
298 define flash8-erase1
299 set *((unsigned long *) 0x10000000) = 0xe3a01205
300 set *((unsigned long *) 0x10000004) = 0xe3a02020
301 set *((unsigned long *) 0x10000008) = 0xe5c12000
302 set *((unsigned long *) 0x1000000c) = 0xe3a020d0
303 set *((unsigned long *) 0x10000010) = 0xe5c12000
304 set $pc = 0x10000000
305 stepi 5
306 shell sleep 2
307 set *((unsigned long *) 0x10000000) = 0xe3a020ff
308 set *((unsigned long *) 0x10000004) = 0xe5c12000
309 set $pc = 0x10000000
310 stepi 2
311 end
312
313 define flash8-erase2
314 set *((unsigned long *) 0x10000000) = 0xe3a01205
315 set *((unsigned long *) 0x10000004) = 0xe3811802
316 set *((unsigned long *) 0x10000008) = 0xe3a02020
317 set *((unsigned long *) 0x1000000c) = 0xe5c12000
318 set *((unsigned long *) 0x10000010) = 0xe3a020d0
319 set *((unsigned long *) 0x10000014) = 0xe5c12000
320 set $pc = 0x10000000
321 stepi 6
322 shell sleep 2
323 set *((unsigned long *) 0x10000000) = 0xe3a020ff
324 set *((unsigned long *) 0x10000004) = 0xe5c12000
325 set $pc = 0x10000000
326 stepi 2
327 end
328
329 define flash8-unlock1
330 set *((unsigned long *) 0x10000000) = 0xe3a01205
331 set *((unsigned long *) 0x10000004) = 0xe3a02060
332 set *((unsigned long *) 0x10000008) = 0xe5c12000
333 set *((unsigned long *) 0x1000000c) = 0xe3a020d0
334 set *((unsigned long *) 0x10000010) = 0xe5c12000
335 set *((unsigned long *) 0x10000014) = 0xe3a020ff
336 set *((unsigned long *) 0x10000018) = 0xe5c12000
337 set $pc = 0x10000000
338 stepi 7
339 end
340
341 define flash8-unlock2
342 set *((unsigned long *) 0x10000000) = 0xe3a01205
343 set *((unsigned long *) 0x10000004) = 0xe3811802
344 set *((unsigned long *) 0x10000008) = 0xe3a02060
345 set *((unsigned long *) 0x1000000c) = 0xe5c12000
346 set *((unsigned long *) 0x10000010) = 0xe3a020d0
347 set *((unsigned long *) 0x10000014) = 0xe5c12000
348 set *((unsigned long *) 0x10000018) = 0xe3a020ff
349 set *((unsigned long *) 0x1000001c) = 0xe5c12000
350 set $pc = 0x10000000
351 stepi 8
352 end
353
354 define flash8-program
355 set *((unsigned long *) 0x10100000) = 0xe59f106c
356 set *((unsigned long *) 0x10100004) = 0xe59f206c
357 set *((unsigned long *) 0x10100008) = 0xe5812000
358 set *((unsigned long *) 0x1010000c) = 0xe59f1068
359 set *((unsigned long *) 0x10100010) = 0xe59f2068
360 set *((unsigned long *) 0x10100014) = 0xe5812000
361 set *((unsigned long *) 0x10100018) = 0xe3a01205
362 set *((unsigned long *) 0x1010001c) = 0xe3a02040
363 set *((unsigned long *) 0x10100020) = 0xe3a03080
364 set *((unsigned long *) 0x10100024) = 0xe3a040ff
365 set *((unsigned long *) 0x10100028) = 0xe3a05000
366 set *((unsigned long *) 0x1010002c) = 0xe3a06701
367 set *((unsigned long *) 0x10100030) = 0xe5c12000
368 set *((unsigned long *) 0x10100034) = 0xe5d57000
369 set *((unsigned long *) 0x10100038) = 0xe5c17000
370 set *((unsigned long *) 0x1010003c) = 0xe5d17000
371 set *((unsigned long *) 0x10100040) = 0xe1170003
372 set *((unsigned long *) 0x10100044) = 0x0afffffc
373 set *((unsigned long *) 0x10100048) = 0xe5c14000
374 set *((unsigned long *) 0x1010004c) = 0xe2811001
375 set *((unsigned long *) 0x10100050) = 0xe2855001
376 set *((unsigned long *) 0x10100054) = 0xe1550006
377 set *((unsigned long *) 0x10100058) = 0x1afffff4
378 set *((unsigned long *) 0x1010005c) = 0xe59f1018
379 set *((unsigned long *) 0x10100060) = 0xe3a02000
380 set *((unsigned long *) 0x10100064) = 0xe5812000
381 set *((unsigned long *) 0x10100068) = 0xe1a00000
382 set *((unsigned long *) 0x1010006c) = 0xe1a00000
383 set *((unsigned long *) 0x10100070) = 0xeafffffe
384 set *((unsigned long *) 0x10100074) = 0xc8004004
385 set *((unsigned long *) 0x10100078) = 0x00003b03
386 set *((unsigned long *) 0x1010007c) = 0xc8004000
387 set *((unsigned long *) 0x10100080) = 0x000004fc
388 set $pc = 0x10100000
389 end
390
391 define flash8-redboot
392 mem-init
393 mem-switch
394 writable
395 flash8-unlock1
396 flash8-erase1
397 flash8-unlock2
398 flash8-erase2
399 load boot/redboot/images/redboot-swap.elf
400 flash8-program
401 c
402 end
403
404 define flash8-boot
405 mem-init
406 mem-switch
407 writable
408 #flash8-unlock1
409 flash8-erase1
410 #flash8-unlock2
411 flash8-erase2
412 load boot/boot-swap.elf
413 mem-setmac
414 flash8-program
415 c
416 end
417
418
419 #
420 #       Set MAC addresses in the appropriate place. Makes it easier
421 #       for redboot to work right...
422 #
423 define mem-setmac
424 set *((unsigned char *) 0x1c000) = 0x00
425 set *((unsigned char *) 0x1c001) = 0xcf
426 set *((unsigned char *) 0x1c002) = 0xd0
427 set *((unsigned char *) 0x1c003) = 0x00
428 set *((unsigned char *) 0x1c004) = 0x00
429 set *((unsigned char *) 0x1c005) = 0x00
430 set *((unsigned char *) 0x1c006) = 0x01
431 set *((unsigned char *) 0x1c007) = 0x00
432 end
433
434 #
435 #       Set debugger into big endian mode.
436 #
437 define gdb-big
438 set endian big
439 monitor endian big
440 end
441
442
443 #
444 #       Startup commands...
445 #
446 set output-radix 16
447 set input-radix 16
448
449 target remote localhost:8888
450
451 #set endian big
452 #monitor endian big
453
454 set print pretty
455 set print asm-demangle
456 #display/i $pc
457