OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / tools / misc / montejade.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 # set for 128MB (3CAS, 3RAS)
31 set *((long*) 0xcc000000) = 0x1b
32
33 # disable refresh
34 set *((long*) 0xcc000004) = 0
35
36 # send NOP command
37 set *((long*) 0xcc000008) = 0x03
38 shell sleep 1
39
40 # set refresh count
41 set *((long*) 0xcc000004) = 0x384
42 shell sleep 1
43
44 # send PRECHARGE-ALL command
45 set *((long*) 0xcc000008) = 0x02
46 shell sleep 1
47
48 # send AUTO-REFRESH command
49 set $num = 8
50 while ($num > 0)
51         set *((long*) 0xcc000008) = 0x04
52         shell sleep 1
53         set $num = $num - 1
54 end
55
56 # send MODE (CAS3) command
57 set *((long*) 0xcc000008) = 0x01
58 shell sleep 1
59
60 # send NORMAL-OPERATION command
61 set *((long*) 0xcc000008) = 0x06
62 shell sleep 1
63
64 end
65
66
67
68 #
69 #       Switch memory and expansion regions
70 #
71 define mem-switch
72 set *((unsigned long *) 0x10000000) = 0xe3a01331
73 set *((unsigned long *) 0x10000004) = 0xe3811020
74 set *((unsigned long *) 0x10000008) = 0xe5912000
75 set *((unsigned long *) 0x1000000c) = 0xe3c22102
76 set *((unsigned long *) 0x10000010) = 0xe5812000
77 set $pc = 0x10000000
78 stepi 5
79 end
80
81
82 define mem-fill
83 set $num = 0
84 set $addr = $arg0
85 set $val = $arg1
86 while ($num < 0x1000)
87         set *((unsigned long *) $addr) = $val
88         set $addr = $addr + 4
89         set $num = $num + 1
90 end
91 end
92
93
94 define mem-check
95 set $num = 0
96 set $addr = $arg0
97 set $val = $arg1
98 while ($num < 0x1000)
99         set $rd = *((unsigned long *) $addr)
100         if ($rd != $val)
101                 print $addr
102         end
103         set $addr = $addr + 4
104         set $num = $num + 1
105 end
106 end
107
108
109 #
110 #       Set BIG endian mode
111 #
112 define big
113 set *((unsigned long *) 0x10000000) = 0xee110f10
114 set *((unsigned long *) 0x10000004) = 0xe3800080
115 set *((unsigned long *) 0x10000008) = 0xee010f10
116 set *((unsigned long *) 0x1000000c) = 0xee120f10
117 set *((unsigned long *) 0x10000010) = 0xe1a00000
118 set *((unsigned long *) 0x10000010) = 0xe24ff004
119 set $pc = 0x10000000
120 stepi 6
121 end
122
123 #
124 #       Enable the caches.
125 #
126 define cache
127 set *((unsigned long *) 0x10000000) = 0xee110f10
128 set *((unsigned long *) 0x10000004) = 0xe3800a01
129 set *((unsigned long *) 0x10000008) = 0xe380000c
130 set *((unsigned long *) 0x1000000c) = 0xee010f10
131 set *((unsigned long *) 0x10000010) = 0xee120f10
132 set *((unsigned long *) 0x10000014) = 0xe1a00000
133 set *((unsigned long *) 0x10000018) = 0xe24ff004
134 set *((unsigned long *) 0x1000001c) = 0xee071f15
135 set *((unsigned long *) 0x10000020) = 0xee120f10
136 set *((unsigned long *) 0x10000024) = 0xe1a00000
137 set *((unsigned long *) 0x10000028) = 0xe24ff004
138 set $pc = 0x10000000
139 stepi 0xb
140 end
141
142 #
143 #       Enable the PCI clock (which is on GPIO14)
144 #
145 define pci-clock
146 set *((unsigned long *) 0xc8004004) = 0x00003fff
147 set *((unsigned long *) 0xc8004018) = 0x000001ff
148 set *((unsigned long *) 0xc8004000) = 0x00004000
149 end
150
151 #
152 #       Configure the flash region to be writable.
153 #
154 define writable
155 set *((unsigned long *) 0x10000000) = 0xe3a01331
156 set *((unsigned long *) 0x10000004) = 0xe5912000
157 set *((unsigned long *) 0x10000008) = 0xe3822002
158 set *((unsigned long *) 0x1000000c) = 0xe5812000
159 set $pc = 0x10000000
160 stepi 4
161 end
162
163
164 #
165 #       FLASH writing code
166 #
167 define flash-erase1
168 set *((unsigned long *) 0x10000000) = 0xe3a01205
169 set *((unsigned long *) 0x10000004) = 0xe3a02020
170 set *((unsigned long *) 0x10000008) = 0xe3822a02
171 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
172 set *((unsigned long *) 0x10000010) = 0xe3a020d0
173 set *((unsigned long *) 0x10000014) = 0xe3822a0d
174 set *((unsigned long *) 0x10000018) = 0xe1c120b0
175 set $pc = 0x10000000
176 stepi 7
177 shell sleep 2
178 set *((unsigned long *) 0x10000000) = 0xe3a020ff
179 set *((unsigned long *) 0x10000004) = 0xe3822cff
180 set *((unsigned long *) 0x10000008) = 0xe1c120b0
181 set $pc = 0x10000000
182 stepi 3
183 end
184
185 define flash-erase2
186 set *((unsigned long *) 0x10000000) = 0xe3a01205
187 set *((unsigned long *) 0x10000004) = 0xe3811802
188 set *((unsigned long *) 0x10000008) = 0xe3a02020
189 set *((unsigned long *) 0x1000000c) = 0xe3822a02
190 set *((unsigned long *) 0x10000010) = 0xe1c120b0
191 set *((unsigned long *) 0x10000014) = 0xe3a020d0
192 set *((unsigned long *) 0x10000018) = 0xe3822a0d
193 set *((unsigned long *) 0x1000001c) = 0xe1c120b0
194 set $pc = 0x10000000
195 stepi 8
196 shell sleep 2
197 set *((unsigned long *) 0x10000000) = 0xe3a020ff
198 set *((unsigned long *) 0x10000004) = 0xe3822cff
199 set *((unsigned long *) 0x10000008) = 0xe1c120b0
200 set $pc = 0x10000000
201 stepi 3
202 end
203
204 define flash-unlock1
205 set *((unsigned long *) 0x10000000) = 0xe3a01205
206 set *((unsigned long *) 0x10000004) = 0xe3a02060
207 set *((unsigned long *) 0x10000008) = 0xe3822a06
208 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
209 set *((unsigned long *) 0x10000010) = 0xe3a020d0
210 set *((unsigned long *) 0x10000014) = 0xe3822a0d
211 set *((unsigned long *) 0x10000018) = 0xe1c120b0
212 set *((unsigned long *) 0x1000001c) = 0xe3a020ff
213 set *((unsigned long *) 0x10000020) = 0xe3822cff
214 set *((unsigned long *) 0x10000024) = 0xe1c120b0
215 set $pc = 0x10000000
216 stepi 10
217 end
218
219 define flash-unlock2
220 set *((unsigned long *) 0x10000000) = 0xe3a01205
221 set *((unsigned long *) 0x10000004) = 0xe3811802
222 set *((unsigned long *) 0x10000008) = 0xe3a02060
223 set *((unsigned long *) 0x1000000c) = 0xe3822a06
224 set *((unsigned long *) 0x10000010) = 0xe1c120b0
225 set *((unsigned long *) 0x10000014) = 0xe3a020d0
226 set *((unsigned long *) 0x10000018) = 0xe3822a0d
227 set *((unsigned long *) 0x1000001c) = 0xe1c120b0
228 set *((unsigned long *) 0x10000020) = 0xe3a020ff
229 set *((unsigned long *) 0x10000024) = 0xe3822cff
230 set *((unsigned long *) 0x10000028) = 0xe1c120b0
231 set $pc = 0x10000000
232 stepi 11
233 end
234
235 define flash-id
236 set *((unsigned long *) 0x10000000) = 0xe3a01205
237 set *((unsigned long *) 0x10000004) = 0xe3a02090
238 set *((unsigned long *) 0x10000008) = 0xe3822a09
239 set *((unsigned long *) 0x1000000c) = 0xe1c120b0
240 set $pc = 0x10000000
241 stepi 4
242 end
243
244 define flash-program
245 set *((unsigned long *) 0x10100000) = 0xe3a01205
246 set *((unsigned long *) 0x10100004) = 0xe3a02040
247 set *((unsigned long *) 0x10100008) = 0xe3822901
248 set *((unsigned long *) 0x1010000c) = 0xe3a03080
249 set *((unsigned long *) 0x10100010) = 0xe3a040ff
250 set *((unsigned long *) 0x10100014) = 0xe3844cff
251 set *((unsigned long *) 0x10100018) = 0xe3a05000
252 set *((unsigned long *) 0x1010001c) = 0xe3a06701
253 set *((unsigned long *) 0x10100020) = 0xe1c120b0
254 set *((unsigned long *) 0x10100024) = 0xe1d570b0
255 set *((unsigned long *) 0x10100028) = 0xe1c170b0
256 set *((unsigned long *) 0x1010002c) = 0xe1d170b0
257 set *((unsigned long *) 0x10100030) = 0xe1170003
258 set *((unsigned long *) 0x10100034) = 0x0afffffc
259 set *((unsigned long *) 0x10100038) = 0xe1c140b0
260 set *((unsigned long *) 0x1010003c) = 0xe2811002
261 set *((unsigned long *) 0x10100040) = 0xe2855002
262 set *((unsigned long *) 0x10100044) = 0xe1550006
263 set *((unsigned long *) 0x10100048) = 0x1afffff4
264 set *((unsigned long *) 0x1010004c) = 0xe1a00000
265 set *((unsigned long *) 0x10100050) = 0xe1a00000
266 set *((unsigned long *) 0x10100054) = 0xeafffffe
267 set $pc = 0x10100000
268 end
269
270 #
271 #       Set MAC addresses in the appropriate place. Makes it easier
272 #       for redboot to work right...
273 #
274 define mem-setmac
275 set *((unsigned char *) 0x1c000) = 0x00
276 set *((unsigned char *) 0x1c001) = 0xcf
277 set *((unsigned char *) 0x1c002) = 0xd0
278 set *((unsigned char *) 0x1c003) = 0x00
279 set *((unsigned char *) 0x1c004) = 0x00
280 set *((unsigned char *) 0x1c005) = 0x00
281 set *((unsigned char *) 0x1c006) = 0x01
282 set *((unsigned char *) 0x1c007) = 0x00
283 end
284
285 #
286 #       Set debugger into big endian mode.
287 #
288 define gdb-big
289 set endian big
290 monitor endian big
291 end
292
293
294 define flash-redboot
295 mem-init
296 mem-switch
297 writable
298 flash-unlock1
299 flash-erase1
300 flash-unlock2
301 flash-erase2
302 load boot/redboot/images/redboot-swap.elf
303 #load /home/gerg/redboot/images/redboot-swap.elf
304 flash-program
305 c
306 end
307
308 define flash-boot
309 mem-init
310 mem-switch
311 writable
312 flash-unlock1
313 flash-erase1
314 flash-unlock2
315 flash-erase2
316 load boot/boot-swap.elf
317 mem-setmac
318 flash-program
319 c
320 end
321
322 #
323 #       Startup commands...
324 #
325 set output-radix 16
326 set input-radix 16
327
328 target remote localhost:8888
329
330 #set endian big
331 #monitor endian big
332
333 set print pretty
334 set print asm-demangle
335 #display/i $pc
336