From b812f841553be30baab45f08b3f6fda692b5166b Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 1 Aug 2000 20:01:14 +0000 Subject: Added sim68000 BSP for the BSVC simulator. This BSP includes the alias simcpu32 that supports the CPU32 simulator in BSVC. At this point, it is still under development. --- c/ACKNOWLEDGEMENTS | 6 +- c/TESTED | 2 + c/src/lib/libbsp/m68k/shared/bspspuriousinit.c | 46 +++ c/src/lib/libbsp/m68k/shared/m68000spurious.c | 76 ++++ c/src/lib/libbsp/m68k/sim68000/.cvsignore | 13 + c/src/lib/libbsp/m68k/sim68000/Makefile.am | 18 + c/src/lib/libbsp/m68k/sim68000/README | 10 + c/src/lib/libbsp/m68k/sim68000/bsp_specs | 23 ++ c/src/lib/libbsp/m68k/sim68000/clock/.cvsignore | 2 + c/src/lib/libbsp/m68k/sim68000/clock/Makefile.am | 35 ++ c/src/lib/libbsp/m68k/sim68000/clock/clockdrv.c | 23 ++ c/src/lib/libbsp/m68k/sim68000/configure.in | 31 ++ c/src/lib/libbsp/m68k/sim68000/console/.cvsignore | 2 + c/src/lib/libbsp/m68k/sim68000/console/Makefile.am | 37 ++ c/src/lib/libbsp/m68k/sim68000/console/conscfg.c | 74 ++++ c/src/lib/libbsp/m68k/sim68000/include/.cvsignore | 2 + c/src/lib/libbsp/m68k/sim68000/include/Makefile.am | 25 ++ c/src/lib/libbsp/m68k/sim68000/include/bsp.h | 106 ++++++ c/src/lib/libbsp/m68k/sim68000/sim68000.setup | 7 + c/src/lib/libbsp/m68k/sim68000/start/.cvsignore | 2 + c/src/lib/libbsp/m68k/sim68000/start/Makefile.am | 32 ++ c/src/lib/libbsp/m68k/sim68000/start/start.S | 416 +++++++++++++++++++++ c/src/lib/libbsp/m68k/sim68000/startup/.cvsignore | 2 + c/src/lib/libbsp/m68k/sim68000/startup/Makefile.am | 40 ++ c/src/lib/libbsp/m68k/sim68000/startup/bspstart.c | 85 +++++ c/src/lib/libbsp/m68k/sim68000/startup/linkcmds | 129 +++++++ .../m68k/sim68000/startup/spurious_assistant.c | 29 ++ c/src/lib/libbsp/m68k/sim68000/wrapup/.cvsignore | 2 + c/src/lib/libbsp/m68k/sim68000/wrapup/Makefile.am | 33 ++ 29 files changed, 1306 insertions(+), 2 deletions(-) create mode 100644 c/src/lib/libbsp/m68k/shared/bspspuriousinit.c create mode 100644 c/src/lib/libbsp/m68k/shared/m68000spurious.c create mode 100644 c/src/lib/libbsp/m68k/sim68000/.cvsignore create mode 100644 c/src/lib/libbsp/m68k/sim68000/Makefile.am create mode 100644 c/src/lib/libbsp/m68k/sim68000/README create mode 100644 c/src/lib/libbsp/m68k/sim68000/bsp_specs create mode 100644 c/src/lib/libbsp/m68k/sim68000/clock/.cvsignore create mode 100644 c/src/lib/libbsp/m68k/sim68000/clock/Makefile.am create mode 100644 c/src/lib/libbsp/m68k/sim68000/clock/clockdrv.c create mode 100644 c/src/lib/libbsp/m68k/sim68000/configure.in create mode 100644 c/src/lib/libbsp/m68k/sim68000/console/.cvsignore create mode 100644 c/src/lib/libbsp/m68k/sim68000/console/Makefile.am create mode 100644 c/src/lib/libbsp/m68k/sim68000/console/conscfg.c create mode 100644 c/src/lib/libbsp/m68k/sim68000/include/.cvsignore create mode 100644 c/src/lib/libbsp/m68k/sim68000/include/Makefile.am create mode 100644 c/src/lib/libbsp/m68k/sim68000/include/bsp.h create mode 100644 c/src/lib/libbsp/m68k/sim68000/sim68000.setup create mode 100644 c/src/lib/libbsp/m68k/sim68000/start/.cvsignore create mode 100644 c/src/lib/libbsp/m68k/sim68000/start/Makefile.am create mode 100644 c/src/lib/libbsp/m68k/sim68000/start/start.S create mode 100644 c/src/lib/libbsp/m68k/sim68000/startup/.cvsignore create mode 100644 c/src/lib/libbsp/m68k/sim68000/startup/Makefile.am create mode 100644 c/src/lib/libbsp/m68k/sim68000/startup/bspstart.c create mode 100644 c/src/lib/libbsp/m68k/sim68000/startup/linkcmds create mode 100644 c/src/lib/libbsp/m68k/sim68000/startup/spurious_assistant.c create mode 100644 c/src/lib/libbsp/m68k/sim68000/wrapup/.cvsignore create mode 100644 c/src/lib/libbsp/m68k/sim68000/wrapup/Makefile.am (limited to 'c') diff --git a/c/ACKNOWLEDGEMENTS b/c/ACKNOWLEDGEMENTS index a459083443..294cb75d45 100644 --- a/c/ACKNOWLEDGEMENTS +++ b/c/ACKNOWLEDGEMENTS @@ -168,8 +168,10 @@ The following persons/organizations have made contributions: + Mark Bronson of RAMIX for submitting i960RP support and the rxgen960 board support package. -+ Joel Sherrill for the i960sim BSP that works - with the i960 instruction set simulator in gdb. ++ Joel Sherrill for the BSPs that work with + numerous simulators including psim, i960sim, c4xsim, h8sim, armulator, + sim68000, and simcpu32. Most of these BSPs work with instruction + set simulators in gdb. + Darlene Stewart and Charles Gauthier of the Institute for Information Technology diff --git a/c/TESTED b/c/TESTED index 716ef80799..088a620a70 100644 --- a/c/TESTED +++ b/c/TESTED @@ -32,6 +32,8 @@ RedHat Linux 5.1 as the host environment: i960 i960ha no BSP (note 9) i960 i960rp rxgen960 (note 1) m68k mfc5200 no BSP (note 9) + m68k m68000 sim68000 (BSVC) (note 5 -- under development) + m68k cpu32 simcpu32 (BSVC) (note 5 -- under development) m68k m68000 efi68k (note 1) m68k m68020 Motorola MVME136 (note 1, 6) m68k m68030 Motorola MVME147 (note 1) diff --git a/c/src/lib/libbsp/m68k/shared/bspspuriousinit.c b/c/src/lib/libbsp/m68k/shared/bspspuriousinit.c new file mode 100644 index 0000000000..d894fe4fc6 --- /dev/null +++ b/c/src/lib/libbsp/m68k/shared/bspspuriousinit.c @@ -0,0 +1,46 @@ +/* + * CXX Spurious Trap Handler Install Routine + * + * This is just enough of a trap handler to let us know what + * the likely source of the trap was. + * + * 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 +#include + +/* + * bsp_spurious_initialize + * + * Install the spurious handler for most vectors. + */ + +rtems_isr bsp_spurious_handler( + rtems_vector_number vector/*, + CPU_Interrupt_frame *isf */ +); + +void bsp_spurious_initialize() +{ + rtems_unsigned32 vector; + + for ( vector=0 ; vector<255 ; vector++ ) { + + /* + * Skip any vectors that might be generally used for traps. + * + * XXX + */ + + set_vector( bsp_spurious_handler, vector, 1 ); + } + +} diff --git a/c/src/lib/libbsp/m68k/shared/m68000spurious.c b/c/src/lib/libbsp/m68k/shared/m68000spurious.c new file mode 100644 index 0000000000..efa5b886ef --- /dev/null +++ b/c/src/lib/libbsp/m68k/shared/m68000spurious.c @@ -0,0 +1,76 @@ +/* + * C3X Spurious Trap Handler + * + * This is just enough of a trap handler to let us know what + * the likely source of the trap was. + * + * 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 +#include + +/* + * bsp_spurious_handler + * + * Print a message on the debug console and then die + */ + +void bsp_spurious_handler_assistant( + rtems_vector_number /*, + CPU_Interrupt_frame * */ +); + +rtems_isr bsp_spurious_handler( + rtems_vector_number vector /*, + CPU_Interrupt_frame *isf */ +) +{ + char *s; + + printk( "Unexpected interrupt (0x%x)\n", vector ); +/* + printk( "It looks like we got the interrupt at 0x%x\n", isf->interrupted ); +*/ + + /* + * Can we print a name? + */ + + s = 0; +#if 0 + if ( vector <= 0x1f ) { + switch ( vector ) { + case 1: s = "INT0"; break; + case 2: s = "INT1"; break; + case 3: s = "INT2"; break; + case 4: s = "INT3"; break; + case 5: s = "XINT0"; break; + case 6: s = "RINT0"; break; + case 7: s = "XINT1"; break; + case 8: s = "RINT1"; break; + case 9: s = "TINT0"; break; + case 0x0a: s = "TINT1"; break; + case 0x0b: s = "DINT0"; break; + case 0x0c: s = "DINT1"; break; + default: s = "Reserved"; break; + } + printk( "Looks like it was an %s\n", s ); + } else { + printk( "Looks like it was a TRAP%d\n", vector - 0x20 ); + } +#endif + + /* + * Now call the BSP specific routine + */ + + bsp_spurious_handler_assistant( vector/* , 0 */ ); +} diff --git a/c/src/lib/libbsp/m68k/sim68000/.cvsignore b/c/src/lib/libbsp/m68k/sim68000/.cvsignore new file mode 100644 index 0000000000..525275c115 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/.cvsignore @@ -0,0 +1,13 @@ +Makefile +Makefile.in +aclocal.m4 +config.cache +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +missing +mkinstalldirs diff --git a/c/src/lib/libbsp/m68k/sim68000/Makefile.am b/c/src/lib/libbsp/m68k/sim68000/Makefile.am new file mode 100644 index 0000000000..90008b9311 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/Makefile.am @@ -0,0 +1,18 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 +ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal + +# wrapup is the one that actually builds and installs the library +# from the individual .rel files built in other directories +#SUBDIRS = include start startup clock console timer wrapup +SUBDIRS = include start startup clock console wrapup + +include $(top_srcdir)/../../bsp.am + +EXTRA_DIST = bsp_specs times + +include $(top_srcdir)/../../../../../../automake/subdirs.am +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/m68k/sim68000/README b/c/src/lib/libbsp/m68k/sim68000/README new file mode 100644 index 0000000000..6509e7a1b9 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/README @@ -0,0 +1,10 @@ +# +# $Id$ +# + +BSP for the BSVC 68000 simulator. This is definitely under construction. +The initialization/setup script for BSVC is the part that likely needs +work. + +--joel +1 August 2000 diff --git a/c/src/lib/libbsp/m68k/sim68000/bsp_specs b/c/src/lib/libbsp/m68k/sim68000/bsp_specs new file mode 100644 index 0000000000..eecf37c5a0 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/bsp_specs @@ -0,0 +1,23 @@ +%rename cpp old_cpp +%rename lib old_lib +%rename endfile old_endfile +%rename startfile old_startfile +%rename link old_link + +*cpp: +%(old_cpp) %{qrtems: -D__embedded__} -Asystem(embedded) + +*lib: +%{!qrtems: %(old_lib)} %{qrtems: --start-group \ +%{!qrtems_debug: -lrtemsall} %{qrtems_debug: -lrtemsall_g} \ +-lc -lgcc --end-group \ +%{!qnolinkcmds: -T linkcmds%s}} + +*startfile: +%{!qrtems: %(old_startfile)} %{qrtems: \ +%{!qrtems_debug: start.o%s} \ +%{qrtems_debug: start_g.o%s}} + +*link: +%(old_link) %{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e _start} + diff --git a/c/src/lib/libbsp/m68k/sim68000/clock/.cvsignore b/c/src/lib/libbsp/m68k/sim68000/clock/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/clock/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/m68k/sim68000/clock/Makefile.am b/c/src/lib/libbsp/m68k/sim68000/clock/Makefile.am new file mode 100644 index 0000000000..23a7a9cff4 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/clock/Makefile.am @@ -0,0 +1,35 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +VPATH = @srcdir@:@srcdir@/../../../shared + +PGM = $(ARCH)/clock.rel + +C_FILES = clockdrv.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) + +# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile + +all-local: $(ARCH) $(OBJS) $(PGM) + +.PRECIOUS: $(PGM) + +# XXX add the other variant files here +EXTRA_DIST = clockdrv.c + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/m68k/sim68000/clock/clockdrv.c b/c/src/lib/libbsp/m68k/sim68000/clock/clockdrv.c new file mode 100644 index 0000000000..1de0ef766b --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/clock/clockdrv.c @@ -0,0 +1,23 @@ +/* + * Instantiate the clock driver shell. + * + * $Id$ + */ + +#include + +#define CLOCK_VECTOR 0 + +#define Clock_driver_support_install_isr( _new, _old ) \ + do { _old = (rtems_isr_entry) set_vector( _new, CLOCK_VECTOR, 1 ); } while(0) + + +#define Clock_driver_support_initialize_hardware() \ + } while (0); + +#define Clock_driver_support_at_tick() \ + Clock_driver_support_initialize_hardware() + +#define Clock_driver_support_shutdown_hardware() + +#include "../../../shared/clockdrv_shell.c" diff --git a/c/src/lib/libbsp/m68k/sim68000/configure.in b/c/src/lib/libbsp/m68k/sim68000/configure.in new file mode 100644 index 0000000000..3dd72fa303 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/configure.in @@ -0,0 +1,31 @@ +dnl Process this file with autoconf to produce a configure script. +dnl +dnl $Id$ + +AC_PREREQ(2.13) +AC_INIT(bsp_specs) +RTEMS_TOP(../../../../../..) +AC_CONFIG_AUX_DIR(../../../../../..) + +RTEMS_CANONICAL_TARGET_CPU +AM_INIT_AUTOMAKE(rtems-c-src-lib-libbsp-m68k-sim68000,$RTEMS_VERSION,no) +AM_MAINTAINER_MODE + +RTEMS_PROG_CC_FOR_TARGET +RTEMS_CANONICALIZE_TOOLS + +RTEMS_ENV_RTEMSBSP +RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP) +RTEMS_CHECK_BSP_CACHE(RTEMS_BSP) +RTEMS_CANONICAL_HOST +RTEMS_PROJECT_ROOT + +# Explicitly list all Makefiles here +AC_OUTPUT( +Makefile +clock/Makefile +console/Makefile +include/Makefile +start/Makefile +startup/Makefile +wrapup/Makefile) diff --git a/c/src/lib/libbsp/m68k/sim68000/console/.cvsignore b/c/src/lib/libbsp/m68k/sim68000/console/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/console/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/m68k/sim68000/console/Makefile.am b/c/src/lib/libbsp/m68k/sim68000/console/Makefile.am new file mode 100644 index 0000000000..2ee7fd276e --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/console/Makefile.am @@ -0,0 +1,37 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +VPATH = @srcdir@:@srcdir@/../../../shared + +PGM = $(ARCH)/console.rel + +C_FILES = conscfg.c console.c +C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o) + +S_FILES = +S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o) + +OBJS = $(C_O_FILES) $(S_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) + +# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile + +all-local: $(ARCH) $(OBJS) $(PGM) + +.PRECIOUS: $(PGM) + +EXTRA_DIST = conscfg.c + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/m68k/sim68000/console/conscfg.c b/c/src/lib/libbsp/m68k/sim68000/console/conscfg.c new file mode 100644 index 0000000000..0817233834 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/console/conscfg.c @@ -0,0 +1,74 @@ +/* + * This file contains the TTY driver table. + * + * 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 + +#include +#include + +/* + * Fix these for the simulator + */ + +#define MC68681_PORT_CONFIG MC68681_XBRG_IGNORED +#define MC68681_PROBE libchip_serial_default_probe +#define MC68681_VECTOR 0 +#define MC68681_BASE_ADDRESS 0x71001 +#define MC68681_BASE_ADDRESS 0x71007 + +/* + * Based on BSP configuration information decide whether to do polling IO + * or interrupt driven IO. + */ + +#if (CONSOLE_USE_INTERRUPTS) +#define MC68681_FUNCTIONS &mc68681_fns +#else +#define MC68681_FUNCTIONS &mc68681_fns_polled +#endif + + + +console_tbl Console_Port_Tbl[] = { + { + "/dev/com0", /* sDeviceName */ + SERIAL_MC68681, /* deviceType */ + MC68681_FUNCTIONS, /* pDeviceFns */ + NULL, /* deviceProbe */ + NULL, /* pDeviceFlow */ + 16, /* ulMargin */ + 8, /* ulHysteresis */ + (void *)9600, /* baud rate */ /* pDeviceParams */ + MC68681_BASE_ADDRESS, /* ulCtrlPort1 */ + MC68681_BASE_ADDRESS, /* ulCtrlPort2 */ + MC68681_DATA_ADDRESS, /* ulDataPort */ + mc68681_get_register_2, /* getRegister */ + mc68681_set_register_2, /* setRegister */ + NULL, /* unused */ /* getData */ + NULL, /* unused */ /* setData */ + mc68681_baud_rate_table, /* ulClock */ + MC68681_VECTOR /* ulIntVector */ + } +}; + +/* + * Declare some information used by the console driver + */ + +#define NUM_CONSOLE_PORTS (sizeof(Console_Port_Tbl)/sizeof(console_tbl)) + +unsigned long Console_Port_Count = NUM_CONSOLE_PORTS; + +console_data Console_Port_Data[NUM_CONSOLE_PORTS]; + +rtems_device_minor_number Console_Port_Minor; diff --git a/c/src/lib/libbsp/m68k/sim68000/include/.cvsignore b/c/src/lib/libbsp/m68k/sim68000/include/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/include/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/m68k/sim68000/include/Makefile.am b/c/src/lib/libbsp/m68k/sim68000/include/Makefile.am new file mode 100644 index 0000000000..1d6c3074ec --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/include/Makefile.am @@ -0,0 +1,25 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +H_FILES = bsp.h ../../../shared/include/coverhd.h + +$(PROJECT_INCLUDE): + $(mkinstalldirs) $@ + +$(PROJECT_INCLUDE)/bsp.h: bsp.h + $(INSTALL_DATA) $< $@ + +$(PROJECT_INCLUDE)/coverhd.h: ../../../shared/include/coverhd.h + $(INSTALL_DATA) $< $@ + +TMPINSTALL_FILES += $(PROJECT_INCLUDE) $(PROJECT_INCLUDE)/bsp.h \ + $(PROJECT_INCLUDE)/coverhd.h + +all-local: $(TMPINSTALL_FILES) + +EXTRA_DIST = bsp.h + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/m68k/sim68000/include/bsp.h b/c/src/lib/libbsp/m68k/sim68000/include/bsp.h new file mode 100644 index 0000000000..818579e1c1 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/include/bsp.h @@ -0,0 +1,106 @@ +/* bsp.h + * + * This include file contains some definitions specific to the + * BSVC simulator BSP. + * + * 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$ + */ + +#ifndef __BSVC_SIM +#define __BSVC_SIM + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +/* + * Define some hardware constants here + */ + +/* + * Define the time limits for RTEMS Test Suite test durations. + * Long test and short test duration limits are provided. These + * values are in seconds and need to be converted to ticks for the + * application. + * + */ + +#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */ +#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */ + +/* + * Define the interrupt mechanism for Time Test 27 + * + * NOTE: Following are not defined for the BSVC Simulator YET. + * + */ + +#define MUST_WAIT_FOR_INTERRUPT 0 + +#define Install_tm27_vector( handler ) /* set_vector( (handler), 6, 1 ) */ + +#define Cause_tm27_intr() + +#define Clear_tm27_intr() + +#define Lower_tm27_intr() + +/* + * Simple spin delay in microsecond units for device drivers. + * This is very dependent on the clock speed of the target. + */ + +#define delay( microseconds ) \ + { register rtems_unsigned32 _delay=(microseconds); \ + register rtems_unsigned32 _tmp = 0; /* initialized to avoid warning */ \ + asm volatile( "0: \ + remo 3,31,%0 ; \ + cmpo 0,%0 ; \ + subo 1,%1,%1 ; \ + cmpobne.t 0,%1,0b " \ + : "=d" (_tmp), "=d" (_delay) \ + : "0" (_tmp), "1" (_delay) ); \ + } + +/* Constants */ + +/* miscellaneous stuff assumed to exist */ + +extern rtems_configuration_table BSP_Configuration; + +/* + * Device Driver Table Entries + */ + +/* + * NOTE: Use the standard Console driver entry + */ + +/* + * NOTE: Use the standard Clock driver entry + */ + +/* functions */ + +void bsp_cleanup( void ); + +m68k_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int ); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/lib/libbsp/m68k/sim68000/sim68000.setup b/c/src/lib/libbsp/m68k/sim68000/sim68000.setup new file mode 100644 index 0000000000..e95c9a695a --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/sim68000.setup @@ -0,0 +1,7 @@ +BSVC Simulator Setup File + +UI_VERSION {2.0} +SIMULATOR {sim68000} +COMMAND {AttachDevice 0 RAM {BaseAddress = 0 Size = 40000}} +COMMAND {AttachDevice 0 RAM {BaseAddress = 40000 Size = 20000}} +COMMAND {AttachDevice 0 M68681 {BaseAddress = 71001 OffsetToFirstRegister = 0 OffsetBetweenRegisters = 2 InterruptLevel = 4 PortAStandardInputOutputFlag = 0 PortBStandardInputOutputFlag = 0 PortACommand = xterm -T "M68681 Port A" -132 -fn fixed -e /usr3/tmp/bsvc-2.1/bin/xtermpipe PortBCommand = }} diff --git a/c/src/lib/libbsp/m68k/sim68000/start/.cvsignore b/c/src/lib/libbsp/m68k/sim68000/start/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/start/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/m68k/sim68000/start/Makefile.am b/c/src/lib/libbsp/m68k/sim68000/start/Makefile.am new file mode 100644 index 0000000000..e5a9f26a27 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/start/Makefile.am @@ -0,0 +1,32 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +PGM = $(ARCH)/start.o + +S_FILES = start.S +S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o) + +OBJS = $(S_O_FILES) + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../../../../../../automake/lib.am + +# +# (OPTIONAL) Add local stuff here using += +# + +$(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o: $(PGM) + $(INSTALL_DATA) $< $@ + +TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o + +all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES) + +.PRECIOUS: $(PGM) + +EXTRA_DIST = start.S + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/m68k/sim68000/start/start.S b/c/src/lib/libbsp/m68k/sim68000/start/start.S new file mode 100644 index 0000000000..6f1acdfe00 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/start/start.S @@ -0,0 +1,416 @@ +/* + * $Id$ + * + * Re-written the gen68302 start-up code. + * + * Uses gas syntax only, removed the OAR asm.h. + * + * Supplies a complete vector table in ROM. + * + * Manages all vectors with seperate handlers to trap unhandled + * execptions. + * + * Uses the target specific header file to get the runtime + * configuration + * + * COPYRIGHT (c) 1996 + * Objective Design Systems Pty Ltd (ODS) + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + */ + +#define STACK_AT_RESET 0x0 + +| +| Boot boot code in a special section, ld postions +| +| Initial stack pointer is in the dual ported RAM +| + .sect .text + + .global _start | program entry + .global M68Kvec | Vector Table + +_start: | standard name for program entry +M68Kvec: | standard location for vectors + +| +| Make relative, can have the code positioned any where +| + +V___ISSP: .long STACK_AT_RESET +V____IPC: .long start - V___ISSP + +| +| Create the rest of the vector table to point to the unhandled expection +| handler +| +| Lots of macros, how-ever it creates a simple ROM vector table +| + +#define MAKE_EXCEPTION_VECTOR(n) V___##n: .long (_CPU_ISR_jump_table + (n * 10)) + +MAKE_EXCEPTION_VECTOR(2) +MAKE_EXCEPTION_VECTOR(3) +MAKE_EXCEPTION_VECTOR(4) +MAKE_EXCEPTION_VECTOR(5) +MAKE_EXCEPTION_VECTOR(6) +MAKE_EXCEPTION_VECTOR(7) +MAKE_EXCEPTION_VECTOR(8) +MAKE_EXCEPTION_VECTOR(9) + +MAKE_EXCEPTION_VECTOR(10) +MAKE_EXCEPTION_VECTOR(11) +MAKE_EXCEPTION_VECTOR(12) +MAKE_EXCEPTION_VECTOR(13) +MAKE_EXCEPTION_VECTOR(14) +MAKE_EXCEPTION_VECTOR(15) +MAKE_EXCEPTION_VECTOR(16) +MAKE_EXCEPTION_VECTOR(17) +MAKE_EXCEPTION_VECTOR(18) +MAKE_EXCEPTION_VECTOR(19) + +MAKE_EXCEPTION_VECTOR(20) +MAKE_EXCEPTION_VECTOR(21) +MAKE_EXCEPTION_VECTOR(22) +MAKE_EXCEPTION_VECTOR(23) +MAKE_EXCEPTION_VECTOR(24) +MAKE_EXCEPTION_VECTOR(25) +MAKE_EXCEPTION_VECTOR(26) +MAKE_EXCEPTION_VECTOR(27) +MAKE_EXCEPTION_VECTOR(28) +MAKE_EXCEPTION_VECTOR(29) + +MAKE_EXCEPTION_VECTOR(30) +MAKE_EXCEPTION_VECTOR(31) +MAKE_EXCEPTION_VECTOR(32) +MAKE_EXCEPTION_VECTOR(33) +MAKE_EXCEPTION_VECTOR(34) +MAKE_EXCEPTION_VECTOR(35) +MAKE_EXCEPTION_VECTOR(36) +MAKE_EXCEPTION_VECTOR(37) +MAKE_EXCEPTION_VECTOR(38) +MAKE_EXCEPTION_VECTOR(39) + +MAKE_EXCEPTION_VECTOR(40) +MAKE_EXCEPTION_VECTOR(41) +MAKE_EXCEPTION_VECTOR(42) +MAKE_EXCEPTION_VECTOR(43) +MAKE_EXCEPTION_VECTOR(44) +MAKE_EXCEPTION_VECTOR(45) +MAKE_EXCEPTION_VECTOR(46) +MAKE_EXCEPTION_VECTOR(47) +MAKE_EXCEPTION_VECTOR(48) +MAKE_EXCEPTION_VECTOR(49) + +MAKE_EXCEPTION_VECTOR(50) +MAKE_EXCEPTION_VECTOR(51) +MAKE_EXCEPTION_VECTOR(52) +MAKE_EXCEPTION_VECTOR(53) +MAKE_EXCEPTION_VECTOR(54) +MAKE_EXCEPTION_VECTOR(55) +MAKE_EXCEPTION_VECTOR(56) +MAKE_EXCEPTION_VECTOR(57) +MAKE_EXCEPTION_VECTOR(58) +MAKE_EXCEPTION_VECTOR(59) + +MAKE_EXCEPTION_VECTOR(60) +MAKE_EXCEPTION_VECTOR(61) +MAKE_EXCEPTION_VECTOR(62) +MAKE_EXCEPTION_VECTOR(63) +MAKE_EXCEPTION_VECTOR(64) +MAKE_EXCEPTION_VECTOR(65) +MAKE_EXCEPTION_VECTOR(66) +MAKE_EXCEPTION_VECTOR(67) +MAKE_EXCEPTION_VECTOR(68) +MAKE_EXCEPTION_VECTOR(69) + +MAKE_EXCEPTION_VECTOR(70) +MAKE_EXCEPTION_VECTOR(71) +MAKE_EXCEPTION_VECTOR(72) +MAKE_EXCEPTION_VECTOR(73) +MAKE_EXCEPTION_VECTOR(74) +MAKE_EXCEPTION_VECTOR(75) +MAKE_EXCEPTION_VECTOR(76) +MAKE_EXCEPTION_VECTOR(77) +MAKE_EXCEPTION_VECTOR(78) +MAKE_EXCEPTION_VECTOR(79) + +MAKE_EXCEPTION_VECTOR(80) +MAKE_EXCEPTION_VECTOR(81) +MAKE_EXCEPTION_VECTOR(82) +MAKE_EXCEPTION_VECTOR(83) +MAKE_EXCEPTION_VECTOR(84) +MAKE_EXCEPTION_VECTOR(85) +MAKE_EXCEPTION_VECTOR(86) +MAKE_EXCEPTION_VECTOR(87) +MAKE_EXCEPTION_VECTOR(88) +MAKE_EXCEPTION_VECTOR(89) + +MAKE_EXCEPTION_VECTOR(90) +MAKE_EXCEPTION_VECTOR(91) +MAKE_EXCEPTION_VECTOR(92) +MAKE_EXCEPTION_VECTOR(93) +MAKE_EXCEPTION_VECTOR(94) +MAKE_EXCEPTION_VECTOR(95) +MAKE_EXCEPTION_VECTOR(96) +MAKE_EXCEPTION_VECTOR(97) +MAKE_EXCEPTION_VECTOR(98) +MAKE_EXCEPTION_VECTOR(99) + +MAKE_EXCEPTION_VECTOR(100) +MAKE_EXCEPTION_VECTOR(101) +MAKE_EXCEPTION_VECTOR(102) +MAKE_EXCEPTION_VECTOR(103) +MAKE_EXCEPTION_VECTOR(104) +MAKE_EXCEPTION_VECTOR(105) +MAKE_EXCEPTION_VECTOR(106) +MAKE_EXCEPTION_VECTOR(107) +MAKE_EXCEPTION_VECTOR(108) +MAKE_EXCEPTION_VECTOR(109) + +MAKE_EXCEPTION_VECTOR(110) +MAKE_EXCEPTION_VECTOR(111) +MAKE_EXCEPTION_VECTOR(112) +MAKE_EXCEPTION_VECTOR(113) +MAKE_EXCEPTION_VECTOR(114) +MAKE_EXCEPTION_VECTOR(115) +MAKE_EXCEPTION_VECTOR(116) +MAKE_EXCEPTION_VECTOR(117) +MAKE_EXCEPTION_VECTOR(118) +MAKE_EXCEPTION_VECTOR(119) + +MAKE_EXCEPTION_VECTOR(120) +MAKE_EXCEPTION_VECTOR(121) +MAKE_EXCEPTION_VECTOR(122) +MAKE_EXCEPTION_VECTOR(123) +MAKE_EXCEPTION_VECTOR(124) +MAKE_EXCEPTION_VECTOR(125) +MAKE_EXCEPTION_VECTOR(126) +MAKE_EXCEPTION_VECTOR(127) +MAKE_EXCEPTION_VECTOR(128) +MAKE_EXCEPTION_VECTOR(129) + +MAKE_EXCEPTION_VECTOR(130) +MAKE_EXCEPTION_VECTOR(131) +MAKE_EXCEPTION_VECTOR(132) +MAKE_EXCEPTION_VECTOR(133) +MAKE_EXCEPTION_VECTOR(134) +MAKE_EXCEPTION_VECTOR(135) +MAKE_EXCEPTION_VECTOR(136) +MAKE_EXCEPTION_VECTOR(137) +MAKE_EXCEPTION_VECTOR(138) +MAKE_EXCEPTION_VECTOR(139) + +MAKE_EXCEPTION_VECTOR(140) +MAKE_EXCEPTION_VECTOR(141) +MAKE_EXCEPTION_VECTOR(142) +MAKE_EXCEPTION_VECTOR(143) +MAKE_EXCEPTION_VECTOR(144) +MAKE_EXCEPTION_VECTOR(145) +MAKE_EXCEPTION_VECTOR(146) +MAKE_EXCEPTION_VECTOR(147) +MAKE_EXCEPTION_VECTOR(148) +MAKE_EXCEPTION_VECTOR(149) + +MAKE_EXCEPTION_VECTOR(150) +MAKE_EXCEPTION_VECTOR(151) +MAKE_EXCEPTION_VECTOR(152) +MAKE_EXCEPTION_VECTOR(153) +MAKE_EXCEPTION_VECTOR(154) +MAKE_EXCEPTION_VECTOR(155) +MAKE_EXCEPTION_VECTOR(156) +MAKE_EXCEPTION_VECTOR(157) +MAKE_EXCEPTION_VECTOR(158) +MAKE_EXCEPTION_VECTOR(159) + +MAKE_EXCEPTION_VECTOR(160) +MAKE_EXCEPTION_VECTOR(161) +MAKE_EXCEPTION_VECTOR(162) +MAKE_EXCEPTION_VECTOR(163) +MAKE_EXCEPTION_VECTOR(164) +MAKE_EXCEPTION_VECTOR(165) +MAKE_EXCEPTION_VECTOR(166) +MAKE_EXCEPTION_VECTOR(167) +MAKE_EXCEPTION_VECTOR(168) +MAKE_EXCEPTION_VECTOR(169) + +MAKE_EXCEPTION_VECTOR(170) +MAKE_EXCEPTION_VECTOR(171) +MAKE_EXCEPTION_VECTOR(172) +MAKE_EXCEPTION_VECTOR(173) +MAKE_EXCEPTION_VECTOR(174) +MAKE_EXCEPTION_VECTOR(175) +MAKE_EXCEPTION_VECTOR(176) +MAKE_EXCEPTION_VECTOR(177) +MAKE_EXCEPTION_VECTOR(178) +MAKE_EXCEPTION_VECTOR(179) + +MAKE_EXCEPTION_VECTOR(180) +MAKE_EXCEPTION_VECTOR(181) +MAKE_EXCEPTION_VECTOR(182) +MAKE_EXCEPTION_VECTOR(183) +MAKE_EXCEPTION_VECTOR(184) +MAKE_EXCEPTION_VECTOR(185) +MAKE_EXCEPTION_VECTOR(186) +MAKE_EXCEPTION_VECTOR(187) +MAKE_EXCEPTION_VECTOR(188) +MAKE_EXCEPTION_VECTOR(189) + +MAKE_EXCEPTION_VECTOR(190) +MAKE_EXCEPTION_VECTOR(191) +MAKE_EXCEPTION_VECTOR(192) +MAKE_EXCEPTION_VECTOR(193) +MAKE_EXCEPTION_VECTOR(194) +MAKE_EXCEPTION_VECTOR(195) +MAKE_EXCEPTION_VECTOR(196) +MAKE_EXCEPTION_VECTOR(197) +MAKE_EXCEPTION_VECTOR(198) +MAKE_EXCEPTION_VECTOR(199) + +MAKE_EXCEPTION_VECTOR(200) +MAKE_EXCEPTION_VECTOR(201) +MAKE_EXCEPTION_VECTOR(202) +MAKE_EXCEPTION_VECTOR(203) +MAKE_EXCEPTION_VECTOR(204) +MAKE_EXCEPTION_VECTOR(205) +MAKE_EXCEPTION_VECTOR(206) +MAKE_EXCEPTION_VECTOR(207) +MAKE_EXCEPTION_VECTOR(208) +MAKE_EXCEPTION_VECTOR(209) + +MAKE_EXCEPTION_VECTOR(210) +MAKE_EXCEPTION_VECTOR(211) +MAKE_EXCEPTION_VECTOR(212) +MAKE_EXCEPTION_VECTOR(213) +MAKE_EXCEPTION_VECTOR(214) +MAKE_EXCEPTION_VECTOR(215) +MAKE_EXCEPTION_VECTOR(216) +MAKE_EXCEPTION_VECTOR(217) +MAKE_EXCEPTION_VECTOR(218) +MAKE_EXCEPTION_VECTOR(219) + +MAKE_EXCEPTION_VECTOR(220) +MAKE_EXCEPTION_VECTOR(221) +MAKE_EXCEPTION_VECTOR(222) +MAKE_EXCEPTION_VECTOR(223) +MAKE_EXCEPTION_VECTOR(224) +MAKE_EXCEPTION_VECTOR(225) +MAKE_EXCEPTION_VECTOR(226) +MAKE_EXCEPTION_VECTOR(227) +MAKE_EXCEPTION_VECTOR(228) +MAKE_EXCEPTION_VECTOR(229) + +MAKE_EXCEPTION_VECTOR(230) +MAKE_EXCEPTION_VECTOR(231) +MAKE_EXCEPTION_VECTOR(232) +MAKE_EXCEPTION_VECTOR(233) +MAKE_EXCEPTION_VECTOR(234) +MAKE_EXCEPTION_VECTOR(235) +MAKE_EXCEPTION_VECTOR(236) +MAKE_EXCEPTION_VECTOR(237) +MAKE_EXCEPTION_VECTOR(238) +MAKE_EXCEPTION_VECTOR(239) + +MAKE_EXCEPTION_VECTOR(240) +MAKE_EXCEPTION_VECTOR(241) +MAKE_EXCEPTION_VECTOR(242) +MAKE_EXCEPTION_VECTOR(243) +MAKE_EXCEPTION_VECTOR(244) +MAKE_EXCEPTION_VECTOR(245) +MAKE_EXCEPTION_VECTOR(246) +MAKE_EXCEPTION_VECTOR(247) +MAKE_EXCEPTION_VECTOR(248) +MAKE_EXCEPTION_VECTOR(249) + +MAKE_EXCEPTION_VECTOR(250) +MAKE_EXCEPTION_VECTOR(251) +MAKE_EXCEPTION_VECTOR(252) +MAKE_EXCEPTION_VECTOR(253) +MAKE_EXCEPTION_VECTOR(254) +MAKE_EXCEPTION_VECTOR(255) + +| +| Start +| +| Entered from a hardware reset. +| + + .global start | Default entry point for GNU +start: + + | + | Copy initialized data area from ROM to RAM + | + +copy_data: + moveal #_etext,%a0 | find the end of .text + moveal #_copy_start,%a1 | find the beginning of .data + moveal #_edata,%a2 | find the end of .data + +copy_data_loop: + + movel %a0@+,%a1@+ | copy the data + cmpal %a2,%a1 + jlt copy_data_loop | loop until edata reached + + | + | zero out uninitialized data area + | + +zerobss: + moveal #_clear_end,%a0 | find end of .bss + moveal #_clear_start,%a1 | find beginning of .bss + moveq #0,%d0 + +zerobss_loop: + + movel %d0,%a1@+ | to zero out uninitialized + cmpal %a0,%a1 + jlt zerobss_loop | loop until _end reached + + movel #_stack_init,%d0 | load stack top + + movw #0x3700,%sr | SUPV MODE,INTERRUPTS OFF!!! + movel %d0,%a7 | set master stack pointer + movel %d0,%a6 | set base pointer + + pea env | push environp + pea arg | push argv + movel #0,%a7@- | push argc + jsr boot_card + | if this returns, what do we do??? + + .global bsp_exitted +bsp_exitted: + jmp bsp_exitted + + +| +| Initialised data +| + + .sect .data + +| +| Uninitialised data +| + + .sect .bss + +env: .long 0 +arg: .long 0 + + .global environ + .align 2 + +environ: + .long env + 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 +#include + +#include + +#include + +/* + * 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 + +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 +#include + +/* + * 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 */ +} diff --git a/c/src/lib/libbsp/m68k/sim68000/wrapup/.cvsignore b/c/src/lib/libbsp/m68k/sim68000/wrapup/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/wrapup/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/m68k/sim68000/wrapup/Makefile.am b/c/src/lib/libbsp/m68k/sim68000/wrapup/Makefile.am new file mode 100644 index 0000000000..ae52204fdb --- /dev/null +++ b/c/src/lib/libbsp/m68k/sim68000/wrapup/Makefile.am @@ -0,0 +1,33 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +BSP_FILES = startup clock console timer + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../../../../../../automake/lib.am + +# bummer; have to use $foreach since % pattern subst rules only replace 1x +OBJS = $(foreach piece, $(BSP_FILES), $(wildcard ../$(piece)/$(ARCH)/*.o)) \ + $(wildcard ../../../../libcpu/$(RTEMS_CPU)/$(RTEMS_CPU_MODEL)/$(ARCH)/*.o) \ + $(foreach piece, $(GENERIC_FILES), ../../../$(piece)/$(ARCH)/$(piece).rel) + +LIB = $(ARCH)/libbsp.a + +# +# (OPTIONAL) Add local stuff here using += +# + +$(LIB): ${OBJS} + $(make-library) + +$(PROJECT_RELEASE)/lib/libbsp$(LIB_VARIANT).a: $(LIB) + $(INSTALL_DATA) $< $@ + +TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/libbsp$(LIB_VARIANT).a + +all-local: ${ARCH} $(TMPINSTALL_FILES) + +include $(top_srcdir)/../../../../../../automake/local.am -- cgit v1.2.3