diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 10:19:28 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 13:08:36 +0200 |
commit | fbcd7c8fa65eb695e96a62ea1c1ac7a024fa9dfc (patch) | |
tree | a17e285cf22cd49cd42e8b3ad562febc3987d566 /bsps/sh | |
parent | d7d66d7d4523b904c8ccc6aea3709dc0d5aa5bdc (diff) |
bsps: Move start files to bsps
This patch is a part of the BSP source reorganization.
Update #3285.
Diffstat (limited to 'bsps/sh')
-rw-r--r-- | bsps/sh/gensh1/start/start.S | 90 | ||||
-rw-r--r-- | bsps/sh/gensh2/start/start.S | 192 | ||||
-rw-r--r-- | bsps/sh/gensh2/start/start.ram | 196 | ||||
-rw-r--r-- | bsps/sh/gensh2/start/start.rom | 91 | ||||
-rw-r--r-- | bsps/sh/gensh4/start/start.S | 278 | ||||
-rw-r--r-- | bsps/sh/shsim/start/start.S | 94 |
6 files changed, 941 insertions, 0 deletions
diff --git a/bsps/sh/gensh1/start/start.S b/bsps/sh/gensh1/start/start.S new file mode 100644 index 0000000000..66b1c4e091 --- /dev/null +++ b/bsps/sh/gensh1/start/start.S @@ -0,0 +1,90 @@ +/* + * Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and + * Bernd Becker (becker@faw.uni-ulm.de) + * + * COPYRIGHT (c) 1997-1998, FAW Ulm, Germany + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * + * COPYRIGHT (c) 1998. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <rtems/asm.h> + + BEGIN_CODE + PUBLIC(start) +SYM (start): + ! install the stack pointer + mov.l stack_k,r15 + + ! zero out bss + mov.l edata_k,r0 + mov.l end_k,r1 + mov #0,r2 +0: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt 0b + + ! copy the vector table from rom to ram + mov.l vects_k,r0 ! vectab + mov #0,r1 ! address of boot vector table + mov #0,r2 ! number of bytes copied + mov.w vects_size,r3 ! size of entries in vectab +1: + mov.l @r1+,r4 + mov.l r4,@r0 + add #4,r0 + add #1,r2 + cmp/hi r3,r2 + bf 1b + + mov.l vects_k,r0 ! update vbr to point to vectab + ldc r0,vbr + + ! call the mainline + mov #0,r4 ! command line + mov.l main_k,r0 + jsr @r0 + + ! call exit + mov r0,r4 + mov.l exit_k,r0 + jsr @r0 + or r0,r0 + + END_CODE + + .align 2 +stack_k: + .long SYM(stack) +edata_k: + .long SYM(edata) +end_k: + .long SYM(end) +main_k: + .long SYM(boot_card) +exit_k: + .long SYM(exit) + +vects_k: + .long SYM(vectab) +vects_size: + .word 255 + +#ifdef __ELF__ + .section .stack,"aw" +#else + .section .stack +#endif +SYM(stack): + .long 0xdeaddead diff --git a/bsps/sh/gensh2/start/start.S b/bsps/sh/gensh2/start/start.S new file mode 100644 index 0000000000..cba17af740 --- /dev/null +++ b/bsps/sh/gensh2/start/start.S @@ -0,0 +1,192 @@ +/* + * Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and + * Bernd Becker (becker@faw.uni-ulm.de) + * + * COPYRIGHT (c) 1997-1998, FAW Ulm, Germany + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Modified to reflect Hitachi EDK SH7045F: + * John M. Mills (jmills@tga.com) + * TGA Technologies, Inc. + * 100 Pinnacle Way, Suite 140 + * Norcross, GA 30071 U.S.A. + * + * + * This modified file may be copied and distributed in accordance + * the above-referenced license. It is provided for critique and + * developmental purposes without any warranty nor representation + * by the authors or by TGA Technologies. + * + * COPYRIGHT (c) 1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <rtems/asm.h> + + BEGIN_CODE + PUBLIC(start) + +SYM (start): + ! install the stack pointer + mov.l stack_k,r15 + +#ifdef START_HW_INIT /* from $RTEMS_BSP.cfg */ + ! Initialize minimal hardware + mov.l hw_init_k, r0 + jsr @r0 + nop !dead slot +#endif /* START_HW_INIT */ + + ! zero out bss + mov.l edata_k,r0 + mov.l end_k,r1 + mov #0,r2 +0: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt 0b + + ! copy the vector table from rom to ram + mov.l vects_k,r0 ! vectab + mov #0,r1 ! address of boot vector table + mov #0,r2 ! number of bytes copied + mov.w vects_size,r3 ! size of entries in vectab +1: + mov.l @r1+,r4 + mov.l r4,@r0 + add #4,r0 + add #1,r2 + cmp/hi r3,r2 + bf 1b + +#ifndef STANDALONE_EVB + ! overlay monitor vectors onto RTEMS table template + ! code adapted from Hitachi EDK7045F User Manual: "Copyvect.s" + mova vects_k,r0 + mov.l @r0, r1 ! Shadow vect tbl addr + stc vbr, r2 ! Original vect tbl addr + and #0, r0 + mov r0, r4 ! 0 in r4 and r0 + +!trapa #32 + or #0x80, r0 + mov.l @(r0,r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!cpu addr err + or #0x24, r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!ill slot + or #0x18, r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!ill inst + or #0x10, r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!nmi + or #0x2c, r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!User brk + or #0x30, r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!sci0 err + or #0x80, r0 + rotl r0 + rotl r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 +!sci rx + or #0x81, r0 + rotl r0 + rotl r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + + stc vbr,r3 ! capture copy of monitor vbr + mov.l vbrtemp_k,r0 + mov.l r3, @r0 + mov.l vects_k,r0 ! point vbr to vectab + ldc r0,vbr +#endif /* ! STANDALONE_EVB */ + + ! call the mainline + mov #0,r4 ! command line + mov.l main_k,r0 + jsr @r0 + nop + + ! call exit + mov r0,r4 + mov.l exit_k,r0 + jsr @r0 + or r0,r0 + + mov.l vbrtemp_k,r0 ! restore original vbr + mov.l @r0,r3 + ldc r3, vbr + trapa #13 ! UBR capture by monitor + nop !debug dead-slot target + + END_CODE + + .align 2 +stack_k: + .long SYM(stack) +edata_k: + .long SYM(edata) +end_k: + .long SYM(end) +main_k: + .long SYM(boot_card) +exit_k: + .long SYM(exit) +#ifdef START_HW_INIT /* from $RTEMS_BSP.cfg */ +hw_init_k: + .long SYM(early_hw_init) +#endif /* START_HW_INIT */ +vbrtemp_k: + .long SYM(vbrtemp) +vects_k: + .long SYM(vectab) +vects_size: + .word 255 + +#ifdef __ELF__ + .section .stack,"aw" +#else + .section .stack +#endif +SYM(stack): + .long 0xdeaddead + +#ifdef __ELF__ + .section .bss,"aw" +#else + .section .bss +#endif +SYM(vbrtemp): + .long 0x0 diff --git a/bsps/sh/gensh2/start/start.ram b/bsps/sh/gensh2/start/start.ram new file mode 100644 index 0000000000..04e68238a6 --- /dev/null +++ b/bsps/sh/gensh2/start/start.ram @@ -0,0 +1,196 @@ +/* + * Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and + * Bernd Becker (becker@faw.uni-ulm.de) + * + * COPYRIGHT (c) 1997-1998, FAW Ulm, Germany + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * + * COPYRIGHT (c) 1998. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + * + * Modified to reflect Hitachi EDK SH7045F: + * John M. Mills (jmills@tga.com) + * TGA Technologies, Inc. + * 100 Pinnacle Way, Suite 140 + * Norcross, GA 30071 U.S.A. + * + * + * This modified file may be copied and distributed in accordance + * the above-referenced license. It is provided for critique and + * developmental purposes without any warranty nor representation + * by the authors or by TGA Technologies. + */ + +#include "asm.h" + + BEGIN_CODE + PUBLIC(start) + +SYM (start): + ! install the stack pointer + mov.l stack_k,r15 + +#ifdef START_HW_INIT /* from $RTEMS_BSP.cfg */ + ! Initialize minimal hardware + mov.l hw_init_k, r0 + jsr @r0 + nop !debug dead-slot target +#endif /* START_HW_INIT */ + + ! zero out bss + mov.l edata_k,r0 + mov.l end_k,r1 + mov #0,r2 +0: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt 0b + nop !debug dead-slot target + + ! copy the vector table from rom to ram + mov.l vects_k,r0 ! vectab + mov #0,r1 ! address of boot vector table + mov #0,r2 ! number of bytes copied + mov.w vects_size,r3 ! size of entries in vectab +1: + mov.l @r1+,r4 + mov.l r4,@r0 + add #4,r0 + add #1,r2 + cmp/hi r3,r2 + bf 1b + nop !debug dead-slot target + + ! overlay monitor vectors onto RTEMS table template + ! code adapted from Hitachi EDK7045F User Manual: "Copyvect.s" + mova vects_k,r0 + mov.l @r0, r1 ! Shadow vect tbl addr + stc vbr, r2 ! Original vect tbl addr + and #0, r0 + mov r0, r4 ! 0 in r4 and r0 + +!trapa #32 + or #0x80, r0 + mov.l @(r0,r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!cpu addr err + or #0x24, r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!ill slot + or #0x18, r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!ill inst + or #0x10, r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!nmi + or #0x2c, r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!User brk + or #0x30, r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 + +!sci0 err + or #0x80, r0 + rotl r0 + rotl r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + mov r4, r0 +!sci rx + or #0x81, r0 + rotl r0 + rotl r0 + mov.l @(r0, r2), r3 + mov.l r3, @(r0, r1) + + stc vbr,r3 ! capture copy of monitor vbr + mov.l vbrtemp_k,r0 + mov.l r3, @r0 + mov.l vects_k,r0 ! point vbr to vectab + ldc r0,vbr + + ! call the mainline + mov #0,r4 ! argc + mov #0,r5 ! argv - can place in dead slot + mov.l main_k,r0 + jsr @r0 + nop !debug dead-slot target + + ! call exit + mov r0,r4 + mov.l exit_k,r0 + or r0,r0 + jsr @r0 + nop !debug dead-slot target + + mov.l vbrtemp_k,r0 ! restore original vbr + mov.l @r0,r3 + ldc r3, vbr + trapa #13 ! UBR capture by monitor + nop !debug dead-slot target + + END_CODE + + .align 2 +stack_k: + .long SYM(stack) +edata_k: + .long SYM(edata) +end_k: + .long SYM(end) +main_k: + .long SYM(boot_card) +exit_k: + .long SYM(exit) +#ifdef START_HW_INIT /* from $RTEMS_BSP.cfg */ +hw_init_k: + .long SYM(hw_initialize) +#endif /* START_HW_INIT */ +vbrtemp_k: + .long SYM(vbrtemp) +vects_k: + .long SYM(vectab) +vects_size: + .word 255 + +#ifdef __ELF__ + .section .stack,"aw" +#else + .section .stack +#endif +SYM(stack): + .long 0xdeaddead + +#ifdef __ELF__ + .section .bss,"aw" +#else + .section .bss +#endif +SYM(vbrtemp): + .long 0x0 + diff --git a/bsps/sh/gensh2/start/start.rom b/bsps/sh/gensh2/start/start.rom new file mode 100644 index 0000000000..87fadd50f3 --- /dev/null +++ b/bsps/sh/gensh2/start/start.rom @@ -0,0 +1,91 @@ +/* + * Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and + * Bernd Becker (becker@faw.uni-ulm.de) + * + * COPYRIGHT (c) 1997-1998, FAW Ulm, Germany + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * + * COPYRIGHT (c) 1998. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include "asm.h" + + BEGIN_CODE + PUBLIC(start) +SYM (start): + ! install the stack pointer + mov.l stack_k,r15 + + ! zero out bss + mov.l edata_k,r0 + mov.l end_k,r1 + mov #0,r2 +0: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt 0b + + ! copy the vector table from rom to ram + mov.l vects_k,r0 ! vectab + mov #0,r1 ! address of boot vector table + mov #0,r2 | number of bytes copied + mov.w vects_size,r3 ! size of entries in vectab +1: + mov.l @r1+,r4 + mov.l r4,@r0 + add #4,r0 + add #1,r2 + cmp/hi r3,r2 + bf 1b + + mov.l vects_k,r0 ! update vbr to point to vectab + ldc r0,vbr + + ! call the mainline + mov #0,r4 ! argc + mov.l main_k,r0 + jsr @r0 + mov #0,r5 ! argv + + ! call exit + mov r0,r4 + mov.l exit_k,r0 + jsr @r0 + or r0,r0 + + END_CODE + + .align 2 +stack_k: + .long SYM(stack) +edata_k: + .long SYM(edata) +end_k: + .long SYM(end) +main_k: + .long SYM(boot_card) +exit_k: + .long SYM(exit) + +vects_k: + .long SYM(vectab) +vects_size: + .word 255 + +#ifdef __ELF__ + .section .stack,"aw" +#else + .section .stack +#endif +SYM(stack): + .long 0xdeaddead diff --git a/bsps/sh/gensh4/start/start.S b/bsps/sh/gensh4/start/start.S new file mode 100644 index 0000000000..a695daaf8a --- /dev/null +++ b/bsps/sh/gensh4/start/start.S @@ -0,0 +1,278 @@ +/* + * start.S -- Initialization code for SH7750 generic BSP + * + * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia + * Author: Victor V. Vengerov <vvv@oktet.ru> + * + * Based on work: + * Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and + * Bernd Becker (becker@faw.uni-ulm.de) + * + * COPYRIGHT (c) 1997-1998, FAW Ulm, Germany + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Modified to reflect Hitachi EDK SH7045F: + * John M. Mills (jmills@tga.com) + * TGA Technologies, Inc. + * 100 Pinnacle Way, Suite 140 + * Norcross, GA 30071 U.S.A. + * + * + * This modified file may be copied and distributed in accordance + * the above-referenced license. It is provided for critique and + * developmental purposes without any warranty nor representation + * by the authors or by TGA Technologies. + * + * COPYRIGHT (c) 1999-2001. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <rtems/asm.h> +#include "rtems/score/sh4_regs.h" +#include "rtems/score/sh7750_regs.h" + + BEGIN_CODE + PUBLIC(start) + +/* + * Algorithm of the first part of the start(): + * + * 1. Initialize stack + * 2. Are we from reset or from gdb? Set value for boot_mode in r9. + * 3. Initialize hardware if we are from reset. Cache is off. + * 4. Copy data from flash to ram; set up boot mode and jump to real address. + * 5. Zero out bss. + * 6. Turn memory cach on. + */ + +SYM (start): + ! install the stack pointer + mov.l stack_k,r15 + + mov.l initial_sr_k,r0 + ldc r0,ssr + ldc r0,sr + + ! let us see if we are from gdb stub or from power-on reset + bsr fake_func + nop +fake_func: + + sts pr, r0 + shlr8 r0 + mov.l reset_pc_value_shift_8_k, r1 + cmp/eq r0, r1 + movt r9 ! r9 == ! boot_mode + neg r9, r9 + add #1, r9 ! r9 == boot_mode + + ! what is in boot_mode? + cmp/pl r9 ! r9 > 0 -> T = 1 + + ! if boot_mode != SH4_BOOT_MODE_FLASH + bt hw_init_end + nop + +#if START_HW_INIT /* from $RTEMS_BSP.cfg */ + ! Initialize minimal hardware + ! to run hw_init we need to calculate its address + ! as it is before data copying + mov.l hw_init_k, r0 + mov.l copy_start_k, r1 + mov.l copy_end_k, r2 + cmp/ge r0, r1 + bt 0f + cmp/ge r0, r2 + bf 0f + ! if copy_start <= hw_init <= copy_end then + neg r1, r1 + mov.l copy_start_in_rom_k, r3 + add r1,r0 + add r3, r0 +0: + jsr @r0 + nop !delay slot +#endif /* START_HW_INIT */ +hw_init_end: + +#if COPY_DATA_FROM_ROM + ! copy data from rom to ram + mov.l copy_start_k, r0 + mov.l copy_end_k, r1 + mov.l copy_start_in_rom_k, r2 + + ! if copy_from == copy_to do not copy anything + cmp/eq r0, r2 + bt real_address + nop + +copy_data_cycle: + cmp/ge r1, r0 + bt end_of_copy_data_cycle + nop + mov.l @r2+, r3 + mov.l r3, @r0 + add #4, r0 + bra copy_data_cycle + nop + +end_of_copy_data_cycle: +#endif + ! go to 0x8....... adresses + mov.l real_address_k, r0 + lds r0, pr + rts + nop +real_address: + ! write boot_mode to ram + mov.l boot_mode_k, r5 + mov.l r9, @r5 + +zero_bss: + ! zero out bss + mov.l __bss_start_k,r0 + mov.l __bss_end_k,r1 + mov #0,r2 +0: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt 0b + nop + + ! Turn cache on + mov.l cache_on_k, r0 + jsr @r0 + nop !delay slot + + ! Save old value of VBR register. We will need it to allow + ! debugger agent hook exceptions. + mov.l __VBR_Saved_k,r0 + stc vbr,r5 + mov.l r5,@r0 + ! Set up VBR register + mov.l _vbr_base_k,r0 + ldc r0,vbr + + ! initialise fpscr for gcc + mov.l set_fpscr_k, r1 + jsr @r1 + nop + + ! Set FPSCR register + mov.l initial_fpscr_k,r0 + lds r0,fpscr + + ! call the mainline + mov #0,r4 ! argc + mov.l main_k,r0 + jsr @r0 + nop + + ! call exit + mov r0,r4 + mov.l exit_k,r0 + jsr @r0 + or r0,r0 + + .global _stop +_stop: + mov #11,r0 + mov #0,r4 + trapa #0x3f + nop +__stop: + bra __stop + nop + + END_CODE + + .align 2 +#if START_HW_INIT +copy_start_k: + .long copy_start +copy_end_k: + .long copy_end +#endif +#if COPY_DATA_FROM_ROM +copy_start_in_rom_k: + .long copy_start_in_rom +#endif + +real_address_k: + .long real_address +set_fpscr_k: + .long ___set_fpscr +_vbr_base_k: + .long SYM(_vbr_base) +__VBR_Saved_k: + .long SYM(_VBR_Saved) +stack_k: + .long SYM(stack) +__bss_start_k: + .long __bss_start +__bss_end_k: + .LONG __bss_end +main_k: + .long SYM(boot_card) +exit_k: + .long SYM(_exit) + +#if START_HW_INIT /* from $RTEMS_BSP.cfg */ +hw_init_k: + .long SYM(early_hw_init) +#endif /* START_HW_INIT */ + +cache_on_k: + .long SYM(bsp_cache_on) + +vects_k: + .long SYM(vectab) +vects_size: + .word 255 + + .align 2 +initial_sr_k: + .long SH4_SR_MD | SH4_SR_IMASK +initial_fpscr_k: +#ifdef __SH4__ + .long SH4_FPSCR_DN | SH4_FPSCR_PR | SH4_FPSCR_RM +#else + .long SH4_FPSCR_DN | SH4_FPSCR_RM +#endif + +reset_pc_value_shift_8_k: + .long 0xa00000 + +boot_mode_k: + .long _boot_mode + +#ifdef __ELF__ + .section .stack,"aw" +#else + .section .stack +#endif +SYM(stack): + .long 0xdeaddead + +#ifdef __ELF__ + .section .bss,"aw" +#else + .section .bss +#endif + + .global __sh4sim_dummy_register +__sh4sim_dummy_register: + .long 0 + + .section .data + .global _boot_mode +_boot_mode: + .long 0 diff --git a/bsps/sh/shsim/start/start.S b/bsps/sh/shsim/start/start.S new file mode 100644 index 0000000000..cc4727b9ff --- /dev/null +++ b/bsps/sh/shsim/start/start.S @@ -0,0 +1,94 @@ +/* + * Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and + * Bernd Becker (becker@faw.uni-ulm.de) + * + * COPYRIGHT (c) 1997-1998, FAW Ulm, Germany + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * + * COPYRIGHT (c) 1998. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <rtems/asm.h> +#include <bsp.h> + + BEGIN_CODE + PUBLIC(start) +SYM (start): + ! install the stack pointer + mov.l stack_k,r15 + + ! zero out bss + mov.l edata_k,r0 + mov.l end_k,r1 + mov #0,r2 +0: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt 0b + + ! copy the vector table from rom to ram + mov.l vects_k,r0 ! vectab + mov #0,r1 ! address of boot vector table + mov #0,r2 ! number of bytes copied + mov.w vects_size,r3 ! size of entries in vectab +1: + mov.l @r1+,r4 + mov.l r4,@r0 + add #4,r0 + add #1,r2 + cmp/hi r3,r2 + bf 1b + + mov.l vects_k,r0 ! update vbr to point to vectab + ldc r0,vbr + + ! call the mainline + mov #0,r4 ! command line + mov.l main_k,r0 + jsr @r0 + + + ! call exit + mov r0,r4 + mov.l exit_k,r0 + jsr @r0 + or r0,r0 + + END_CODE + + .align 2 +stack_k: + .long SYM(stack) +edata_k: + .long SYM(edata) +end_k: + .long SYM(end) +main_k: + .long SYM(boot_card) +exit_k: + .long SYM(_sys_exit) + +vects_k: + .long SYM(vectab) +vects_size: + .word 255 + +#ifdef __ELF__ + .section .stack,"aw" +#else + .section .stack +#endif +SYM(stack): + .long 0xdeaddead +monvects_k: + .long SYM(monvects) |