[PATCH v2 2/3] Add sample Moxie BSP for GDB sim

Anthony Green green at moxielogic.com
Wed Feb 27 14:11:26 UTC 2013


Signed-off-by: Anthony Green <green at moxielogic.com>
---
 c/src/lib/libbsp/moxie/.cvsignore                  |   8 +
 c/src/lib/libbsp/moxie/ChangeLog                   |   3 +
 c/src/lib/libbsp/moxie/Makefile.am                 |  11 +
 c/src/lib/libbsp/moxie/acinclude.m4                |  10 +
 c/src/lib/libbsp/moxie/configure.ac                |  21 ++
 c/src/lib/libbsp/moxie/moxiesim/.cvsignore         |   8 +
 c/src/lib/libbsp/moxie/moxiesim/ChangeLog          |   7 +
 c/src/lib/libbsp/moxie/moxiesim/Makefile.am        |  49 ++++
 c/src/lib/libbsp/moxie/moxiesim/bsp_specs          |  11 +
 c/src/lib/libbsp/moxie/moxiesim/configure.ac       |  22 ++
 .../lib/libbsp/moxie/moxiesim/console/console-io.c |  67 ++++++
 c/src/lib/libbsp/moxie/moxiesim/console/syscalls.S |  14 ++
 c/src/lib/libbsp/moxie/moxiesim/include/.cvsignore |   5 +
 c/src/lib/libbsp/moxie/moxiesim/include/bsp.h      |  47 ++++
 .../libbsp/moxie/moxiesim/make/custom/moxiesim.cfg |  15 ++
 c/src/lib/libbsp/moxie/moxiesim/preinstall.am      |  67 ++++++
 c/src/lib/libbsp/moxie/moxiesim/start/start.S      |  22 ++
 c/src/lib/libbsp/moxie/moxiesim/startup/__main.c   |  22 ++
 c/src/lib/libbsp/moxie/moxiesim/startup/linkcmds   | 251 +++++++++++++++++++++
 .../moxie/moxiesim/startup/moxiebdinstallirq.c     |  22 ++
 20 files changed, 682 insertions(+)
 create mode 100644 c/src/lib/libbsp/moxie/.cvsignore
 create mode 100644 c/src/lib/libbsp/moxie/ChangeLog
 create mode 100644 c/src/lib/libbsp/moxie/Makefile.am
 create mode 100644 c/src/lib/libbsp/moxie/acinclude.m4
 create mode 100644 c/src/lib/libbsp/moxie/configure.ac
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/.cvsignore
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/ChangeLog
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/Makefile.am
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/bsp_specs
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/configure.ac
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/console/console-io.c
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/console/syscalls.S
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/include/.cvsignore
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/include/bsp.h
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/make/custom/moxiesim.cfg
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/preinstall.am
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/start/start.S
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/startup/__main.c
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/startup/linkcmds
 create mode 100644 c/src/lib/libbsp/moxie/moxiesim/startup/moxiebdinstallirq.c

