OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / tools / misc / sg560.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-erase
166 set $r1 = $arg0
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 = 0x10000004
174 stepi 6
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-erase1
184 set *((unsigned long *) 0x10000000) = 0xe3a01205
185 set *((unsigned long *) 0x10000004) = 0xe3a02020
186 set *((unsigned long *) 0x10000008) = 0xe3822a02
187 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
188 set *((unsigned long *) 0x10000010) = 0xe3a020d0
189 set *((unsigned long *) 0x10000014) = 0xe3822a0d
190 set *((unsigned long *) 0x10000018) = 0xe1c120b0
191 set $pc = 0x10000000
192 stepi 7
193 shell sleep 2
194 set *((unsigned long *) 0x10000000) = 0xe3a020ff
195 set *((unsigned long *) 0x10000004) = 0xe3822cff
196 set *((unsigned long *) 0x10000008) = 0xe1c120b0
197 set $pc = 0x10000000
198 stepi 3
199 end
200
201 define flash-erase2
202 set *((unsigned long *) 0x10000000) = 0xe3a01205
203 set *((unsigned long *) 0x10000004) = 0xe3811802
204 set *((unsigned long *) 0x10000008) = 0xe3a02020
205 set *((unsigned long *) 0x1000000c) = 0xe3822a02
206 set *((unsigned long *) 0x10000010) = 0xe1c120b0
207 set *((unsigned long *) 0x10000014) = 0xe3a020d0
208 set *((unsigned long *) 0x10000018) = 0xe3822a0d
209 set *((unsigned long *) 0x1000001c) = 0xe1c120b0
210 set $pc = 0x10000000
211 stepi 8
212 shell sleep 2
213 set *((unsigned long *) 0x10000000) = 0xe3a020ff
214 set *((unsigned long *) 0x10000004) = 0xe3822cff
215 set *((unsigned long *) 0x10000008) = 0xe1c120b0
216 set $pc = 0x10000000
217 stepi 3
218 end
219
220 define flash-unlock
221 set $r1 = $arg0
222 set *((unsigned long *) 0x10000004) = 0xe3a02060
223 set *((unsigned long *) 0x10000008) = 0xe3822a06
224 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
225 set *((unsigned long *) 0x10000010) = 0xe3a020d0
226 set *((unsigned long *) 0x10000014) = 0xe3822a0d
227 set *((unsigned long *) 0x10000018) = 0xe1c120b0
228 set *((unsigned long *) 0x1000001c) = 0xe3a020ff
229 set *((unsigned long *) 0x10000020) = 0xe3822cff
230 set *((unsigned long *) 0x10000024) = 0xe1c120b0
231 set $pc = 0x10000004
232 stepi 9
233 end
234
235 define flash-unlock1
236 set *((unsigned long *) 0x10000000) = 0xe3a01205
237 set *((unsigned long *) 0x10000004) = 0xe3a02060
238 set *((unsigned long *) 0x10000008) = 0xe3822a06
239 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
240 set *((unsigned long *) 0x10000010) = 0xe3a020d0
241 set *((unsigned long *) 0x10000014) = 0xe3822a0d
242 set *((unsigned long *) 0x10000018) = 0xe1c120b0
243 set *((unsigned long *) 0x1000001c) = 0xe3a020ff
244 set *((unsigned long *) 0x10000020) = 0xe3822cff
245 set *((unsigned long *) 0x10000024) = 0xe1c120b0
246 set $pc = 0x10000000
247 stepi 10
248 end
249
250 define flash-unlock2
251 set *((unsigned long *) 0x10000000) = 0xe3a01205
252 set *((unsigned long *) 0x10000004) = 0xe3811802
253 set *((unsigned long *) 0x10000008) = 0xe3a02060
254 set *((unsigned long *) 0x1000000c) = 0xe3822a06
255 set *((unsigned long *) 0x10000010) = 0xe1c120b0
256 set *((unsigned long *) 0x10000014) = 0xe3a020d0
257 set *((unsigned long *) 0x10000018) = 0xe3822a0d
258 set *((unsigned long *) 0x1000001c) = 0xe1c120b0
259 set *((unsigned long *) 0x10000020) = 0xe3a020ff
260 set *((unsigned long *) 0x10000024) = 0xe3822cff
261 set *((unsigned long *) 0x10000028) = 0xe1c120b0
262 set $pc = 0x10000000
263 stepi 11
264 end
265
266 define flash-id
267 set *((unsigned long *) 0x10000000) = 0xe3a01205
268 set *((unsigned long *) 0x10000004) = 0xe3a02090
269 set *((unsigned long *) 0x10000008) = 0xe3822a09
270 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
271 set $pc = 0x10000000
272 stepi 4
273 end
274
275 define flash-program
276 set *((unsigned long *) 0x10100000) = 0xe3a01205
277 set *((unsigned long *) 0x10100004) = 0xe3a02040
278 set *((unsigned long *) 0x10100008) = 0xe3822901
279 set *((unsigned long *) 0x1010000c) = 0xe3a03080
280 set *((unsigned long *) 0x10100010) = 0xe3a040ff
281 set *((unsigned long *) 0x10100014) = 0xe3844cff
282 set *((unsigned long *) 0x10100018) = 0xe3a05000
283 set *((unsigned long *) 0x1010001c) = 0xe3a06701
284 set *((unsigned long *) 0x10100020) = 0xe1c120b0
285 set *((unsigned long *) 0x10100024) = 0xe1d570b0
286 set *((unsigned long *) 0x10100028) = 0xe1c170b0
287 set *((unsigned long *) 0x1010002c) = 0xe1d170b0
288 set *((unsigned long *) 0x10100030) = 0xe1170003
289 set *((unsigned long *) 0x10100034) = 0x0afffffc
290 set *((unsigned long *) 0x10100038) = 0xe1c140b0
291 set *((unsigned long *) 0x1010003c) = 0xe2811002
292 set *((unsigned long *) 0x10100040) = 0xe2855002
293 set *((unsigned long *) 0x10100044) = 0xe1550006
294 set *((unsigned long *) 0x10100048) = 0x1afffff4
295 set *((unsigned long *) 0x1010004c) = 0xe1a00000
296 set *((unsigned long *) 0x10100050) = 0xe1a00000
297 set *((unsigned long *) 0x10100054) = 0xeafffffe
298 set $pc = 0x10100000
299 end
300
301 define flash-redboot
302 mem-init
303 mem-switch
304 writable
305 flash-unlock1
306 flash-erase1
307 flash-unlock2
308 flash-erase2
309 load boot/redboot/images/redboot-swap.elf
310 flash-program
311 c
312 end
313
314 define flash-boot
315 mem-init
316 mem-switch
317 writable
318 flash-unlock1
319 flash-erase1
320 flash-unlock2
321 flash-erase2
322 load boot/boot-swap.elf
323 mem-setmac
324 flash-program
325 c
326 end
327
328 define flash-eraseall
329 set pagination 0
330 mem-init
331 mem-switch
332 writable
333 set $num = 0
334 set $addr = 0x50000000
335 while ($num < 0x80)
336         print $addr
337         flash-unlock $addr
338         flash-erase $addr
339         set $addr = $addr + 0x20000
340         set $num = $num + 1
341 end
342 end
343
344 #
345 #       FLASH writing code (8bit functions)
346 #
347 define flash8-erase1
348 set *((unsigned long *) 0x10000000) = 0xe3a01205
349 set *((unsigned long *) 0x10000004) = 0xe3a02020
350 set *((unsigned long *) 0x10000008) = 0xe5c12000
351 set *((unsigned long *) 0x1000000c) = 0xe3a020d0
352 set *((unsigned long *) 0x10000010) = 0xe5c12000
353 set $pc = 0x10000000
354 stepi 5
355 shell sleep 2
356 set *((unsigned long *) 0x10000000) = 0xe3a020ff
357 set *((unsigned long *) 0x10000004) = 0xe5c12000
358 set $pc = 0x10000000
359 stepi 2
360 end
361
362 define flash8-erase2
363 set *((unsigned long *) 0x10000000) = 0xe3a01205
364 set *((unsigned long *) 0x10000004) = 0xe3811802
365 set *((unsigned long *) 0x10000008) = 0xe3a02020
366 set *((unsigned long *) 0x1000000c) = 0xe5c12000
367 set *((unsigned long *) 0x10000010) = 0xe3a020d0
368 set *((unsigned long *) 0x10000014) = 0xe5c12000
369 set $pc = 0x10000000
370 stepi 6
371 shell sleep 2
372 set *((unsigned long *) 0x10000000) = 0xe3a020ff
373 set *((unsigned long *) 0x10000004) = 0xe5c12000
374 set $pc = 0x10000000
375 stepi 2
376 end
377
378 define flash8-unlock1
379 set *((unsigned long *) 0x10000000) = 0xe3a01205
380 set *((unsigned long *) 0x10000004) = 0xe3a02060
381 set *((unsigned long *) 0x10000008) = 0xe5c12000
382 set *((unsigned long *) 0x1000000c) = 0xe3a020d0
383 set *((unsigned long *) 0x10000010) = 0xe5c12000
384 set *((unsigned long *) 0x10000014) = 0xe3a020ff
385 set *((unsigned long *) 0x10000018) = 0xe5c12000
386 set $pc = 0x10000000
387 stepi 7
388 end
389
390 define flash8-unlock2
391 set *((unsigned long *) 0x10000000) = 0xe3a01205
392 set *((unsigned long *) 0x10000004) = 0xe3811802
393 set *((unsigned long *) 0x10000008) = 0xe3a02060
394 set *((unsigned long *) 0x1000000c) = 0xe5c12000
395 set *((unsigned long *) 0x10000010) = 0xe3a020d0
396 set *((unsigned long *) 0x10000014) = 0xe5c12000
397 set *((unsigned long *) 0x10000018) = 0xe3a020ff
398 set *((unsigned long *) 0x1000001c) = 0xe5c12000
399 set $pc = 0x10000000
400 stepi 8
401 end
402
403 define flash8-program
404 set *((unsigned long *) 0x10100000) = 0xe3a01205
405 set *((unsigned long *) 0x10100004) = 0xe3a02040
406 set *((unsigned long *) 0x10100008) = 0xe3a03080
407 set *((unsigned long *) 0x1010000c) = 0xe3a040ff
408 set *((unsigned long *) 0x10100010) = 0xe3a05000
409 set *((unsigned long *) 0x10100014) = 0xe3a06701
410 set *((unsigned long *) 0x10100018) = 0xe5c12000
411 set *((unsigned long *) 0x1010001c) = 0xe5d57000
412 set *((unsigned long *) 0x10100020) = 0xe5c17000
413 set *((unsigned long *) 0x10100024) = 0xe5d17000
414 set *((unsigned long *) 0x10100028) = 0xe1170003
415 set *((unsigned long *) 0x1010002c) = 0x0afffffc
416 set *((unsigned long *) 0x10100030) = 0xe5c14000
417 set *((unsigned long *) 0x10100034) = 0xe2811001
418 set *((unsigned long *) 0x10100038) = 0xe2855001
419 set *((unsigned long *) 0x1010003c) = 0xe1550006
420 set *((unsigned long *) 0x10100040) = 0x1afffff4
421 set *((unsigned long *) 0x10100044) = 0xe1a00000
422 set *((unsigned long *) 0x10100048) = 0xe1a00000
423 set *((unsigned long *) 0x1010004c) = 0xeafffffe
424 set $pc = 0x10100000
425 end
426
427 define flash8-redboot
428 mem-init
429 mem-switch
430 writable
431 flash8-unlock1
432 flash8-erase1
433 flash8-unlock2
434 flash8-erase2
435 load boot/redboot/images/redboot-swap.elf
436 flash8-program
437 c
438 end
439
440 define flash8-boot
441 mem-init
442 mem-switch
443 writable
444 #flash8-unlock1
445 flash8-erase1
446 #flash8-unlock2
447 flash8-erase2
448 load boot/boot-swap.elf
449 mem-setmac
450 flash8-program
451 c
452 end
453
454
455 #
456 #       Set MAC addresses in the appropriate place. Makes it easier
457 #       for redboot to work right...
458 #
459 define mem-setmac
460 set *((unsigned char *) 0x1c000) = 0x00
461 set *((unsigned char *) 0x1c001) = 0xcf
462 set *((unsigned char *) 0x1c002) = 0xd0
463 set *((unsigned char *) 0x1c003) = 0x00
464 set *((unsigned char *) 0x1c004) = 0x00
465 set *((unsigned char *) 0x1c005) = 0x00
466 set *((unsigned char *) 0x1c006) = 0x01
467 set *((unsigned char *) 0x1c007) = 0x00
468 end
469
470 #
471 #       Set debugger into big endian mode.
472 #
473 define gdb-big
474 set endian big
475 monitor endian big
476 end
477
478
479 #
480 #       Startup commands...
481 #
482 set output-radix 16
483 set input-radix 16
484
485 target remote localhost:8888
486
487 #set endian big
488 #monitor endian big
489
490 set print pretty
491 set print asm-demangle
492 #display/i $pc
493