1 | /* |
---|
2 | * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Obere Lagerstr. 30 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.com/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #include <bsp/start.h> |
---|
16 | #include <bsp/linker-symbols.h> |
---|
17 | |
---|
18 | static void BSP_START_TEXT_SECTION bsp_start_clear_bss(void) |
---|
19 | { |
---|
20 | const int *end = (const int *) bsp_section_bss_end; |
---|
21 | int *out = (int *) bsp_section_bss_begin; |
---|
22 | |
---|
23 | /* Clear BSS */ |
---|
24 | while (out != end) { |
---|
25 | *out = 0; |
---|
26 | ++out; |
---|
27 | } |
---|
28 | } |
---|
29 | |
---|
30 | void BSP_START_TEXT_SECTION bsp_start_copy_sections(void) |
---|
31 | { |
---|
32 | /* Copy .text section */ |
---|
33 | bsp_start_memcpy( |
---|
34 | (int *) bsp_section_text_begin, |
---|
35 | (const int *) bsp_section_text_load_begin, |
---|
36 | (size_t) bsp_section_text_size |
---|
37 | ); |
---|
38 | |
---|
39 | /* Copy .rodata section */ |
---|
40 | bsp_start_memcpy( |
---|
41 | (int *) bsp_section_rodata_begin, |
---|
42 | (const int *) bsp_section_rodata_load_begin, |
---|
43 | (size_t) bsp_section_rodata_size |
---|
44 | ); |
---|
45 | |
---|
46 | /* Copy .data section */ |
---|
47 | bsp_start_memcpy( |
---|
48 | (int *) bsp_section_data_begin, |
---|
49 | (const int *) bsp_section_data_load_begin, |
---|
50 | (size_t) bsp_section_data_size |
---|
51 | ); |
---|
52 | |
---|
53 | /* Copy .fast_text section */ |
---|
54 | bsp_start_memcpy( |
---|
55 | (int *) bsp_section_fast_text_begin, |
---|
56 | (const int *) bsp_section_fast_text_load_begin, |
---|
57 | (size_t) bsp_section_fast_text_size |
---|
58 | ); |
---|
59 | |
---|
60 | /* Copy .fast_data section */ |
---|
61 | bsp_start_memcpy( |
---|
62 | (int *) bsp_section_fast_data_begin, |
---|
63 | (const int *) bsp_section_fast_data_load_begin, |
---|
64 | (size_t) bsp_section_fast_data_size |
---|
65 | ); |
---|
66 | |
---|
67 | bsp_start_clear_bss(); |
---|
68 | } |
---|