OpenCores
URL https://opencores.org/ocsvn/Aquarius/Aquarius/trunk

Subversion Repositories Aquarius

[/] [Aquarius/] [trunk/] [application/] [shc_monitor_release_v1/] [startup/] [crt0.S] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 thorn_aitc
/****************************************
2
 SuperH (SH-2) C compiler Startup Routine
3
 ----------------------------------------
4
     Rev1. March 21, 2003 by Thorn Aitch
5
 ****************************************/
6
 
7
/********************
8
 Section: .text (ROM)
9
 ********************/
10
    .section  .text
11
 
12
/************
13
 Vector Table
14
 ************/
15
_vector_top:
16
    .long     _start       ! #000
17
    .long     _stack+0x200 ! #001
18
    .long     _start       ! #002
19
    .long     _stack+0x200 ! #003
20
    .long     _gnrl_ilgl   ! #004
21
    .long     _unexpected  ! #005
22
    .long     _slot_ilgl   ! #006
23
    .long     _unexpected  ! #007
24
    .long     _unexpected  ! #008
25
    .long     _cpuerr      ! #009
26
    .long     _dmaerr      ! #010
27
    .long     _nmi         ! #011
28
    .long     _unexpected  ! #012
29
    .long     _unexpected  ! #013
30
    .long     _unexpected  ! #014
31
    .long     _unexpected  ! #015
32
    .long     _unexpected  ! #016
33
    .long     _unexpected  ! #017
34
    .long     _unexpected  ! #018
35
    .long     _unexpected  ! #019
36
    .long     _unexpected  ! #020
37
    .long     _unexpected  ! #021
38
    .long     _unexpected  ! #022
39
    .long     _unexpected  ! #023
40
    .long     _unexpected  ! #024
41
    .long     _unexpected  ! #025
42
    .long     _unexpected  ! #026
43
    .long     _unexpected  ! #027
44
    .long     _unexpected  ! #028
45
    .long     _unexpected  ! #029
46
    .long     _unexpected  ! #030
47
    .long     _unexpected  ! #031
48
    .long     _trap        ! #032
49
    .long     _trap        ! #033
50
    .long     _trap        ! #034
51
    .long     _trap        ! #035
52
    .long     _trap        ! #036
53
    .long     _trap        ! #037
54
    .long     _trap        ! #038
55
    .long     _trap        ! #039
56
    .long     _trap        ! #040
57
    .long     _trap        ! #041
58
    .long     _trap        ! #042
59
    .long     _trap        ! #043
60
    .long     _trap        ! #044
61
    .long     _trap        ! #045
62
    .long     _trap        ! #046
63
    .long     _trap        ! #047
64
    .long     _trap        ! #048
65
    .long     _trap        ! #049
66
    .long     _trap        ! #050
67
    .long     _trap        ! #051
68
    .long     _trap        ! #052
69
    .long     _trap        ! #053
70
    .long     _trap        ! #054
71
    .long     _trap        ! #055
72
    .long     _trap        ! #056
73
    .long     _trap        ! #057
74
    .long     _trap        ! #058
75
    .long     _trap        ! #059
76
    .long     _trap        ! #060
77
    .long     _trap        ! #061
78
    .long     _trap        ! #062
79
    .long     _trap        ! #063
80
    .long     _irq0        ! #064
81
    .long     _irq1        ! #065
82
    .long     _irq2        ! #066
83
    .long     _irq3        ! #067
84
    .long     _irq4        ! #068
85
    .long     _irq5        ! #069
86
    .long     _irq6        ! #070
87
    .long     _irq7        ! #071
88
 
89
/***************
90
 General Illegal
91
 Slot Illegal
92
 ***************/
93
_gnrl_ilgl:
94
_slot_ilgl:
95
    mov.l    _pillegal, r0
96
    jsr      @r0
97
    nop
98
_restart:
99
    mov.l    _pvector_top, r1
100
    mov.l    @r1, r0
101
    jmp      @r0
102
    mov.l    @(4, r1), r15
103
 
104
/*****************
105
 CPU Address Error
106
 DMA Address Error
107
 Unexpected Vector
108
 *****************/
109
_cpuerr:
110
_dmaerr:
111
_unexpected:
112
    mov.l    _perror, r0
113
    jsr      @r0
114
    nop
115
    bra      _restart
116
    nop
117
 
118
/****************************
119
 NMI (Non Maskable Interrupt)
120
 ****************************/
121
_nmi:
122
    mov.l    r0, @-r15
123
    mov.l    r1, @-r15
