- Timestamp:
-
05/11/10 13:37:07 (14 years ago)
- Author:
-
Sh
- Comment:
-
/* Implementation Details */
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v9
|
v10
|
|
113 | 113 | |
114 | 114 | typedef void (*rtems_sysinit_function)(rtems_sysinit_state state); |
| 115 | = Error Handling = |
| 116 | |
| 117 | |
| 118 | * What should happen if an error occurs during initialization or termination? |
| 119 | * Should we do the error handling on a per function basis? |
| 120 | * Should we use a return status code and let the initialization sequencer decide what to do? |
| 121 | = Linker Set Construction = |
| 122 | |
| 123 | |
| 124 | What action will add an item to the linker set? |
| 125 | |
| 126 | # We have an explicit reference to an object which contains a linker set item. |
| 127 | # We add an object which contains a linker set item to our binary. |
| 128 | |
| 129 | Since RTEMS is used as a library the first action is trivial. |
| 130 | |
| 131 | To trigger the second action may be difficult. Some objects may perform basic actions during system initialization but are not referenced by the application for example the board support package dependent startup. How can we ensure that these objects will be part of the application? Normal kernels like FreeBSD or Linux are a collection of objects and not a library. The build process determines the set of kernel objects. |
| 132 | = C++ Support = |
| 133 | |
| 134 | |
| 135 | It should be possible to construct global C++ objects via the sequenced initialization mechanism. |
| 136 | |
| 137 | Example: |
| 138 | static char blob [sizeof(T)]; |
| 139 | |
| 140 | T &obj = *reinterpret_cast<T *>(blob); |
| 141 | |
| 142 | static void init_obj(rtems_sysinit_state state) |
| 143 | { |
| 144 | switch (state) { |
| 145 | case RTEMS_SYSINIT_STARTUP: |
| 146 | new (blob) T(1234567890); |
| 147 | break; |
| 148 | case RTEMS_SYSINIT_TERMINATE: |
| 149 | obj.~T(); |
| 150 | break; |
| 151 | default: |
| 152 | break; |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | RTEMS_SYSINIT(0, init_obj); |
115 | 157 | = Open Projects = |
116 | 158 | |