summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/lm3s69xx/startup
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2011-09-24 13:23:42 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2011-09-24 13:23:42 +0000
commite263c1607a12b3df0ef0eaf10477eaabd3e763a7 (patch)
treeafc29093490341c4d2a270d1ccc6edcadb51e8b0 /c/src/lib/libbsp/arm/lm3s69xx/startup
parent2011-09-24 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-e263c1607a12b3df0ef0eaf10477eaabd3e763a7.tar.bz2
2011-09-24 Sebastian Huber <sebastian.huber@embedded-brains.de>
* 0001-Fixed-interrupt-handling-for-ARMv7M.patch, 0002-Fixed-system-handler-priority-register-access.patch, 0003-Disable-priority_mask-unused-for-NVIC.patch, 0004-Typo.patch, 0005-Evil-hack-for-BASEPRI-BASEPRI_MAX.patch, 0006-Evil-hack-to-increase-the-RAM-size.patch, bsp_specs, ChangeLog, clock/clock-config.c, configure.ac, console/console-config.c, console/uart.c, .cvsignore, include/bsp.h, include/.cvsignore, include/irq.h, include/lm3s69xx.h, include/uart.h, irq/irq.c, make/custom/lm3s6965.cfg, make/custom/lm3s69xx.inc, Makefile.am, README, start/start.S, startup/bspreset.c, startup/bspstart.c, startup/bspstarthook.c, startup/linkcmds.lm3s6965, timer/timer.c: New files.
Diffstat (limited to 'c/src/lib/libbsp/arm/lm3s69xx/startup')
-rw-r--r--c/src/lib/libbsp/arm/lm3s69xx/startup/bspreset.c28
-rw-r--r--c/src/lib/libbsp/arm/lm3s69xx/startup/bspstart.c28
-rw-r--r--c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c85
-rw-r--r--c/src/lib/libbsp/arm/lm3s69xx/startup/linkcmds.lm3s696529
4 files changed, 170 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/arm/lm3s69xx/startup/bspreset.c b/c/src/lib/libbsp/arm/lm3s69xx/startup/bspreset.c
new file mode 100644
index 0000000000..686f5a4263
--- /dev/null
+++ b/c/src/lib/libbsp/arm/lm3s69xx/startup/bspreset.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011 Sebastian Huber. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@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.h>
+#include <rtems/score/armv7m.h>
+
+#include <bsp/bootcard.h>
+
+void bsp_reset(void)
+{
+ rtems_interrupt_level level;
+
+ rtems_interrupt_disable(level);
+
+ _ARMV7M_NVIC->reserved_5 [0] = 0;
+}
diff --git a/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstart.c b/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstart.c
new file mode 100644
index 0000000000..1eb8af5d6d
--- /dev/null
+++ b/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstart.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011 Sebastian Huber. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@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.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <bsp/bootcard.h>
+#include <bsp/irq-generic.h>
+#include <bsp/irq.h>
+#include <bsp/linker-symbols.h>
+
+void bsp_start(void)
+{
+ if (bsp_interrupt_initialize() != RTEMS_SUCCESSFUL) {
+ _CPU_Fatal_halt(0xe);
+ }
+}
diff --git a/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c b/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c
new file mode 100644
index 0000000000..33d0670205
--- /dev/null
+++ b/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2011 Sebastian Huber. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@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 <bsp/start.h>
+#include <bsp/linker-symbols.h>
+
+static void BSP_START_TEXT_SECTION copy(int *dst, const int *src, int n)
+{
+ if (src != dst) {
+ const int *end = dst + (n + sizeof(int) - 1) / sizeof(int);
+
+ while (dst != end) {
+ *dst = *src;
+ ++src;
+ ++dst;
+ }
+ }
+}
+
+static void BSP_START_TEXT_SECTION clear_bss(void)
+{
+ int *dst = (int *) bsp_section_bss_begin;
+ int n = (int) bsp_section_bss_size;
+ const int *end = dst + (n + sizeof(int) - 1) / sizeof(int);
+
+ while (dst != end) {
+ *dst = 0;
+ ++dst;
+ }
+}
+
+void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
+{
+ /* Copy .text section */
+ copy(
+ (int *) bsp_section_text_begin,
+ (const int *) bsp_section_text_load_begin,
+ (size_t) bsp_section_text_size
+ );
+
+ /* Copy .rodata section */
+ copy(
+ (int *) bsp_section_rodata_begin,
+ (const int *) bsp_section_rodata_load_begin,
+ (size_t) bsp_section_rodata_size
+ );
+
+ /* Copy .data section */
+ copy(
+ (int *) bsp_section_data_begin,
+ (const int *) bsp_section_data_load_begin,
+ (size_t) bsp_section_data_size
+ );
+
+ /* Copy .fast_text section */
+ copy(
+ (int *) bsp_section_fast_text_begin,
+ (const int *) bsp_section_fast_text_load_begin,
+ (size_t) bsp_section_fast_text_size
+ );
+
+ /* Copy .fast_data section */
+ copy(
+ (int *) bsp_section_fast_data_begin,
+ (const int *) bsp_section_fast_data_load_begin,
+ (size_t) bsp_section_fast_data_size
+ );
+
+ /* Clear .bss section */
+ clear_bss();
+
+ /* At this point we can use objects outside the .start section */
+}
diff --git a/c/src/lib/libbsp/arm/lm3s69xx/startup/linkcmds.lm3s6965 b/c/src/lib/libbsp/arm/lm3s69xx/startup/linkcmds.lm3s6965
new file mode 100644
index 0000000000..aad5e0305a
--- /dev/null
+++ b/c/src/lib/libbsp/arm/lm3s69xx/startup/linkcmds.lm3s6965
@@ -0,0 +1,29 @@
+/**
+ * @file
+ *
+ * @brief Memory map.
+ */
+
+MEMORY {
+ RAM_INT (AIW) : ORIGIN = 0x20000000, LENGTH = 16M
+ ROM_INT (RX) : ORIGIN = 0x00000000, LENGTH = 64M
+ NIRVANA : ORIGIN = 0, LENGTH = 0
+}
+
+REGION_ALIAS ("REGION_START", ROM_INT);
+REGION_ALIAS ("REGION_VECTOR", RAM_INT);
+REGION_ALIAS ("REGION_TEXT", ROM_INT);
+REGION_ALIAS ("REGION_TEXT_LOAD", ROM_INT);
+REGION_ALIAS ("REGION_RODATA", ROM_INT);
+REGION_ALIAS ("REGION_RODATA_LOAD", ROM_INT);
+REGION_ALIAS ("REGION_DATA", RAM_INT);
+REGION_ALIAS ("REGION_DATA_LOAD", ROM_INT);
+REGION_ALIAS ("REGION_FAST_TEXT", RAM_INT);
+REGION_ALIAS ("REGION_FAST_TEXT_LOAD", ROM_INT);
+REGION_ALIAS ("REGION_FAST_DATA", RAM_INT);
+REGION_ALIAS ("REGION_FAST_DATA_LOAD", ROM_INT);
+REGION_ALIAS ("REGION_BSS", RAM_INT);
+REGION_ALIAS ("REGION_WORK", RAM_INT);
+REGION_ALIAS ("REGION_STACK", RAM_INT);
+
+INCLUDE linkcmds.armv7