124
    mov.l    _pbreak_reg_top, r1
125
 
126
    mov.l    @(12, r15), r0 ! sr
127
    mov.l    r0, @r1
128
    add      #4, r1
129
    mov.l    @( 8, r15), r0 ! pc
130
    mov.l    r0, @r1
131
    add      #4, r1
132
    mov      r15, r0        ! sp
133
    add      #8, r0
134
    mov.l    r0, @r1
135
    add      #4, r1
136
    sts      pr, r0         ! pr
137
    mov.l    r0, @r1
138
    add      #4, r1
139
    mov.l    @( 4, r15), r0 ! r0
140
    mov.l    r0, @r1
141
    add      #4, r1
142
    mov.l    @( 0, r15), r0 ! r1
143
    mov.l    r0, @r1
144
    add      #4, r1
145
    mov.l    r2, @r1        ! r2
146
    add      #4, r1
147
    mov.l    r3, @r1        ! r3
148
    add      #4, r1
149
    mov.l    r4, @r1        ! r4
150
    add      #4, r1
151
    mov.l    r5, @r1        ! r5
152
    add      #4, r1
153
    mov.l    r6, @r1        ! r6
154
    add      #4, r1
155
    mov.l    r7, @r1        ! r7
156
    add      #4, r1
157
    mov.l    r8, @r1        ! r8
158
    add      #4, r1
159
    mov.l    r9, @r1        ! r9
160
    add      #4, r1
161
    mov.l    r10, @r1       ! r10
162
    add      #4, r1
163
    mov.l    r11, @r1       ! r11
164
    add      #4, r1
165
    mov.l    r12, @r1       ! r12
166
    add      #4, r1
167
    mov.l    r13, @r1       ! r13
168
    add      #4, r1
169
    mov.l    r14, @r1       ! r14
170
    add      #4, r1
171
    mov      r15, r0        ! r15
172
    add      #8, r0
173
    mov.l    r0, @r1
174
    add      #4, r1
175
    sts      mach, r0       ! mach
176
    mov.l    r0, @r1
177
    add      #4, r1
178
    sts      macl, r0       ! macl
179
    mov.l    r0, @r1
180
    add      #4, r1
181
    stc      gbr, r0        ! gbr
182
    mov.l    r0, @r1
183
    add      #4, r1
184
    stc      vbr, r0        ! vbr
185
    mov.l    r0, @r1
186
 
187
    mov.l    _pnmi_handler, r0
188
    jsr      @r0
189
    nop
190
    bra      _restart
191
    nop
192
 
193
/***********************
194
 IRQ (Interrupt Request)
195
 ***********************/
196
_irq0:
197
_irq1:
198
_irq2:
199
_irq3:
200
_irq4:
201
_irq5:
202
_irq6:
203
_irq7:
204
    stc.l   gbr, @-r15
205
    stc.l   vbr, @-r15
206
    sts.l   mach, @-r15
207
    sts.l   macl, @-r15
208
    sts.l   pr, @-r15
209
    mov.l   r14, @-r15
210
    mov.l   r13, @-r15
211
    mov.l   r12, @-r15
212
    mov.l   r11, @-r15
213
    mov.l   r10, @-r15
214
    mov.l   r9, @-r15
215
    mov.l   r8, @-r15
216
    mov.l   r7, @-r15
217
    mov.l   r6, @-r15
218
    mov.l   r5, @-r15
219
    mov.l   r4, @-r15
220
    mov.l   r3, @-r15
221
    mov.l   r2, @-r15
222
    mov.l   r1, @-r15
223
    mov.l   r0, @-r15
224
    mov.l    _pirq_handler, r0
225
    jsr      @r0
226
    nop
227
    mov.l   @r15+, r0
228
    mov.l   @r15+, r1
229
    mov.l   @r15+, r2
230
    mov.l   @r15+, r3
231
    mov.l   @r15+, r4
232
    mov.l   @r15+, r5
233
    mov.l   @r15+, r6
234
    mov.l   @r15+, r7
235
    mov.l   @r15+, r8
236
    mov.l   @r15+, r9
237
    mov.l   @r15+, r10
238
    mov.l   @r15+, r11
239
    mov.l   @r15+, r12
240
    mov.l   @r15+, r13
241
    mov.l   @r15+, r14
242
    lds.l   @r15+, pr
243
    lds.l   @r15+, macl
244
    lds.l   @r15+, mach
245
    ldc.l   @r15+, vbr
246
    ldc.l   @r15+, gbr
247
    rte
248
    nop
