OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [m68k/] [gen68360/] [start/] [start.S] - Blame information for rev 493

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *
3
 *  This file contains the entry point for the application.
4
 *  It jumps to the BSP which is responsible for performing
5
 *  all initialization.
6
 *
7
 *  COPYRIGHT (c) 1989-1999.
8
 *  On-Line Applications Research Corporation (OAR).
9
 *
10
 *  The license and distribution terms for this file may in
11
 *  the file LICENSE in this distribution or at
12
 *  http://www.OARcorp.com/rtems/license.html.
13
 *
14
 * Based on the `gen68302' board support package, and covered by the
15
 * original distribution terms.
16
 *
17
 * W. Eric Norum
18
 * Saskatchewan Accelerator Laboratory
19
 * University of Saskatchewan
20
 * Saskatoon, Saskatchewan, CANADA
21
 * eric@skatter.usask.ca
22
 *
23
 *  $Id: start.S,v 1.2 2001-09-27 12:00:08 chris Exp $
24
 */
25
 
26
#include "asm.h"
27
 
28
BEGIN_CODE
29
        /*
30
         * Step 1: Decide on Reset Stack Pointer and Initial Program Counter
31
         */
32
Entry:
33
        .long   m360+1024               |   0: Initial SSP
34
        .long   start                   |   1: Initial PC
35
        .long   _uhoh                   |   2: Bus error
36
        .long   _uhoh                   |   3: Address error
37
        .long   _uhoh                   |   4: Illegal instruction
38
        .long   _uhoh                   |   5: Zero division
39
        .long   _uhoh                   |   6: CHK, CHK2 instruction
40
        .long   _uhoh                   |   7: TRAPcc, TRAPV instructions
41
        .long   _uhoh                   |   8: Privilege violation
42
        .long   _uhoh                   |   9: Trace
43
        .long   _uhoh                   |  10: Line 1010 emulator
44
        .long   _uhoh                   |  11: Line 1111 emulator
45
        .long   _uhoh                   |  12: Hardware breakpoint
46
        .long   _uhoh                   |  13: Reserved for coprocessor violation
47
        .long   _uhoh                   |  14: Format error
48
        .long   _uhoh                   |  15: Uninitialized interrupt
49
        .long   _uhoh                   |  16: Unassigned, reserved
50
        .long   _uhoh                   |  17:
51
        .long   _uhoh                   |  18:
52
        .long   _uhoh                   |  19:
53
        .long   _uhoh                   |  20:
54
        .long   _uhoh                   |  21:
55
        .long   _uhoh                   |  22:
56
        .long   _uhoh                   |  23:
57
        .long   _spuriousInterrupt      |  24: Spurious interrupt
58
        .long   _uhoh                   |  25: Level 1 interrupt autovector
59
        .long   _uhoh                   |  26: Level 2 interrupt autovector
60
        .long   _uhoh                   |  27: Level 3 interrupt autovector
61
        .long   _uhoh                   |  28: Level 4 interrupt autovector
62
        .long   _uhoh                   |  29: Level 5 interrupt autovector
63
        .long   _uhoh                   |  30: Level 6 interrupt autovector
64
        .long   _uhoh                   |  31: Level 7 interrupt autovector
65
        .long   _uhoh                   |  32: Trap instruction (0-15)
66
        .long   _uhoh                   |  33:
67
        .long   _uhoh                   |  34:
68
        .long   _uhoh                   |  35:
69
        .long   _uhoh                   |  36:
70
        .long   _uhoh                   |  37:
71
        .long   _uhoh                   |  38:
72
        .long   _uhoh                   |  39:
73
        .long   _uhoh                   |  40:
74
        .long   _uhoh                   |  41:
75
        .long   _uhoh                   |  42:
76
        .long   _uhoh                   |  43:
77
        .long   _uhoh                   |  44:
78
        .long   _uhoh                   |  45:
79
        .long   _uhoh                   |  46:
80
        .long   _uhoh                   |  47:
81
        .long   _uhoh                   |  48: Reserved for coprocessor
82
        .long   _uhoh                   |  49:
83
        .long   _uhoh                   |  50:
84
        .long   _uhoh                   |  51:
85
        .long   _uhoh                   |  52:
86
        .long   _uhoh                   |  53:
87
        .long   _uhoh                   |  54:
88
        .long   _uhoh                   |  55:
89
        .long   _uhoh                   |  56:
90
        .long   _uhoh                   |  57:
91
        .long   _uhoh                   |  58:
92
        .long   _uhoh                   |  59: Unassigned, reserved
93
        .long   _uhoh                   |  60:
94
        .long   _uhoh                   |  61:
95
        .long   _uhoh                   |  62:
96
        .long   _uhoh                   |  63:
97
        .long   _uhoh                   |  64: User defined vectors (192)
98
        .long   _uhoh                   |  65:
99
        .long   _uhoh                   |  66:
100
        .long   _uhoh                   |  67:
101
        .long   _uhoh                   |  68:
102
        .long   _uhoh                   |  69:
103
        .long   _uhoh                   |  70:
104
        .long   _uhoh                   |  71:
105
        .long   _uhoh                   |  72:
106
        .long   _uhoh                   |  73:
107
        .long   _uhoh                   |  74:
108
        .long   _uhoh                   |  75:
109
        .long   _uhoh                   |  76:
110
        .long   _uhoh                   |  77:
111
        .long   _uhoh                   |  78:
112
        .long   _uhoh                   |  79:
113
        .long   _uhoh                   |  80:
114
        .long   _uhoh                   |  81:
115
        .long   _uhoh                   |  82:
116
        .long   _uhoh                   |  83:
117
        .long   _uhoh                   |  84:
118
        .long   _uhoh                   |  85:
119
        .long   _uhoh                   |  86:
120
        .long   _uhoh                   |  87:
121
        .long   _uhoh                   |  88:
122
        .long   _uhoh                   |  89:
123
        .long   _uhoh                   |  90:
124
        .long   _uhoh                   |  91:
125
        .long   _uhoh                   |  92:
126
        .long   _uhoh                   |  93:
127
        .long   _uhoh                   |  94:
128
        .long   _uhoh                   |  95:
129
        .long   _uhoh                   |  96:
130
        .long   _uhoh                   |  97:
131
        .long   _uhoh                   |  98:
132
        .long   _uhoh                   |  99:
133
        .long   _uhoh                   | 100:
134
        .long   _uhoh                   | 101:
135
        .long   _uhoh                   | 102:
136
        .long   _uhoh                   | 103:
137
        .long   _uhoh                   | 104:
138
        .long   _uhoh                   | 105:
139
        .long   _uhoh                   | 106:
140
        .long   _uhoh                   | 107:
141
        .long   _uhoh                   | 108:
142
        .long   _uhoh                   | 109:
143
        .long   _uhoh                   | 110:
144
        .long   _uhoh                   | 111:
145
        .long   _uhoh                   | 112:
146
        .long   _uhoh                   | 113:
147
        .long   _uhoh                   | 114:
148
        .long   _uhoh                   | 115:
149
        .long   _uhoh                   | 116:
150
        .long   _uhoh                   | 117:
151
        .long   _uhoh                   | 118:
152
        .long   _uhoh                   | 119:
153
        .long   _uhoh                   | 120:
154
        .long   _uhoh                   | 121:
155
        .long   _uhoh                   | 122:
156
        .long   _uhoh                   | 123:
157
        .long   _uhoh                   | 124:
158
        .long   _uhoh                   | 125:
159
        .long   _uhoh                   | 126:
160
        .long   _uhoh                   | 127:
161
        .long   _uhoh                   | 128:
162
        .long   _uhoh                   | 129:
163
        .long   _uhoh                   | 130:
164
        .long   _uhoh                   | 131:
165
        .long   _uhoh                   | 132:
166
        .long   _uhoh                   | 133:
167
        .long   _uhoh                   | 134:
168
        .long   _uhoh                   | 135:
169
        .long   _uhoh                   | 136:
170
        .long   _uhoh                   | 137:
171
        .long   _uhoh                   | 138:
172
        .long   _uhoh                   | 139:
173
        .long   _uhoh                   | 140:
174
        .long   _uhoh                   | 141:
175
        .long   _uhoh                   | 142:
176
        .long   _uhoh                   | 143:
177
        .long   _uhoh                   | 144:
178
        .long   _uhoh                   | 145:
179
        .long   _uhoh                   | 146:
180
        .long   _uhoh                   | 147:
181
        .long   _uhoh                   | 148:
182
        .long   _uhoh                   | 149:
183
        .long   _uhoh                   | 150:
184
        .long   _uhoh                   | 151:
185
        .long   _uhoh                   | 152:
186
        .long   _uhoh                   | 153:
187
        .long   _uhoh                   | 154:
188
        .long   _uhoh                   | 155:
189
        .long   _uhoh                   | 156:
190
        .long   _uhoh                   | 157:
191
        .long   _uhoh                   | 158:
192
        .long   _uhoh                   | 159:
193
        .long   _uhoh                   | 160:
194
        .long   _uhoh                   | 161:
195
        .long   _uhoh                   | 162:
196
        .long   _uhoh                   | 163:
197
        .long   _uhoh                   | 164:
198
        .long   _uhoh                   | 165:
199
        .long   _uhoh                   | 166:
200
        .long   _uhoh                   | 167:
201
        .long   _uhoh                   | 168:
202
        .long   _uhoh                   | 169:
203
        .long   _uhoh                   | 170:
204
        .long   _uhoh                   | 171:
205
        .long   _uhoh                   | 172:
206
        .long   _uhoh                   | 173:
207
        .long   _uhoh                   | 174:
208
        .long   _uhoh                   | 175:
209
        .long   _uhoh                   | 176:
210
        .long   _uhoh                   | 177:
211
        .long   _uhoh                   | 178:
212
        .long   _uhoh                   | 179:
213
        .long   _uhoh                   | 180:
214
        .long   _uhoh                   | 181:
215
        .long   _uhoh                   | 182:
216
        .long   _uhoh                   | 183:
217
        .long   _uhoh                   | 184:
218
        .long   _uhoh                   | 185:
219
        .long   _uhoh                   | 186:
220
        .long   _uhoh                   | 187:
221
        .long   _uhoh                   | 188:
222
        .long   _uhoh                   | 189:
223
        .long   _uhoh                   | 190:
224
        .long   _uhoh                   | 191:
225
        .long   _uhoh                   | 192:
226
        .long   _uhoh                   | 193:
227
        .long   _uhoh                   | 194:
228
        .long   _uhoh                   | 195:
229
        .long   _uhoh                   | 196:
230
        .long   _uhoh                   | 197:
231
        .long   _uhoh                   | 198:
232
        .long   _uhoh                   | 199:
233
        .long   _uhoh                   | 200:
234
        .long   _uhoh                   | 201:
235
        .long   _uhoh                   | 202:
236
        .long   _uhoh                   | 203:
237
        .long   _uhoh                   | 204:
238
        .long   _uhoh                   | 205:
239
        .long   _uhoh                   | 206:
240
        .long   _uhoh                   | 207:
241
        .long   _uhoh                   | 208:
242
        .long   _uhoh                   | 209:
243
        .long   _uhoh                   | 210:
244
        .long   _uhoh                   | 211:
245
        .long   _uhoh                   | 212:
246
        .long   _uhoh                   | 213:
247
        .long   _uhoh                   | 214:
248
        .long   _uhoh                   | 215:
249
        .long   _uhoh                   | 216:
250
        .long   _uhoh                   | 217:
251
        .long   _uhoh                   | 218:
252
        .long   _uhoh                   | 219:
253
        .long   _uhoh                   | 220:
254
        .long   _uhoh                   | 221:
255
        .long   _uhoh                   | 222:
256
        .long   _uhoh                   | 223:
257
        .long   _uhoh                   | 224:
258
        .long   _uhoh                   | 225:
259
        .long   _uhoh                   | 226:
260
        .long   _uhoh                   | 227:
261
        .long   _uhoh                   | 228:
262
        .long   _uhoh                   | 229:
263
        .long   _uhoh                   | 230:
264
        .long   _uhoh                   | 231:
265
        .long   _uhoh                   | 232:
266
        .long   _uhoh                   | 233:
267
        .long   _uhoh                   | 234:
268
        .long   _uhoh                   | 235:
269
        .long   _uhoh                   | 236:
270
        .long   _uhoh                   | 237:
271
        .long   _uhoh                   | 238:
272
        .long   _uhoh                   | 239:
273
        .long   _uhoh                   | 240:
274
        .long   _uhoh                   | 241:
275
        .long   _uhoh                   | 242:
276
        .long   _uhoh                   | 243:
277
        .long   _uhoh                   | 244:
278
        .long   _uhoh                   | 245:
279
        .long   _uhoh                   | 246:
280
        .long   _uhoh                   | 247:
281
        .long   _uhoh                   | 248:
282
        .long   _uhoh                   | 249:
283
        .long   _uhoh                   | 250:
284
        .long   _uhoh                   | 251:
285
        .long   _uhoh                   | 252:
286
        .long   _uhoh                   | 253:
287
        .long   _uhoh                   | 254:
288
        .long   _uhoh                   | 255:
289
 
290
/*
291
 * Default trap handler
292
 * With an oscilloscope you can see AS* stop
293
 */
294
        PUBLIC (_uhoh)
295
_uhoh:  nop                             | Leave spot for breakpoint
296
        stop    #0x2700                 | Stop with interrupts disabled
297
        bra.l   _uhoh                   | Stuck forever
298
 
299
/*
300
 * Log, but otherwise ignore, spurious interrupts
301
 */
302
        PUBLIC (_spuriousInterrupt)
303
_spuriousInterrupt:
304
        addql   #1,_M68kSpuriousInterruptCount
305
        rte
306
 
307
/*
308
 * Place the low-order 3 octets of the board's ethernet address at
309
 * a `well-known' fixed location relative to the startup location.
