Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:49

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*  entry.s
0004  *
0005  *  This file contains the entry point for the application.
0006  *  The name of this entry point is compiler dependent.
0007  *  It jumps to the BSP which is responsible for performing
0008  *  all initialization.
0009  *
0010  *  COPYRIGHT (c) 1989-1999.
0011  *  On-Line Applications Research Corporation (OAR).
0012  *
0013  * Redistribution and use in source and binary forms, with or without
0014  * modification, are permitted provided that the following conditions
0015  * are met:
0016  * 1. Redistributions of source code must retain the above copyright
0017  *    notice, this list of conditions and the following disclaimer.
0018  * 2. Redistributions in binary form must reproduce the above copyright
0019  *    notice, this list of conditions and the following disclaimer in the
0020  *    documentation and/or other materials provided with the distribution.
0021  *
0022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0023  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0025  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0026  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0027  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0028  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0029  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0030  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0031  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0032  * POSSIBILITY OF SUCH DAMAGE.
0033  */
0034 
0035 #include <rtems/asm.h>
0036 
0037 #if (M68K_COLDFIRE_ARCH == 0) /* All ColdFire BSPs must provide their own start vector */
0038 
0039 BEGIN_CODE
0040                                         | Default entry points for:
0041          PUBLIC (start)                 |   GNU
0042          PUBLIC (M68Kvec)               |   Vector Table
0043 
0044 SYM (start):
0045 SYM (M68Kvec):                          | standard location for vectors
0046         nop                             | for linkers with problem
0047                                         | location zero
0048         jmp      SYM (start_around)
0049 
0050      /*
0051       *  We can use the following space as our vector table
0052       *  if the CPU has a VBR or we can save vector table in it
0053       *  if the CPU does not.
0054       */
0055 
0056         .space   4088                   | to avoid initial intr stack
0057                                         |   from 135BUG on MVME13?
0058                                         |   and start code at 0x4000
0059 SYM (vectors):
0060         .space   1016                   | reserve space for rest of vectors
0061 
0062 #if ( M68K_HAS_SEPARATE_STACKS == 1 )
0063 SYM (lowintstack):
0064         .space   4092                   | reserve for interrupt stack
0065 SYM (hiintstack):
0066         .space   4                      | end of interrupt stack
0067 #endif
0068 
0069     PUBLIC (start_around)
0070 SYM (start_around):
0071         move.w  sr, SYM (initial_sr)
0072         oriw    #0x3700,sr              | SUPV MODE,INTERRUPTS OFF!!!
0073 #if ( M68K_HAS_SEPARATE_STACKS == 1 )
0074         movec   isp,a0
0075         move.l  a0, SYM (initial_isp)
0076         movec   usp,a0
0077         move.l  a0, SYM (initial_usp)
0078         movec   msp,a0
0079         move.l  a0, SYM (initial_msp)
0080 #else
0081         move.l  a7, SYM (initial_msp)
0082 #endif
0083 
0084         |
0085         | zero out uninitialized data area
0086         |
0087 zerobss:
0088         moveal  # SYM (bsp_section_bss_end),a0     | find end of .bss
0089         moveal  # SYM (bsp_section_bss_begin),a1   | find beginning of .bss
0090         movel   #0,d0
0091 
0092 loop:   movel   #0,a1@+                 | to zero out uninitialized
0093         cmpal   a0,a1
0094         jlt     loop                    | loop until _end reached
0095 
0096         movel   # SYM (_ISR_Stack_area_end),d0 | d0 = stop of stack
0097         movw    #0x3700,sr              | SUPV MODE,INTERRUPTS OFF!!!
0098         movel   d0,a7                   | set master stack pointer
0099         movel   d0,a6                   | set base pointer
0100 
0101       /*
0102        *  RTEMS should maintain a separate interrupt stack on CPUs
0103        *  without one in hardware.  This is currently not supported
0104        *  on versions of the m68k without a HW intr stack.
0105        */
0106 
0107 #if ( M68K_HAS_SEPARATE_STACKS == 1 )
0108         lea     SYM (hiintstack),a0   | a0 = high end of intr stack
0109         movec   a0,isp                | set interrupt stack
0110 #endif
0111 
0112         movel   #0,a7@-               | push command line
0113         jsr     SYM (boot_card)
0114         addl    #12,a7
0115 
0116 #if ( M68K_HAS_SEPARATE_STACKS == 1 )
0117         move.l  SYM (initial_isp),a0
0118         movec   a0,isp
0119         move.l  SYM (initial_usp),a0
0120         movec   a0,usp
0121         move.l  SYM (initial_msp),a0
0122         movec   a0,msp
0123 #else
0124         movea.l SYM (initial_msp),a7
0125 #endif
0126         move.w  SYM (initial_sr),sr
0127         rts
0128 
0129 END_CODE
0130 
0131 BEGIN_DATA
0132 
0133     PUBLIC (start_frame)
0134 SYM (start_frame):
0135         .space  4,0
0136 
0137 END_DATA
0138 
0139 BEGIN_BSS
0140 
0141     PUBLIC (initial_isp)
0142 SYM (initial_isp):
0143         .space  4
0144 
0145     PUBLIC (initial_msp)
0146 SYM (initial_msp):
0147         .space  4
0148 
0149     PUBLIC (initial_usp)
0150 SYM (initial_usp):
0151         .space  4
0152 
0153          PUBLIC (initial_sr)
0154 SYM (initial_sr):
0155         .space  2
0156 
0157 END_DATA
0158 #endif
0159 END