249
 
250
/************
251
 TRAP Handler
252
 ************/
253
_trap:
254
    stc.l   gbr, @-r15
255
    stc.l   vbr, @-r15
256
    sts.l   mach, @-r15
257
    sts.l   macl, @-r15
258
    sts.l   pr, @-r15
259
    mov.l   r14, @-r15
260
    mov.l   r13, @-r15
261
    mov.l   r12, @-r15
262
    mov.l   r11, @-r15
263
    mov.l   r10, @-r15
264
    mov.l   r9, @-r15
265
    mov.l   r8, @-r15
266
    mov.l   r7, @-r15
267
    mov.l   r6, @-r15
268
    mov.l   r5, @-r15
269
    mov.l   r4, @-r15
270
    mov.l   r3, @-r15
271
    mov.l   r2, @-r15
272
    mov.l   r1, @-r15
273
    mov.l   r0, @-r15
274
    mov.l    _ptrap_handler, r0
275
    jsr      @r0
276
    nop
277
    mov.l   @r15+, r0
278
    mov.l   @r15+, r1
279
    mov.l   @r15+, r2
280
    mov.l   @r15+, r3
281
    mov.l   @r15+, r4
282
    mov.l   @r15+, r5
283
    mov.l   @r15+, r6
284
    mov.l   @r15+, r7
285
    mov.l   @r15+, r8
286
    mov.l   @r15+, r9
287
    mov.l   @r15+, r10
288
    mov.l   @r15+, r11
289
    mov.l   @r15+, r12
290
    mov.l   @r15+, r13
291
    mov.l   @r15+, r14
292
    lds.l   @r15+, pr
293
    lds.l   @r15+, macl
294
    lds.l   @r15+, mach
295
    ldc.l   @r15+, vbr
296
    ldc.l   @r15+, gbr
297
    rte
298
    nop
299
 
300
/**********************
301
 Break Information Area
302
 **********************/
303
    .org     _vector_top + 0x300
304
_break_reg_top:
305
_break_sr: .long 0xffffffff
306
_break_pc: .long 0xffffffff
307
_break_sp: .long 0xffffffff
308
_break_pr: .long 0xffffffff
309
_break_r0: .long 0xffffffff
310
_break_r1: .long 0xffffffff
311
_break_r2: .long 0xffffffff
312
_break_r3: .long 0xffffffff
313
_break_r4: .long 0xffffffff
314
_break_r5: .long 0xffffffff
315
_break_r6: .long 0xffffffff
316
_break_r7: .long 0xffffffff
317
_break_r8: .long 0xffffffff
318
_break_r9: .long 0xffffffff
319
_break_r10: .long 0xffffffff
320
_break_r11: .long 0xffffffff
321
_break_r12: .long 0xffffffff
322
_break_r13: .long 0xffffffff
323
_break_r14: .long 0xffffffff
324
_break_r15: .long 0xffffffff
325
_break_mach: .long 0xffffffff
326
_break_macl: .long 0xffffffff
327
_break_gbr: .long 0xffffffff
328
_break_vbr: .long 0xffffffff
329
 
330
/************
331
 Main Routine
332
 ************/
333
    .org     _vector_top + 0x400
334
_start:
335
    mov.l    _pvector_top, r8
336
    ldc      r8, vbr
337
    mov      #0x00, r8
338
    ldc      r8, sr
339
    mov.l    _pmain_sh, r8
340
    jsr      @r8
341
    mov      #0, r14
342
 
343
_endless:
344
    bra      _endless
345
    nop
346
 
347
    .align   4
348
_pmain_sh :      .long _main_sh
349
_pvector_top:    .long _vector_top
350
_pillegal:       .long _illegal
351
_perror:         .long _error
352
_pnmi_handler:   .long _nmi_handler
353
_pirq_handler:   .long _irq_handler
354
_ptrap_handler:  .long _trap_handler
355
_pbreak_reg_top: .long _break_reg_top
356
 
357
 
358
/**********************
359
 Section: .rodata (ROM)
360
 **********************/
361
    .section .rodata
362
    .align 4
363
 
364
/********************
365
 Section: .data (RAM)
366
 ********************/
367
    .section .data
368
    .align 4
369
 
370
/*******************
371
 Section: .bss (RAM)
372
 *******************/
373
    .section .bss
374
    .align 4
375
 
376
/*********************
377
 Section: .stack (RAM)
378
 *********************/
379
    .section .stack
380
    .align   4
381
_stack:
382
        .end
383
 

powered by: WebSVN 2.1.0

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