1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup lpc32xx |
---|
5 | * |
---|
6 | * @brief Startup code. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2009 |
---|
11 | * embedded brains GmbH |
---|
12 | * Obere Lagerstr. 30 |
---|
13 | * D-82178 Puchheim |
---|
14 | * Germany |
---|
15 | * <rtems@embedded-brains.de> |
---|
16 | * |
---|
17 | * The license and distribution terms for this file may be |
---|
18 | * found in the file LICENSE in this distribution or at |
---|
19 | * http://www.rtems.com/license/LICENSE. |
---|
20 | */ |
---|
21 | |
---|
22 | #include <stdbool.h> |
---|
23 | |
---|
24 | #include <bspopts.h> |
---|
25 | #include <bsp/start.h> |
---|
26 | #include <bsp/lpc32xx.h> |
---|
27 | #include <bsp/linker-symbols.h> |
---|
28 | |
---|
29 | #define BSP_START_SECTION __attribute__((section(".bsp_start"))) |
---|
30 | |
---|
31 | static void BSP_START_SECTION lpc32xx_clear_bss(void) |
---|
32 | { |
---|
33 | const int *end = (const int *) bsp_section_bss_end; |
---|
34 | int *out = (int *) bsp_section_bss_begin; |
---|
35 | |
---|
36 | /* Clear BSS */ |
---|
37 | while (out != end) { |
---|
38 | *out = 0; |
---|
39 | ++out; |
---|
40 | } |
---|
41 | } |
---|
42 | |
---|
43 | void BSP_START_SECTION bsp_start_hook_0(void) |
---|
44 | { |
---|
45 | /* TODO */ |
---|
46 | } |
---|
47 | |
---|
48 | void BSP_START_SECTION bsp_start_hook_1(void) |
---|
49 | { |
---|
50 | /* TODO */ |
---|
51 | |
---|
52 | /* Copy .text section */ |
---|
53 | bsp_start_memcpy_arm( |
---|
54 | (int *) bsp_section_text_begin, |
---|
55 | (const int *) bsp_section_text_load_begin, |
---|
56 | (size_t) bsp_section_text_size |
---|
57 | ); |
---|
58 | |
---|
59 | /* Copy .rodata section */ |
---|
60 | bsp_start_memcpy_arm( |
---|
61 | (int *) bsp_section_rodata_begin, |
---|
62 | (const int *) bsp_section_rodata_load_begin, |
---|
63 | (size_t) bsp_section_rodata_size |
---|
64 | ); |
---|
65 | |
---|
66 | /* Copy .data section */ |
---|
67 | bsp_start_memcpy_arm( |
---|
68 | (int *) bsp_section_data_begin, |
---|
69 | (const int *) bsp_section_data_load_begin, |
---|
70 | (size_t) bsp_section_data_size |
---|
71 | ); |
---|
72 | |
---|
73 | /* Copy .fast section */ |
---|
74 | bsp_start_memcpy_arm( |
---|
75 | (int *) bsp_section_fast_begin, |
---|
76 | (const int *) bsp_section_fast_load_begin, |
---|
77 | (size_t) bsp_section_fast_size |
---|
78 | ); |
---|
79 | |
---|
80 | /* Clear .bss section */ |
---|
81 | lpc32xx_clear_bss(); |
---|
82 | |
---|
83 | /* At this point we can use objects outside the .start section */ |
---|
84 | } |
---|