[rtems commit] bsp/lm3s69xx: Use shared start.S

Sebastian Huber sebh at rtems.org
Sat Mar 24 21:50:50 UTC 2012


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Sat Mar 24 20:55:40 2012 +0100

bsp/lm3s69xx: Use shared start.S

---

 c/src/lib/libbsp/arm/lm3s69xx/Makefile.am          |   10 ++-
 c/src/lib/libbsp/arm/lm3s69xx/start/start.S        |   65 ------------------
 .../lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c |   69 ++------------------
 3 files changed, 12 insertions(+), 132 deletions(-)

diff --git a/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am b/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
index 6ad98d6..ae26006 100644
--- a/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
+++ b/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
@@ -45,7 +45,7 @@ include_HEADERS += ../../shared/include/tm27.h
 
 noinst_LIBRARIES = libbspstart.a
 
-libbspstart_a_SOURCES = start/start.S
+libbspstart_a_SOURCES = ../shared/start/start.S
 
 project_lib_DATA = start.$(OBJEXT)
 
@@ -75,9 +75,11 @@ libbsp_a_SOURCES += ../../shared/bootcard.c \
 	../../shared/src/stackalloc.c
 
 # Startup
-libbsp_a_SOURCES += startup/bspstart.c \
-	startup/bspstarthook.c \
-	startup/bspreset.c
+libbsp_a_SOURCES += ../shared/startup/bsp-start-copy-sections.c
+libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
+libbsp_a_SOURCES += startup/bspstart.c
+libbsp_a_SOURCES += startup/bspstarthook.c
+libbsp_a_SOURCES += startup/bspreset.c
 
 # IRQ
 libbsp_a_SOURCES += ../../shared/src/irq-generic.c \
diff --git a/c/src/lib/libbsp/arm/lm3s69xx/start/start.S b/c/src/lib/libbsp/arm/lm3s69xx/start/start.S
deleted file mode 100644
index e90a9f3..0000000
--- a/c/src/lib/libbsp/arm/lm3s69xx/start/start.S
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2011 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/asm.h>
-#include <rtems/system.h>	
-#include <rtems/score/cpu.h>
-	
-#include <bspopts.h>
-#include <bsp/irq.h>
-#include <bsp/linker-symbols.h>
-
-/* External symbols */
-
-.extern bsp_start_hook
-.extern boot_card
-.extern bsp_reset
-
-/* Global symbols */
-
-.globl _start
-
-.syntax unified
-
-.section ".bsp_start_text", "ax"
-.thumb
-.word bsp_stack_main_end
-.word _start /* Reset */
-.word bsp_reset /* NMI */
-.word bsp_reset /* Hard Fault */
-.word bsp_reset /* MPU Fault */
-.word bsp_reset /* Bus Fault */
-.word bsp_reset /* Usage Fault */
-.word 0 /* Reserved */
-.word 0 /* Reserved */
-.word 0 /* Reserved */
-.word 0 /* Reserved */
-.word bsp_reset /* SVC */
-.word bsp_reset /* Debug Monitor */
-.word 0 /* Reserved */
-.word bsp_reset /* PendSV */
-.word bsp_reset /* SysTick */
-.rept BSP_INTERRUPT_VECTOR_MAX - 15
-.word bsp_reset /* IRQ */
-.endr
-
-.thumb_func
-_start:
-	bl	bsp_start_hook_0
-	mov	r0, #0
-	bl	boot_card
-
-twiddle:
-	bl	bsp_reset
-	b	twiddle
diff --git a/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c b/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c
index 33d0670..241e54e 100644
--- a/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c
+++ b/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Sebastian Huber.  All rights reserved.
+ * Copyright (c) 2011-2012 Sebastian Huber.  All rights reserved.
  *
  *  embedded brains GmbH
  *  Obere Lagerstr. 30
@@ -12,74 +12,17 @@
  * http://www.rtems.com/license/LICENSE.
  */
 
-#include <bspopts.h>
+#include <bsp.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)
+void BSP_START_TEXT_SECTION bsp_start_hook_0(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;
-  }
+  /* Do nothing */
 }
 
-void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
+void BSP_START_TEXT_SECTION bsp_start_hook_1(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();
+  bsp_start_copy_sections();
 
   /* At this point we can use objects outside the .start section */
 }




More information about the vc mailing list