diff --git a/c/src/lib/libbsp/moxie/.cvsignore b/c/src/lib/libbsp/moxie/.cvsignore
new file mode 100644
index 0000000..baba64e
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/.cvsignore
@@ -0,0 +1,8 @@
+aclocal.m4
+autom4te*.cache
+config.cache
+config.log
+config.status
+configure
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/moxie/ChangeLog b/c/src/lib/libbsp/moxie/ChangeLog
new file mode 100644
index 0000000..ecb4d49
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/ChangeLog
@@ -0,0 +1,3 @@
+2011-06-15  Anthony Green <green at moxielogic.com>
+
+	* All files: Created.
diff --git a/c/src/lib/libbsp/moxie/Makefile.am b/c/src/lib/libbsp/moxie/Makefile.am
new file mode 100644
index 0000000..d8b53da
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/Makefile.am
@@ -0,0 +1,11 @@
+##
+## $Id: Makefile.am,v 1.8 2004/01/13 13:11:05 ralf Exp $
+##
+
+ACLOCAL_AMFLAGS = -I ../../../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/moxie/acinclude.m4 b/c/src/lib/libbsp/moxie/acinclude.m4
new file mode 100644
index 0000000..54c068d
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/acinclude.m4
@@ -0,0 +1,10 @@
+# RTEMS_CHECK_BSPDIR(RTEMS_BSP_FAMILY)
+AC_DEFUN([RTEMS_CHECK_BSPDIR],
+[
+  case "$1" in
+  moxiesim )
+    AC_CONFIG_SUBDIRS([moxiesim]);;
+  *)
+    AC_MSG_ERROR([Invalid BSP]);;
+  esac
+])
diff --git a/c/src/lib/libbsp/moxie/configure.ac b/c/src/lib/libbsp/moxie/configure.ac
new file mode 100644
index 0000000..329fe72
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/configure.ac
@@ -0,0 +1,21 @@
+## Process this file with autoconf to produce a configure script.
+##
+## $Id: configure.ac,v 1.15 2009/11/28 06:28:39 ralf Exp $
+
+AC_PREREQ(2.60)
+AC_INIT([rtems-c-src-lib-libbsp-moxie],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
+AC_CONFIG_SRCDIR([moxiesim])
+RTEMS_TOP(../../../../..)
+
+RTEMS_CANONICAL_TARGET_CPU
+AM_INIT_AUTOMAKE([no-define foreign 1.10])
+AM_MAINTAINER_MODE
+
+RTEMS_ENV_RTEMSBSP
+
+RTEMS_PROJECT_ROOT
+RTEMS_CHECK_BSPDIR([$RTEMS_BSP_FAMILY])
+
+# Explicitly list all Makefiles here
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/c/src/lib/libbsp/moxie/moxiesim/.cvsignore b/c/src/lib/libbsp/moxie/moxiesim/.cvsignore
new file mode 100644
index 0000000..baba64e
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/.cvsignore
@@ -0,0 +1,8 @@
+aclocal.m4
+autom4te*.cache
+config.cache
+config.log
+config.status
+configure
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/moxie/moxiesim/ChangeLog b/c/src/lib/libbsp/moxie/moxiesim/ChangeLog
new file mode 100644
index 0000000..d70c067
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/ChangeLog
@@ -0,0 +1,7 @@
+2013-02-12  Anthony Green <green at moxielogic.com>
+
+	* start/start.S (_start): Modify for newer ABI.
+
+2011-06-15  Anthony Green <green at moxielogic.com>
+
+	* All files: Created.
diff --git a/c/src/lib/libbsp/moxie/moxiesim/Makefile.am b/c/src/lib/libbsp/moxie/moxiesim/Makefile.am
new file mode 100644
index 0000000..8b06280
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/Makefile.am
@@ -0,0 +1,49 @@
+##
+## $Id: Makefile.am,v 1.36 2008/10/02 21:39:40 joel Exp $
+##
+
+ACLOCAL_AMFLAGS = -I ../../../../aclocal
+
+include $(top_srcdir)/../../../../automake/compile.am
+
+include_bspdir = $(includedir)/bsp
+
+dist_project_lib_DATA = bsp_specs
+
+include_HEADERS = include/bsp.h
+include_HEADERS += ../../shared/include/tm27.h
+
+nodist_include_HEADERS = include/bspopts.h
+nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
+DISTCLEANFILES = include/bspopts.h
+
+nodist_include_HEADERS += ../../shared/include/coverhd.h
+
+noinst_LIBRARIES = libbspstart.a
+libbspstart_a_SOURCES = start/start.S
+project_lib_DATA = start.$(OBJEXT)
+
+dist_project_lib_DATA += startup/linkcmds
+
+noinst_LIBRARIES += libbsp.a
+libbsp_a_SOURCES =
+
+# startup
+libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsplibc.c \
+    ../../shared/bsppredriverhook.c ../../shared/bsppretaskinghook.c \
+    ../../shared/bspgetworkarea.c ../../shared/bsppost.c \
+    ../../shared/bspstart.c startup/moxiebdinstallirq.c \
+    ../../shared/bootcard.c ../../shared/sbrk.c \
+    ../../shared/gnatinstallhandler.c startup/__main.c
+# clock
+libbsp_a_SOURCES += ../../shared/clock_driver_simidle.c
+# console
+libbsp_a_SOURCES += ../../shared/console-polled.c console/console-io.c \
+   console/syscalls.S
+# timer
+libbsp_a_SOURCES += ../../shared/timerstub.c
+
+EXTRA_DIST = times
+
+include $(srcdir)/preinstall.am
+include $(top_srcdir)/../../../../automake/local.am
diff --git a/c/src/lib/libbsp/moxie/moxiesim/bsp_specs b/c/src/lib/libbsp/moxie/moxiesim/bsp_specs
new file mode 100644
index 0000000..61018c2
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/bsp_specs
@@ -0,0 +1,11 @@
+%rename endfile old_endfile
+%rename startfile old_startfile
+%rename link old_link
+
+*startfile:
+%{!qrtems: %(old_startfile)} \
+%{!nostdlib: %{qrtems: start.o%s -e _start}}
+
+*link:
+%(old_link) %{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
+
diff --git a/c/src/lib/libbsp/moxie/moxiesim/configure.ac b/c/src/lib/libbsp/moxie/moxiesim/configure.ac
new file mode 100644
index 0000000..25a4097
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/configure.ac
@@ -0,0 +1,22 @@
+## Process this file with autoconf to produce a configure script.
+##
+## $Id: configure.ac,v 1.20 2009/11/28 06:28:39 ralf Exp $
+
+AC_PREREQ(2.60)
+AC_INIT([rtems-c-src-lib-libbsp-moxie-moxiesim],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
+AC_CONFIG_SRCDIR([bsp_specs])
+RTEMS_TOP(../../../../../..)
+
+RTEMS_CANONICAL_TARGET_CPU
+AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.10])
+RTEMS_BSP_CONFIGURE
+
+RTEMS_PROG_CC_FOR_TARGET
+RTEMS_CANONICALIZE_TOOLS
+RTEMS_PROG_CCAS
+
+RTEMS_BSP_CLEANUP_OPTIONS(0, 0)
+
+# Explicitly list all Makefiles here
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/c/src/lib/libbsp/moxie/moxiesim/console/console-io.c b/c/src/lib/libbsp/moxie/moxiesim/console/console-io.c
new file mode 100644
index 0000000..b9f8870
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/console/console-io.c
@@ -0,0 +1,67 @@
+/*
+ *  This file contains the hardware specific portions of the TTY driver
+ *  for the Moxie GDB simulator.
+ *
+ *  COPYRIGHT (c) 2011.
+ *  Anthony Green.
+ * 
+ *  COPYRIGHT (c) 1989-2008.
+ *  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.rtems.com/license/LICENSE.
+ *
+ *  $Id: console-io.c,v 1.10 2008/09/25 13:34:18 joel Exp $
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/*
+ *  console_initialize_hardware
+ *
+ *  This routine initializes the console hardware.
+ *
+ */
+
+void console_initialize_hardware(void)
+{
+  return;
+}
+
+/*
+ *  console_outbyte_polled
+ *
+ *  This routine transmits a character using polling.
+ */
+ssize_t _sys_write(int fd, const void *buf, size_t count);
+void console_outbyte_polled(
+  int  port,
+  char ch
+)
+{
+  _sys_write( 1, &ch, 1 );
+}
+
+/*
+ *  console_inbyte_nonblocking
+ *
+ *  This routine polls for a character.
+ */
+
+int console_inbyte_nonblocking(
+  int port
+)
+{
+  return -1;
+}
+
+#include <rtems/bspIo.h>
+
+void moxiesim_output_char(char c) { console_outbyte_polled( 0, c ); }
+
+BSP_output_char_function_type           BSP_output_char = moxiesim_output_char;
+BSP_polling_getchar_function_type       BSP_poll_char = NULL;
diff --git a/c/src/lib/libbsp/moxie/moxiesim/console/syscalls.S b/c/src/lib/libbsp/moxie/moxiesim/console/syscalls.S
new file mode 100644
index 0000000..90958eb
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/console/syscalls.S
@@ -0,0 +1,14 @@
+/*
+ *  System call support for simulator in gdb.
+ *  Copied from newlib.
+ */
+
+#define	SYS_write	5
+
+	.section .text
+	.align 2
+	.global _sys_write
+_sys_write:
+	swi	SYS_write
+	ret
+	.end
diff --git a/c/src/lib/libbsp/moxie/moxiesim/include/.cvsignore b/c/src/lib/libbsp/moxie/moxiesim/include/.cvsignore
new file mode 100644
index 0000000..eb2d61f
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/include/.cvsignore
@@ -0,0 +1,5 @@
+bspopts.h
+bspopts.h.in
+coverhd.h
+stamp-h
+stamp-h.in
diff --git a/c/src/lib/libbsp/moxie/moxiesim/include/bsp.h b/c/src/lib/libbsp/moxie/moxiesim/include/bsp.h
new file mode 100644
index 0000000..a9b12f1
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/include/bsp.h
@@ -0,0 +1,47 @@
+/*  bsp.h
+ *
+ *  This include file contains some definitions specific to the
+ *  moxie simulator in gdb.
+ *
+ *  COPYRIGHT (c) 1989-1999, 2010.
+ *  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.rtems.com/license/LICENSE.
+ *
+ *  $Id: bsp.h,v 1.17 2008/09/24 21:26:42 joel Exp $
+ */
+
+#ifndef _BSP_H
+#define _BSP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bspopts.h>
+
+#include <rtems.h>
+#include <rtems/iosupp.h>
+#include <rtems/console.h>
+#include <rtems/clockdrv.h>
+
+/* support for simulated clock tick */
+Thread clock_driver_sim_idle_body(uintptr_t);
+#define BSP_IDLE_TASK_BODY clock_driver_sim_idle_body
+
+/*
+ *  Simple spin delay in microsecond units for device drivers.
+ *  This is very dependent on the clock speed of the target.
+ */
+
+#define rtems_bsp_delay( microseconds ) \
+  { \
+  }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/lib/libbsp/moxie/moxiesim/make/custom/moxiesim.cfg b/c/src/lib/libbsp/moxie/moxiesim/make/custom/moxiesim.cfg
new file mode 100644
index 0000000..2229ef9
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/make/custom/moxiesim.cfg
@@ -0,0 +1,15 @@
+#
+#  Config file for the moxie simulator in gdb.
+#
+#  $Id: moxiesxsim.cfg,v 1.2 2009/10/21 10:41:27 ralf Exp $
+#
+
+include $(RTEMS_ROOT)/make/custom/default.cfg
+
+RTEMS_CPU=moxie
+RTEMS_CPU_MODEL=moxie
+
+# optimize flag: typically -O2
+CFLAGS_OPTIMIZE_V = -Os -g -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
\ No newline at end of file
diff --git a/c/src/lib/libbsp/moxie/moxiesim/preinstall.am b/c/src/lib/libbsp/moxie/moxiesim/preinstall.am
new file mode 100644
index 0000000..bdd3a3e
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/preinstall.am
@@ -0,0 +1,67 @@
+## Automatically generated by ampolish3 - Do not edit
+
+if AMPOLISH3
+$(srcdir)/preinstall.am: Makefile.am
+	$(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
+endif
+
+PREINSTALL_DIRS =
+DISTCLEANFILES += $(PREINSTALL_DIRS)
+
+all-local: $(TMPINSTALL_FILES)
+
+TMPINSTALL_FILES =
+CLEANFILES = $(TMPINSTALL_FILES)
+
+all-am: $(PREINSTALL_FILES)
+
+PREINSTALL_FILES =
+CLEANFILES += $(PREINSTALL_FILES)
+
+$(PROJECT_LIB)/$(dirstamp):
+	@$(MKDIR_P) $(PROJECT_LIB)
+	@: > $(PROJECT_LIB)/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
+
+$(PROJECT_INCLUDE)/$(dirstamp):
+	@$(MKDIR_P) $(PROJECT_INCLUDE)
+	@: > $(PROJECT_INCLUDE)/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
+
+$(PROJECT_INCLUDE)/bsp/$(dirstamp):
+	@$(MKDIR_P) $(PROJECT_INCLUDE)/bsp
+	@: > $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+
+$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
+PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
+
+$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
+
+$(PROJECT_INCLUDE)/tm27.h: ../../shared/include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
+
+$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
+
+$(PROJECT_INCLUDE)/bsp/bootcard.h: ../../shared/include/bootcard.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/bootcard.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/bootcard.h
+
+$(PROJECT_INCLUDE)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
+
+$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
+TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
+
+$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
+PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
+
diff --git a/c/src/lib/libbsp/moxie/moxiesim/start/start.S b/c/src/lib/libbsp/moxie/moxiesim/start/start.S
new file mode 100644
index 0000000..3e2e56b
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/start/start.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 2011, 2013  Anthony Green */
+
+/* moxie start up file. */
+
+	.text
+	.global	_start
+_start:
+	ldi.l	$sp, _stack	/* load up stack pointer */
+	xor	$fp, $fp	/* zero fp to allow unwinders to stop */
+	
+	/* zero the bss area */
+	ldi.l	$r0, __bss_start__
+	xor	$r1, $r1
+	ldi.l	$r2, __bss_end__
+	sub.l	$r2, $r0
+	jsra	memset
+
+	ldi.l	$r0, 0x0	# pass in NULL
+	jsra	boot_card
+	jmpa	_start 		# restart
+.Lend:
+	.size	_start,(.Lend-_start)
diff --git a/c/src/lib/libbsp/moxie/moxiesim/startup/__main.c b/c/src/lib/libbsp/moxie/moxiesim/startup/__main.c
new file mode 100644
index 0000000..1db4f51
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/startup/__main.c
@@ -0,0 +1,22 @@
+/*
+ *  Copied from newlib 1.8.2
+ *
+ *  $Id: __main.c,v 1.3 2008/09/14 21:02:10 joel Exp $
+ */
+
+typedef void (*pfunc) (void);
+extern pfunc __ctors[];
+extern pfunc __ctors_end[];
+
+void __main (void)
+{
+  static int initialized;
+  pfunc *p;
+
+  if (initialized)
+    return;
+
+  initialized = 1;
+  for (p = __ctors_end; p > __ctors; )
+    (*--p) ();
+}
diff --git a/c/src/lib/libbsp/moxie/moxiesim/startup/linkcmds b/c/src/lib/libbsp/moxie/moxiesim/startup/linkcmds
new file mode 100644
index 0000000..11a98ba
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/startup/linkcmds
@@ -0,0 +1,251 @@
+/*
+ * The common part of the default linker scripts for standalone
+ * executables running on a Moxie processor.
+ *
+ * Copyright (C) 2008 Anthony Green
+ *
+ * The authors hereby grant permission to use, copy, modify,
+ * distribute, and license this software and its documentation for any
+ * purpose, provided that existing copyright notices are retained in
+ * all copies and that this notice is included verbatim in any
+ * distributions. No written agreement, license, or royalty fee is
+ * required for any of the authorized uses. Modifications to this
+ * software may be copyrighted by their authors and need not follow
+ * the licensing terms described here, provided that the new terms are
+ * clearly indicated on the first page of each file where they apply.
+ */
+
+OUTPUT_FORMAT("elf32-bigmoxie")
+OUTPUT_ARCH(moxie)
+ENTRY(_start)
+
+RamBase = DEFINED(RamBase) ? RamBase : 0x00000000;
+RamSize = DEFINED(RamSize) ? RamSize : 16M;
+HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
+
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = 0x00001000;
+  .interp     : { *(.interp) 	}
+  .hash          : { *(.hash)		}
+  .dynsym        : { *(.dynsym)		}
+  .dynstr        : { *(.dynstr)		}
+  .gnu.version   : { *(.gnu.version)	}
+  .gnu.version_d   : { *(.gnu.version_d)	}
+  .gnu.version_r   : { *(.gnu.version_r)	}
+  .rel.init      : { *(.rel.init)	}
+  .rela.init     : { *(.rela.init)	}
+  .rel.text      :
+    {
+      *(.rel.text)
+      *(.rel.text.*)
+      *(.rel.gnu.linkonce.t*)
+    }
+  .rela.text     :
+    {
+      *(.rela.text)
+      *(.rela.text.*)
+      *(.rela.gnu.linkonce.t*)
+    }
+  .rel.fini      : { *(.rel.fini)	}
+  .rela.fini     : { *(.rela.fini)	}
+  .rel.rodata    :
+    {
+      *(.rel.rodata)
+      *(.rel.rodata.*)
+      *(.rel.gnu.linkonce.r*)
+    }
+  .rela.rodata   :
+    {
+      *(.rela.rodata)
+      *(.rela.rodata.*)
+      *(.rela.gnu.linkonce.r*)
+    }
+  .rel.data      :
+    {
+      *(.rel.data)
+      *(.rel.data.*)
+      *(.rel.gnu.linkonce.d*)
+    }
+  .rela.data     :
+    {
+      *(.rela.data)
+      *(.rela.data.*)
+      *(.rela.gnu.linkonce.d*)
+    }
+  .rel.ctors     : { *(.rel.ctors)	}
+  .rela.ctors    : { *(.rela.ctors)	}
+  .rel.dtors     : { *(.rel.dtors)	}
+  .rela.dtors    : { *(.rela.dtors)	}
+  .rel.got       : { *(.rel.got)		}
+  .rela.got      : { *(.rela.got)		}
+  .rel.sdata     :
+    {
+      *(.rel.sdata)
+      *(.rel.sdata.*)
+      *(.rel.gnu.linkonce.s*)
+    }
+  .rela.sdata     :
+    {
+      *(.rela.sdata)
+      *(.rela.sdata.*)
+      *(.rela.gnu.linkonce.s*)
+    }
+  .rel.sbss      : { *(.rel.sbss)		}
+  .rela.sbss     : { *(.rela.sbss)	}
+  .rel.bss       : { *(.rel.bss)		}
+  .rela.bss      : { *(.rela.bss)		}
+  .rel.plt       : { *(.rel.plt)		}
+  .rela.plt      : { *(.rela.plt)		}
+  .plt      : { *(.plt)	}
+  .text      :
+  {
+    *(.text)
+    *(.text.*)
+    *(.stub)
+
+    /*
+     * Special FreeBSD sysctl sections.
+     */
+    . = ALIGN (16);
+    __start_set_sysctl_set = .;
+    *(set_sysctl_*);
+    __stop_set_sysctl_set = ABSOLUTE(.);
+    *(set_domain_*);
+    *(set_pseudo_*);
+
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+    *(.gnu.linkonce.t*)
+    *(.glue_7t) *(.glue_7)
+  } =0
+  .init          : 
+  { 
+    KEEP (*(.init))
+  } =0
+  _etext = .;
+  PROVIDE (etext = .);
+  .fini      :
+  {
+    KEEP (*(.fini))
+  } =0
+  .rodata   : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) }
+  .rodata1   : { *(.rodata1) }
+  .eh_frame_hdr : { *(.eh_frame_hdr) }
+  /* Adjust the address for the data segment.  We want to adjust up to
+     the same address within the page on the next page up.  */
+  . = ALIGN(256) + (. & (256 - 1));
+  .data    :
+  {
+    *(.data)
+    *(.data.*)
+    *(.gnu.linkonce.d*)
+    SORT(CONSTRUCTORS)
+  }
+  .data1   : { *(.data1) }
+  .eh_frame : { KEEP (*(.eh_frame)) }
+  .gcc_except_table : { *(.gcc_except_table) }
+  .ctors   : 
+  {
+    /* gcc uses crtbegin.o to find the start of
+       the constructors, 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.  */
+    KEEP (*crtbegin.o(.ctors))
+    /* We don't want to include the .ctor section from
+       from the crtend.o file until after the sorted ctors.
+       The .ctor section from the crtend file contains the
+       end of ctors marker and it must be last */
+    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*(.ctors))
+  }
+   .dtors         :
+  {
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*(.dtors))
+  }
+  .jcr            : { KEEP (*(.jcr)) }
+  .got           : { *(.got.plt) *(.got) }
+  .dynamic       : { *(.dynamic) }
+  /* We want the small data sections together, so single-instruction offsets
+     can access them all, and initialized data all before uninitialized, so
+     we can shorten the on-disk segment size.  */
+  .sdata     : 
+  {
+    *(.sdata) 
+    *(.sdata.*)
+    *(.gnu.linkonce.s.*)
+  }
+  _edata = .;
+  PROVIDE (edata = .);
+  __bss_start = .;
+  __bss_start__ = .;
+  .sbss      :
+  {
+    *(.dynsbss)
+    *(.sbss)
+    *(.sbss.*)
+    *(.scommon)
+  }
+  .bss       :
+  {
+   *(.dynbss)
+   *(.bss)
+   *(.bss.*)
+   *(COMMON)
+   /* Align here to ensure that the .bss section occupies space up to
+      _end.  Align after .bss to ensure correct alignment even if the
+      .bss section disappears because there are no input sections.  */
+   . = ALIGN(32 / 8);
+  }
+  . = ALIGN(32 / 8);
+  _end = .;
+  _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
+  PROVIDE (end = .);
+  WorkAreaBase = .;
+  /* Stabs debugging sections.  */
+  .stab 0 : { *(.stab) }
+  .stabstr 0 : { *(.stabstr) }
+  .stab.excl 0 : { *(.stab.excl) }
+  .stab.exclstr 0 : { *(.stab.exclstr) }
+  .stab.index 0 : { *(.stab.index) }
+  .stab.indexstr 0 : { *(.stab.indexstr) }
+  .comment 0 : { *(.comment) }
+  /* DWARF debug sections.
+     Symbols in the DWARF debugging sections are relative to the beginning
+     of the section so we begin them at 0.  */
+  /* DWARF 1 */
+  .debug          0 : { *(.debug) }
+  .line           0 : { *(.line) }
+  /* GNU DWARF 1 extensions */
+  .debug_srcinfo  0 : { *(.debug_srcinfo) }
+  .debug_sfnames  0 : { *(.debug_sfnames) }
+  /* DWARF 1.1 and DWARF 2 */
+  .debug_aranges  0 : { *(.debug_aranges) }
+  .debug_pubnames 0 : { *(.debug_pubnames) }
+  /* DWARF 2 */
+  .debug_info     0 : { *(.debug_info) }
+  .debug_abbrev   0 : { *(.debug_abbrev) }
+  .debug_line     0 : { *(.debug_line) }
+  .debug_frame    0 : { *(.debug_frame) }
+  .debug_str      0 : { *(.debug_str) }
+  .debug_loc      0 : { *(.debug_loc) }
+  .debug_macinfo  0 : { *(.debug_macinfo) }
+  .debug_ranges   0 : { *(.debug_ranges) }
+  /* SGI/MIPS DWARF 2 extensions */
+  .debug_weaknames 0 : { *(.debug_weaknames) }
+  .debug_funcnames 0 : { *(.debug_funcnames) }
+  .debug_typenames 0 : { *(.debug_typenames) }
+  .debug_varnames  0 : { *(.debug_varnames) }
+  .stack 0x400000 : { _stack = .; *(.stack) }
+  /* These must appear regardless of  .  */
+}
diff --git a/c/src/lib/libbsp/moxie/moxiesim/startup/moxiebdinstallirq.c b/c/src/lib/libbsp/moxie/moxiesim/startup/moxiebdinstallirq.c
new file mode 100644
index 0000000..d35234b
--- /dev/null
+++ b/c/src/lib/libbsp/moxie/moxiesim/startup/moxiebdinstallirq.c
@@ -0,0 +1,22 @@
+/*
+ *
+ *  Copyright (c) 2011  Anthony Green
+ *
+ *  COPYRIGHT (c) 1989-2008, 2010.
+ *  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.rtems.com/license/LICENSE.
+ *
+ *  $Id: moxiebdinstallirq.c,v 1.1 2008/09/19 15:50:26 joel Exp $
+ */
+
+#include <rtems.h>
+
+void MOXIEBD_Install_IRQ(
+  uint32_t  	vector,
+  proc_ptr	new_handler,
+  proc_ptr	*old_handler )
+{ /* empty */
+}
-- 
1.8.1.4




More information about the devel mailing list