source: rtems/c/src/lib/libbsp/sh/gensh2/start/start.S @ 0ab65474

4.104.114.84.95
Last change on this file since 0ab65474 was 4a238002, checked in by Joel Sherrill <joel.sherrill@…>, on 11/18/99 at 21:22:58

Patch from "John M. Mills" <jmills@…> with subsequent cleanup from
Ralf Corsepius <corsepiu@…> that adds initial Hitachi SH-2
support to RTEMS. Ralf's comments are:

Changes:
------

  1. SH-Port:
  • Many files renamed.
  • CONSOLE_DEVNAME and MHZ defines removed from libcpu.
  • console.c moved to libbsp/sh/shared, build in libbsp/sh/<BSP>/console applying VPATH.
  • CONSOLE_DEVNAME made BSP-specific, replacement is defined in bsp.h
  • MHZ define replaced with HZ (extendent resolution) in custom/*.cfg
  • -DHZ=HZ used in bspstart.c, only
  • Makefile variable HZ used in bsp-dependent directories only.
  1. SH1-Port
  • clock-driver rewritten to provide better resolution for odd CPU frequencies. This driver is only partially tested on hardware, ie. sightly experimental, but I don't expect severe problems with it.
  • Polling SCI-driver added. This driver is experimental and completly untested yet. Therefore it is not yet used for the console (/dev/console is still pointing to /dev/null, cf. gensh1/bsp.h).
  • minor changes to the timer driver
  • SH1 specific delay()/CPU_delay() now is implemented as a function
  1. SH2-Port
  • Merged
  • IMO, the code is still in its infancy. Therefore I have interspersed comments (FIXME) it for items which I think John should look after.
  • sci and console drivers partially rewritten and extended (John, I hope you don't mind).
  • Copyright notices are not yet adapted
  • 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 *  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 *  Copyright assigned to U.S. Government, 1994.
26 *
27 *  The license and distribution terms for this file may be
28 *  found in the file LICENSE in this distribution or at
29 *  http://www.OARcorp.com/rtems/license.html.
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.