- Timestamp:
-
05/11/10 12:56:19 (14 years ago)
- Author:
-
Sh
- Comment:
-
/* Implementation Alternatives */
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v7
|
v8
|
|
35 | 35 | |
36 | 36 | Code and data size measurements should be made before and after the implementation is done on the sparc/sis and arm/rtl22xx_t BSPs. These BSPs are used for code size analysis across releases. |
37 | | = Implementation Alternatives = |
| 37 | = Implementation Details = |
38 | 38 | |
39 | 39 | = Definitions = |
… |
… |
|
74 | 74 | * [CON] Depends on GNU linker feature. |
75 | 75 | * [CON] Order information must be derived from the place in the linker set. It is impossible to derive the order value specified at compile time. |
| 76 | |
| 77 | Linker command file example: |
| 78 | .rtems : { |
| 79 | . = ALIGN(8); |
| 80 | rtems_sysinit_begin = .; |
| 81 | *(SORT(.rtems.sysinit.*)) |
| 82 | rtems_sysinit_end = .; |
| 83 | } |
| 84 | |
| 85 | Header file example: |
| 86 | #define RTEMS_SYSINIT_MAKE_STRING(str) #str |
| 87 | |
| 88 | #define RTEMS_SYSINIT(group, func) \ |
| 89 | static const uintptr_t \ |
| 90 | rtems_sysinit_ ## func \ |
| 91 | __attribute__((section(".rtems.sysinit." RTEMS_SYSINIT_MAKE_STRING(group)))) \ |
| 92 | __attribute__((used)) \ |
| 93 | = (uintptr_t) &func |
| 94 | |
| 95 | extern uintptr_t rtems_sysinit_begin []; |
| 96 | |
| 97 | extern uintptr_t rtems_sysinit_end []; |
| 98 | = Initialization and Termination = |
| 99 | |
| 100 | |
| 101 | The sequenced initialization can be used also for termination. We have two alternatives here: |
| 102 | |
| 103 | # Add a second linker set for termination items. |
| 104 | # Use the initialization linker set and pass a state parameter to the initialization function. The initialization functions should be called in reversed initialization order for termination. |
| 105 | |
| 106 | We should use the second approach. This is more flexible and reduces the code inside the linker command files. Linker command files are hard to maintain. |
| 107 | |
| 108 | Proposed API: |
| 109 | typedef enum { |
| 110 | RTEMS_SYSINIT_STARTUP, |
| 111 | RTEMS_SYSINIT_TERMINATE |
| 112 | } rtems_sysinit_state; |
| 113 | |
| 114 | typedef void (*rtems_sysinit_function)(rtems_sysinit_state state); |
76 | 115 | = Open Projects = |
77 | 116 | |