summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-05-03 10:39:26 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-05-03 17:30:54 +0200
commitfb0584fff85c4f03edbd26b44f10f07ec4eb5001 (patch)
treeb5a862e38d771f70e18d453d71489d84b8825d36
parentarm: Switch to ARM only for Thumb-1 (diff)
downloadrtems-fb0584fff85c4f03edbd26b44f10f07ec4eb5001.tar.bz2
bsps/arm: Move implementation to inline functions
-rw-r--r--c/src/lib/libbsp/arm/lm3s69xx/Makefile.am1
-rw-r--r--c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c1
-rw-r--r--c/src/lib/libbsp/arm/lpc24xx/Makefile.am1
-rw-r--r--c/src/lib/libbsp/arm/lpc24xx/startup/bspstarthooks.c1
-rw-r--r--c/src/lib/libbsp/arm/shared/include/start.h49
-rw-r--r--c/src/lib/libbsp/arm/shared/startup/bsp-start-copy-sections.c68
-rw-r--r--c/src/lib/libbsp/arm/stm32f4/Makefile.am1
-rw-r--r--c/src/lib/libbsp/arm/stm32f4/startup/bspstarthook.c1
8 files changed, 49 insertions, 74 deletions
diff --git a/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am b/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
index 6d2ad7f285..589112a715 100644
--- a/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
+++ b/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
@@ -73,7 +73,6 @@ libbsp_a_SOURCES += ../../shared/sbrk.c
libbsp_a_SOURCES += ../../shared/src/stackalloc.c
# Startup
-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
diff --git a/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c b/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c
index 241e54e6ab..9c7bfa5c3d 100644
--- a/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c
+++ b/c/src/lib/libbsp/arm/lm3s69xx/startup/bspstarthook.c
@@ -23,6 +23,7 @@ void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
void BSP_START_TEXT_SECTION bsp_start_hook_1(void)
{
bsp_start_copy_sections();
+ bsp_start_clear_bss();
/* At this point we can use objects outside the .start section */
}
diff --git a/c/src/lib/libbsp/arm/lpc24xx/Makefile.am b/c/src/lib/libbsp/arm/lpc24xx/Makefile.am
index 63e9d2fad9..9aa574da7a 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/Makefile.am
+++ b/c/src/lib/libbsp/arm/lpc24xx/Makefile.am
@@ -101,7 +101,6 @@ libbsp_a_SOURCES += ../../shared/bootcard.c \
../../shared/src/uart-output-char.c
# Startup
-libbsp_a_SOURCES += ../shared/startup/bsp-start-copy-sections.c
libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
libbsp_a_SOURCES += startup/bspreset.c
libbsp_a_SOURCES += startup/bspstart.c
diff --git a/c/src/lib/libbsp/arm/lpc24xx/startup/bspstarthooks.c b/c/src/lib/libbsp/arm/lpc24xx/startup/bspstarthooks.c
index c80a91980e..232a1b93f8 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/startup/bspstarthooks.c
+++ b/c/src/lib/libbsp/arm/lpc24xx/startup/bspstarthooks.c
@@ -527,6 +527,7 @@ BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
lpc24xx_stop_ethernet();
lpc24xx_stop_usb();
bsp_start_copy_sections();
+ bsp_start_clear_bss();
/* At this point we can use objects outside the .start section */
}
diff --git a/c/src/lib/libbsp/arm/shared/include/start.h b/c/src/lib/libbsp/arm/shared/include/start.h
index 764239129d..3f5301c1a3 100644
--- a/c/src/lib/libbsp/arm/shared/include/start.h
+++ b/c/src/lib/libbsp/arm/shared/include/start.h
@@ -7,7 +7,7 @@
*/
/*
- * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2008-2013 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
@@ -23,7 +23,9 @@
#ifndef LIBBSP_ARM_SHARED_START_H
#define LIBBSP_ARM_SHARED_START_H
-#include <stddef.h>
+#include <string.h>
+
+#include <bsp/linker-symbols.h>
#ifdef __cplusplus
extern "C" {
@@ -81,7 +83,48 @@ void bsp_start_memcpy_arm(int *dest, const int *src, size_t n);
/**
* @brief Copies all standard sections from the load to the runtime area.
*/
-void bsp_start_copy_sections(void);
+BSP_START_TEXT_SECTION static inline void bsp_start_copy_sections(void)
+{
+ /* Copy .text section */
+ bsp_start_memcpy(
+ (int *) bsp_section_text_begin,
+ (const int *) bsp_section_text_load_begin,
+ (size_t) bsp_section_text_size
+ );
+
+ /* Copy .rodata section */
+ bsp_start_memcpy(
+ (int *) bsp_section_rodata_begin,
+ (const int *) bsp_section_rodata_load_begin,
+ (size_t) bsp_section_rodata_size
+ );
+
+ /* Copy .data section */
+ bsp_start_memcpy(
+ (int *) bsp_section_data_begin,
+ (const int *) bsp_section_data_load_begin,
+ (size_t) bsp_section_data_size
+ );
+
+ /* Copy .fast_text section */
+ bsp_start_memcpy(
+ (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 */
+ bsp_start_memcpy(
+ (int *) bsp_section_fast_data_begin,
+ (const int *) bsp_section_fast_data_load_begin,
+ (size_t) bsp_section_fast_data_size
+ );
+}
+
+BSP_START_TEXT_SECTION static inline void bsp_start_clear_bss(void)
+{
+ memset(bsp_section_bss_begin, 0, (size_t) bsp_section_bss_size);
+}
/** @} */
diff --git a/c/src/lib/libbsp/arm/shared/startup/bsp-start-copy-sections.c b/c/src/lib/libbsp/arm/shared/startup/bsp-start-copy-sections.c
deleted file mode 100644
index b7eb1f99a5..0000000000
--- a/c/src/lib/libbsp/arm/shared/startup/bsp-start-copy-sections.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2008-2011 embedded brains GmbH. 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 <bsp/start.h>
-#include <bsp/linker-symbols.h>
-
-static void BSP_START_TEXT_SECTION bsp_start_clear_bss(void)
-{
- const int *end = (const int *) bsp_section_bss_end;
- int *out = (int *) bsp_section_bss_begin;
-
- /* Clear BSS */
- while (out != end) {
- *out = 0;
- ++out;
- }
-}
-
-void BSP_START_TEXT_SECTION bsp_start_copy_sections(void)
-{
- /* Copy .text section */
- bsp_start_memcpy(
- (int *) bsp_section_text_begin,
- (const int *) bsp_section_text_load_begin,
- (size_t) bsp_section_text_size
- );
-
- /* Copy .rodata section */
- bsp_start_memcpy(
- (int *) bsp_section_rodata_begin,
- (const int *) bsp_section_rodata_load_begin,
- (size_t) bsp_section_rodata_size
- );
-
- /* Copy .data section */
- bsp_start_memcpy(
- (int *) bsp_section_data_begin,
- (const int *) bsp_section_data_load_begin,
- (size_t) bsp_section_data_size
- );
-
- /* Copy .fast_text section */
- bsp_start_memcpy(
- (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 */
- bsp_start_memcpy(
- (int *) bsp_section_fast_data_begin,
- (const int *) bsp_section_fast_data_load_begin,
- (size_t) bsp_section_fast_data_size
- );
-
- bsp_start_clear_bss();
-}
diff --git a/c/src/lib/libbsp/arm/stm32f4/Makefile.am b/c/src/lib/libbsp/arm/stm32f4/Makefile.am
index a54d974a05..6203aa33fc 100644
--- a/c/src/lib/libbsp/arm/stm32f4/Makefile.am
+++ b/c/src/lib/libbsp/arm/stm32f4/Makefile.am
@@ -72,7 +72,6 @@ libbsp_a_SOURCES += ../../shared/sbrk.c
libbsp_a_SOURCES += ../../shared/src/stackalloc.c
# Startup
-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
diff --git a/c/src/lib/libbsp/arm/stm32f4/startup/bspstarthook.c b/c/src/lib/libbsp/arm/stm32f4/startup/bspstarthook.c
index 1a69da76cc..0db86529ec 100644
--- a/c/src/lib/libbsp/arm/stm32f4/startup/bspstarthook.c
+++ b/c/src/lib/libbsp/arm/stm32f4/startup/bspstarthook.c
@@ -23,6 +23,7 @@ void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
void BSP_START_TEXT_SECTION bsp_start_hook_1(void)
{
bsp_start_copy_sections();
+ bsp_start_clear_bss();
/* At this point we can use objects outside the .start section */
}