source: rtems/c/src/lib/libbsp/sh/gensh2/start/start.ram @ 646e0008

4.104.114.84.95
Last change on this file since 646e0008 was 2b4c86e, checked in by Joel Sherrill <joel.sherrill@…>, on 10/12/01 at 21:05:26

2001-10-12 Joel Sherrill <joel@…>

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