summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-07-31 18:29:37 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-07-31 18:29:37 +0000
commitcaf8869939b50ffc4e3e090b3572935e21327ae8 (patch)
treebd59aef32f9aeba0762726ca85aa95d54f6ce3ae
parentPatch rtems-rc-20000713-1-cvs.diff from Ralf Corsepius <corsepiu@faw.uni-ulm.de> (diff)
downloadrtems-caf8869939b50ffc4e3e090b3572935e21327ae8.tar.bz2
New bsp for simulator in gdb. Does not work yet.
-rw-r--r--c/src/lib/libbsp/arm/armulator/Makefile.am17
-rw-r--r--c/src/lib/libbsp/arm/armulator/bsp_specs23
-rw-r--r--c/src/lib/libbsp/arm/armulator/clock/.cvsignore2
-rw-r--r--c/src/lib/libbsp/arm/armulator/clock/Makefile.am32
-rw-r--r--c/src/lib/libbsp/arm/armulator/clock/clockdrv.c22
-rw-r--r--c/src/lib/libbsp/arm/armulator/configure.in32
-rw-r--r--c/src/lib/libbsp/arm/armulator/console/.cvsignore2
-rw-r--r--c/src/lib/libbsp/arm/armulator/console/Makefile.am37
-rw-r--r--c/src/lib/libbsp/arm/armulator/console/console-io.c73
-rw-r--r--c/src/lib/libbsp/arm/armulator/console/mon-syscalls.S43
-rw-r--r--c/src/lib/libbsp/arm/armulator/include/.cvsignore2
-rw-r--r--c/src/lib/libbsp/arm/armulator/include/Makefile.am25
-rw-r--r--c/src/lib/libbsp/arm/armulator/include/bsp.h83
-rw-r--r--c/src/lib/libbsp/arm/armulator/start/Makefile.am40
-rw-r--r--c/src/lib/libbsp/arm/armulator/start/start.S244
-rw-r--r--c/src/lib/libbsp/arm/armulator/startup/.cvsignore2
-rw-r--r--c/src/lib/libbsp/arm/armulator/startup/Makefile.am50
-rw-r--r--c/src/lib/libbsp/arm/armulator/startup/bspstart.c95
-rw-r--r--c/src/lib/libbsp/arm/armulator/startup/libcfunc.c40
-rw-r--r--c/src/lib/libbsp/arm/armulator/startup/linkcmds61
-rw-r--r--c/src/lib/libbsp/arm/armulator/startup/swi.h65
-rw-r--r--c/src/lib/libbsp/arm/armulator/startup/syscalls.c172
-rw-r--r--c/src/lib/libbsp/arm/armulator/startup/trap.S93
-rw-r--r--c/src/lib/libbsp/arm/armulator/wrapup/.cvsignore2
-rw-r--r--c/src/lib/libbsp/arm/armulator/wrapup/Makefile.am33
-rw-r--r--make/custom/armulator.cfg53
26 files changed, 1343 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/arm/armulator/Makefile.am b/c/src/lib/libbsp/arm/armulator/Makefile.am
new file mode 100644
index 0000000000..d76b6662be
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/Makefile.am
@@ -0,0 +1,17 @@
+##
+## $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 clock console startup start wrapup
+
+include $(top_srcdir)/../../bsp.am
+
+EXTRA_DIST = bsp_specs
+
+include $(top_srcdir)/../../../../../../automake/subdirs.am
+include $(top_srcdir)/../../../../../../automake/local.am
diff --git a/c/src/lib/libbsp/arm/armulator/bsp_specs b/c/src/lib/libbsp/arm/armulator/bsp_specs
new file mode 100644
index 0000000000..eecf37c5a0
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/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/arm/armulator/clock/.cvsignore b/c/src/lib/libbsp/arm/armulator/clock/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/clock/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/arm/armulator/clock/Makefile.am b/c/src/lib/libbsp/arm/armulator/clock/Makefile.am
new file mode 100644
index 0000000000..7c33173275
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/clock/Makefile.am
@@ -0,0 +1,32 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+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)
+
+EXTRA_DIST = ckinit.c
+
+include $(top_srcdir)/../../../../../../automake/local.am
diff --git a/c/src/lib/libbsp/arm/armulator/clock/clockdrv.c b/c/src/lib/libbsp/arm/armulator/clock/clockdrv.c
new file mode 100644
index 0000000000..c49150fba6
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/clock/clockdrv.c
@@ -0,0 +1,22 @@
+/*
+ * Instantiate the clock driver shell.
+ *
+ * Since there is no clock source on the simulator, all we do is
+ * make sure it will build.
+ *
+ * $Id$
+ */
+
+#define CLOCK_VECTOR 0
+
+#define Clock_driver_support_at_tick()
+
+#define Clock_driver_support_install_isr( _new, _old ) \
+ do { _old = 0; } while(0)
+
+
+#define Clock_driver_support_initialize_hardware()
+
+#define Clock_driver_support_shutdown_hardware()
+
+#include "../../../shared/clockdrv_shell.c"
diff --git a/c/src/lib/libbsp/arm/armulator/configure.in b/c/src/lib/libbsp/arm/armulator/configure.in
new file mode 100644
index 0000000000..6b472d257e
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/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-arm-armulator,$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/arm/armulator/console/.cvsignore b/c/src/lib/libbsp/arm/armulator/console/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/console/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/arm/armulator/console/Makefile.am b/c/src/lib/libbsp/arm/armulator/console/Makefile.am
new file mode 100644
index 0000000000..371c0b2e36
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/console/Makefile.am
@@ -0,0 +1,37 @@
+##
+## $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)
+
+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 = console.c
+
+include $(top_srcdir)/../../../../../../automake/local.am
diff --git a/c/src/lib/libbsp/arm/armulator/console/console-io.c b/c/src/lib/libbsp/arm/armulator/console/console-io.c
new file mode 100644
index 0000000000..da38d8d3c0
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/console/console-io.c
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+extern int armulator_stdin;
+extern int armulator_stdout;
+extern int armulator_stderr;
+
+void console_outbyte_polled(
+ int port,
+ char ch
+)
+{
+ int nwritten;
+ int _swiwrite (int, char *, int);
+
+ nwritten = _swiwrite (armulator_stdout, &ch , 1);
+
+ /* error if (nwritten == -1 || nwritten == len) */
+}
+
+/*
+ * console_inbyte_nonblocking
+ *
+ * This routine polls for a character.
+ */
+
+int console_inbyte_nonblocking(
+ int port
+)
+{
+ int nread;
+ char c;
+ int _swiread (int, char *, int);
+
+ nread = _swiread (armulator_stdin, &c, 1);
+ if ( nread != 1 )
+ return -1;
+
+ return c;
+}
+
+#include <bspIo.h>
+
+void Armulator_BSP_output_char(char c) { console_outbyte_polled( 0, c ); }
+
+BSP_output_char_function_type BSP_output_char = Armulator_BSP_output_char;
+BSP_polling_getchar_function_type BSP_poll_char = NULL;
+
diff --git a/c/src/lib/libbsp/arm/armulator/console/mon-syscalls.S b/c/src/lib/libbsp/arm/armulator/console/mon-syscalls.S
new file mode 100644
index 0000000000..e844274fc8
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/console/mon-syscalls.S
@@ -0,0 +1,43 @@
+#ifdef __STDC__
+# define _C_LABEL(x) _ ## x
+#else
+# define _C_LABEL(x) _/**/x
+#endif
+#define _ASM_LABEL(x) x
+
+#define _ENTRY(name) \
+ .text; .align 4; .globl name; name:
+
+#define ENTRY(name) \
+ _ENTRY(_C_LABEL(name))
+
+
+
+ENTRY(_sys_exit)
+ lda 257,g13
+ calls g13
+
+ENTRY(_sys_open)
+ lda 230,g13
+ calls g13
+ ret
+
+ENTRY(_sys_read)
+ lda 231,g13
+ calls g13
+ ret
+
+ENTRY(_sys_write)
+ lda 232,g13
+ calls g13
+ ret
+
+ENTRY(_sys_lseek)
+ lda 233,g13
+ calls g13
+ ret
+
+ENTRY(_sys_close)
+ lda 234,g13
+ calls g13
+ ret
diff --git a/c/src/lib/libbsp/arm/armulator/include/.cvsignore b/c/src/lib/libbsp/arm/armulator/include/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/include/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/arm/armulator/include/Makefile.am b/c/src/lib/libbsp/arm/armulator/include/Makefile.am
new file mode 100644
index 0000000000..1d6c3074ec
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/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/arm/armulator/include/bsp.h b/c/src/lib/libbsp/arm/armulator/include/bsp.h
new file mode 100644
index 0000000000..d0e0ca66ed
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/include/bsp.h
@@ -0,0 +1,83 @@
+/* bsp.h
+ *
+ * This include file contains some definitions specific to the
+ * ARM simulator in gdb (the ARMulator).
+ *
+ * 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 __ARMULATOR_h
+#define __ARMULATOR_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 not defined 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()
+
+/* 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 );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/lib/libbsp/arm/armulator/start/Makefile.am b/c/src/lib/libbsp/arm/armulator/start/Makefile.am
new file mode 100644
index 0000000000..44e006c298
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/start/Makefile.am
@@ -0,0 +1,40 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+PGM = $(ARCH)/start.o
+
+S_FILES = start.S
+S_O_FILES = $(S_FILES:%.c=$(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 +=
+#
+
+# From newlib
+# Select which debug protocol is being used.
+# ARM_RDP_MONITOR selects the Demon monitor.
+# ARM_RDI_MONITOR selects the Angel monitor.
+# If neither are defined, then hard coded defaults will be used
+# to create the program's environment.
+AM_CPPFLAGS += -DARM_RDI_MONITOR
+
+$(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/arm/armulator/start/start.S b/c/src/lib/libbsp/arm/armulator/start/start.S
new file mode 100644
index 0000000000..727dcc9d61
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/start/start.S
@@ -0,0 +1,244 @@
+#include "../startup/swi.h"
+
+/* ANSI concatenation macros. */
+#define CONCAT(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+#ifdef __USER_LABEL_PREFIX__
+#define FUNCTION( name ) CONCAT (__USER_LABEL_PREFIX__, name)
+#else
+#error __USER_LABEL_PREFIX is not defined
+#endif
+
+/* .text is used instead of .section .text so it works with arm-aout too. */
+ .text
+ .code 32
+ .align 0
+
+ .global _mainCRTStartup
+ .global _start
+ .global start
+start:
+_start:
+_mainCRTStartup:
+
+/* Start by setting up a stack */
+#ifdef ARM_RDP_MONITOR
+ /* Issue Demon SWI to read stack info */
+ swi SWI_GetEnv /* Returns command line in r0 */
+ mov sp,r1 /* and the highest memory address in r1 */
+ ldr sl, .LC2 /* stack limit is at end of data */
+ add sl, sl, #256 /* allow slop for stack overflow handling */
+ /* and small frames */
+#else
+#ifdef ARM_RDI_MONITOR
+ /* Issue Angel SWI to read stack info */
+ mov r0, #AngelSWI_Reason_HeapInfo
+ adr r1, .LC0 /* point at ptr to 4 words to receive data */
+ swi AngelSWI_ARM /* We are always in ARM mode for startup */
+ ldr r0, .LC0 /* point at values read */
+ ldr sp, [r0, #8]
+ ldr sl, [r0, #12]
+ add sl, sl, #256 /* allow slop for stack overflow handling */
+ /* and small frames */
+#else
+ /* Set up the stack pointer to a fixed value */
+ ldr r3, .LC0
+ mov sp, r3
+ /* Setup a default stack-limit in-case the code has been
+ compiled with "-mapcs-stack-check". Hard-wiring this value
+ is not ideal, since there is currently no support for
+ checking that the heap and stack have not collided, or that
+ this default 64k is enough for the program being executed.
+ However, it ensures that this simple crt0 world will not
+ immediately cause an overflow event: */
+ sub sl, sp, #64 << 10 /* Still assumes 256bytes below sl */
+#endif
+#endif
+ mov a2, #0 /* Second arg: fill value */
+ mov fp, a2 /* Null frame pointer */
+ mov r7, a2 /* Null frame pointer for Thumb */
+
+ ldr a1, .LC1 /* First arg: start of memory block */
+ ldr a3, .LC2
+ sub a3, a3, a1 /* Third arg: length of block */
+
+
+#ifdef __thumb__ /* Enter Thumb mode.... */
+
+ add a4, pc, #1 /* Get the address of the Thumb block */
+ bx a4 /* Go there and start Thumb decoding */
+
+ .code 16
+ .global __change_mode
+ .thumb_func
+__change_mode:
+#endif
+
+ bl FUNCTION (memset)
+#if !defined (ARM_RDP_MONITOR) && !defined (ARM_RDI_MONITOR)
+ mov r0, #0 /* no arguments */
+ mov r1, #0 /* no argv either */
+#else
+ /* Need to set up standard file handles */
+ bl FUNCTION (initialize_monitor_handles)
+
+#ifdef ARM_RDP_MONITOR
+ swi SWI_GetEnv /* sets r0 to point to the command line */
+ mov r1, r0
+#else
+ mov r0, #AngelSWI_Reason_GetCmdLine
+ adr r1, .LC30 /* Space for command line */
+ swi AngelSWI
+ ldr r1, .LC30
+#endif
+ /* Parse string at r1 */
+ mov r0, #0 /* count of arguments so far */
+.LC10:
+/* Skip leading blanks */
+#ifdef __thumb__
+ ldrb r3, [r1]
+ add r1, #1
+#else
+ ldrb r3, [r1], #1
+#endif
+ cmp r3, #0
+ beq .LC12
+ cmp r3, #' '
+ beq .LC10
+
+/* See whether we are scanning a string */
+ cmp r3, #'"'
+#ifdef __thumb__
+ beq .LC20
+ cmp r3, #'\''
+ bne .LC21
+.LC20:
+ mov r2, r3
+ b .LC22
+
+.LC21:
+ mov r2, #' ' /* terminator type */
+ sub r1, r1, #1 /* adjust back to point at start char */
+.LC22:
+#else
+ cmpne r3, #'\''
+ moveq r2, r3
+ movne r2, #' ' /* terminator type */
+ subne r1, r1, #1 /* adjust back to point at start char */
+#endif
+
+/* Stack a pointer to the current argument */
+#ifdef __thumb__
+ push {r1}
+#else
+ stmfd sp!, {r1}
+#endif
+ add r0, r0, #1
+.LC11:
+#ifdef __thumb__
+ ldrb r3, [r1]
+ add r1, #1
+#else
+ ldrb r3, [r1], #1
+#endif
+ cmp r3, #0
+ beq .LC12
+ cmp r2, r3 /* reached terminator? */
+ bne .LC11
+ mov r2, #0
+ sub r3, r1, #1
+ strb r2, [r3] /* terminate the arg string */
+ b .LC10
+
+.LC12:
+ mov r1, sp /* point at stacked arg pointers */
+ /* We've now got the stacked args in order reverse the */
+#ifdef __thumb__
+ mov r2, r0
+ lsl r2, #2
+ add r2, sp
+ mov r3, sp
+.LC15: cmp r2, r3
+ bls .LC14
+ sub r2, #4
+ ldr r4, [r2]
+ ldr r5, [r3]
+ str r5, [r2]
+ str r4, [r3]
+ add r3, #4
+ b .LC15
+.LC14:
+#else
+ add r2, sp, r0, LSL #2 /* End of args */
+ mov r3, sp /* Start of args */
+.LC13: cmp r2, r3
+ ldrhi r4,[r2, #-4] /* Reverse ends of list */
+ ldrhi r5, [r3]
+ strhi r5, [r2, #-4]!
+ strhi r4, [r3], #4
+ bhi .LC13
+#endif
+
+#endif
+ bl FUNCTION (main)
+
+ bl FUNCTION (exit) /* Should not return */
+
+#ifdef __thumb__
+ /* Come out of Thumb mode... This code should be redundant... */
+
+ mov a4, pc
+ bx a4
+
+ .code 32
+ .global change_back
+change_back:
+ /* Halt the execution. This code should never be executed. */
+ /*
+ ** With no debug monitor, this probably aborts (eventually).
+ ** With a Demon debug monitor, this halts cleanly.
+ ** With an Angel debug monitor, this will report 'Unknown SWI'.
+ */
+ swi SWI_Exit
+#endif
+
+ /* For Thumb, constants must be after the code since only
+ positive offsets are supported for PC relative addresses. */
+
+ .align 0
+.LC0:
+#ifdef ARM_RDI_MONITOR
+ .word HeapBase
+#else
+#ifndef ARM_RDP_MONITOR
+#ifdef __pe__
+ .word 0x800000
+#else
+/* .word 0x80000 */ /* Top of RAM on the PIE board */
+#endif
+#endif
+#endif
+.LC1:
+ .word _clear_start
+.LC2:
+ .word _clear_end
+
+#ifdef ARM_RDI_MONITOR
+.LC30: .word CommandLine
+
+/* Workspace for Angel calls. */
+ .data
+/* Data returned by monitor SWI */
+HeapBase: .word 0
+HeapLimit: .word 0
+StackBase: .word 0
+StackLimit: .word 0
+CommandLine: .space 256,0 /* Maximum length of 255 chars handled */
+#endif
+
+#ifdef __pe__
+ .section .idata$3
+ .long 0,0,0,0,0,0,0,0
+#endif
+
diff --git a/c/src/lib/libbsp/arm/armulator/startup/.cvsignore b/c/src/lib/libbsp/arm/armulator/startup/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/startup/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/arm/armulator/startup/Makefile.am b/c/src/lib/libbsp/arm/armulator/startup/Makefile.am
new file mode 100644
index 0000000000..35d84913b7
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/startup/Makefile.am
@@ -0,0 +1,50 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+VPATH = @srcdir@:@srcdir@/../../../shared
+
+PGM = $(ARCH)/startup.rel
+
+C_FILES = bsplibc.c bsppost.c bspstart.c bootcard.c main.c sbrk.c \
+ gnatinstallhandler.c libcfunc.c syscalls.c
+C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
+
+S_FILES = trap.S
+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 +=
+#
+
+# From newlib
+# Select which debug protocol is being used.
+# ARM_RDP_MONITOR selects the Demon monitor.
+# ARM_RDI_MONITOR selects the Angel monitor.
+# If neither are defined, then hard coded defaults will be used
+# to create the program's environment.
+AM_CPPFLAGS += -DARM_RDI_MONITOR
+
+$(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/arm/armulator/startup/bspstart.c b/c/src/lib/libbsp/arm/armulator/startup/bspstart.c
new file mode 100644
index 0000000000..cf56f7e60d
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/startup/bspstart.c
@@ -0,0 +1,95 @@
+/*
+ * 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;
+
+ initialize_monitor_handles();
+ Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
+
+/*
+ if ( BSP_Configuration.work_space_size >(512*1024) )
+ abort_program( 1 );
+*/
+
+ BSP_Configuration.work_space_start = (void *) &WorkspaceBase;
+}
diff --git a/c/src/lib/libbsp/arm/armulator/startup/libcfunc.c b/c/src/lib/libbsp/arm/armulator/startup/libcfunc.c
new file mode 100644
index 0000000000..aec84d0f4c
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/startup/libcfunc.c
@@ -0,0 +1,40 @@
+/* Support files for GNU libc. Files in the C namespace go here.
+ Files in the system namespace (ie those that start with an underscore)
+ go in syscalls.c.
+
+ Note: These functions are in a seperate file so that OS providers can
+ overrride the system call stubs (defined in syscalls.c) without having
+ to provide libc funcitons as well. */
+#include "swi.h"
+
+#ifdef ARM_RDI_MONITOR
+
+static inline int
+do_AngelSWI (int reason, void * arg)
+{
+ int value;
+ asm volatile ("mov r0, %1; mov r1, %2; swi %a3; mov %0, r0"
+ : "=r" (value) /* Outputs */
+ : "r" (reason), "r" (arg), "i" (AngelSWI) /* Inputs */
+ : "r0", "r1", "lr"
+ /* Clobbers r0 and r1, and lr if in supervisor mode */);
+ return value;
+}
+#endif /* ARM_RDI_MONITOR */
+
+
+void
+abort_program (void)
+{
+#ifdef ARM_RDI_MONITOR
+ do_AngelSWI (AngelSWI_Reason_ReportException,
+ (void *) ADP_Stopped_RunTimeError);
+#else
+ asm ("mov r0,#17\nswi %a0" :: "i" (SWI_Exit));
+#endif
+}
+
+void
+alarm (void)
+{
+}
diff --git a/c/src/lib/libbsp/arm/armulator/startup/linkcmds b/c/src/lib/libbsp/arm/armulator/startup/linkcmds
new file mode 100644
index 0000000000..d6b6e5f6a5
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/startup/linkcmds
@@ -0,0 +1,61 @@
+/*
+ * $Id$
+ */
+
+/*
+ * Declare some sizes.
+ */
+_RamBase = DEFINED(_RamBase) ? _RamBase : 0x0;
+_RamSize = DEFINED(_RamSize) ? _RamSize : 1M;
+_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
+_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
+
+SECTIONS
+{
+ . = 0x8000;
+ .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__ = .;
+ }
+ . = ALIGN(256) + (. & (256 - 1));
+ .data :
+ {
+ *(.data)
+ CONSTRUCTORS
+ _edata = .;
+ }
+ .bss SIZEOF(.data) + ADDR(.data):
+ {
+ _bss_start = .;
+ _clear_start = .;
+ *(.bss)
+ *(COMMON)
+ . = ALIGN (64);
+ _stack_init = .;
+ . += _StackSize;
+ _clear_end = .;
+ _WorkspaceBase = .;
+ . += 512K; /* reserve some memory for workspace */
+ _HeapBase = .;
+ . += _HeapSize; /* reserve some memory for heap */
+ _end = .;
+ __end = .;
+ }
+}
+
+HeapBase = _HeapBase;
+HeapSize = _HeapSize;
+WorkspaceBase = _WorkspaceBase;
diff --git a/c/src/lib/libbsp/arm/armulator/startup/swi.h b/c/src/lib/libbsp/arm/armulator/startup/swi.h
new file mode 100644
index 0000000000..91fad59121
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/startup/swi.h
@@ -0,0 +1,65 @@
+
+/***************************************************************************\
+* SWI numbers *
+\***************************************************************************/
+
+/* SWI numbers for RDP (Demon) monitor */
+#define SWI_WriteC 0x0
+#define SWI_Write0 0x2
+#define SWI_ReadC 0x4
+#define SWI_CLI 0x5
+#define SWI_GetEnv 0x10
+#define SWI_Exit 0x11
+#define SWI_EnterOS 0x16
+
+#define SWI_GetErrno 0x60
+#define SWI_Clock 0x61
+#define SWI_Time 0x63
+#define SWI_Remove 0x64
+#define SWI_Rename 0x65
+#define SWI_Open 0x66
+
+#define SWI_Close 0x68
+#define SWI_Write 0x69
+#define SWI_Read 0x6a
+#define SWI_Seek 0x6b
+#define SWI_Flen 0x6c
+
+#define SWI_IsTTY 0x6e
+#define SWI_TmpNam 0x6f
+#define SWI_InstallHandler 0x70
+#define SWI_GenerateError 0x71
+
+
+/* Now the SWI numbers and reason codes for RDI (Angel) monitors */
+#define AngelSWI_ARM (0x123456)
+#ifdef __thumb__
+#define AngelSWI (0xAB)
+#else
+#define AngelSWI AngelSWI_ARM
+#endif
+
+/* The reason codes: */
+#define AngelSWI_Reason_Open (0x01)
+#define AngelSWI_Reason_Close (0x02)
+#define AngelSWI_Reason_WriteC (0x03)
+#define AngelSWI_Reason_Write0 (0x04)
+#define AngelSWI_Reason_Write (0x05)
+#define AngelSWI_Reason_Read (0x06)
+#define AngelSWI_Reason_ReadC (0x07)
+#define AngelSWI_Reason_IsTTY (0x09)
+#define AngelSWI_Reason_Seek (0x0A)
+#define AngelSWI_Reason_FLen (0x0C)
+#define AngelSWI_Reason_TmpNam (0x0D)
+#define AngelSWI_Reason_Remove (0x0E)
+#define AngelSWI_Reason_Rename (0x0F)
+#define AngelSWI_Reason_Clock (0x10)
+#define AngelSWI_Reason_Time (0x11)
+#define AngelSWI_Reason_System (0x12)
+#define AngelSWI_Reason_Errno (0x13)
+#define AngelSWI_Reason_GetCmdLine (0x15)
+#define AngelSWI_Reason_HeapInfo (0x16)
+#define AngelSWI_Reason_EnterSVC (0x17)
+#define AngelSWI_Reason_ReportException (0x18)
+#define ADP_Stopped_ApplicationExit ((2 << 16) + 38)
+#define ADP_Stopped_RunTimeError ((2 << 16) + 34)
diff --git a/c/src/lib/libbsp/arm/armulator/startup/syscalls.c b/c/src/lib/libbsp/arm/armulator/startup/syscalls.c
new file mode 100644
index 0000000000..b0a3530739
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/startup/syscalls.c
@@ -0,0 +1,172 @@
+/* Support files for newlib/GDB simulator.
+ * $Id$
+ */
+
+#include <_ansi.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/fcntl.h>
+#include <stdio.h>
+#include <time.h>
+#include <sys/time.h>
+#include <sys/times.h>
+#include <errno.h>
+#include <reent.h>
+#include "swi.h"
+
+int armulator_stdin;
+int armulator_stdout;
+int armulator_stderr;
+
+#ifdef ARM_RDI_MONITOR
+
+static inline int
+do_AngelSWI (int reason, void * arg)
+{
+ int value;
+ asm volatile ("mov r0, %1; mov r1, %2; swi %a3; mov %0, r0"
+ : "=r" (value) /* Outputs */
+ : "r" (reason), "r" (arg), "i" (AngelSWI) /* Inputs */
+ : "r0", "r1", "lr"
+ /* Clobbers r0 and r1, and lr if in supervisor mode */);
+ return value;
+}
+#endif /* ARM_RDI_MONITOR */
+
+void
+initialize_monitor_handles (void)
+{
+ int i;
+
+#ifdef ARM_RDI_MONITOR
+ int volatile block[3];
+
+ block[0] = (int) ":tt";
+ block[2] = 3; /* length of filename */
+ block[1] = 0; /* mode "r" */
+ armulator_stdin = do_AngelSWI (AngelSWI_Reason_Open, block);
+
+ block[0] = (int) ":tt";
+ block[2] = 3; /* length of filename */
+ block[1] = 4; /* mode "w" */
+ armulator_stdout = armulator_stderr = do_AngelSWI (AngelSWI_Reason_Open, block);
+#else
+ int fh;
+ const char * name;
+
+ name = ":tt";
+ asm ("mov r0,%2; mov r1, #0; swi %a1; mov %0, r0"
+ : "=r"(fh)
+ : "i" (SWI_Open),"r"(name)
+ : "r0","r1");
+ armulator_stdin = fh;
+
+ name = ":tt";
+ asm ("mov r0,%2; mov r1, #4; swi %a1; mov %0, r0"
+ : "=r"(fh)
+ : "i" (SWI_Open),"r"(name)
+ : "r0","r1");
+ armulator_stdout = armulator_stderr = fh;
+#endif
+}
+
+/* Returns # chars not! read */
+
+int
+_swiread (int file,
+ char * ptr,
+ int len)
+{
+ int fh = file;
+#ifdef ARM_RDI_MONITOR
+ int block[3];
+
+ block[0] = fh;
+ block[1] = (int) ptr;
+ block[2] = len;
+
+ return do_AngelSWI (AngelSWI_Reason_Read, block);
+#else
+ asm ("mov r0, %1; mov r1, %2;mov r2, %3; swi %a0"
+ : /* No outputs */
+ : "i"(SWI_Read), "r"(fh), "r"(ptr), "r"(len)
+ : "r0","r1","r2");
+#endif
+}
+
+/* Returns #chars not! written */
+int
+_swiwrite (
+ int file,
+ char * ptr,
+ int len)
+{
+ int fh = file;
+#ifdef ARM_RDI_MONITOR
+ int block[3];
+
+ block[0] = fh;
+ block[1] = (int) ptr;
+ block[2] = len;
+
+ return do_AngelSWI (AngelSWI_Reason_Write, block);
+#else
+ asm ("mov r0, %1; mov r1, %2;mov r2, %3; swi %a0"
+ : /* No outputs */
+ : "i"(SWI_Write), "r"(fh), "r"(ptr), "r"(len)
+ : "r0","r1","r2");
+#endif
+}
+
+/*
+ * Move me
+ */
+
+void
+bsp_cleanup (void )
+{
+ /* FIXME: return code is thrown away */
+
+#ifdef ARM_RDI_MONITOR
+ do_AngelSWI (AngelSWI_Reason_ReportException,
+ (void *) ADP_Stopped_ApplicationExit);
+#else
+ asm ("swi %a0" :: "i" (SWI_Exit));
+#endif
+}
+
+/*
+ * Technically could use this as guts of a "real-time clock driver"
+ */
+
+#if 0
+int
+_gettimeofday (struct timeval * tp, struct timezone * tzp)
+{
+
+ if (tp)
+ {
+ /* Ask the host for the seconds since the Unix epoch */
+#ifdef ARM_RDI_MONITOR
+ tp->tv_sec = do_AngelSWI (AngelSWI_Reason_Time,NULL);
+#else
+ {
+ int value;
+ asm ("swi %a1; mov %0, r0" : "=r" (value): "i" (SWI_Time) : "r0");
+ tp->tv_sec = value;
+ }
+#endif
+ tp->tv_usec = 0;
+ }
+
+ /* Return fixed data for the timezone */
+ if (tzp)
+ {
+ tzp->tz_minuteswest = 0;
+ tzp->tz_dsttime = 0;
+ }
+
+ return 0;
+}
+#endif
+
diff --git a/c/src/lib/libbsp/arm/armulator/startup/trap.S b/c/src/lib/libbsp/arm/armulator/startup/trap.S
new file mode 100644
index 0000000000..328fabca5c
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/startup/trap.S
@@ -0,0 +1,93 @@
+ /* Run-time exception support */
+#include "swi.h"
+
+/* .text is used instead of .section .text so it works with arm-aout too. */
+ .text
+ .align 0
+ .global __rt_stkovf_split_big
+ .global __rt_stkovf_split_small
+
+/* The following functions are provided for software stack checking.
+ If hardware stack-checking is being used then the code can be
+ compiled without the PCS entry checks, and simply rely on VM
+ management to extend the stack for a thread.
+
+ The stack extension event occurs when the PCS function entry code
+ would result in a stack-pointer beneath the stack-limit register
+ value. The system relies on the following map:
+
+ +-----------------------------------+ <-- end of stack block
+ | ... |
+ | ... |
+ | active stack |
+ | ... | <-- sp (stack-pointer) somewhere in here
+ | ... |
+ +-----------------------------------+ <-- sl (stack-limit)
+ | stack-extension handler workspace |
+ +-----------------------------------+ <-- base of stack block
+
+ The "stack-extension handler workspace" is an amount of memory in
+ which the stack overflow support code must execute. It must be
+ large enough to deal with the worst case path through the extension
+ code. At the moment the compiler expects this to be AT LEAST
+ 256bytes. It uses this fact to code functions with small local
+ data usage within the overflow space.
+
+ In a true target environment We may need to increase the space
+ between sl and the true limit to allow for the stack extension
+ code, SWI handlers and for undefined instruction handlers of the
+ target environment. */
+
+__rt_stkovf_split_small:
+ mov ip,sp @ Ensure we can calculate the stack required
+ @ and fall through to...
+__rt_stkovf_split_big:
+ @ in: sp = current stack-pointer (beneath stack-limit)
+ @ sl = current stack-limit
+ @ ip = low stack point we require for the current function
+ @ lr = return address into the current function
+ @ fp = frame-pointer
+ @ original sp --> +----------------------------------+
+ @ | pc (12 ahead of PCS entry store) |
+ @ current fp ---> +----------------------------------+
+ @ | lr (on entry) pc (on exit) |
+ @ +----------------------------------+
+ @ | sp ("original sp" on entry) |
+ @ +----------------------------------+
+ @ | fp (on entry to function) |
+ @ +----------------------------------+
+ @ | |
+ @ | ..argument and work registers.. |
+ @ | |
+ @ current sp ---> +----------------------------------+
+ @
+ @ The "current sl" is somewhere between "original sp" and "current sp"
+ @ but above "true sl". The "current sl" should be at least 256bytes
+ @ above the "true sl". The 256byte stack guard should be large enough
+ @ to deal with the worst case function entry stacking (160bytes) plus
+ @ the stack overflow handler stacking requirements, plus the stack
+ @ required for the memory allocation routines.
+ @
+ @ Normal PCS entry (before stack overflow check) can stack 16
+ @ standard registers (64bytes) and 8 floating point registers
+ @ (96bytes). This gives a minimum stack guard of 160bytes (excluding
+ @ the stack required for the code). (Actually only a maximum of
+ @ 14standard registers are ever stacked on entry to a function).
+ @
+ @ NOTE: Structure returns are performed by the caller allocating a
+ @ dummy space on the stack and passing in a "phantom" arg1 into
+ @ the function. This means that we do not need to worry about
+ @ preserving the stack under "sp" even on function return.
+ @
+ @ Code should never poke values beneath sp. The sp register
+ @ should always be "dropped" first to cover the data. This
+ @ protects the data against any events that may try and use
+ @ the stack.
+
+ SUB ip, sp, ip @ extra stack required for function
+ @ Add stack extension code here. If desired a new stack chunk
+ @ can be allocated, and the register state updated suitably.
+
+ @ We now know how much extra stack the function requires.
+ @ Terminate the program for the moment:
+ swi SWI_Exit
diff --git a/c/src/lib/libbsp/arm/armulator/wrapup/.cvsignore b/c/src/lib/libbsp/arm/armulator/wrapup/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/wrapup/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/arm/armulator/wrapup/Makefile.am b/c/src/lib/libbsp/arm/armulator/wrapup/Makefile.am
new file mode 100644
index 0000000000..ae52204fdb
--- /dev/null
+++ b/c/src/lib/libbsp/arm/armulator/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
diff --git a/make/custom/armulator.cfg b/make/custom/armulator.cfg
new file mode 100644
index 0000000000..753acdd2ae
--- /dev/null
+++ b/make/custom/armulator.cfg
@@ -0,0 +1,53 @@
+#
+# Config file for ARMulator
+#
+# $Id$
+#
+
+include $(RTEMS_ROOT)/make/custom/default.cfg
+
+RTEMS_CPU=arm
+RTEMS_CPU_MODEL=arm7tdmi
+
+# This is the actual bsp directory used during the build process.
+RTEMS_BSP_FAMILY=armulator
+
+# This section makes the target dependent options file.
+
+# if defined asserts do not generate code. This is commonly used
+
+define make-target-options
+endef
+
+# This contains the compiler options necessary to select the CPU model
+# and (hopefully) optimize for it.
+#
+#CPU_CFLAGS = -mcpu=arm7tdmi
+CPU_CFLAGS =
+
+# optimize flag: typically -0, could use -O4 or -fast
+# -O4 is ok for RTEMS
+# NOTE2: some level of -O may be actually required by inline assembler (at least
+# -O2 so far.
+# NOTE2 Apparently nobody really knows the status or r2 and r13.
+# As far as I know, small data are pointer impose a very specific compliation
+# model => not used.
+# Currently the sdata2 and sbss2 sections are empty => r2 is not used...
+CFLAGS_OPTIMIZE_V=
+#CFLAGS_OPTIMIZE_V=-O4 -mmultiple -mstring -mstrict-align
+#CFLAGS_OPTIMIZE_V=-O4 -fno-keep-inline-functions -fvolatile-global -fvolatile -mstrict-align -mcpu=750
+
+# debug flags: typically none, but at least -O1 is required due to this
+# BSP using inlined code
+CFLAGS_DEBUG_V = -O1
+#CFLAGS_DEBUG_V = -O1 -mmultiple -mstring -mstrict-align
+
+define make-exe
+# $(CC) -v -static -Wl,-Map -Wl,Mapfile -Wl,-T -Wl,linkcmds -Wl,-N -o $(basename $@).obj $(LINK_OBJS) $(LINK_LIBS)
+ $(LINK.c) $(LDLIBS) -o $@ $(LINK_OBJS) $(LINK_LIBS)
+ $(NM) -g -n $(basename $@).exe > $(basename $@).num
+ $(SIZE) $(basename $@).exe
+
+endef
+
+# Miscellaneous additions go here