310
 */
311
        .align 2
312
        .word   0                        | Padding
313
ethernet_address_buffer:
314
        .word   0x08F3                  | Default address
315
        .word   0xDEAD
316
        .word   0xCAFE
317
 
318
/*
319
 * Initial PC
320
 */
321
.globl start
322
start:
323
        /*
324
         * Step 2: Stay in Supervisor Mode
325
         */
326
#if ( M68K_HAS_SEPARATE_STACKS == 1 )
327
        oriw    #0x3000,sr              | Switch to Master Stack Pointer
328
        lea     SYM(m360)+1024-64,a7    | Put stack in dual-port ram
329
                                        | a little below the interrupt stack
330
#endif
331
 
332
        /*
333
         * Step 3: Write the VBR
334
         */
335
        lea     Entry,a0                | Get base of vector table
336
        movec   a0,vbr                  | Set up the VBR
337
 
338
        /*
339
         * Step 4: Write the MBAR
340
         */
341
        movec   dfc,d1                  | Save destination register
342
        moveq   #7,d0                   | CPU-space funcction code
343
        movec   d0,dfc                  | Set destination function code register
344
        movel   #m360+0x101,d0          | MBAR value (mask CPU space accesses)
345
        movesl  d0,0x3FF00              | Set MBAR
346
        movec   d1,dfc                  | Restore destination register
