source: rtems/bsps/m68k/gen68360/start/start.S @ ff081aee

5
Last change on this file since ff081aee was ff081aee, checked in by Sebastian Huber <sebastian.huber@…>, on 11/06/18 at 15:58:02

score: Rename interrupt stack symbols

Rename

  • _Configuration_Interrupt_stack_area_begin in _ISR_Stack_area_begin,
  • _Configuration_Interrupt_stack_area_end in _ISR_Stack_area_end, and
  • _Configuration_Interrupt_stack_size in _ISR_Stack_size.

Move definitions to <rtems/score/isr.h>. The new names are considerable
shorter and in the right namespace.

Update #3459.

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