[PATCH 15/18] bsp/altera-cyclone-v: New BSP

Ralf Kirchner ralf.kirchner at embedded-brains.de
Fri Mar 7 13:59:19 UTC 2014


From: Sebastian Huber <sebastian.huber at embedded-brains.de>

---
 c/src/lib/libbsp/arm/acinclude.m4                  |    2 +
 c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am  |  184 ++++++++++++++++
 c/src/lib/libbsp/arm/altera-cyclone-v/bsp_specs    |   13 ++
 c/src/lib/libbsp/arm/altera-cyclone-v/configure.ac |   47 ++++
 .../arm/altera-cyclone-v/console/console-config.c  |   99 +++++++++
 .../lib/libbsp/arm/altera-cyclone-v/include/bsp.h  |   55 +++++
 .../lib/libbsp/arm/altera-cyclone-v/include/irq.h  |  100 +++++++++
 .../lib/libbsp/arm/altera-cyclone-v/include/tm27.h |   24 +++
 .../arm/altera-cyclone-v/make/custom/altcycv.inc   |    8 +
 .../make/custom/altcycv_devkit.cfg                 |    1 +
 .../make/custom/altcycv_devkit_smp.cfg             |    1 +
 .../lib/libbsp/arm/altera-cyclone-v/preinstall.am  |  224 ++++++++++++++++++++
 .../libbsp/arm/altera-cyclone-v/startup/bspreset.c |   26 +++
 .../libbsp/arm/altera-cyclone-v/startup/bspstart.c |   27 +++
 .../arm/altera-cyclone-v/startup/bspstarthooks.c   |  107 ++++++++++
 .../arm/altera-cyclone-v/startup/linkcmds.altcycv  |   26 +++
 .../startup/linkcmds.altcycv_devkit                |    6 +
 .../startup/linkcmds.altcycv_devkit_smp            |    3 +
 18 Dateien geändert, 953 Zeilen hinzugefügt(+)
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/README
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/bsp_specs
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/configure.ac
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/console/console-config.c
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/include/bsp.h
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/include/irq.h
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/include/tm27.h
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv.inc
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv_devkit.cfg
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv_devkit_smp.cfg
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspreset.c
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstart.c
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstarthooks.c
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv_devkit
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv_devkit_smp

