summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-07-06 20:07:34 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-07-06 20:07:34 +0000
commit501d312a91f66a56f4958f399d9fe30465a86437 (patch)
tree275d5093b512a8a751efff5f79f0184da243fbd7
parent34a267926634dfb41abd716cac0062fa58d60477 (diff)
downloadrtems-501d312a91f66a56f4958f399d9fe30465a86437.tar.bz2
Added baseline for h8 simulator BSP to support the simulator in gdb 5.0
-rw-r--r--c/src/lib/libbsp/h8300/Makefile.am12
-rw-r--r--c/src/lib/libbsp/h8300/configure.in24
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/Makefile.am18
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/bsp_specs23
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/configure.in32
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/console/.cvsignore2
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/console/Makefile.am34
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/console/console-io.c50
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/include/.cvsignore2
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/include/Makefile.am25
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/include/bsp.h104
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/start/.cvsignore2
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/start/Makefile.am32
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/start/start.S45
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/startup/.cvsignore2
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/startup/Makefile.am39
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/startup/__main.c22
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/startup/bspstart.c94
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/startup/linkcmds94
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/wrapup/.cvsignore2
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/wrapup/Makefile.am32
-rw-r--r--make/custom/h8sim.cfg67
22 files changed, 757 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/h8300/Makefile.am b/c/src/lib/libbsp/h8300/Makefile.am
new file mode 100644
index 0000000000..8515dfe07b
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/Makefile.am
@@ -0,0 +1,12 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
+
+# Descend into the $(RTEMS_BSP_FAMILY) directory
+SUBDIRS = $(RTEMS_BSP_FAMILY)
+
+include $(top_srcdir)/../../../../../automake/subdirs.am
+include $(top_srcdir)/../../../../../automake/local.am
diff --git a/c/src/lib/libbsp/h8300/configure.in b/c/src/lib/libbsp/h8300/configure.in
new file mode 100644
index 0000000000..204035022d
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/configure.in
@@ -0,0 +1,24 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl
+dnl $Id$
+
+AC_PREREQ(2.13)
+AC_INIT(h8sim)
+RTEMS_TOP(../../../../..)
+AC_CONFIG_AUX_DIR(../../../../..)
+
+RTEMS_CANONICAL_TARGET_CPU
+AM_INIT_AUTOMAKE(rtems-c-src-lib-libbsp-h8300,$RTEMS_VERSION,no)
+AM_MAINTAINER_MODE
+
+RTEMS_ENV_RTEMSBSP
+RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
+RTEMS_CHECK_BSP_CACHE(RTEMS_BSP)
+
+RTEMS_PROJECT_ROOT
+RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
+AC_CONFIG_SUBDIRS($bspdir)
+
+# Explicitly list all Makefiles here
+AC_OUTPUT(
+Makefile)
diff --git a/c/src/lib/libbsp/h8300/h8sim/Makefile.am b/c/src/lib/libbsp/h8300/h8sim/Makefile.am
new file mode 100644
index 0000000000..17a9b27760
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/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 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/h8300/h8sim/bsp_specs b/c/src/lib/libbsp/h8300/h8sim/bsp_specs
new file mode 100644
index 0000000000..eecf37c5a0
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/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/h8300/h8sim/configure.in b/c/src/lib/libbsp/h8300/h8sim/configure.in
new file mode 100644
index 0000000000..bebd61a5f6
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/configure.in
@@ -0,0 +1,32 @@
+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-h8300-h8sim,$RTEMS_VERSION,no)
+AM_MAINTAINER_MODE
+
+RTEMS_PROG_CC_FOR_TARGET
+RTEMS_CANONICALIZE_TOOLS
+RTEMS_ENABLE_MULTIPROCESSING
+
+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
+console/Makefile
+include/Makefile
+start/Makefile
+startup/Makefile
+wrapup/Makefile)
diff --git a/c/src/lib/libbsp/h8300/h8sim/console/.cvsignore b/c/src/lib/libbsp/h8300/h8sim/console/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/console/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/h8300/h8sim/console/Makefile.am b/c/src/lib/libbsp/h8300/h8sim/console/Makefile.am
new file mode 100644
index 0000000000..89dc14d67e
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/console/Makefile.am
@@ -0,0 +1,34 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+VPATH = @srcdir@:@srcdir@/../../../shared
+
+PGM = $(ARCH)/console.rel
+
+C_FILES = console-io.c console-polled.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)
+
+EXTRA_DIST = console-io.c
+
+include $(top_srcdir)/../../../../../../automake/local.am
diff --git a/c/src/lib/libbsp/h8300/h8sim/console/console-io.c b/c/src/lib/libbsp/h8300/h8sim/console/console-io.c
new file mode 100644
index 0000000000..c0b2b2340f
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/console/console-io.c
@@ -0,0 +1,50 @@
+/*
+ * This file contains the hardware specific portions of the TTY driver
+ * for the serial ports on the erc32.
+ *
+ * COPYRIGHT (c) 1989-1997.
+ * 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>
+#include <rtems/libio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/* external prototypes for monitor interface routines */
+
+/*
+ * console_outbyte_polled
+ *
+ * This routine transmits a character using polling.
+ */
+
+void console_outbyte_polled(
+ int port,
+ char ch
+)
+{
+ asm volatile( "mov.b #0,r1l ; mov.b %0l,r2l ; jsr @@0xc4"
+ : : "r" (ch) : "r1", "r2");
+}
+
+/*
+ * console_inbyte_nonblocking
+ *
+ * This routine polls for a character.
+ */
+
+int console_inbyte_nonblocking(
+ int port
+)
+{
+ return -1;
+}
+
diff --git a/c/src/lib/libbsp/h8300/h8sim/include/.cvsignore b/c/src/lib/libbsp/h8300/h8sim/include/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/include/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/h8300/h8sim/include/Makefile.am b/c/src/lib/libbsp/h8300/h8sim/include/Makefile.am
new file mode 100644
index 0000000000..1d6c3074ec
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/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/h8300/h8sim/include/bsp.h b/c/src/lib/libbsp/h8300/h8sim/include/bsp.h
new file mode 100644
index 0000000000..22e15dcabb
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/include/bsp.h
@@ -0,0 +1,104 @@
+/* bsp.h
+ *
+ * This include file contains some definitions specific to the
+ * i960 simulator in gdb.
+ *
+ * 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$
+ */
+
+#ifndef __CVME961_h
+#define __CVME961_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems.h>
+#include <iosupp.h>
+#include <console.h>
+#include <clockdrv.h>
+
+/*
+ * 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 for i960CA and are board independent
+ *
+ */
+
+#define MUST_WAIT_FOR_INTERRUPT 0
+
+#define Install_tm27_vector( handler ) /* set_vector( (handler), 6, 1 ) */
+
+#define Cause_tm27_intr() /* i960_cause_intr( 0x62 ) */
+
+#define Clear_tm27_intr() /* i960_clear_intr( 6 ) */
+
+#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 );
+
+/*
+i960_isr_entry set_vector( rtems_isr_entry, unsigned int, unsigned int );
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/h8300/h8sim/start/.cvsignore b/c/src/lib/libbsp/h8300/h8sim/start/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/start/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/h8300/h8sim/start/Makefile.am b/c/src/lib/libbsp/h8300/h8sim/start/Makefile.am
new file mode 100644
index 0000000000..e5a9f26a27
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/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/h8300/h8sim/start/start.S b/c/src/lib/libbsp/h8300/h8sim/start/start.S
new file mode 100644
index 0000000000..32b074f7bf
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/start/start.S
@@ -0,0 +1,45 @@
+; h8/300 and h8/300h start up file.
+
+#ifdef __H8300__
+
+ .text
+ .global _start
+_start:
+ mov.w #_stack_init,sp
+ mov.w #_edata,r0
+ mov.w #_clear_end,r1
+ mov.w #0,r2
+.loop: mov.w r2,@r0
+ adds #2,r0
+ cmp r1,r0
+ blo .loop
+ ; call __main
+ jsr @_boot_card
+ mov.w #0,r0 ; indicate reason to exit
+ sleep
+ jmp @_start ; restart
+#else
+
+#if defined(__H8300H__)
+ .h8300h
+#else /* must be __H300S__ */
+ .h8300s
+#endif
+ .text
+ .global _start
+_start:
+ mov.l #_stack_init,sp
+ mov.l #_edata,er0
+ mov.l #_clear_end,er1
+ mov.w #0,r2 ; not sure about alignment requirements
+.loop: mov.w r2,@er0 ; playing it safe for now
+ adds #2,er0
+ cmp.l er1,er0
+ blo .loop
+ ; call __main
+ jsr @_boot_card
+ mov.w #0,r0 ; indicate reason to exit
+ sleep
+ jmp @_start ; restart
+
+#endif /* end of H8300 */
diff --git a/c/src/lib/libbsp/h8300/h8sim/startup/.cvsignore b/c/src/lib/libbsp/h8300/h8sim/startup/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/startup/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/h8300/h8sim/startup/Makefile.am b/c/src/lib/libbsp/h8300/h8sim/startup/Makefile.am
new file mode 100644
index 0000000000..cf040e1aed
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/startup/Makefile.am
@@ -0,0 +1,39 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+VPATH = @srcdir@:@srcdir@/../../../shared
+
+PGM = $(ARCH)/startup.rel
+
+C_FILES = bspclean.c bsplibc.c bsppost.c bspstart.c bootcard.c main.c sbrk.c \
+ gnatinstallhandler.c __main.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/h8300/h8sim/startup/__main.c b/c/src/lib/libbsp/h8300/h8sim/startup/__main.c
new file mode 100644
index 0000000000..4169cea605
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/startup/__main.c
@@ -0,0 +1,22 @@
+/*
+ * Copied from newlib 1.8.2
+ *
+ * $Id$
+ */
+
+void __main ()
+{
+ static int initialized;
+ if (! initialized)
+ {
+ typedef void (*pfunc) ();
+ extern pfunc __ctors[];
+ extern pfunc __ctors_end[];
+ pfunc *p;
+
+ initialized = 1;
+ for (p = __ctors_end; p > __ctors; )
+ (*--p) ();
+
+ }
+}
diff --git a/c/src/lib/libbsp/h8300/h8sim/startup/bspstart.c b/c/src/lib/libbsp/h8300/h8sim/startup/bspstart.c
new file mode 100644
index 0000000000..212dd0c8c3
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/startup/bspstart.c
@@ -0,0 +1,94 @@
+/*
+ * 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 );
+
+/*
+ * Function: bsp_pretasking_hook
+ * Created: 95/03/10
+ *
+ * Description:
+ * BSP pretasking hook. Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ *
+ * NOTES:
+ * Must not use libc (to do io) from here, since drivers are
+ * not yet initialized.
+ *
+ */
+
+void bsp_pretasking_hook(void)
+{
+ extern int HeapBase;
+ extern int HeapSize;
+ void *heapStart = &HeapBase;
+ unsigned long heapSize = (unsigned long)&HeapSize;
+ unsigned long ramSpace;
+
+ bsp_libc_init(heapStart, heapSize, 0);
+
+#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 )
+{
+ extern int _end;
+ extern int WorkspaceBase;
+ /* Configure Number of Register Caches */
+
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+ Cpu_table.interrupt_stack_size = 4096;
+
+ if ( BSP_Configuration.work_space_size >(512*1024) )
+ _sys_exit( 1 );
+
+ BSP_Configuration.work_space_start = (void *) &WorkspaceBase;
+}
diff --git a/c/src/lib/libbsp/h8300/h8sim/startup/linkcmds b/c/src/lib/libbsp/h8300/h8sim/startup/linkcmds
new file mode 100644
index 0000000000..5c2982a873
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/startup/linkcmds
@@ -0,0 +1,94 @@
+/*
+ * $Id$
+ */
+
+/*
+ * Declare some sizes.
+ */
+_RamBase = DEFINED(_RamBase) ? _RamBase : 0x0;
+_RamSize = DEFINED(_RamSize) ? _RamSize : 1M;
+_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
+_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
+
+ENTRY("_start")
+/* The memory size is 256KB to coincide with the simulator.
+ Don't change either without considering the other. */
+MEMORY
+{
+ /* 0xc4 is a magic entry. We should have the linker just
+ skip over it one day... */
+ vectors : o = 0x0000, l = 0xc4
+ magicvectors : o = 0xc4, l = 0x3c
+ /* We still only use 256k as the main ram size. */
+ ram : o = 0x0100, l = 0x3fefc
+ /* The stack starts at the top of main ram. */
+ topram : o = 0x3fffc, l = 0x4
+ /* This holds variables in the "tiny" sections. */
+ tiny : o = 0xff8000, l = 0x7f00
+ /* At the very top of the address space is the 8-bit area. */
+ eight : o = 0xffff00, l = 0x100
+}
+
+
+SECTIONS
+{
+ .vectors :
+ {
+ *(.vectors)
+ } > vectors
+
+ .text :
+ {
+ CREATE_OBJECT_SYMBOLS
+ *(.text)
+ _etext = .;
+
+/*
+ ___CTOR_LIST__ = .;
+ LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)
+ *(.ctors)
+ LONG(0)
+ ___CTOR_END__ = .;
+ ___DTOR_LIST__ = .;
+ LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)
+ *(.dtors)
+ LONG(0)
+ ___DTOR_END__ = .;
+*/
+ } >ram
+ .data SIZEOF(.text) + ADDR(.text):
+ {
+ *(.data)
+ CONSTRUCTORS
+ _edata = .;
+ } >ram
+ .bss SIZEOF(.data) + ADDR(.data):
+ {
+ _bss_start = .;
+ *(.bss)
+ *(COMMON)
+ . = ALIGN (64);
+ . += _StackSize;
+ _stack_init = .;
+ _clear_end = .;
+ _WorkspaceBase = .;
+ . += 512K; /* reserve some memory for workspace */
+ _HeapBase = .;
+ . += _HeapSize; /* reserve some memory for heap */
+ _end = .;
+ __end = .;
+ } >ram
+ .tiny : {
+ *(.tiny)
+ } > tiny
+ .eight : {
+ *(.eight)
+ } > eight
+ .stab 0 (NOLOAD) : {
+ [ .stab ]
+ }
+ .stabstr 0 (NOLOAD) : {
+ [ .stabstr ]
+ }
+
+}
diff --git a/c/src/lib/libbsp/h8300/h8sim/wrapup/.cvsignore b/c/src/lib/libbsp/h8300/h8sim/wrapup/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/wrapup/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/h8300/h8sim/wrapup/Makefile.am b/c/src/lib/libbsp/h8300/h8sim/wrapup/Makefile.am
new file mode 100644
index 0000000000..613305a13e
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/wrapup/Makefile.am
@@ -0,0 +1,32 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+BSP_FILES = startup console
+
+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)) \
+ $(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
diff --git a/make/custom/h8sim.cfg b/make/custom/h8sim.cfg
new file mode 100644
index 0000000000..c8388eae01
--- /dev/null
+++ b/make/custom/h8sim.cfg
@@ -0,0 +1,67 @@
+#
+# Config file for the i960 simulator in gdb
+#
+# $Id$
+#
+
+include $(RTEMS_ROOT)/make/custom/default.cfg
+
+RTEMS_CPU=h8300
+RTEMS_CPU_MODEL=h8300h
+
+# This is the actual bsp directory used during the build process.
+RTEMS_BSP_FAMILY=h8sim
+
+# This contains the compiler options necessary to select the CPU model
+# and (hopefully) optimize for it.
+#
+CPU_CFLAGS=-mh -mint32
+
+# optimize flag: typically -0, could use -O4 or -fast
+# -O4 is ok for RTEMS
+# CFLAGS_OPTIMIZE_V=-O4 -mleaf-procedures
+CFLAGS_OPTIMIZE_V=-O0 -g
+
+# This section makes the target dependent options file.
+
+# NDEBUG (C library)
+# if defined asserts do not generate code. This is commonly used
+# as a command line option.
+#
+# RTEMS_TEST_NO_PAUSE (RTEMS tests)
+# do not pause between screens of output in the rtems tests
+#
+# RTEMS_DEBUG (RTEMS)
+# If defined, debug checks in RTEMS and support library code are enabled.
+
+define make-target-options
+ @echo "/* #define NDEBUG 1 */ " >>$@
+ @echo "#define RTEMS_TEST_NO_PAUSE 1" >>$@
+ @echo "/* #define RTEMS_DEBUG 1 */" >>$@
+endef
+
+# The following are definitions of make-exe which will work using ld as
+# is currently required. It is expected that as of gcc 2.8, the end user
+# will be able to override parts of the compilers specs and link using gcc.
+
+ifeq ($(RTEMS_USE_GCC272),yes)
+
+define make-exe
+ $(LD) -u _sbrk $(LDFLAGS) -N -T $(LINKCMDS) -o $(basename $@).exe \
+ $(START_FILE) $(LINK_OBJS) --start-group $(LINK_LIBS) --end-group
+ $(NM) -g -n $(basename $@).exe > $(basename $@).num
+ $(SIZE) $(basename $@).exe
+endef
+
+else
+define make-exe
+ $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) \
+ $(LDLIBS) -o $@ \
+ $(LINK_OBJS) $(LINK_LIBS)
+ $(NM) -g -n $@ > $(basename $@).num
+ $(SIZE) $@
+endef
+endif
+
+# Miscellaneous additions go here
+