[rtems commit] powerpc/t32mppc: New BSP

Sebastian Huber sebh at rtems.org
Tue May 22 13:02:23 UTC 2012


Module:    rtems
Branch:    master
Commit:    e21c287cdb7c00a55e232b501f1f20d61bb85f83
Changeset: http://git.rtems.org/rtems/commit/?id=e21c287cdb7c00a55e232b501f1f20d61bb85f83

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon May 21 14:56:31 2012 +0200

powerpc/t32mppc: New BSP

---

 c/src/lib/libbsp/powerpc/acinclude.m4              |    2 +
 c/src/lib/libbsp/powerpc/t32mppc/Makefile.am       |   90 ++++++++++
 c/src/lib/libbsp/powerpc/t32mppc/README            |    5 +
 c/src/lib/libbsp/powerpc/t32mppc/bsp_specs         |   14 ++
 c/src/lib/libbsp/powerpc/t32mppc/configsim.t32     |    7 +
 c/src/lib/libbsp/powerpc/t32mppc/configure.ac      |   28 +++
 .../powerpc/t32mppc/console/console-config.c       |  149 +++++++++++++++++
 c/src/lib/libbsp/powerpc/t32mppc/include/bsp.h     |   36 ++++
 c/src/lib/libbsp/powerpc/t32mppc/include/irq.h     |   33 ++++
 c/src/lib/libbsp/powerpc/t32mppc/init.cmm          |   19 ++
 c/src/lib/libbsp/powerpc/t32mppc/irq/irq.c         |   30 ++++
 .../libbsp/powerpc/t32mppc/make/custom/t32mppc.cfg |    8 +
 c/src/lib/libbsp/powerpc/t32mppc/preinstall.am     |  111 ++++++++++++
 c/src/lib/libbsp/powerpc/t32mppc/start/start.S     |  176 ++++++++++++++++++++
 .../lib/libbsp/powerpc/t32mppc/startup/bspreset.c  |   24 +++
 .../lib/libbsp/powerpc/t32mppc/startup/bspstart.c  |   84 ++++++++++
 .../powerpc/t32mppc/startup/linkcmds.t32mppc       |   23 +++
 c/src/lib/libcpu/powerpc/configure.ac              |    3 +-
 18 files changed, 841 insertions(+), 1 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/acinclude.m4 b/c/src/lib/libbsp/powerpc/acinclude.m4
index 6ea1d33..e46fa2b 100644
--- a/c/src/lib/libbsp/powerpc/acinclude.m4
+++ b/c/src/lib/libbsp/powerpc/acinclude.m4
@@ -34,6 +34,8 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
     AC_CONFIG_SUBDIRS([score603e]);;
   ss555 )
     AC_CONFIG_SUBDIRS([ss555]);;
