forked from Imagelibrary/rtems
bsps/arm: Move implementation to inline functions
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user