source: rtems/c/src/lib/libbsp/m68k/gen68360/start360/start360.s @ ecc4594

4.104.114.84.95
Last change on this file since ecc4594 was e2d79559, checked in by Joel Sherrill <joel.sherrill@…>, on 04/09/97 at 14:05:50

Added ka9q tcpip stack and network driver for the gen68360. This effort
was done based on the 3.6.0 release and had to be autoconf'ed locally.
It is turned on is the bsp enables it and it is not explicitly disabled
via the configure option --disable-tcpip. As many warnings as possible
were removed locally after the code was merged. Only the gen68360
and mvme136 bsps were compiled this way.

The ka9q port and network driver were submitted by Eric Norum
(eric@…).

The network demo programs are not included in the tree at this point.

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