347
 
348
        /*
349
         * Step 5: Verify a dual-port RAM location
350
         */
351
        lea     m360,a0                 | Point a0 to first DPRAM location
352
        moveb   #0x33,d0                | Set the test value
353
        moveb   d0,a0@                  | Set the memory location
354
        cmpb    a0@,d0                  | Does it read back?
355
        bne     _uhoh                   | If not, bad news!
356
        notb    d0                      | Flip bits
357
        moveb   d0,a0@                  | Set the memory location
358
        cmpb    a0@,d0                  | Does it read back?
359
        bne     _uhoh                   | If not, bad news!
360
 
361
        /*
362
         * Remaining steps are handled by C code
363
         */
364
        jmp     _Init68360              | Start C code (which never returns)
365
 
366
/*
367
 * Copy DATA segment, clear BSS segment, set up real stack, start C program.
368
 * Assume that DATA and BSS sizes are multiples of 4.
369
 */
370
        PUBLIC (_CopyDataClearBSSAndStart)
371
_CopyDataClearBSSAndStart:
372
        lea     _copy_start,a0          | Get start of DATA in RAM
373
        lea     etext,a2                | Get start of DATA in ROM
374
        cmpl    a0,a2                   | Are they the same?
375
        beq.s   NOCOPY                  | Yes, no copy necessary
