2 # SnapGear/SG720 target gdbinit script.
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
19 set *((long*) 0xc8000000) = $arg0
29 # set for the type of DDR1 RAM on the SG720
30 monitor long 0xcc00e504 = 0x52220106
31 monitor long 0xcc00e508 = 0x25609074
33 # set SDRAM phys base (SDBR)
34 monitor long 0xcc00e50c) = 0
35 monitor long 0xcc00e50c
37 # set SDRAM boundary (SBR0 and SBR1) (pairs of 512Mb x 16)
38 monitor long 0xcc00e510 = 0x00000004
39 monitor long 0xcc00e510
40 monitor long 0xcc00e514 = 0x00000008
41 monitor long 0xcc00e514
43 # disable refresh cycles
44 monitor long 0xcc00e548 = 0
47 monitor long 0xcc00e500 = 3
50 # send PRECHARGE-ALL command
51 monitor long 0xcc00e500 = 2
54 # send ENABLE-DLL command
55 monitor long 0xcc00e500 = 4
58 # send MODE-SET-RESET command
59 monitor long 0xcc00e500 = 1
62 # send PRECHARGE-ALL command
63 monitor long 0xcc00e500 = 2
66 # send 2 AUTO-REFRESH cycles
67 monitor long 0xcc00e500 = 6
68 monitor long 0xcc00e500 = 6
70 # send MODE-SET command (without DLL reset)
71 monitor long 0xcc00e500 = 0
74 # start normal operation command
75 monitor long 0xcc00e500 = 0xf
79 monitor long 0xcc00e548 = 0x410
87 # Switch memory and expansion regions
90 monitor long 0xc4000020 = 0x00ffff7f
99 set *((unsigned long *) $addr) = $val
100 set $addr = $addr + 4
109 while ($num < 0x80000)
110 #set *((unsigned long *) $addr) = 0x55555555
111 set *((unsigned long *) ($addr + 0x00002aaa)) = 0x55555555
113 #set *((unsigned long *) $addr) = 0xaaaaaaaa
114 #set *((unsigned long *) $addr) = 0xffffffff
115 set *((unsigned long *) ($addr + 0x00001555)) = 0xaaaaaaaa
122 while ($num < 0x80000)
123 set *((unsigned long *) $addr) = 0x55555555
125 set $val = *((unsigned long *) $addr)
133 while ($num < 0x80000)
134 set $junk = *((unsigned char *) ($addr + $range))
136 set $range = $range + 1
148 while ($num < 0x1000)
149 set $rd = *((unsigned long *) $addr)
153 set $addr = $addr + 4
160 # Set BIG endian mode
163 set *((unsigned long *) 0x00000000) = 0xee110f10
164 set *((unsigned long *) 0x00000004) = 0xe3800080
165 set *((unsigned long *) 0x00000008) = 0xee010f10
166 set *((unsigned long *) 0x0000000c) = 0xee120f10
167 set *((unsigned long *) 0x00000010) = 0xe1a00000
168 set *((unsigned long *) 0x00000010) = 0xe24ff004
177 set *((unsigned long *) 0x00000000) = 0xee110f10
178 set *((unsigned long *) 0x00000004) = 0xe3800a01
179 set *((unsigned long *) 0x00000008) = 0xe380000c
180 set *((unsigned long *) 0x0000000c) = 0xee010f10
181 set *((unsigned long *) 0x00000010) = 0xee120f10
182 set *((unsigned long *) 0x00000014) = 0xe1a00000
183 set *((unsigned long *) 0x00000018) = 0xe24ff004
184 set *((unsigned long *) 0x0000001c) = 0xee071f15
185 set *((unsigned long *) 0x00000020) = 0xee120f10
186 set *((unsigned long *) 0x00000024) = 0xe1a00000
187 set *((unsigned long *) 0x00000028) = 0xe24ff004
193 # Enable the PCI clock (which is on GPIO14)
196 set *((unsigned long *) 0xc8004004) = 0x00003fff
197 set *((unsigned long *) 0xc8004018) = 0x000001ff
198 set *((unsigned long *) 0xc8004000) = 0x00004000
202 # Configure the flash region to be writable.
205 monitor long 0xc4000000 = 0xbfff3c43
210 # Set debugger into big endian mode.
218 # FLASH writing code (8bit functions)
221 monitor char 0x50000000 = 0x20
222 monitor char 0x50000000 = 0xd0
224 monitor char 0x50000000 = 0xff
228 monitor char 0x50020000 = 0x20
229 monitor char 0x50020000 = 0xd0
231 monitor char 0x50020000 = 0xff
234 define flash8-unlock1
235 monitor char 0x50000000 = 0x60
236 monitor char 0x50000000 = 0xd0
238 monitor char 0x50000000 = 0xff
241 define flash8-unlock2
242 monitor char 0x50020000 = 0x60
243 monitor char 0x50020000 = 0xd0
245 monitor char 0x50020000 = 0xff
248 define flash8-program
249 set *((unsigned long *) 0x00100000) = 0xe3a01205
250 set *((unsigned long *) 0x00100004) = 0xe3a02040
251 set *((unsigned long *) 0x00100008) = 0xe3a03080
252 set *((unsigned long *) 0x0010000c) = 0xe3a040ff
253 set *((unsigned long *) 0x00100010) = 0xe3a05000
254 set *((unsigned long *) 0x00100014) = 0xe3a06701
255 set *((unsigned long *) 0x00100018) = 0xe5c12000
256 set *((unsigned long *) 0x0010001c) = 0xe5d57000
257 set *((unsigned long *) 0x00100020) = 0xe5c17000
258 set *((unsigned long *) 0x00100024) = 0xe5d17000
259 set *((unsigned long *) 0x00100028) = 0xe1170003
260 set *((unsigned long *) 0x0010002c) = 0x0afffffc
261 set *((unsigned long *) 0x00100030) = 0xe5c14000
262 set *((unsigned long *) 0x00100034) = 0xe2811001
263 set *((unsigned long *) 0x00100038) = 0xe2855001
264 set *((unsigned long *) 0x0010003c) = 0xe1550006
265 set *((unsigned long *) 0x00100040) = 0x1afffff4
266 set *((unsigned long *) 0x00100044) = 0xe1a00000
267 set *((unsigned long *) 0x00100048) = 0xe1a00000
268 set *((unsigned long *) 0x0010004c) = 0xeafffffe
272 define flash8-redboot
280 load boot/redboot/images/redboot-swap.elf
291 load boot/boot-swap.elf
300 # Set MAC addresses in the appropriate place. Makes it easier
301 # for redboot to work right...
304 set *((unsigned char *) 0x1c000) = 0x00
305 set *((unsigned char *) 0x1c001) = 0xcf
306 set *((unsigned char *) 0x1c002) = 0xd0
307 set *((unsigned char *) 0x1c003) = 0x00
308 set *((unsigned char *) 0x1c004) = 0x00
309 set *((unsigned char *) 0x1c005) = 0x00
310 set *((unsigned char *) 0x1c006) = 0x01
311 set *((unsigned char *) 0x1c007) = 0x00
315 set *((unsigned char *) 0x1c023) = 'c'
316 set *((unsigned char *) 0x1c022) = 'o'
317 set *((unsigned char *) 0x1c021) = 'n'
318 set *((unsigned char *) 0x1c020) = 's'
319 set *((unsigned char *) 0x1c027) = 'o'
320 set *((unsigned char *) 0x1c026) = 'l'
321 set *((unsigned char *) 0x1c025) = 'e'
322 set *((unsigned char *) 0x1c024) = '='
323 set *((unsigned char *) 0x1c02b) = 't'
324 set *((unsigned char *) 0x1c02a) = 't'
325 set *((unsigned char *) 0x1c029) = 'y'
326 set *((unsigned char *) 0x1c028) = 'S'
327 set *((unsigned char *) 0x1c02f) = '0'
328 set *((unsigned char *) 0x1c02e) = ','
329 set *((unsigned char *) 0x1c02d) = '1'
330 set *((unsigned char *) 0x1c02c) = '1'
331 set *((unsigned char *) 0x1c033) = '5'
332 set *((unsigned char *) 0x1c032) = '2'
333 set *((unsigned char *) 0x1c031) = '0'
334 set *((unsigned char *) 0x1c030) = '0'
335 set *((unsigned char *) 0x1c037) = 0
336 set *((unsigned char *) 0x1c036) = 0
337 set *((unsigned char *) 0x1c035) = 0
338 set *((unsigned char *) 0x1c034) = 0
343 # Startup commands...
348 target remote localhost:8888
353 set print asm-demangle