summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/m68k/sim68000/startup
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c/src/lib/libbsp/m68k/sim68000/startup/.cvsignore2
-rw-r--r--c/src/lib/libbsp/m68k/sim68000/startup/Makefile.am40
-rw-r--r--c/src/lib/libbsp/m68k/sim68000/startup/bspstart.c85
-rw-r--r--c/src/lib/libbsp/m68k/sim68000/startup/linkcmds129
-rw-r--r--c/src/lib/libbsp/m68k/sim68000/startup/spurious_assistant.c29
5 files changed, 285 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/m68k/sim68000/startup/.cvsignore b/c/src/lib/libbsp/m68k/sim68000/startup/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/sim68000/startup/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/m68k/sim68000/startup/Makefile.am b/c/src/lib/libbsp/m68k/sim68000/startup/Makefile.am
new file mode 100644
index 0000000000..7215533447
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/sim68000/startup/Makefile.am
@@ -0,0 +1,40 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+VPATH = @srcdir@:@srcdir@/../../shared:@srcdir@/../../../shared
+
+PGM = $(ARCH)/startup.rel
+
+C_FILES = bspclean.c bsplibc.c bsppost.c bspstart.c bootcard.c \
+ m68kpretaskinghook.c main.c sbrk.c setvec.c gnatinstallhandler.c \
+ bspspuriousinit.c m68000spurious.c spurious_assistant.c
+C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
+
+OBJS = $(C_O_FILES)
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../../../../../../automake/lib.am
+
+#
+# (OPTIONAL) Add local stuff here using +=
+#
+
+$(PGM): $(OBJS)
+ $(make-rel)
+
+$(PROJECT_RELEASE)/lib/linkcmds: linkcmds
+ $(INSTALL_DATA) $< $@
+
+# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
+TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/linkcmds
+
+all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES)
+
+.PRECIOUS: $(PGM)
+
+EXTRA_DIST = bspclean.c bspstart.c exit.c linkcmds setvec.c
+
+include $(top_srcdir)/../../../../../../automake/local.am
diff --git a/c/src/lib/libbsp/m68k/sim68000/startup/bspstart.c b/c/src/lib/libbsp/m68k/sim68000/startup/bspstart.c
new file mode 100644
index 0000000000..60c417496c
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/sim68000/startup/bspstart.c
@@ -0,0 +1,85 @@
+/*
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ *
+ * COPYRIGHT (c) 1989-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.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <libcsupport.h>
+
+#include <string.h>
+
+/*
+ * The original table from the application and our copy of it with
+ * some changes.
+ */
+
+extern rtems_configuration_table Configuration;
+
+rtems_configuration_table BSP_Configuration;
+
+rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
+
+/*
+ * Use the shared implementations of the following routines
+ */
+
+void bsp_postdriver_hook(void);
+void bsp_libc_init( void *, unsigned32, int );
+void bsp_pretasking_hook(void); /* m68k version */
+
+void bsp_predriver_hook(void)
+{
+ void bsp_spurious_initialize();
+ bsp_spurious_initialize();
+}
+/*
+ * bsp_start
+ *
+ * This routine does the bulk of the system initialization.
+ */
+
+void bsp_start( void )
+{
+ unsigned8 dummy;
+ extern void * _WorkspaceBase;
+ extern void *_RamSize;
+ extern unsigned long _M68k_Ramsize;
+
+ _M68k_Ramsize = (unsigned long)&_RamSize; /* RAM size set in linker script */
+
+ /*
+ * Clear interrupt sources.
+ */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+ Cpu_table.predriver_hook = bsp_predriver_hook;
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+/* XXX address shutdown
+ if ( BSP_Configuration.work_space_size >(128*1024) )
+ _sys_exit( 1 );
+*/
+
+ BSP_Configuration.work_space_start = (void *) &_WorkspaceBase;
+}
+
+#include <bspIo.h>
+
+int debug_putc( char c ) { write( 2, &c, 1 ); return 0; }
+BSP_output_char_function_type BSP_output_char = debug_putc;
+BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/c/src/lib/libbsp/m68k/sim68000/startup/linkcmds b/c/src/lib/libbsp/m68k/sim68000/startup/linkcmds
new file mode 100644
index 0000000000..82f44ba523
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/sim68000/startup/linkcmds
@@ -0,0 +1,129 @@
+/*
+ * $Id$
+ *
+ * MC68302 Linker command file
+ *
+ */
+
+/*
+ * Declare some sizes.
+ */
+_RomBase = DEFINED(_RomBase) ? _RomBase : 0x0;
+_RomSize = DEFINED(_RomSize) ? _RomSize : 256K;
+_RamBase = DEFINED(_RamBase) ? _RamBase : 0x40000;
+_RamSize = DEFINED(_RamSize) ? _RamSize : 128K;
+_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 32K;
+_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
+
+/*
+ * Declare on-board memory.
+ */
+MEMORY {
+ eprom : ORIGIN = 0x00000000, LENGTH = 256K
+ ram : ORIGIN = 0x00040000, LENGTH = 128K
+}
+SECTIONS
+{
+ ram : {
+ . = .;
+ } >ram
+
+ /*
+ * Text, data and bss segments
+ */
+ .text 0x0 : {
+ *(.text)
+
+ /*
+ * C++ constructors/destructors
+ */
+ *(.gnu.linkonce.t.*)
+
+ /*
+ * Initialization and finalization code.
+ *
+ * Various files can provide initialization and finalization
+ * functions. crtbegin.o and crtend.o are two instances. The
+ * body of these functions are in .init and .fini sections. We
+ * accumulate the bodies here, and prepend function prologues
+ * from crti.o and function epilogues from crtn.o. crti.o must
+ * be linked first; crtn.o must be linked last. Because these
+ * are wildcards, it doesn't matter if the user does not
+ * actually link against crti.o and crtn.o; the linker won't
+ * look for a file to match a wildcard. The wildcard also
+ * means that it doesn't matter which directory crti.o and
+ * crtn.o are in.
+ */
+ PROVIDE (_init = .);
+ *crti.o(.init)
+ *(.init)
+ *crtn.o(.init)
+ PROVIDE (_fini = .);
+ *crti.o(.fini)
+ *(.fini)
+ *crtn.o(.fini)
+
+ /*
+ * C++ constructors/destructors
+ *
+ * gcc uses crtbegin.o to find the start of the constructors
+ * and destructors so we make sure it is first. Because this
+ * is a wildcard, it doesn't matter if the user does not
+ * actually link against crtbegin.o; the linker won't look for
+ * a file to match a wildcard. The wildcard also means that
+ * it doesn't matter which directory crtbegin.o is in. The
+ * constructor and destructor list are terminated in
+ * crtend.o. The same comments apply to it.
+ */
+ . = ALIGN (16);
+ *crtbegin.o(.ctors)
+ *(.ctors)
+ *crtend.o(.ctors)
+ *crtbegin.o(.dtors)
+ *(.dtors)
+ *crtend.o(.dtors)
+
+ /*
+ * Exception frame info
+ */
+ . = ALIGN (16);
+ *(.eh_frame)
+
+ /*
+ * Read-only data
+ */
+ . = ALIGN (16);
+ _rodata_start = . ;
+ *(.rodata)
+ *(.gnu.linkonce.r*)
+
+ . = ALIGN (16);
+ PROVIDE (_etext = .);
+ }
+ .data 0x40000 : AT (ADDR(.text) + SIZEOF (.text)) {
+ PROVIDE (_copy_start = .);
+ *(.data)
+ *(.gnu.linkonce.d*)
+ *(.gcc_except_table)
+ . = ALIGN (16);
+ PROVIDE (_edata = .);
+ PROVIDE (_copy_end = .);
+ }
+ .bss ADDR(.data) + SIZEOF(.data) : {
+ _clear_start = .;
+ *(.bss)
+ *(COMMON)
+ . = ALIGN (16);
+ PROVIDE (end = .);
+
+ . += _StackSize;
+ . = ALIGN (16);
+ _stack_init = .;
+ _clear_end = .;
+
+ _WorkspaceBase = .;
+ }
+}
+
+_VBR = 0xFFFFFFFF; /* indicates VBR table is in ROM */
+
diff --git a/c/src/lib/libbsp/m68k/sim68000/startup/spurious_assistant.c b/c/src/lib/libbsp/m68k/sim68000/startup/spurious_assistant.c
new file mode 100644
index 0000000000..eef49b7fa0
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/sim68000/startup/spurious_assistant.c
@@ -0,0 +1,29 @@
+/*
+ * Spurious Trap Handler Assistant
+ *
+ * COPYRIGHT (c) 1989-2000.
+ * 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.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <bspIo.h>
+
+/*
+ * bsp_spurious_handler_assistant
+ *
+ * We can't recover so just return to gdb.
+ */
+
+void bsp_spurious_handler_assistant(
+ rtems_vector_number vector/* ,
+ CPU_Interrupt_frame *isf */
+)
+{
+ /* XXX do something here */
+}