summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/mvme2307/startup
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/powerpc/mvme2307/startup')
-rw-r--r--c/src/lib/libbsp/powerpc/mvme2307/startup/Makefile.in71
-rw-r--r--c/src/lib/libbsp/powerpc/mvme2307/startup/bspclean.c31
-rw-r--r--c/src/lib/libbsp/powerpc/mvme2307/startup/bspstart.c159
-rw-r--r--c/src/lib/libbsp/powerpc/mvme2307/startup/linkcmds201
-rw-r--r--c/src/lib/libbsp/powerpc/mvme2307/startup/main.c108
-rw-r--r--c/src/lib/libbsp/powerpc/mvme2307/startup/setvec.c58
6 files changed, 628 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/powerpc/mvme2307/startup/Makefile.in b/c/src/lib/libbsp/powerpc/mvme2307/startup/Makefile.in
new file mode 100644
index 0000000000..6287d10133
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/mvme2307/startup/Makefile.in
@@ -0,0 +1,71 @@
+#
+# $Id$
+#
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = ../../../..
+subdir = libbsp/powerpc/mvme2307/startup
+
+RTEMS_ROOT = @RTEMS_ROOT@
+PROJECT_ROOT = @PROJECT_ROOT@
+
+VPATH = @srcdir@:@srcdir@/../../../shared
+
+PGM=${ARCH}/startup.rel
+
+# C source names, if any, go here -- minus the .c
+C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec
+C_FILES=$(C_PIECES:%=%.c)
+C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
+
+H_FILES=
+
+# Assembly source names, if any, go here -- minus the .S
+S_PIECES=
+S_FILES=$(S_PIECES:%=%.S)
+S_O_FILES=$(S_FILES:%.S=${ARCH}/%.o)
+
+SRCS=linkcmds $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
+OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(RTEMS_ROOT)/make/leaf.cfg
+
+INSTALL_CHANGE = @INSTALL_CHANGE@
+
+#
+# (OPTIONAL) Add local stuff here using +=
+#
+
+DEFINES +=
+CPPFLAGS +=
+CFLAGS +=
+
+LD_PATHS +=
+LD_LIBS +=
+LDFLAGS +=
+
+#
+# Add your list of files to delete here. The config files
+# already know how to delete some stuff, so you may want
+# to just run 'make clean' first to see what gets missed.
+# 'make clobber' already includes 'make clean'
+#
+
+CLEAN_ADDITIONS +=
+CLOBBER_ADDITIONS +=
+
+${PGM}: ${SRCS} ${OBJS}
+ $(make-rel)
+
+all: ${ARCH} $(SRCS) $(PGM)
+ $(INSTALL_CHANGE) $(srcdir)/linkcmds $(PROJECT_RELEASE)/lib
+
+# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
+install: all
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
diff --git a/c/src/lib/libbsp/powerpc/mvme2307/startup/bspclean.c b/c/src/lib/libbsp/powerpc/mvme2307/startup/bspclean.c
new file mode 100644
index 0000000000..83360a71df
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/mvme2307/startup/bspclean.c
@@ -0,0 +1,31 @@
+/* bsp_cleanup()
+ *
+ * This routine normally is part of start.s and usually returns
+ * control to a monitor.
+ *
+ * INPUT: NONE
+ *
+ * OUTPUT: NONE
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <rtems/score/cpu.h>
+#include <bsp.h>
+
+void bsp_cleanup( void )
+{
+ /* disable raven interrupts */
+ set_interrupt_task_priority(15);
+ /* exit to PPCBUG */
+ asm volatile ( "li 10,99; sc" : : : "r10");
+}
diff --git a/c/src/lib/libbsp/powerpc/mvme2307/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mvme2307/startup/bspstart.c
new file mode 100644
index 0000000000..a592cd0bc3
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/mvme2307/startup/bspstart.c
@@ -0,0 +1,159 @@
+/*
+ * This set of routines starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before any of these are invoked.
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+#include <fcntl.h>
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+
+
+/*
+ * Use the shared implementations of the following routines
+ */
+
+void bsp_postdriver_hook(void);
+void bsp_libc_init( void *, unsigned32, int );
+
+/*
+ * bsp_pretasking_hook
+ *
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ */
+
+void bsp_pretasking_hook(void)
+{
+ extern int end;
+ rtems_unsigned32 heap_start;
+ rtems_unsigned32 heap_size;
+ rtems_isr_entry old_handler;
+ rtems_status_code sc;
+
+ heap_start = (rtems_unsigned32) &end;
+ if (heap_start & (CPU_ALIGNMENT-1)) {
+ heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
+ }
+
+ heap_size = BSP_Configuration.work_space_start - (void *)&end;
+ heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */
+
+ bsp_libc_init((void *) heap_start, heap_size, 0);
+
+ sc = interrupt_controller_init();
+
+
+
+#ifdef RTEMS_DEBUG
+ rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+
+}
+
+/*
+ * bsp_start
+ *
+ * This routine does the bulk of the system initialization.
+ */
+
+void bsp_start( void )
+{
+ unsigned char *work_space_start;
+ unsigned32 RAM_end = 0;
+
+#if 1
+ /*
+ * Set MSR to show vectors at 0 XXX
+ */
+ rtems_unsigned32 msr_value;
+
+ _CPU_MSR_Value( msr_value );
+ msr_value &= ~PPC_MSR_EP;
+ _CPU_MSR_SET( msr_value );
+#endif
+
+ /*
+ * Set up our hooks
+ * Make sure libc_init is done before drivers initialized so that
+ * they can use atexit()
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+ Cpu_table.interrupt_stack_size = (12 * 1024);
+
+ /*
+ * The monitor likes the exception table to be at 0x0.
+ */
+
+ Cpu_table.exceptions_in_RAM = TRUE;
+
+ /*
+ #if defined(RTEMS_POSIX_API)
+ BSP_Configuration.work_space_size *= 3;
+ #endif
+ */
+
+ /* from PSIM - why? */
+ BSP_Configuration.work_space_size += 1024;
+
+ /* determine memory size */
+ switch (Falcon_MEMCR.MemSize) {
+ case RAM_16_MB:
+ RAM_end = 16 * 1024 * 1024;
+ break;
+ case RAM_32_MB:
+ RAM_end = 32 * 1024 * 1024;
+ break;
+ case RAM_64_MB:
+ RAM_end = 64 * 1024 * 1024;
+ break;
+ case RAM_128_MB:
+ RAM_end = 128 * 1024 * 1024;
+ break;
+ }
+ RAM_end -= 1024 * 1024; /* reserve memory for PPCBUG */
+ work_space_start =
+ (unsigned char *)RAM_end - BSP_Configuration.work_space_size;
+
+ if ( work_space_start <= (unsigned char *)&end ) {
+ printk( "bspstart: Not enough RAM!!!\n" );
+ bsp_cleanup();
+ }
+
+ BSP_Configuration.work_space_start = work_space_start;
+
+ /*
+ * Account for the console's resources
+ */
+
+ console_reserve_resources( &BSP_Configuration );
+
+}
diff --git a/c/src/lib/libbsp/powerpc/mvme2307/startup/linkcmds b/c/src/lib/libbsp/powerpc/mvme2307/startup/linkcmds
new file mode 100644
index 0000000000..396ab3ff78
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/mvme2307/startup/linkcmds
@@ -0,0 +1,201 @@
+/*
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
+ "elf32-powerpc")
+OUTPUT_ARCH(powerpc)
+ENTRY(_start)
+ /*SEARCH_DIR(/usr1/gnu/cross/powerpc-unknown-eabi//powerpc-unknown-eabi/lib); */
+/* Do we need any of these for elf?
+ __DYNAMIC = 0; */
+MEMORY
+ {
+ /* VECTORS : ORIGIN = 0x0, LENGTH = 0x4000 */
+ /* reserve top 1M for PPCBUG */
+ RAM : ORIGIN = 0x4000, LENGTH = 63M - 0x4000
+ }
+
+SECTIONS
+{
+/*
+ PROVIDE(ppcbug_reset = 0xfff04000);
+ PROVIDE(ppcbug_general = 0xfff04120);
+ .vectors 0x00000100 :
+ {
+ *(.vectors)
+ } >VECTORS
+*/
+
+ /* Read-only sections, merged into text segment: */
+ /* . = 0x40000 + SIZEOF_HEADERS; */
+ . = 0x4000;
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .rela.text : { *(.rela.text) }
+ .rela.data : { *(.rela.data) }
+ .rela.rodata : { *(.rela.rodata) }
+ .rela.got : { *(.rela.got) }
+ .rela.got1 : { *(.rela.got1) }
+ .rela.got2 : { *(.rela.got2) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rela.init : { *(.rela.init) }
+ .rela.fini : { *(.rela.fini) }
+ .rela.bss : { *(.rela.bss) }
+ .rela.plt : { *(.rela.plt) }
+ .rela.sdata : { *(.rela.sdata2) }
+ .rela.sbss : { *(.rela.sbss2) }
+ .rela.sdata2 : { *(.rela.sdata2) }
+ .rela.sbss2 : { *(.rela.sbss2) }
+ .plt : { *(.plt) }
+ .text :
+ {
+ PROVIDE (__text_start = .);
+ *(.text)
+ *(.gnu.linkonce.t.*)
+ *(.descriptors)
+ /* .gnu.warning sections are handled specially by elf32.em. */
+ *(.gnu.warning)
+ } >RAM
+ .init : { *(.init) } >RAM
+ .fini : { *(.fini) } >RAM
+ .rodata : { *(.rodata) *(.gnu.linkonce.r*) } >RAM
+ .rodata1 : { *(.rodata1) } >RAM
+ _etext = .;
+ PROVIDE (etext = .);
+ PROVIDE (__SDATA2_START__ = .);
+ .sdata2 : { *(.sdata2) } >RAM
+ .sbss2 : { *(.sbss2) } >RAM
+ PROVIDE (__SBSS2_END__ = .);
+ /* Adjust the address for the data segment. We want to adjust up to
+ the same address within the page on the next page up. It would
+ be more correct to do this:
+ . = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1));
+ The current expression does not correctly handle the case of a
+ text segment ending precisely at the end of a page; it causes the
+ data segment to skip a page. The above expression does not have
+ this problem, but it will currently (2/95) cause BFD to allocate
+ a single segment, combining both text and data, for this case.
+ This will prevent the text segment from being shared among
+ multiple executions of the program; I think that is more
+ important than losing a page of the virtual address space (note
+ that no actual memory is lost; the page which is skipped can not
+ be referenced). */
+ /* . = ALIGN(8) + 0x40000; */
+ .data :
+ {
+ *(.data)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ } >RAM
+ PROVIDE (__EXCEPT_START__ = .);
+ .gcc_except_table : { *(.gcc_except_table) } >RAM
+ PROVIDE (__EXCEPT_END__ = .);
+
+ .data1 : { *(.data1) } >RAM
+ .got1 : { *(.got1) } >RAM
+ .dynamic : { *(.dynamic) } >RAM
+ /* Put .ctors and .dtors next to the .got2 section, so that the pointers
+ get relocated with -mrelocatable. Also put in the .fixup pointers.
+ The current compiler no longer needs this, but keep it around for 2.7.2 */
+ PROVIDE (__GOT2_START__ = .);
+ PROVIDE (_GOT2_START_ = .);
+ .got2 : { *(.got2) } >RAM
+ PROVIDE (__GOT2_END__ = .);
+ PROVIDE (_GOT2_END_ = .);
+
+ PROVIDE (__CTOR_LIST__ = .);
+ .ctors : { *(.ctors) } >RAM
+ PROVIDE (__CTOR_END__ = .);
+
+ PROVIDE (__DTOR_LIST__ = .);
+ .dtors : { *(.dtors) } >RAM
+ PROVIDE (__DTOR_END__ = .);
+
+ PROVIDE (__FIXUP_START__ = .);
+ PROVIDE (_FIXUP_START_ = .);
+ .fixup : { *(.fixup) } >RAM
+ PROVIDE (_FIXUP_END_ = .);
+ PROVIDE (__FIXUP_END__ = .);
+
+ PROVIDE (__GOT_START__ = .);
+ PROVIDE (_GOT_START_ = .);
+ s.got = .;
+ .got : { *(.got) } >RAM
+ .got.plt : { *(.got.plt) } >RAM
+ PROVIDE (_GOT_END_ = .);
+ PROVIDE (__GOT_END__ = .);
+
+ /* We want the small data sections together, so single-instruction offsets
+ can access them all, and initialized data all before uninitialized, so
+ we can shorten the on-disk segment size. */
+ PROVIDE (__SDATA_START__ = .);
+ .sdata : { *(.sdata) } >RAM
+ _edata = .;
+ PROVIDE (edata = .);
+
+ PROVIDE (RAM_END = 0x3f0000);
+ .sbss :
+ {
+ PROVIDE (__sbss_start = .);
+ *(.sbss)
+ *(.scommon)
+ PROVIDE (__sbss_end = .);
+ } >RAM
+ PROVIDE (__SBSS_END__ = .);
+
+ .bss :
+ {
+ PROVIDE (__bss_start = .);
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ } >RAM
+ . = ALIGN(8) + 0x8000;
+ PROVIDE(__stack = .);
+ PROVIDE (_end = .);
+ PROVIDE (end = .);
+
+ /* These are needed for ELF backends which have not yet been
+ converted to the new style linker. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ /* SGI/MIPS DWARF 2 extensions */
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+ /* These must appear regardless of . */
+}
diff --git a/c/src/lib/libbsp/powerpc/mvme2307/startup/main.c b/c/src/lib/libbsp/powerpc/mvme2307/startup/main.c
new file mode 100644
index 0000000000..01a7c9f5c5
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/mvme2307/startup/main.c
@@ -0,0 +1,108 @@
+/*
+ * A simple main which can be used on any embedded target.
+ *
+ * This style of initialization insures that the C++ global
+ * constructors are executed after RTEMS is initialized.
+ *
+ * Thanks to Chris Johns <cjohns@plessey.com.au> for this idea.
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+char *rtems_progname;
+
+extern void bsp_start( void );
+extern void bsp_cleanup( void );
+
+extern rtems_configuration_table Configuration;
+extern rtems_configuration_table BSP_Configuration;
+extern rtems_cpu_table Cpu_table;
+
+rtems_interrupt_level bsp_isr_level;
+
+int main(int argc, char **argv);
+
+int boot_card(int argc, char **argv)
+{
+ int status;
+
+ /*
+ * Set default values for the CPU Table fields all ports must have.
+ * These values can be overridden in bsp_start() but they are
+ * right most of the time.
+ */
+
+ Cpu_table.pretasking_hook = NULL;
+ Cpu_table.predriver_hook = NULL;
+ Cpu_table.postdriver_hook = NULL;
+ Cpu_table.idle_task = NULL;
+ Cpu_table.do_zero_of_workspace = TRUE;
+ Cpu_table.interrupt_stack_size = RTEMS_MINIMUM_STACK_SIZE;
+ Cpu_table.extra_mpci_receive_server_stack = 0;
+ Cpu_table.stack_allocate_hook = NULL;
+ Cpu_table.stack_free_hook = NULL;
+
+
+ /*
+ * Copy the configuration table so we and the BSP wants to change it.
+ */
+
+ BSP_Configuration = Configuration;
+
+ /*
+ * The atexit hook will be before the static destructor list's entry
+ * point.
+ */
+
+ bsp_start();
+
+ /*
+ * Initialize RTEMS but do NOT start multitasking.
+ */
+
+ bsp_isr_level =
+ rtems_initialize_executive_early( &BSP_Configuration, &Cpu_table );
+
+ /*
+ * Call main() and get the global constructors invoked if there
+ * are any.
+ */
+
+ status = main(argc, argv);
+
+ /*
+ * Perform any BSP specific shutdown actions.
+ */
+
+ bsp_cleanup();
+
+ /*
+ * Now return to the start code.
+ */
+
+ return status;
+}
+
+int main(int argc, char **argv)
+{
+
+ if ((argc > 0) && argv && argv[0])
+ rtems_progname = argv[0];
+ else
+ rtems_progname = "RTEMS";
+
+ rtems_initialize_executive_late( bsp_isr_level );
+
+ return 0;
+}
+
diff --git a/c/src/lib/libbsp/powerpc/mvme2307/startup/setvec.c b/c/src/lib/libbsp/powerpc/mvme2307/startup/setvec.c
new file mode 100644
index 0000000000..dcdd94c665
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/mvme2307/startup/setvec.c
@@ -0,0 +1,58 @@
+/* set_vector
+ *
+ * This routine installs an interrupt vector on the target Board/CPU.
+ * This routine is allowed to be as board dependent as necessary.
+ *
+ * INPUT:
+ * handler - interrupt handler entry point
+ * vector - vector number
+ * type - 0 indicates raw hardware connect
+ * 1 indicates RTEMS interrupt connect
+ *
+ * RETURNS:
+ * address of previous interrupt handler
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/setvec.c:
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+
+rtems_isr_entry set_vector( /* returns old vector */
+ rtems_isr_entry handler, /* isr routine */
+ rtems_vector_number vector, /* vector number */
+ int type /* RTEMS or RAW intr */
+)
+{
+ rtems_isr_entry previous_isr;
+
+ rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr );
+
+ return previous_isr;
+}
+