source: rtems/c/src/lib/libbsp/sh/gensh2/start/start.S @ 7358d5b1

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