Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:01

0001 /*
0002  *  Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
0003  *           Bernd Becker (becker@faw.uni-ulm.de)
0004  *
0005  *  COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
0006  *
0007  *  This program is distributed in the hope that it will be useful,
0008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0010  *
0011  *  Modified to reflect Hitachi EDK SH7045F:
0012  *  John M. Mills (jmills@tga.com)
0013  *  TGA Technologies, Inc.
0014  *  100 Pinnacle Way, Suite 140
0015  *  Norcross, GA 30071 U.S.A.
0016  *
0017  *
0018  *  This modified file may be copied and distributed in accordance
0019  *  the above-referenced license. It is provided for critique and
0020  *  developmental purposes without any warranty nor representation
0021  *  by the authors or by TGA Technologies.
0022  *
0023  *  COPYRIGHT (c) 1999.
0024  *  On-Line Applications Research Corporation (OAR).
0025  *
0026  *  The license and distribution terms for this file may be
0027  *  found in the file LICENSE in this distribution or at
0028  *  http://www.rtems.org/license/LICENSE.
0029  */
0030 
0031 #include <rtems/asm.h>
0032 
0033     BEGIN_CODE
0034     PUBLIC(start)
0035 
0036 SYM (start):
0037         ! install the stack pointer
0038     mov.l   stack_k,r15
0039 
0040 #ifdef  START_HW_INIT   /* from $RTEMS_BSP.cfg */
0041     ! Initialize minimal hardware
0042     mov.l   hw_init_k, r0
0043     jsr @r0
0044     nop     !dead slot
0045 #endif /* START_HW_INIT */
0046 
0047     ! zero out bss
0048     mov.l   edata_k,r0
0049     mov.l   end_k,r1
0050     mov #0,r2
0051 0:
0052     mov.l   r2,@r0
0053     add #4,r0
0054     cmp/ge  r0,r1
0055     bt  0b
0056 
0057     ! copy the vector table from rom to ram
0058     mov.l   vects_k,r0      ! vectab
0059     mov #0,r1       ! address of boot vector table
0060     mov     #0,r2       ! number of bytes copied
0061     mov.w   vects_size,r3   ! size of entries in vectab
0062 1:
0063     mov.l   @r1+,r4
0064     mov.l   r4,@r0
0065     add     #4,r0
0066     add     #1,r2
0067     cmp/hi  r3,r2
0068     bf      1b
0069 
0070 #ifndef STANDALONE_EVB
0071     ! overlay monitor vectors onto RTEMS table template
0072     ! code adapted  from Hitachi EDK7045F User Manual: "Copyvect.s"
0073     mova    vects_k,r0
0074     mov.l   @r0, r1 ! Shadow vect tbl addr
0075     stc     vbr, r2 ! Original vect tbl addr
0076     and     #0, r0
0077     mov     r0, r4  ! 0 in r4 and r0
0078 
0079 !trapa #32
0080     or      #0x80, r0
0081     mov.l   @(r0,r2), r3
0082     mov.l   r3, @(r0, r1)
0083     mov     r4, r0
0084 
0085 !cpu addr err
0086     or      #0x24, r0
0087     mov.l   @(r0, r2), r3
0088     mov.l   r3, @(r0, r1)
0089     mov     r4, r0
0090 
0091 !ill slot
0092     or      #0x18, r0
0093     mov.l   @(r0, r2), r3
0094     mov.l   r3, @(r0, r1)
0095     mov     r4, r0
0096 
0097 !ill inst
0098     or      #0x10, r0
0099     mov.l   @(r0, r2), r3
0100     mov.l   r3, @(r0, r1)
0101     mov     r4, r0
0102 
0103 !nmi
0104     or      #0x2c, r0
0105     mov.l   @(r0, r2), r3
0106     mov.l   r3, @(r0, r1)
0107     mov     r4, r0
0108 
0109 !User brk
0110     or      #0x30, r0
0111     mov.l   @(r0, r2), r3
0112     mov.l   r3, @(r0, r1)
0113     mov     r4, r0
0114 
0115 !sci0 err
0116     or      #0x80, r0
0117     rotl    r0
0118     rotl    r0
0119     mov.l   @(r0, r2), r3
0120     mov.l   r3, @(r0, r1)
0121     mov     r4, r0
0122 !sci rx
0123     or      #0x81, r0
0124     rotl    r0
0125     rotl    r0
0126     mov.l   @(r0, r2), r3
0127     mov.l   r3, @(r0, r1)
0128 
0129     stc vbr,r3      ! capture copy of monitor vbr
0130     mov.l   vbrtemp_k,r0
0131     mov.l   r3, @r0
0132     mov.l   vects_k,r0      ! point vbr to vectab
0133     ldc     r0,vbr
0134 #endif /* ! STANDALONE_EVB */
0135 
0136     ! call the mainline
0137     mov #0,r4       ! command line
0138     mov.l main_k,r0
0139     jsr @r0
0140     nop
0141 
0142     ! call exit
0143     mov r0,r4
0144     mov.l   exit_k,r0
0145     jsr @r0
0146     or  r0,r0
0147 
0148     mov.l   vbrtemp_k,r0    ! restore original vbr
0149     mov.l   @r0,r3
0150     ldc r3, vbr
0151     trapa   #13     ! UBR capture by monitor
0152     nop     !debug dead-slot target
0153 
0154     END_CODE
0155 
0156     .align 2
0157 stack_k:
0158     .long   SYM(_ISR_Stack_area_end)
0159 edata_k:
0160     .long   SYM(edata)
0161 end_k:
0162     .long   SYM(end)
0163 main_k:
0164     .long   SYM(boot_card)
0165 exit_k:
0166     .long   SYM(exit)
0167 #ifdef  START_HW_INIT   /* from $RTEMS_BSP.cfg */
0168 hw_init_k:
0169     .long   SYM(early_hw_init)
0170 #endif /* START_HW_INIT */
0171 vbrtemp_k:
0172     .long   SYM(vbrtemp)
0173 vects_k:
0174     .long   SYM(vectab)
0175 vects_size:
0176     .word   255
0177 
0178 #ifdef __ELF__
0179     .section .bss,"aw"
0180 #else
0181     .section .bss
0182 #endif
0183 SYM(vbrtemp):
0184     .long   0x0