diff --git a/c/src/lib/libbsp/arm/acinclude.m4 b/c/src/lib/libbsp/arm/acinclude.m4
index b800a60..b4a597d 100644
--- a/c/src/lib/libbsp/arm/acinclude.m4
+++ b/c/src/lib/libbsp/arm/acinclude.m4
@@ -2,6 +2,8 @@
 AC_DEFUN([RTEMS_CHECK_BSPDIR],
 [
   case "$1" in
+  altera-cyclone-v )
+    AC_CONFIG_SUBDIRS([altera-cyclone-v]);;
   csb336 )
     AC_CONFIG_SUBDIRS([csb336]);;
   csb337 )
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
new file mode 100644
index 0000000..e552f23
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
@@ -0,0 +1,184 @@
+##
+#
+# @file
+#
+# @brief Makefile of LibBSP for the Altera Cyclone-V platform.
+#
+
+ACLOCAL_AMFLAGS = -I ../../../../aclocal
+
+include $(top_srcdir)/../../../../automake/compile.am
+
+include_bspdir = $(includedir)/bsp
+include_libcpudir = $(includedir)/libcpu
+
+dist_project_lib_DATA = bsp_specs
+
+###############################################################################
+#                  Header                                                     #
+###############################################################################
+
+include_HEADERS = include/bsp.h
+include_HEADERS += include/tm27.h
+
+nodist_include_HEADERS = ../../shared/include/coverhd.h \
+	include/bspopts.h
+
+nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
+
+include_bsp_HEADERS =
+include_bsp_HEADERS += ../../shared/include/utility.h
+include_bsp_HEADERS += ../../shared/include/irq-generic.h
+include_bsp_HEADERS += ../../shared/include/irq-info.h
+include_bsp_HEADERS += ../../shared/include/stackalloc.h
+include_bsp_HEADERS += ../../shared/tod.h
+include_bsp_HEADERS += ../shared/include/start.h
+include_bsp_HEADERS += ../shared/include/arm-a9mpcore-irq.h
+include_bsp_HEADERS += ../shared/include/arm-a9mpcore-regs.h
+include_bsp_HEADERS += ../shared/include/arm-a9mpcore-start.h
+include_bsp_HEADERS += ../shared/include/arm-cp15-start.h
+include_bsp_HEADERS += ../shared/include/arm-gic.h
+include_bsp_HEADERS += ../shared/include/arm-gic-irq.h
+include_bsp_HEADERS += ../shared/include/arm-gic-regs.h
+include_bsp_HEADERS += ../shared/include/arm-gic-tm27.h
+include_bsp_HEADERS += include/irq.h
+
+# Altera hwlib
+include_bsp_HEADERS += hwlib/include/alt_16550_uart.h
+include_bsp_HEADERS += hwlib/include/alt_address_space.h
+include_bsp_HEADERS += hwlib/include/alt_bridge_manager.h
+include_bsp_HEADERS += hwlib/include/alt_clock_group.h
+include_bsp_HEADERS += hwlib/include/alt_clock_manager.h
+include_bsp_HEADERS += hwlib/include/alt_dma_common.h
+include_bsp_HEADERS += hwlib/include/alt_dma_program.h
+include_bsp_HEADERS += hwlib/include/alt_dma.h
+include_bsp_HEADERS += hwlib/include/alt_fpga_manager.h
+include_bsp_HEADERS += hwlib/include/alt_generalpurpose_io.h
+include_bsp_HEADERS += hwlib/include/alt_globaltmr.h
+include_bsp_HEADERS += hwlib/include/alt_hwlibs_ver.h
+include_bsp_HEADERS += hwlib/include/alt_interrupt_common.h
+include_bsp_HEADERS += hwlib/include/alt_mpu_registers.h
+include_bsp_HEADERS += hwlib/include/alt_reset_manager.h
+include_bsp_HEADERS += hwlib/include/alt_system_manager.h
+include_bsp_HEADERS += hwlib/include/alt_timers.h
+include_bsp_HEADERS += hwlib/include/alt_watchdog.h
+include_bsp_HEADERS += hwlib/include/hwlib.h
+#The following Altera hwlib headers would be problematic with RTEMS:
+#include_bsp_HEADERS += hwlib/include/alt_interrupt.h
+
+include_libcpu_HEADERS = ../../../libcpu/arm/shared/include/arm-cp15.h
+
+
+
+###############################################################################
+#                  Data                                                       #
+###############################################################################
+
+noinst_LIBRARIES = libbspstart.a
+
+libbspstart_a_SOURCES = ../shared/start/start.S
+
+project_lib_DATA = start.$(OBJEXT)
+
+project_lib_DATA += startup/linkcmds
+project_lib_DATA += startup/linkcmds.altcycv
+project_lib_DATA += startup/linkcmds.altcycv_devkit
+project_lib_DATA += startup/linkcmds.altcycv_devkit_smp
+
+###############################################################################
+#                  LibBSP                                                     #
+###############################################################################
+
+noinst_LIBRARIES += libbsp.a
+
+libbsp_a_SOURCES =
+libbsp_a_CPPFLAGS =
+libbsp_a_LIBADD =
+
+# for the Altera hwlib
+libbsp_a_CPPFLAGS += -I ${srcdir}/hwlib/include
+libbsp_a_CPPFLAGS += -std=gnu99
+
+# hwlib from Altera
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_16550_uart.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_address_space.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_bridge_manager.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_clock_manager.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_dma_program.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_dma.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_fpga_manager.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_generalpurpose_io.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_globaltmr.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_reset_manager.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_system_manager.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_timers.c
+libbsp_a_SOURCES += hwlib/src/hwmgr/alt_watchdog.c
+# The following Altera hwlib source files would be problematic with RTEMS:
+#libbsp_a_SOURCES += hwlib/src/hwmgr/alt_interrupt.c
+
+
+# Shared
+libbsp_a_SOURCES += ../../shared/bootcard.c
+libbsp_a_SOURCES += ../../shared/bspclean.c
+libbsp_a_SOURCES += ../../shared/bspgetworkarea.c
+libbsp_a_SOURCES += ../../shared/bsplibc.c
+libbsp_a_SOURCES += ../../shared/bsppost.c
+libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
+libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
+libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
+libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
+libbsp_a_SOURCES += ../../shared/sbrk.c
+libbsp_a_SOURCES += ../../shared/timerstub.c
+libbsp_a_SOURCES += ../../shared/src/stackalloc.c
+libbsp_a_SOURCES += ../shared/abort/simple_abort.c
+libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
+libbsp_a_SOURCES += ../shared/arm-cp15-set-exception-handler.c
+libbsp_a_SOURCES += ../shared/arm-cp15-set-ttb-entries.c
+
+# Startup
+libbsp_a_SOURCES += startup/bspreset.c
+libbsp_a_SOURCES += startup/bspstart.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 += ../shared/arm-gic-irq.c
+
+# Console
+libbsp_a_SOURCES += ../../shared/console.c
+libbsp_a_SOURCES += ../../shared/console_control.c
+libbsp_a_SOURCES += ../../shared/console_read.c
+libbsp_a_SOURCES += ../../shared/console_select_simple.c
+libbsp_a_SOURCES += ../../shared/console_write.c
+libbsp_a_SOURCES += console/console-config.c
+
+# Clock
+libbsp_a_SOURCES += ../../shared/clockdrv_shell.h
+libbsp_a_SOURCES += ../shared/arm-a9mpcore-clock-config.c
+
+# Cache
+libbsp_a_SOURCES += ../../../libcpu/shared/src/cache_manager.c
+libbsp_a_SOURCES += ../../../libcpu/arm/shared/include/cache_.h
+libbsp_a_CPPFLAGS += -I$(srcdir)/../../../libcpu/arm/shared/include
+#libbsp_a_CPPFLAGS += -I$(srcdir)/startup/linux
+#libbsp_a_SOURCES += startup/linux/cache-l2x0.c
+
+# Start hooks
+libbsp_a_SOURCES += startup/bspstarthooks.c
+
+if HAS_SMP
+libbsp_a_SOURCES += ../shared/arm-a9mpcore-smp.c
+endif
+
+###############################################################################
+#                  Special Rules                                              #
+###############################################################################
+
+DISTCLEANFILES = include/bspopts.h
+
+include $(srcdir)/preinstall.am
+include $(top_srcdir)/../../../../automake/local.am
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/README b/c/src/lib/libbsp/arm/altera-cyclone-v/README
new file mode 100644
index 0000000..e69de29
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/bsp_specs b/c/src/lib/libbsp/arm/altera-cyclone-v/bsp_specs
new file mode 100644
index 0000000..082653a
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/bsp_specs
@@ -0,0 +1,13 @@
+%rename endfile old_endfile
+%rename startfile old_startfile
+%rename link old_link
+
+*startfile:
+%{!qrtems: %(old_startfile)} \
+%{!nostdlib: %{qrtems: start.o%s crti.o%s crtbegin.o%s -e _start}}
+
+*link:
+%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
+
+*endfile:
+%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/configure.ac b/c/src/lib/libbsp/arm/altera-cyclone-v/configure.ac
new file mode 100644
index 0000000..bcf5b10
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/configure.ac
@@ -0,0 +1,47 @@
+##
+#
+# @file
+#
+# @brief Configure script of LibBSP for the Altera Cyclone-V platform.
+#
+
+AC_PREREQ([2.69])
+AC_INIT([rtems-c-src-lib-libbsp-arm-xilinx-zynq-a9],[_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.12.2])
+RTEMS_BSP_CONFIGURE
+
+RTEMS_PROG_CC_FOR_TARGET
+RTEMS_CANONICALIZE_TOOLS
+RTEMS_PROG_CCAS
+
+RTEMS_CHECK_NETWORKING
+AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
+
+RTEMS_BSPOPTS_SET([BSP_START_RESET_VECTOR],[*],[])
+RTEMS_BSPOPTS_HELP([BSP_START_RESET_VECTOR],[reset vector address for BSP start])
+
+RTEMS_BSPOPTS_SET([BSP_ARM_A9MPCORE_PERIPHCLK],[altcycv_devkit*],[666666667U])
+RTEMS_BSPOPTS_SET([BSP_ARM_A9MPCORE_PERIPHCLK],[*],[100000000U])
+RTEMS_BSPOPTS_HELP([BSP_ARM_A9MPCORE_PERIPHCLK],[ARM Cortex-A9 MPCore PERIPHCLK clock frequency in Hz])
+
+RTEMS_BSPOPTS_SET([CLOCK_DRIVER_USE_FAST_IDLE],[*qemu],[1])
+RTEMS_BSPOPTS_HELP([CLOCK_DRIVER_USE_FAST_IDLE],
+[This sets a mode where the time runs as fast as possible when a clock ISR
+occurs while the IDLE thread is executing.  This can significantly reduce
+simulation times.])
+
+RTEMS_BSPOPTS_SET([BSP_CONSOLE_MINOR],[*],[0])
+RTEMS_BSPOPTS_HELP([BSP_CONSOLE_MINOR],[minor number of console device])
+
+RTEMS_CHECK_SMP
+AM_CONDITIONAL(HAS_SMP,[test "$rtems_cv_HAS_SMP" = "yes"])
+
+RTEMS_BSP_CLEANUP_OPTIONS(0, 1)
+RTEMS_BSP_LINKCMDS
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/console/console-config.c b/c/src/lib/libbsp/arm/altera-cyclone-v/console/console-config.c
new file mode 100644
index 0000000..acad744
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/console/console-config.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <info 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 <libchip/serial.h>
+
+#include <bsp.h>
+#include <bsp/irq.h>
+
+console_tbl Console_Configuration_Ports[] = {
+#if 0
+  {
+    .sDeviceName = "/dev/ttyS0",
+    .deviceType = SERIAL_CUSTOM,
+    .pDeviceFns = &altcycv_uart_fns,
+    .deviceProbe = NULL,
+    .pDeviceFlow = NULL,
+    .ulMargin = 0,
+    .ulHysteresis = 0,
+    .pDeviceParams = (void *) 115200,
+    .ulCtrlPort1 = 0xe0000000,
+    .ulCtrlPort2 = 0,
+    .ulDataPort = 0,
+    .getRegister = NULL,
+    .setRegister = NULL,
+    .getData = NULL,
+    .setData = NULL,
+    .ulClock = 0,
+    .ulIntVector = ALTCYCV_IRQ_UART_0
+  }, {
+    .sDeviceName = "/dev/ttyS1",
+    .deviceType = SERIAL_CUSTOM,
+    .pDeviceFns = &altcycv_uart_fns,
+    .deviceProbe = NULL,
+    .pDeviceFlow = NULL,
+    .ulMargin = 0,
+    .ulHysteresis = 0,
+    .pDeviceParams = (void *) 115200,
+    .ulCtrlPort1 = 0xe0001000,
+    .ulCtrlPort2 = 0,
+    .ulDataPort = 0,
+    .getRegister = NULL,
+    .setRegister = NULL,
+    .getData = NULL,
+    .setData = NULL,
+    .ulClock = 0,
+    .ulIntVector = ALTCYCV_IRQ_UART_1
+  }
+#endif
+};
+
+unsigned long Console_Configuration_Count =
+  RTEMS_ARRAY_SIZE(Console_Configuration_Ports);
+
+static void output_char(char c)
+{
+  int minor = (int) Console_Port_Minor;
+  const console_tbl *ct = Console_Port_Tbl != NULL ?
+    Console_Port_Tbl[minor] : &Console_Configuration_Ports[minor];
+  const console_fns *cf = ct->pDeviceFns;
+
+  if (c == '\n') {
+    (*cf->deviceWritePolled)(minor, '\r');
+  }
+
+  (*cf->deviceWritePolled)(minor, c);
+}
+
+static void output_char_init(char c)
+{
+  if (Console_Port_Tbl == NULL) {
+    int minor;
+    const console_fns *cf;
+
+    bsp_console_select();
+
+    minor = (int) Console_Port_Minor;
+    cf = Console_Configuration_Ports[minor].pDeviceFns;
+
+    (*cf->deviceInitialize)(minor);
+  }
+
+  BSP_output_char = output_char;
+  output_char(c);
+}
+
+BSP_output_char_function_type BSP_output_char = output_char_init;
+
+BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/include/bsp.h b/c/src/lib/libbsp/arm/altera-cyclone-v/include/bsp.h
new file mode 100644
index 0000000..8d872ee
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/include/bsp.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <info 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_ARM_ALTCYCV_BSP_H
+#define LIBBSP_ARM_ALTCYCV_BSP_H
+
+#include <bspopts.h>
+
+#define BSP_FEATURE_IRQ_EXTENSION
+
+#ifndef ASM
+
+#include <rtems.h>
+#include <rtems/console.h>
+#include <rtems/clockdrv.h>
+
+#include <bsp/default-initial-extension.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define BSP_ARM_A9MPCORE_SCU_BASE 0xf8f00000
+
+#define BSP_ARM_GIC_CPUIF_BASE 0xf8f00100
+
+#define BSP_ARM_A9MPCORE_PT_BASE 0xf8f00600
+
+#define BSP_ARM_GIC_DIST_BASE 0xf8f01000
+
+typedef enum {
+  BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_INSTALL,
+  BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_REMOVE
+} altcycv_fatal_code;
+
+void altcycv_fatal(altcycv_fatal_code code) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* ASM */
+
+#endif /* LIBBSP_ARM_ALTCYCV_BSP_H */
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/include/irq.h b/c/src/lib/libbsp/arm/altera-cyclone-v/include/irq.h
new file mode 100644
index 0000000..d548e5b
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/include/irq.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <info 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_ARM_ALTCYCV_IRQ_H
+#define LIBBSP_ARM_ALTCYCV_IRQ_H
+
+#ifndef ASM
+
+#include <rtems/irq.h>
+#include <rtems/irq-extension.h>
+
+#include <bsp/arm-a9mpcore-irq.h>
+#include <bsp/arm-gic-irq.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define ALTCYCV_IRQ_CPU_0 32
+#define ALTCYCV_IRQ_CPU_1 33
+#define ALTCYCV_IRQ_L2_CACHE 34
+#define ALTCYCV_IRQ_OCM 35
+#define ALTCYCV_IRQ_PMU_0 37
+#define ALTCYCV_IRQ_PMU_1 38
+#define ALTCYCV_IRQ_XADC 39
+#define ALTCYCV_IRQ_DVI 40
+#define ALTCYCV_IRQ_SWDT 41
+#define ALTCYCV_IRQ_TTC_0_0 42
+#define ALTCYCV_IRQ_TTC_1_0 43
+#define ALTCYCV_IRQ_TTC_2_0 44
+#define ALTCYCV_IRQ_DMAC_ABORT 45
+#define ALTCYCV_IRQ_DMAC_0 46
+#define ALTCYCV_IRQ_DMAC_1 47
+#define ALTCYCV_IRQ_DMAC_2 48
+#define ALTCYCV_IRQ_DMAC_3 49
+#define ALTCYCV_IRQ_SMC 50
+#define ALTCYCV_IRQ_QUAD_SPI 51
+#define ALTCYCV_IRQ_GPIO 52
+#define ALTCYCV_IRQ_USB_0 53
+#define ALTCYCV_IRQ_ETHERNET_0 54
+#define ALTCYCV_IRQ_ETHERNET_0_WAKEUP 55
+#define ALTCYCV_IRQ_SDIO_0 56
+#define ALTCYCV_IRQ_I2C_0 57
+#define ALTCYCV_IRQ_SPI_0 58
+#define ALTCYCV_IRQ_UART_0 59
+#define ALTCYCV_IRQ_CAN_0 60
+#define ALTCYCV_IRQ_FPGA_0 61
+#define ALTCYCV_IRQ_FPGA_1 62
+#define ALTCYCV_IRQ_FPGA_2 63
+#define ALTCYCV_IRQ_FPGA_3 64
+#define ALTCYCV_IRQ_FPGA_4 65
+#define ALTCYCV_IRQ_FPGA_5 66
+#define ALTCYCV_IRQ_FPGA_6 67
+#define ALTCYCV_IRQ_FPGA_7 68
+#define ALTCYCV_IRQ_TTC_0_1 69
+#define ALTCYCV_IRQ_TTC_1_1 70
+#define ALTCYCV_IRQ_TTC_2_1 71
+#define ALTCYCV_IRQ_DMAC_4 72
+#define ALTCYCV_IRQ_DMAC_5 73
+#define ALTCYCV_IRQ_DMAC_6 74
+#define ALTCYCV_IRQ_DMAC_7 75
+#define ALTCYCV_IRQ_USB_1 76
+#define ALTCYCV_IRQ_ETHERNET_1 77
+#define ALTCYCV_IRQ_ETHERNET_1_WAKEUP 78
+#define ALTCYCV_IRQ_SDIO_1 79
+#define ALTCYCV_IRQ_I2C_1 80
+#define ALTCYCV_IRQ_SPI_1 81
+#define ALTCYCV_IRQ_UART_1 82
+#define ALTCYCV_IRQ_CAN_1 83
+#define ALTCYCV_IRQ_FPGA_8 84
+#define ALTCYCV_IRQ_FPGA_9 85
+#define ALTCYCV_IRQ_FPGA_10 86
+#define ALTCYCV_IRQ_FPGA_11 87
+#define ALTCYCV_IRQ_FPGA_12 88
+#define ALTCYCV_IRQ_FPGA_13 89
+#define ALTCYCV_IRQ_FPGA_14 90
+#define ALTCYCV_IRQ_FPGA_15 91
+#define ALTCYCV_IRQ_PARITY 92
+
+#define BSP_INTERRUPT_VECTOR_MIN 0
+#define BSP_INTERRUPT_VECTOR_MAX 92
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* ASM */
+
+#endif /* LIBBSP_ARM_ALTCYCV_IRQ_H */
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/include/tm27.h b/c/src/lib/libbsp/arm/altera-cyclone-v/include/tm27.h
new file mode 100644
index 0000000..96ab469
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/include/tm27.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <info 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 _RTEMS_TMTEST27
+#error "This is an RTEMS internal file you must not include directly."
+#endif
+
+#ifndef __tm27_h
+#define __tm27_h
+
+#include <bsp/arm-gic-tm27.h>
+
+#endif /* __tm27_h */
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv.inc b/c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv.inc
new file mode 100644
index 0000000..bbe3f54
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv.inc
@@ -0,0 +1,8 @@
+include $(RTEMS_ROOT)/make/custom/default.cfg
+
+RTEMS_CPU = arm
+
+CPU_CFLAGS = -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mtune=cortex-a9
+
+#CFLAGS_OPTIMIZE_V ?= -O0 -g
+CFLAGS_OPTIMIZE_V ?= -O2 -g
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv_devkit.cfg b/c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv_devkit.cfg
new file mode 100644
index 0000000..ed54edf
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv_devkit.cfg
@@ -0,0 +1 @@
+include $(RTEMS_ROOT)/make/custom/altcycv.inc
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv_devkit_smp.cfg b/c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv_devkit_smp.cfg
new file mode 100644
index 0000000..ed54edf
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/make/custom/altcycv_devkit_smp.cfg
@@ -0,0 +1 @@
+include $(RTEMS_ROOT)/make/custom/altcycv.inc
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am b/c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am
new file mode 100644
index 0000000..d59525a
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am
@@ -0,0 +1,224 @@
+## 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_INCLUDE)/libcpu/$(dirstamp):
+	@$(MKDIR_P) $(PROJECT_INCLUDE)/libcpu
+	@: > $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libcpu/$(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: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.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)/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)/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/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/stackalloc.h: ../../shared/include/stackalloc.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/stackalloc.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/stackalloc.h
+
+$(PROJECT_INCLUDE)/bsp/tod.h: ../../shared/tod.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/tod.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/tod.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/arm-a9mpcore-irq.h: ../shared/include/arm-a9mpcore-irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-a9mpcore-irq.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-a9mpcore-irq.h
+
+$(PROJECT_INCLUDE)/bsp/arm-a9mpcore-regs.h: ../shared/include/arm-a9mpcore-regs.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-a9mpcore-regs.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-a9mpcore-regs.h
+
+$(PROJECT_INCLUDE)/bsp/arm-a9mpcore-start.h: ../shared/include/arm-a9mpcore-start.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-a9mpcore-start.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-a9mpcore-start.h
+
+$(PROJECT_INCLUDE)/bsp/arm-cp15-start.h: ../shared/include/arm-cp15-start.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-cp15-start.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-cp15-start.h
+
+$(PROJECT_INCLUDE)/bsp/arm-gic.h: ../shared/include/arm-gic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-gic.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-gic.h
+
+$(PROJECT_INCLUDE)/bsp/arm-gic-irq.h: ../shared/include/arm-gic-irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-gic-irq.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-gic-irq.h
+
+$(PROJECT_INCLUDE)/bsp/arm-gic-regs.h: ../shared/include/arm-gic-regs.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-gic-regs.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-gic-regs.h
+
+$(PROJECT_INCLUDE)/bsp/arm-gic-tm27.h: ../shared/include/arm-gic-tm27.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-gic-tm27.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-gic-tm27.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/alt_16550_uart.h: hwlib/include/alt_16550_uart.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_16550_uart.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_16550_uart.h
+
+$(PROJECT_INCLUDE)/bsp/alt_address_space.h: hwlib/include/alt_address_space.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_address_space.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_address_space.h
+
+$(PROJECT_INCLUDE)/bsp/alt_bridge_manager.h: hwlib/include/alt_bridge_manager.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_bridge_manager.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_bridge_manager.h
+
+$(PROJECT_INCLUDE)/bsp/alt_clock_group.h: hwlib/include/alt_clock_group.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_clock_group.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_clock_group.h
+
+$(PROJECT_INCLUDE)/bsp/alt_clock_manager.h: hwlib/include/alt_clock_manager.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_clock_manager.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_clock_manager.h
+
+$(PROJECT_INCLUDE)/bsp/alt_dma_common.h: hwlib/include/alt_dma_common.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_dma_common.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_dma_common.h
+
+$(PROJECT_INCLUDE)/bsp/alt_dma_program.h: hwlib/include/alt_dma_program.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_dma_program.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_dma_program.h
+
+$(PROJECT_INCLUDE)/bsp/alt_dma.h: hwlib/include/alt_dma.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_dma.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_dma.h
+
+$(PROJECT_INCLUDE)/bsp/alt_fpga_manager.h: hwlib/include/alt_fpga_manager.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_fpga_manager.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_fpga_manager.h
+
+$(PROJECT_INCLUDE)/bsp/alt_generalpurpose_io.h: hwlib/include/alt_generalpurpose_io.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_generalpurpose_io.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_generalpurpose_io.h
+
+$(PROJECT_INCLUDE)/bsp/alt_globaltmr.h: hwlib/include/alt_globaltmr.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_globaltmr.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_globaltmr.h
+
+$(PROJECT_INCLUDE)/bsp/alt_hwlibs_ver.h: hwlib/include/alt_hwlibs_ver.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_hwlibs_ver.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_hwlibs_ver.h
+
+$(PROJECT_INCLUDE)/bsp/alt_interrupt_common.h: hwlib/include/alt_interrupt_common.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_interrupt_common.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_interrupt_common.h
+
+$(PROJECT_INCLUDE)/bsp/alt_mpu_registers.h: hwlib/include/alt_mpu_registers.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_mpu_registers.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_mpu_registers.h
+
+$(PROJECT_INCLUDE)/bsp/alt_reset_manager.h: hwlib/include/alt_reset_manager.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_reset_manager.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_reset_manager.h
+
+$(PROJECT_INCLUDE)/bsp/alt_system_manager.h: hwlib/include/alt_system_manager.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_system_manager.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_system_manager.h
+
+$(PROJECT_INCLUDE)/bsp/alt_timers.h: hwlib/include/alt_timers.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_timers.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_timers.h
+
+$(PROJECT_INCLUDE)/bsp/alt_watchdog.h: hwlib/include/alt_watchdog.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/alt_watchdog.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/alt_watchdog.h
+
+$(PROJECT_INCLUDE)/bsp/hwlib.h: hwlib/include/hwlib.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/hwlib.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/hwlib.h
+
+$(PROJECT_INCLUDE)/libcpu/arm-cp15.h: ../../../libcpu/arm/shared/include/arm-cp15.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/arm-cp15.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/arm-cp15.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
+TMPINSTALL_FILES += $(PROJECT_LIB)/linkcmds
+
+$(PROJECT_LIB)/linkcmds.altcycv: startup/linkcmds.altcycv $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.altcycv
+TMPINSTALL_FILES += $(PROJECT_LIB)/linkcmds.altcycv
+
+$(PROJECT_LIB)/linkcmds.altcycv_devkit: startup/linkcmds.altcycv_devkit $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.altcycv_devkit
+TMPINSTALL_FILES += $(PROJECT_LIB)/linkcmds.altcycv_devkit
+
+$(PROJECT_LIB)/linkcmds.altcycv_devkit_smp: startup/linkcmds.altcycv_devkit_smp $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.altcycv_devkit_smp
+TMPINSTALL_FILES += $(PROJECT_LIB)/linkcmds.altcycv_devkit_smp
+
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspreset.c b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspreset.c
new file mode 100644
index 0000000..658f870
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspreset.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <info 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/bootcard.h>
+
+void bsp_reset(void)
+{
+  volatile uint32_t *slcr_unlock = (volatile uint32_t *) 0xf8000008;
+  volatile uint32_t *pss_rst_ctrl = (volatile uint32_t *) 0xf8000200;
+
+  while (true) {
+    *slcr_unlock = 0xdf0d;
+    *pss_rst_ctrl = 0x1;
+  }
+}
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstart.c b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstart.c
new file mode 100644
index 0000000..40459bb
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstart.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <info 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.h>
+#include <bsp/bootcard.h>
+#include <bsp/irq-generic.h>
+
+void altcycv_fatal(altcycv_fatal_code code)
+{
+  rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, code);
+}
+
+void bsp_start(void)
+{
+  bsp_interrupt_initialize();
+}
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstarthooks.c b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstarthooks.c
new file mode 100644
index 0000000..9831084
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstarthooks.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <info 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.h>
+#include <bsp/start.h>
+#include <bsp/arm-cp15-start.h>
+#include <bsp/arm-a9mpcore-start.h>
+#include <bsp/linker-symbols.h>
+
+#ifdef RTEMS_SMP
+  #define MMU_DATA_READ_WRITE ARMV7_MMU_DATA_READ_WRITE_SHAREABLE
+#else
+  #define MMU_DATA_READ_WRITE ARMV7_MMU_DATA_READ_WRITE_CACHED
+#endif
+
+BSP_START_DATA_SECTION static const arm_cp15_start_section_config
+altcycv_mmu_config_table[] = {
+  {
+    .begin = (uint32_t) bsp_section_fast_text_begin,
+    .end = (uint32_t) bsp_section_fast_text_end,
+    .flags = ARMV7_MMU_CODE_CACHED
+  }, {
+    .begin = (uint32_t) bsp_section_fast_data_begin,
+    .end = (uint32_t) bsp_section_fast_data_end,
+    .flags = MMU_DATA_READ_WRITE
+  }, {
+    .begin = (uint32_t) bsp_section_start_begin,
+    .end = (uint32_t) bsp_section_start_end,
+    .flags = ARMV7_MMU_CODE_CACHED
+  }, {
+    .begin = (uint32_t) bsp_section_vector_begin,
+    .end = (uint32_t) bsp_section_vector_end,
+    .flags = MMU_DATA_READ_WRITE
+  }, {
+    .begin = (uint32_t) bsp_section_text_begin,
+    .end = (uint32_t) bsp_section_text_end,
+    .flags = ARMV7_MMU_CODE_CACHED
+  }, {
+    .begin = (uint32_t) bsp_section_rodata_begin,
+    .end = (uint32_t) bsp_section_rodata_end,
+    .flags = ARMV7_MMU_DATA_READ_ONLY_CACHED
+  }, {
+    .begin = (uint32_t) bsp_section_data_begin,
+    .end = (uint32_t) bsp_section_data_end,
+    .flags = MMU_DATA_READ_WRITE
+  }, {
+    .begin = (uint32_t) bsp_section_bss_begin,
+    .end = (uint32_t) bsp_section_bss_end,
+    .flags = MMU_DATA_READ_WRITE
+  }, {
+    .begin = (uint32_t) bsp_section_work_begin,
+    .end = (uint32_t) bsp_section_work_end,
+    .flags = MMU_DATA_READ_WRITE
+  }, {
+    .begin = (uint32_t) bsp_section_stack_begin,
+    .end = (uint32_t) bsp_section_stack_end,
+    .flags = MMU_DATA_READ_WRITE
+  }, {
+    .begin = 0xe0000000U,
+    .end = 0xe0200000U,
+    .flags = ARMV7_MMU_DEVICE
+  }, {
+    .begin = 0xf8000000U,
+    .end = 0xf9000000U,
+    .flags = ARMV7_MMU_DEVICE
+  }
+};
+
+BSP_START_TEXT_SECTION static void setup_mmu_and_cache(void)
+{
+  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
+    ARM_CP15_CTRL_A,
+    ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z
+  );
+
+  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
+    ctrl,
+    (uint32_t *) bsp_translation_table_base,
+    ARM_MMU_DEFAULT_CLIENT_DOMAIN,
+    &altcycv_mmu_config_table[0],
+    RTEMS_ARRAY_SIZE(altcycv_mmu_config_table)
+  );
+}
+
+BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
+{
+  arm_a9mpcore_start_hook_0();
+}
+
+BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
+{
+  arm_a9mpcore_start_hook_1();
+  bsp_start_copy_sections();
+  setup_mmu_and_cache();
+  bsp_start_clear_bss();
+}
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv
new file mode 100644
index 0000000..da4275f
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv
@@ -0,0 +1,26 @@
+REGION_ALIAS ("REGION_START",          RAM);
+REGION_ALIAS ("REGION_VECTOR",         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_DATA",           RAM);
+REGION_ALIAS ("REGION_DATA_LOAD",      RAM);
+REGION_ALIAS ("REGION_FAST_TEXT",      RAM);
+REGION_ALIAS ("REGION_FAST_TEXT_LOAD", RAM);
+REGION_ALIAS ("REGION_FAST_DATA",      RAM);
+REGION_ALIAS ("REGION_FAST_DATA_LOAD", RAM);
+REGION_ALIAS ("REGION_BSS",            RAM);
+REGION_ALIAS ("REGION_WORK",           RAM);
+REGION_ALIAS ("REGION_STACK",          RAM);
+
+bsp_stack_irq_size = DEFINED (bsp_stack_irq_size) ? bsp_stack_irq_size : 4096;
+bsp_stack_abt_size = DEFINED (bsp_stack_abt_size) ? bsp_stack_abt_size : 1024;
+
+bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1M;
+
+bsp_vector_table_in_start_section = 1;
+
+bsp_translation_table_base = ORIGIN (RAM_MMU);
+
+INCLUDE linkcmds.armv4
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv_devkit b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv_devkit
new file mode 100644
index 0000000..2bb0f82
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv_devkit
@@ -0,0 +1,6 @@
+MEMORY {
+   RAM_MMU   : ORIGIN = 0x00100000, LENGTH = 16k
+   RAM       : ORIGIN = 0x00104000, LENGTH = 512M - 1M - 16k
+}
+
+INCLUDE linkcmds.altcycv
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv_devkit_smp b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv_devkit_smp
new file mode 100644
index 0000000..2da0865
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/linkcmds.altcycv_devkit_smp
@@ -0,0 +1,3 @@
+bsp_processor_count = DEFINED (bsp_processor_count) ? bsp_processor_count : 2;
+
+INCLUDE linkcmds.altcycv_devkit
-- 
1.7.10.4




More information about the devel mailing list