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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [sh/] [gensh2/] [start/] [start.ram] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
3
 *           Bernd Becker (becker@faw.uni-ulm.de)
4
 *
5
 *  COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
6
 *
7
 *  This program is distributed in the hope that it will be useful,
8
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 *
11
 *
12
 *  COPYRIGHT (c) 1998.
13
 *  On-Line Applications Research Corporation (OAR).
14
 *  Copyright assigned to U.S. Government, 1994.
15
 *
16
 *  The license and distribution terms for this file may be
17
 *  found in the file LICENSE in this distribution or at
18
 *  http://www.OARcorp.com/rtems/license.html.
19
 *
20
 *  Modified to reflect Hitachi EDK SH7045F:
21
 *  John M. Mills (jmills@tga.com)
22
 *  TGA Technologies, Inc.
23
 *  100 Pinnacle Way, Suite 140
24
 *  Norcross, GA 30071 U.S.A.
25
 *
26
 *
27
 *  This modified file may be copied and distributed in accordance
28
 *  the above-referenced license. It is provided for critique and
29
 *  developmental purposes without any warranty nor representation
30
 *  by the authors or by TGA Technologies.
31
 *
32
 *  $Id: start.ram,v 1.2 2001-09-27 12:01:12 chris Exp $
33
 */
34
 
35
#include "asm.h"
36
 
37
        BEGIN_CODE
38
        PUBLIC(start)
39
 
40
SYM (start):
41
        ! install the stack pointer
42
        mov.l   stack_k,r15
43
 
44
#ifdef  START_HW_INIT   /* from $RTEMS_BSP.cfg */
45
        ! Initialize minimal hardware
46
        mov.l   hw_init_k, r0
47
        jsr @r0
48
        nop             !debug dead-slot target
49
#endif /* START_HW_INIT */
50
 
51
        ! zero out bss
52
        mov.l   edata_k,r0
53
        mov.l   end_k,r1
54
        mov     #0,r2
55
0:
56
        mov.l   r2,@r0
57
        add     #4,r0
58
        cmp/ge  r0,r1
59
        bt      0b
60
        nop             !debug dead-slot target
61
 
62
        ! copy the vector table from rom to ram
63
        mov.l   vects_k,r0      ! vectab
64
        mov     #0,r1           ! address of boot vector table
65
        mov     #0,r2           ! number of bytes copied
66
        mov.w   vects_size,r3   ! size of entries in vectab
67
1:
68
        mov.l   @r1+,r4
69
        mov.l   r4,@r0
70
        add     #4,r0
71
        add     #1,r2
72
        cmp/hi  r3,r2
73
        bf      1b
74
        nop             !debug dead-slot target
75
 
76
        ! overlay monitor vectors onto RTEMS table template
77
        ! code adapted  from Hitachi EDK7045F User Manual: "Copyvect.s"
78
        mova    vects_k,r0
79
        mov.l   @r0, r1 ! Shadow vect tbl addr
80
        stc             vbr, r2 ! Original vect tbl addr
81
        and             #0, r0
82
        mov             r0, r4  ! 0 in r4 and r0
83
 
84
!trapa #32
85
        or              #0x80, r0
86
        mov.l   @(r0,r2), r3
87
        mov.l   r3, @(r0, r1)
88
        mov             r4, r0
89
 
90
!cpu addr err
91
        or              #0x24, r0
92
        mov.l   @(r0, r2), r3
93
        mov.l   r3, @(r0, r1)
94
        mov             r4, r0
95
 
96
!ill slot
97
        or              #0x18, r0
98
        mov.l   @(r0, r2), r3
99
        mov.l   r3, @(r0, r1)
100
        mov             r4, r0
101
 
102
!ill inst
103
        or              #0x10, r0
104
        mov.l   @(r0, r2), r3
105
        mov.l   r3, @(r0, r1)
106
        mov             r4, r0
107
 
108
!nmi
109
        or              #0x2c, r0
110
        mov.l   @(r0, r2), r3
111
        mov.l   r3, @(r0, r1)
112
        mov             r4, r0
113
 
114
!User brk
115
        or              #0x30, r0
116
        mov.l   @(r0, r2), r3
117
        mov.l   r3, @(r0, r1)
118
        mov             r4, r0
119
 
120
!sci0 err
121
        or              #0x80, r0
122
        rotl    r0
123
        rotl    r0
124
        mov.l   @(r0, r2), r3
125
        mov.l   r3, @(r0, r1)
126
        mov             r4, r0
127
!sci rx
128
        or              #0x81, r0
129
        rotl    r0
130
        rotl    r0
131
        mov.l   @(r0, r2), r3
132
        mov.l   r3, @(r0, r1)
133
 
134
        stc     vbr,r3          ! capture copy of monitor vbr
135
        mov.l   vbrtemp_k,r0
136
        mov.l   r3, @r0
137
        mov.l   vects_k,r0      ! point vbr to vectab
138
        ldc     r0,vbr
139
 
140
        ! call the mainline
141
        mov #0,r4               ! argc
142
        mov #0,r5               ! argv - can place in dead slot
143
        mov.l main_k,r0
144
        jsr @r0
145
        nop             !debug dead-slot target
146
 
147
        ! call exit
148
        mov     r0,r4
149
        mov.l   exit_k,r0
150
        or      r0,r0
151
        jsr     @r0
152
        nop             !debug dead-slot target
153
 
154
        mov.l   vbrtemp_k,r0    ! restore original vbr
155
        mov.l   @r0,r3
156
        ldc     r3, vbr
157
        trapa   #13             ! UBR capture by monitor
158
        nop             !debug dead-slot target
159
 
160
        END_CODE
161
 
162
        .align 2
163
stack_k:
164
        .long   SYM(stack)
165
edata_k:
166
        .long   SYM(edata)
167
end_k:
168
        .long   SYM(end)
169
main_k:
170
        .long   SYM(boot_card)
171
exit_k:
172
        .long   SYM(exit)
173
#ifdef  START_HW_INIT   /* from $RTEMS_BSP.cfg */
174
hw_init_k:
175
        .long   SYM(hw_initialize)
176
#endif /* START_HW_INIT */
177
vbrtemp_k:
178
        .long   SYM(vbrtemp)
179
vects_k:
180
        .long   SYM(vectab)
181
vects_size:
182
        .word   255
183
 
184
#ifdef __ELF__
185
        .section .stack,"aw"
186
#else
187
        .section .stack
188
#endif
189
SYM(stack):
190
        .long   0xdeaddead
191
 
192
#ifdef __ELF__
193
        .section .bss,"aw"
194
#else
195
        .section .bss
196
#endif
197
SYM(vbrtemp):
198
        .long   0x0
199
 

powered by: WebSVN 2.1.0

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