376
        lea     _copy_end,a1            | Get end of DATA in RAM
377
        bra.s   COPYLOOPTEST            | Branch into copy loop
378
COPYLOOP:
379
        movel   a2@+,a0@+               | Copy word from ROM to RAM
380
COPYLOOPTEST:
381
        cmpl    a1,a0                   | Done?
382
        bcs.s   COPYLOOP                | No, skip
383
NOCOPY:
384
 
385
        lea     _clear_start,a0         | Get start of BSS
386
        lea     _clear_end,a1           | Get end of BSS
387
        clrl    d0                      | Value to set
388
        bra.s   ZEROLOOPTEST            | Branch into clear loop
389
ZEROLOOP:
390
        movel   d0,a0@+                 | Clear a word
391
ZEROLOOPTEST:
392
        cmpl    a1,a0                   | Done?
393
        bcs.s   ZEROLOOP                | No, skip
394
 
395
        movel   4(a7),_M68k_Ramsize     | Set RAM size
396
 
397
        movel   #_stack_init,a7         | set master stack pointer
398
        pea     env                     | envp
399
        pea     arg                     | argv
400
        movel   d0,a7@-                 | argc
401
        jsr     boot_card               | Call C main
402
 
403
        PUBLIC (_mainDone)
404
_mainDone:
405
        nop                             | Leave spot for breakpoint
406
        movew   #1,a7                   | Force a double bus error
407
        movel   d0,a7@-                 | This should cause a RESET
408
        stop    #0x2700                 | Stop with interrupts disabled
409
        bra.l   _mainDone               | Stuck forever
410
 
411
        .align 2
412
END_CODE
413
 
414
BEGIN_DATA_DCL
415
        .align 2
416
        PUBLIC (environ)
417
environ:
418
        .long   env
419
        PUBLIC (_M68kSpuriousInterruptCount)
420
_M68kSpuriousInterruptCount:
421
        .long   0
422
END_DATA_DCL
423
 
424
BEGIN_BSS
425
env:    .long   0
426
arg:    .long   0
427
END_BSS
428
 
429
END

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.