1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup bsp_bootcard |
---|
5 | * |
---|
6 | * @brief Standard system startup. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2008 |
---|
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 found in the file |
---|
18 | * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE. |
---|
19 | * |
---|
20 | * $Id$ |
---|
21 | */ |
---|
22 | |
---|
23 | /** |
---|
24 | * @defgroup bsp_kit Board Support Package |
---|
25 | * |
---|
26 | * @brief Board support package dependent code. |
---|
27 | */ |
---|
28 | |
---|
29 | /** |
---|
30 | * @defgroup bsp_bootcard Bootcard |
---|
31 | * |
---|
32 | * @ingroup bsp_kit |
---|
33 | * |
---|
34 | * @brief Standard system startup. |
---|
35 | * |
---|
36 | * @{ |
---|
37 | */ |
---|
38 | |
---|
39 | #ifndef LIBBSP_SHARED_BOOTCARD_H |
---|
40 | #define LIBBSP_SHARED_BOOTCARD_H |
---|
41 | |
---|
42 | #include <stddef.h> |
---|
43 | #include <stdint.h> |
---|
44 | #include <sys/types.h> |
---|
45 | |
---|
46 | #include <bspopts.h> |
---|
47 | |
---|
48 | #ifdef __cplusplus |
---|
49 | extern "C" { |
---|
50 | #endif /* __cplusplus */ |
---|
51 | |
---|
52 | /** |
---|
53 | * @brief Global pointer to the command line of boot_card(). |
---|
54 | */ |
---|
55 | extern const char *bsp_boot_cmdline; |
---|
56 | |
---|
57 | void bsp_start(void); |
---|
58 | |
---|
59 | void bsp_pretasking_hook(void); |
---|
60 | |
---|
61 | void bsp_predriver_hook(void); |
---|
62 | |
---|
63 | void bsp_postdriver_hook(void); |
---|
64 | |
---|
65 | void bsp_cleanup(void); |
---|
66 | |
---|
67 | void bsp_reset(void); |
---|
68 | |
---|
69 | /** |
---|
70 | * @brief Should be used as the heap begin address in bsp_get_work_area() if |
---|
71 | * the heap area is contained in the work area. |
---|
72 | */ |
---|
73 | #define BSP_BOOTCARD_HEAP_USES_WORK_AREA NULL |
---|
74 | |
---|
75 | /** |
---|
76 | * @brief Should be used to request the default heap size in bsp_get_work_area(). |
---|
77 | * |
---|
78 | * In case that the heap area is contained in the work area this heap size |
---|
79 | * value indicates that the area outside the work space should be used as heap |
---|
80 | * space. |
---|
81 | */ |
---|
82 | #define BSP_BOOTCARD_HEAP_SIZE_DEFAULT 0 |
---|
83 | |
---|
84 | void bsp_get_work_area( |
---|
85 | void **work_area_begin, |
---|
86 | uintptr_t *work_area_size, |
---|
87 | void **heap_begin, |
---|
88 | uintptr_t *heap_size |
---|
89 | ); |
---|
90 | |
---|
91 | /** |
---|
92 | * @brief Standard system initialization procedure. |
---|
93 | * |
---|
94 | * You may pass a command line in @a cmdline. It is later available via the |
---|
95 | * global @ref bsp_boot_cmdline variable. |
---|
96 | * |
---|
97 | * This is the C entry point for ALL RTEMS BSPs. It is invoked from the |
---|
98 | * assembly language initialization file usually called @c start.S which does |
---|
99 | * the basic CPU setup (stack, C runtime environment, zero BSS, load other |
---|
100 | * sections) and calls afterwards boot_card(). The boot card function provides |
---|
101 | * the framework for the BSP initialization sequence. The basic flow of |
---|
102 | * initialization is: |
---|
103 | * |
---|
104 | * - disable interrupts, interrupts will be enabled during the first context switch |
---|
105 | * - bsp_start() - more advanced initialization |
---|
106 | * - obtain information on BSP memory via bsp_get_work_area() and allocate RTEMS Workspace |
---|
107 | * - rtems_initialize_data_structures() |
---|
108 | * - allocate memory for C Program Heap |
---|
109 | * - initialize C Library and C Program Heap |
---|
110 | * - bsp_pretasking_hook() |
---|
111 | * - if defined( RTEMS_DEBUG ) |
---|
112 | * - rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ) |
---|
113 | * - rtems_initialize_before_drivers() |
---|
114 | * - bsp_predriver_hook() |
---|
115 | * - rtems_initialize_device_drivers() |
---|
116 | * - initialization of all device drivers |
---|
117 | * - bsp_postdriver_hook() |
---|
118 | * - rtems_initialize_start_multitasking() |
---|
119 | * - 1st task executes C++ global constructors |
---|
120 | * - .... appplication runs ... |
---|
121 | * - exit |
---|
122 | * - back to here eventually |
---|
123 | * - bsp_cleanup() |
---|
124 | * |
---|
125 | * If something goes wrong bsp_cleanup() will be called out of order. |
---|
126 | * |
---|
127 | * This style of initialization ensures that the C++ global constructors are |
---|
128 | * executed after RTEMS is initialized. |
---|
129 | */ |
---|
130 | int boot_card(const char *cmdline); |
---|
131 | |
---|
132 | /** @} */ |
---|
133 | |
---|
134 | void bsp_libc_init(void *heap_begin, uintptr_t heap_size, size_t sbrk_amount); |
---|
135 | |
---|
136 | #ifdef __cplusplus |
---|
137 | } |
---|
138 | #endif /* __cplusplus */ |
---|
139 | |
---|
140 | #endif /* LIBBSP_SHARED_BOOTCARD_H */ |
---|