OSDN Git Service

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