+  t32mppc )
+    AC_CONFIG_SUBDIRS([t32mppc]);;
   tqm8xx )
     AC_CONFIG_SUBDIRS([tqm8xx]);;
   virtex4 )
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/Makefile.am b/c/src/lib/libbsp/powerpc/t32mppc/Makefile.am
new file mode 100644
index 0000000..864b4c1
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/Makefile.am
@@ -0,0 +1,90 @@
+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
+DISTCLEANFILES = include/bspopts.h
+
+EXTRA_DIST = README
+
+noinst_PROGRAMS =
+
+include_HEADERS += ../../shared/include/coverhd.h
+
+nodist_include_HEADERS += ../../shared/tod.h
+
+include_bsp_HEADERS = include/irq.h \
+	../../shared/include/irq-generic.h \
+	../../shared/include/irq-info.h \
+	../../shared/include/bootcard.h \
+	../../shared/include/utility.h \
+	../shared/include/start.h \
+	../shared/include/tictac.h \
+	../shared/include/linker-symbols.h
+
+noinst_LIBRARIES = libbspstart.a
+libbspstart_a_SOURCES = start/start.S
+project_lib_DATA = start.$(OBJEXT)
+
+libbspstart_a_SOURCES += ../../powerpc/shared/start/rtems_crti.S
+project_lib_DATA += rtems_crti.$(OBJEXT)
+
+dist_project_lib_DATA += startup/linkcmds \
+	../shared/startup/linkcmds.base \
+	startup/linkcmds.t32mppc
+
+noinst_LIBRARIES += libbsp.a
+libbsp_a_SOURCES =
+
+# Startup
+libbsp_a_SOURCES += ../../shared/bsplibc.c \
+	../../shared/bsppost.c \
+	../../shared/bootcard.c \
+	../../shared/bsppretaskinghook.c \
+	../../shared/bsppredriverhook.c \
+	../../shared/sbrk.c \
+	../../shared/gnatinstallhandler.c \
+	../../shared/bspclean.c \
+	../../shared/bspgetworkarea.c \
+	../shared/src/tictac.c \
+	../shared/src/bsp-start-zero.S \
+	startup/bspstart.c \
+	startup/bspreset.c
+
+# Clock
+libbsp_a_SOURCES += ../shared/clock/clock.c
+
+# Timer
+libbsp_a_SOURCES += ../../shared/timerstub.c
+
+# IRQ
+libbsp_a_SOURCES += ../../shared/src/irq-default-handler.c
+libbsp_a_SOURCES += ../../shared/src/irq-generic.c
+libbsp_a_SOURCES += ../../shared/src/irq-info.c
+libbsp_a_SOURCES += ../../shared/src/irq-legacy.c
+libbsp_a_SOURCES += ../../shared/src/irq-server.c
+libbsp_a_SOURCES += ../../shared/src/irq-shell.c
+libbsp_a_SOURCES += irq/irq.c
+
+# Console
+libbsp_a_SOURCES += ../../shared/console.c \
+        ../../shared/console_select.c \
+	console/console-config.c \
+        ../../shared/console_read.c \
+        ../../shared/console_write.c \
+        ../../shared/console_control.c
+
+libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/shared/cpuIdent.rel \
+	../../../libcpu/@RTEMS_CPU@/shared/cache.rel \
+	../../../libcpu/@RTEMS_CPU@/@exceptions@/rtems-cpu.rel \
+	../../../libcpu/@RTEMS_CPU@/@exceptions@/exc_bspsupport.rel
+
+include $(srcdir)/preinstall.am
+include $(top_srcdir)/../../../../automake/local.am
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/README b/c/src/lib/libbsp/powerpc/t32mppc/README
new file mode 100644
index 0000000..cdd44a5
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/README
@@ -0,0 +1,5 @@
+Board support package for the Lauterbach Trace32 PowerPC simulator.
+
+  http://http://www.lauterbach.com
+
+See also files "init.cmm" and "configsim.t32" in this directory.
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/bsp_specs b/c/src/lib/libbsp/powerpc/t32mppc/bsp_specs
new file mode 100644
index 0000000..92f6c58
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/bsp_specs
@@ -0,0 +1,14 @@
+%rename endfile old_endfile
+%rename startfile old_startfile
+%rename link old_link
+
+*startfile:
+%{!qrtems: %(old_startfile)} \
+%{!nostdlib: %{qrtems: ecrti%O%s rtems_crti%O%s  crtbegin.o%s start.o%s}}
+
+*endfile:
+%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s ecrtn.o%s}
+
+*link:
+%{!qrtems: %(old_link)} %{qrtems: -dc -dp -u __vectors -N}
+
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/configsim.t32 b/c/src/lib/libbsp/powerpc/t32mppc/configsim.t32
new file mode 100644
index 0000000..03070f4
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/configsim.t32
@@ -0,0 +1,7 @@
+PBI=SIM
+
+SCREEN=
+FONT=DEC
+FONT=SMALL
+
+HEADER=Simulator
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/configure.ac b/c/src/lib/libbsp/powerpc/t32mppc/configure.ac
new file mode 100644
index 0000000..85b0f2b
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/configure.ac
@@ -0,0 +1,28 @@
+AC_PREREQ(2.60)
+AC_INIT([rtems-c-src-lib-libbsp-powerpc-qoriq],[_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_BSPOPTS_SET_DATA_CACHE_ENABLED([*],[1])
+RTEMS_BSPOPTS_HELP_DATA_CACHE_ENABLED
+
+RTEMS_BSPOPTS_SET_INSTRUCTION_CACHE_ENABLED([*],[1])
+RTEMS_BSPOPTS_HELP_INSTRUCTION_CACHE_ENABLED
+
+RTEMS_CHECK_NETWORKING
+AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
+
+RTEMS_BSP_CLEANUP_OPTIONS(0, 0)
+RTEMS_PPC_EXCEPTIONS
+RTEMS_BSP_LINKCMDS
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/console/console-config.c b/c/src/lib/libbsp/powerpc/t32mppc/console/console-config.c
new file mode 100644
index 0000000..4a7349e
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/console/console-config.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * 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.
+ */
+
+/*
+ * Console driver for Lauterbach Trace32 Simulator.  The implementation is
+ * based on the example in "demo/powerpc/etc/terminal/terminal_mpc85xx.cmm" in
+ * the Trace32 system directory.
+ */
+
+#include <rtems/bspIo.h>
+#include <rtems/libio.h>
+#include <rtems/termiostypes.h>
+
+#include <libchip/serial.h>
+#include <libchip/sersupp.h>
+
+#define CONSOLE_COUNT 1
+
+volatile unsigned char messagebufferin [256];
+
+volatile unsigned char messagebufferout [256];
+
+static void initialize(int minor)
+{
+  /* Nothing to do */
+}
+
+static int first_open(int major, int minor, void *arg)
+{
+  rtems_libio_open_close_args_t *oc = (rtems_libio_open_close_args_t *) arg;
+  struct rtems_termios_tty *tty = (struct rtems_termios_tty *) oc->iop->data1;
+  console_data *cd = &Console_Port_Data [minor];
+
+  cd->termios_data = tty;
+  rtems_termios_set_initial_baud(tty, 115200);
+
+  return 0;
+}
+
+static int last_close(int major, int minor, void *arg)
+{
+  return 0;
+}
+
+static int read_polled(int minor)
+{
+  static int bufsize;
+  static int bufindex;
+
+  int c;
+
+  if (bufsize == 0) {
+    int new_bufsize = messagebufferin [0];
+
+    if (new_bufsize != 0) {
+      bufsize = new_bufsize;
+      bufindex = 0;
+    } else {
+      return -1;
+    }
+  }
+
+  c = messagebufferin [4 + bufindex];
+
+  ++bufindex;
+  if (bufindex >= bufsize) {
+    messagebufferin [0] = 0;
+    bufsize = 0;
+  }
+
+  return c;
+}
+
+static void write_polled(int minor, char c)
+{
+  while (messagebufferout[0] != 0) {
+    /* Wait for ready */
+  }
+
+  messagebufferout [4] = (unsigned char) c;
+  messagebufferout [0] = 1;
+}
+
+static ssize_t write_support_polled(
+  int minor,
+  const char *s,
+  size_t n
+)
+{
+  ssize_t i = 0;
+
+  for (i = 0; i < n; ++i) {
+    write_polled(minor, s [i]);
+  }
+
+  return n;
+}
+
+static int set_attribues(int minor, const struct termios *term)
+{
+  return -1;
+}
+
+static console_fns t32mppc_console_fns = {
+  .deviceProbe = libchip_serial_default_probe,
+  .deviceFirstOpen = first_open,
+  .deviceLastClose = last_close,
+  .deviceRead = read_polled,
+  .deviceWrite = write_support_polled,
+  .deviceInitialize = initialize,
+  .deviceWritePolled = write_polled,
+  .deviceSetAttributes = set_attribues,
+  .deviceOutputUsesInterrupts = false
+};
+
+unsigned long Console_Configuration_Count = CONSOLE_COUNT;
+
+console_tbl Console_Configuration_Ports [CONSOLE_COUNT] = {
+  {
+    .sDeviceName = "/dev/ttyS0",
+    .deviceType = SERIAL_CUSTOM,
+    .pDeviceFns = &t32mppc_console_fns
+  }
+};
+
+static void output_char(char c)
+{
+  const console_fns *con = Console_Port_Tbl [Console_Port_Minor]->pDeviceFns;
+
+  if (c == '\n') {
+    con->deviceWritePolled((int) Console_Port_Minor, '\r');
+  }
+  con->deviceWritePolled((int) Console_Port_Minor, c);
+}
+
+BSP_output_char_function_type BSP_output_char = output_char;
+
+BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/include/bsp.h b/c/src/lib/libbsp/powerpc/t32mppc/include/bsp.h
new file mode 100644
index 0000000..5266fea
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/include/bsp.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * 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.
+ */
+
+#ifndef LIBBSP_POWERPC_T32MPPC_BSP_H
+#define LIBBSP_POWERPC_T32MPPC_BSP_H
+
+#include <bspopts.h>
+
+#ifndef ASM
+
+#include <rtems.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define BSP_FEATURE_IRQ_EXTENSION
+
+#endif /* ASM */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LIBBSP_POWERPC_T32MPPC_BSP_H */
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/include/irq.h b/c/src/lib/libbsp/powerpc/t32mppc/include/irq.h
new file mode 100644
index 0000000..1055901
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/include/irq.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * 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.
+ */
+
+#ifndef LIBBSP_POWERPC_T32MPPC_IRQ_H
+#define LIBBSP_POWERPC_T32MPPC_IRQ_H
+
+#include <rtems.h>
+#include <rtems/irq.h>
+#include <rtems/irq-extension.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define BSP_INTERRUPT_VECTOR_MIN 0
+#define BSP_INTERRUPT_VECTOR_MAX 0
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LIBBSP_POWERPC_T32MPPC_IRQ_H */
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/init.cmm b/c/src/lib/libbsp/powerpc/t32mppc/init.cmm
new file mode 100644
index 0000000..019fd2c
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/init.cmm
@@ -0,0 +1,19 @@
+; Set CPU
+system.cpu mpc8540
+system.up
+
+; Set PVR
+per.s spr:0x11f %long %be 0x80200000
+
+; Load application
+Data.LOAD.Elf /home/sh/build/t32mppc/powerpc-rtems4.11/c/t32mppc/testsuites/samples/ticker/ticker.exe
+
+; Configure memory-based terminal
+term.reset
+term.method buffere v.address("messagebufferout") v.address("messagebufferin") 
+term.gate
+ 
+; Initialize RTOS support
+task.config ~~/demo/powerpc/kernel/rtems/rtems.t32
+menu.reprogram ~~/demo/powerpc/kernel/rtems/rtems.men
+task.stack.pattern 0xa5
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/irq/irq.c b/c/src/lib/libbsp/powerpc/t32mppc/irq/irq.c
new file mode 100644
index 0000000..55b22c7
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/irq/irq.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * 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.
+ */
+
+#include <bsp/irq-generic.h>
+
+rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+{
+	return RTEMS_INVALID_ID;
+}
+
+rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+{
+	return RTEMS_INVALID_ID;
+}
+
+rtems_status_code bsp_interrupt_facility_initialize(void)
+{
+	return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/make/custom/t32mppc.cfg b/c/src/lib/libbsp/powerpc/t32mppc/make/custom/t32mppc.cfg
new file mode 100644
index 0000000..df05c44
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/make/custom/t32mppc.cfg
@@ -0,0 +1,8 @@
+include $(RTEMS_ROOT)/make/custom/default.cfg
+
+RTEMS_CPU = powerpc
+
+CPU_CFLAGS = -mcpu=8540 -meabi -msdata -fno-common -msoft-float \
+	-D__ppc_generic
+
+CFLAGS_OPTIMIZE_V = -O2 -g
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/preinstall.am b/c/src/lib/libbsp/powerpc/t32mppc/preinstall.am
new file mode 100644
index 0000000..2d73712
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/preinstall.am
@@ -0,0 +1,111 @@
+## 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)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
+
+$(PROJECT_INCLUDE)/tod.h: ../../shared/tod.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tod.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/tod.h
+
+$(PROJECT_INCLUDE)/bsp/irq.h: include/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
+
+$(PROJECT_INCLUDE)/bsp/irq-generic.h: ../../shared/include/irq-generic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-generic.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-generic.h
+
+$(PROJECT_INCLUDE)/bsp/irq-info.h: ../../shared/include/irq-info.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-info.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-info.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)/bsp/utility.h: ../../shared/include/utility.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/utility.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/utility.h
+
+$(PROJECT_INCLUDE)/bsp/start.h: ../shared/include/start.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/start.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/start.h
+
+$(PROJECT_INCLUDE)/bsp/tictac.h: ../shared/include/tictac.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/tictac.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/tictac.h
+
+$(PROJECT_INCLUDE)/bsp/linker-symbols.h: ../shared/include/linker-symbols.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/linker-symbols.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/linker-symbols.h
+
+$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
+TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
+
+$(PROJECT_LIB)/rtems_crti.$(OBJEXT): rtems_crti.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/rtems_crti.$(OBJEXT)
+TMPINSTALL_FILES += $(PROJECT_LIB)/rtems_crti.$(OBJEXT)
+
+$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
+PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
+
+$(PROJECT_LIB)/linkcmds.base: ../shared/startup/linkcmds.base $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.base
+PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.base
+
+$(PROJECT_LIB)/linkcmds.t32mppc: startup/linkcmds.t32mppc $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.t32mppc
+PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.t32mppc
+
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/start/start.S b/c/src/lib/libbsp/powerpc/t32mppc/start/start.S
new file mode 100644
index 0000000..466e42f
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/start/start.S
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * 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.
+ */
+
+#include <bspopts.h>
+
+#include <libcpu/powerpc-utility.h>
+
+#include <bsp/vectors.h>
+
+	.globl _start
+	.globl bsp_exc_vector_base
+
+	.section ".bsp_start_text", "ax"
+
+_start:
+	/* Enable time base */
+	li	r0, 0x4000
+	mtspr	HID0, r0
+
+	/* Initialize start stack */
+	LWI	r1, start_stack_end
+	subi	r1, r1, 16
+	li	r0, 0
+	stw	r0, 0(r1)
+
+	/* Copy fast text */
+	LWI	r3, bsp_section_fast_text_begin
+	LWI	r4, bsp_section_fast_text_load_begin
+	LWI	r5, bsp_section_fast_text_size
+	bl	copy
+
+	/* Copy read-only data */
+	LWI	r3, bsp_section_rodata_begin
+	LWI	r4, bsp_section_rodata_load_begin
+	LWI	r5, bsp_section_rodata_size
+	bl	copy
+
+	/* Copy fast data */
+	LWI	r3, bsp_section_fast_data_begin
+	LWI	r4, bsp_section_fast_data_load_begin
+	LWI	r5, bsp_section_fast_data_size
+	bl	copy
+
+	/* Copy data */
+	LWI	r3, bsp_section_data_begin
+	LWI	r4, bsp_section_data_load_begin
+	LWI	r5, bsp_section_data_size
+	bl	copy
+
+	/* Clear SBSS */
+	LWI	r3, bsp_section_sbss_begin
+	LWI	r4, bsp_section_sbss_size
+	bl	bsp_start_zero
+
+	/* Clear BSS */
+	LWI	r3, bsp_section_bss_begin
+	LWI	r4, bsp_section_bss_size
+	bl	bsp_start_zero
+
+	/* Set up EABI and SYSV environment */
+	bl	__eabi
+
+	/* Clear command line */
+	li	r3, 0
+
+	bl	boot_card
+
+twiddle:
+	b	twiddle
+
+copy:
+	cmpw	r3, r4
+	beqlr
+	b	memcpy
+
+	/* Exception vector prologues area */
+	.section ".bsp_start_text", "ax"
+	.align 4
+bsp_exc_vector_base:
+	stw	r1, ppc_exc_lock_crit at sdarel(r13)
+	stw	r4, ppc_exc_vector_register_crit at sdarel(r13)
+	li	r4, -32767
+	b	ppc_exc_wrap_bookE_crit
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 2
+	b	ppc_exc_wrap_nopush_e500_mchk
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 3
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 4
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -PPC_EXC_MINIMAL_FRAME_SIZE(r1)
+	stw	r4, PPC_EXC_VECTOR_PROLOGUE_OFFSET(r1)
+	li	r4, -32763
+	b	ppc_exc_wrap_async_normal
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 6
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 7
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 8
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 12
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 24
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -PPC_EXC_MINIMAL_FRAME_SIZE(r1)
+	stw	r4, PPC_EXC_VECTOR_PROLOGUE_OFFSET(r1)
+	li	r4, -32752
+	b	ppc_exc_wrap_async_normal
+	stwu	r1, -PPC_EXC_MINIMAL_FRAME_SIZE(r1)
+	stw	r4, PPC_EXC_VECTOR_PROLOGUE_OFFSET(r1)
+	li	r4, -32749
+	b	ppc_exc_wrap_async_normal
+	stw	r1, ppc_exc_lock_crit at sdarel(r13)
+	stw	r4, ppc_exc_vector_register_crit at sdarel(r13)
+	li	r4, -32748
+	b	ppc_exc_wrap_bookE_crit
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 18
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 17
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 13
+	b	ppc_exc_wrap_nopush_bookE_crit
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 10
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 25
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 26
+	b	ppc_exc_wrap_nopush_std
+	stwu	r1, -EXC_GENERIC_SIZE(r1)
+	stw	r4, GPR4_OFFSET(r1)
+	li	r4, 15
+	b	ppc_exc_wrap_nopush_std
+
+	/* Start stack area */
+	.section ".bsp_rwextra", "aw", @nobits
+	.align 4
+	.space 4096
+start_stack_end:
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/startup/bspreset.c b/c/src/lib/libbsp/powerpc/t32mppc/startup/bspreset.c
new file mode 100644
index 0000000..ba1f4d8
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/startup/bspreset.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * 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.
+ */
+
+#include <stdbool.h>
+
+#include <bsp/bootcard.h>
+
+void bsp_reset(void)
+{
+  while (true) {
+    /* Do nothing */
+  }
+}
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/startup/bspstart.c b/c/src/lib/libbsp/powerpc/t32mppc/startup/bspstart.c
new file mode 100644
index 0000000..b856c8d
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/startup/bspstart.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * 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.
+ */
+
+#include <rtems/config.h>
+
+#include <bsp.h>
+#include <bsp/vectors.h>
+#include <bsp/bootcard.h>
+#include <bsp/irq-generic.h>
+#include <bsp/linker-symbols.h>
+
+LINKER_SYMBOL(bsp_exc_vector_base);
+
+/*
+ * Configuration parameter for clock driver.  The Trace32 PowerPC simulator has
+ * an odd decrementer frequency.  The time base frequency is one tick per
+ * instruction.  The decrementer frequency is one tick per ten instructions.
+ * The clock driver assumes that the time base and decrementer frequencies are
+ * equal.  For now we simulate processor that issues 10000000 instructions per
+ * second.
+ */
+uint32_t bsp_time_base_frequency = 10000000 / 10;
+
+void BSP_panic(char *s)
+{
+  rtems_interrupt_level level;
+
+  rtems_interrupt_disable(level);
+
+  printk("%s PANIC %s\n", rtems_get_version_string(), s);
+
+  while (1) {
+    /* Do nothing */
+  }
+}
+
+void _BSP_Fatal_error(unsigned n)
+{
+  rtems_interrupt_level level;
+
+  rtems_interrupt_disable(level);
+
+  printk("%s PANIC ERROR %u\n", rtems_get_version_string(), n);
+
+  while (1) {
+    /* Do nothing */
+  }
+}
+
+void bsp_start(void)
+{
+  rtems_status_code sc;
+
+  get_ppc_cpu_type();
+  get_ppc_cpu_revision();
+
+  /* Initialize exception handler */
+  ppc_exc_vector_base = (uint32_t) bsp_exc_vector_base;
+  sc = ppc_exc_initialize(
+    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
+    (uintptr_t) bsp_section_work_begin,
+    Configuration.interrupt_stack_size
+  );
+  if (sc != RTEMS_SUCCESSFUL) {
+    BSP_panic("cannot initialize exceptions");
+  }
+
+  /* Initalize interrupt support */
+  sc = bsp_interrupt_initialize();
+  if (sc != RTEMS_SUCCESSFUL) {
+    BSP_panic("cannot initialize interrupts\n");
+  }
+}
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/startup/linkcmds.t32mppc b/c/src/lib/libbsp/powerpc/t32mppc/startup/linkcmds.t32mppc
new file mode 100644
index 0000000..88e3b43
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/t32mppc/startup/linkcmds.t32mppc
@@ -0,0 +1,23 @@
+MEMORY {
+	RAM : ORIGIN = 0x0, LENGTH = 128M
+	NIRVANA : ORIGIN = 0x0, LENGTH = 0
+}
+
+REGION_ALIAS ("REGION_START", RAM);
+REGION_ALIAS ("REGION_FAST_TEXT", RAM);
+REGION_ALIAS ("REGION_FAST_TEXT_LOAD", RAM);
+REGION_ALIAS ("REGION_TEXT", RAM);
+REGION_ALIAS ("REGION_TEXT_LOAD", RAM);
+REGION_ALIAS ("REGION_RODATA", RAM);
+REGION_ALIAS ("REGION_RODATA_LOAD", RAM);
+REGION_ALIAS ("REGION_FAST_DATA", RAM);
+REGION_ALIAS ("REGION_FAST_DATA_LOAD", RAM);
+REGION_ALIAS ("REGION_DATA", RAM);
+REGION_ALIAS ("REGION_DATA_LOAD", RAM);
+REGION_ALIAS ("REGION_BSS", RAM);
+REGION_ALIAS ("REGION_RWEXTRA", RAM);
+REGION_ALIAS ("REGION_WORK", RAM);
+REGION_ALIAS ("REGION_STACK", RAM);
+REGION_ALIAS ("REGION_NOCACHE", RAM);
+
+INCLUDE linkcmds.base
diff --git a/c/src/lib/libcpu/powerpc/configure.ac b/c/src/lib/libcpu/powerpc/configure.ac
index 79cc583..62441b9 100644
--- a/c/src/lib/libcpu/powerpc/configure.ac
+++ b/c/src/lib/libcpu/powerpc/configure.ac
@@ -20,7 +20,8 @@ RTEMS_CANONICALIZE_TOOLS
 RTEMS_PROG_CCAS
 
 AM_CONDITIONAL(shared, \
-   test "$RTEMS_CPU_MODEL" = "mpc750" \
+   test "$RTEMS_CPU_MODEL" = "" \
+|| test "$RTEMS_CPU_MODEL" = "mpc750" \
 || test "$RTEMS_CPU_MODEL" = "mpc7400" \
 || test "$RTEMS_CPU_MODEL" = "mpc7455" \
 || test "$RTEMS_CPU_MODEL" = "mpc7457" \




More information about the vc mailing list