1 | @c COPYRIGHT (c) 1988-1998. |
---|
2 | @c On-Line Applications Research Corporation (OAR). |
---|
3 | @c All rights reserved. |
---|
4 | @c |
---|
5 | @c $Id$ |
---|
6 | @c |
---|
7 | |
---|
8 | @c The following macros from confdefs.h have not been discussed in this |
---|
9 | @c chapter: |
---|
10 | @c |
---|
11 | @c CONFIGURE_NEWLIB_EXTENSION |
---|
12 | @c CONFIGURE_MALLOC_REGION |
---|
13 | @c CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS |
---|
14 | @c CONFIGURE_LIBIO_SEMAPHORES |
---|
15 | @c CONFIGURE_INIT |
---|
16 | @c CONFIGURE_INTERRUPT_STACK_MEMORY |
---|
17 | @c CONFIGURE_GNAT_RTEMS |
---|
18 | @c CONFIGURE_GNAT_MUTEXES |
---|
19 | @c CONFIGURE_GNAT_KEYS |
---|
20 | @c CONFIGURE_MAXIMUM_ADA_TASKS |
---|
21 | @c CONFIGURE_MAXIMUM_FAKE_ADA_TASKS |
---|
22 | @c CONFIGURE_ADA_TASKS_STACK |
---|
23 | @c |
---|
24 | @c In addition, there should be examples of defining your own |
---|
25 | @c Device Driver Table, Init task table, etc. |
---|
26 | @c |
---|
27 | @c Regardless, this is a big step up. :) |
---|
28 | @c |
---|
29 | |
---|
30 | @chapter Configuring a System |
---|
31 | |
---|
32 | @section Automatic Generation of System Configuration |
---|
33 | |
---|
34 | RTEMS provides the @code{confdefs.h} C language header file that |
---|
35 | based on the setting of a variety of macros can automatically |
---|
36 | produce nearly all of the configuration tables required |
---|
37 | by an RTEMS application. Rather than building the individual |
---|
38 | tables by hand. the application simply specifies the values |
---|
39 | for the configuration parameters it wishes to set. In the following |
---|
40 | example, the configuration information for a simple system with |
---|
41 | a message queue and a time slice of 50 milliseconds is configured: |
---|
42 | |
---|
43 | @example |
---|
44 | @group |
---|
45 | #define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER |
---|
46 | #define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER |
---|
47 | |
---|
48 | #define CONFIGURE_MICROSECONDS_PER_TICK 1000 /* 1 millisecond */ |
---|
49 | #define CONFIGURE_TICKS_PER_TIMESLICE 50 /* 50 milliseconds */ |
---|
50 | |
---|
51 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
52 | @end group |
---|
53 | @end example |
---|
54 | |
---|
55 | This system will begin execution with the single initialization task |
---|
56 | named @code{Init}. It will be configured to have both a console |
---|
57 | device driver (for standard I/O) and a clock tick device driver. |
---|
58 | |
---|
59 | For each configuration parameter in the configuration tables, the |
---|
60 | macro corresponding to that field is discussed. Most systems |
---|
61 | can be easily configured using the @code{confdefs.h} mechanism. |
---|
62 | |
---|
63 | @section Configuration Table |
---|
64 | |
---|
65 | The RTEMS Configuration Table is used to tailor an |
---|
66 | application for its specific needs. For example, the user can |
---|
67 | configure the number of device drivers or which APIs may be used. |
---|
68 | THe address of the user-defined Configuration Table is passed as an |
---|
69 | argument to the @code{@value{DIRPREFIX}initialize_executive} |
---|
70 | directive, which MUST be the first RTEMS directive called. |
---|
71 | The RTEMS Configuration Table |
---|
72 | is defined in the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
73 | |
---|
74 | @ifset is-C |
---|
75 | @example |
---|
76 | @group |
---|
77 | typedef struct @{ |
---|
78 | void *work_space_start; |
---|
79 | rtems_unsigned32 work_space_size; |
---|
80 | rtems_unsigned32 maximum_extensions; |
---|
81 | rtems_unsigned32 microseconds_per_tick; |
---|
82 | rtems_unsigned32 ticks_per_timeslice; |
---|
83 | rtems_unsigned32 maximum_devices; |
---|
84 | rtems_unsigned32 number_of_device_drivers; |
---|
85 | rtems_driver_address_table *Device_driver_table; |
---|
86 | rtems_unsigned32 number_of_initial_extensions; |
---|
87 | rtems_extensions_table *User_extension_table; |
---|
88 | rtems_multiprocessing_table *User_multiprocessing_table; |
---|
89 | rtems_api_configuration_table *RTEMS_api_configuration; |
---|
90 | posix_api_configuration_table *POSIX_api_configuration; |
---|
91 | @} rtems_configuration_table; |
---|
92 | @end group |
---|
93 | @end example |
---|
94 | @end ifset |
---|
95 | |
---|
96 | @ifset is-Ada |
---|
97 | @example |
---|
98 | type Configuration_Table is |
---|
99 | record |
---|
100 | Work_Space_Start : RTEMS.Address; |
---|
101 | Work_Space_Size : RTEMS.Unsigned32; |
---|
102 | Maximum_Extensions : RTEMS.Unsigned32; |
---|
103 | Microseconds_Per_Tick : RTEMS.Unsigned32; |
---|
104 | Ticks_Per_Timeslice : RTEMS.Unsigned32; |
---|
105 | Maximum_Devices : RTEMS.Unsigned32; |
---|
106 | Number_Of_Device_Drivers : RTEMS.Unsigned32; |
---|
107 | Device_Driver_Table : RTEMS.Driver_Address_Table_Pointer; |
---|
108 | Number_Of_Initial_Extensions : RTEMS.Unsigned32; |
---|
109 | User_Extension_Table : RTEMS.Extensions_Table_Pointer; |
---|
110 | User_Multiprocessing_Table : RTEMS.Multiprocessing_Table_Pointer; |
---|
111 | RTEMS_API_Configuration : RTEMS.API_Configuration_Table_Pointer; |
---|
112 | POSIX_API_Configuration : |
---|
113 | RTEMS.POSIX_API_Configuration_Table_Pointer; |
---|
114 | end record; |
---|
115 | |
---|
116 | type Configuration_Table_Pointer is access all Configuration_Table; |
---|
117 | @end example |
---|
118 | @end ifset |
---|
119 | |
---|
120 | @table @b |
---|
121 | @item work_space_start |
---|
122 | is the address of the RTEMS RAM Workspace. |
---|
123 | This area contains items such as the |
---|
124 | various object control blocks (TCBs, QCBs, ...) and task stacks. |
---|
125 | If the address is not aligned on a four-word boundary, then |
---|
126 | RTEMS will invoke the fatal error handler during |
---|
127 | @code{@value{DIRPREFIX}initialize_executive}. |
---|
128 | When using the @code{confdefs.h} mechanism for configuring |
---|
129 | an RTEMS application, the value for this field corresponds |
---|
130 | to the setting of the macro @code{CONFIGURE_EXECUTIVE_RAM_WORK_AREA}. |
---|
131 | |
---|
132 | @item work_space_size |
---|
133 | is the calculated size of the |
---|
134 | RTEMS RAM Workspace. The section Sizing the RTEMS RAM Workspace |
---|
135 | details how to arrive at this number. |
---|
136 | When using the @code{confdefs.h} mechanism for configuring |
---|
137 | an RTEMS application, the value for this field corresponds |
---|
138 | to the setting of the macro @code{CONFIGURE_EXECUTIVE_RAM_SIZE} |
---|
139 | and is calculated based on the other system configuration settings. |
---|
140 | |
---|
141 | @item microseconds_per_tick |
---|
142 | is number of microseconds per clock tick. |
---|
143 | When using the @code{confdefs.h} mechanism for configuring |
---|
144 | an RTEMS application, the value for this field corresponds |
---|
145 | to the setting of the macro @code{CONFIGURE_MICROSECONDS_PER_TICK}. |
---|
146 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_TASKS} |
---|
147 | macro defaults to 10. |
---|
148 | XXX |
---|
149 | |
---|
150 | @item ticks_per_timeslice |
---|
151 | is the number of clock ticks for a timeslice. |
---|
152 | When using the @code{confdefs.h} mechanism for configuring |
---|
153 | an RTEMS application, the value for this field corresponds |
---|
154 | to the setting of the macro @code{CONFIGURE_TICKS_PER_TIMESLICE}. |
---|
155 | |
---|
156 | @item maximum_devices |
---|
157 | is the maximum number of devices that can be registered. |
---|
158 | When using the @code{confdefs.h} mechanism for configuring |
---|
159 | an RTEMS application, the value for this field corresponds |
---|
160 | to the setting of the macro @code{CONFIGURE_MAXIMUM_DEVICES}. |
---|
161 | |
---|
162 | @item number_of_device_drivers |
---|
163 | is the number of device drivers for the system. There should be |
---|
164 | the same number of entries in the Device Driver Table. If this field |
---|
165 | is zero, then the @code{User_driver_address_table} entry should be NULL. |
---|
166 | When using the @code{confdefs.h} mechanism for configuring |
---|
167 | an RTEMS application, the value for this field is calculated |
---|
168 | automatically based on the number of entries in the |
---|
169 | Device Driver Table. This calculation is based on the assumption |
---|
170 | that the Device Driver Table is named @code{Device_drivers} |
---|
171 | and defined in C. This table may be generated automatically |
---|
172 | for simple applications using only the device drivers that correspond |
---|
173 | to the following macros: |
---|
174 | |
---|
175 | @itemize @bullet |
---|
176 | |
---|
177 | @item @code{CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER} |
---|
178 | @item @code{CONFIGURE_TEST_NEEDS_CLOCK_DRIVER} |
---|
179 | @item @code{CONFIGURE_TEST_NEEDS_TIMER_DRIVER} |
---|
180 | @item @code{CONFIGURE_TEST_NEEDS_RTC_DRIVER} |
---|
181 | @item @code{CONFIGURE_TEST_NEEDS_STUB_DRIVER} |
---|
182 | |
---|
183 | @end itemize |
---|
184 | |
---|
185 | Note that network device drivers are not configured in the |
---|
186 | Device Driver Table. |
---|
187 | |
---|
188 | @item Device_driver_table |
---|
189 | is the address of the Device Driver Table. This table contains the entry |
---|
190 | points for each device driver. If the number_of_device_drivers field is zero, |
---|
191 | then this entry should be NULL. The format of this table will be |
---|
192 | discussed below. |
---|
193 | When using the @code{confdefs.h} mechanism for configuring |
---|
194 | an RTEMS application, the Device Driver Table is assumed to be |
---|
195 | named @code{Device_drivers} and defined in C. If the application is providing |
---|
196 | its own Device Driver Table, then the macro |
---|
197 | @code{CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE} must be defined to indicate |
---|
198 | this and prevent @code{confdefs.h} from generating the table. |
---|
199 | |
---|
200 | @item number_of_initial_extensions |
---|
201 | is the number of initial user extensions. There should be |
---|
202 | the same number of entries as in the User_extension_table. If this field |
---|
203 | is zero, then the User_driver_address_table entry should be NULL. |
---|
204 | When using the @code{confdefs.h} mechanism for configuring |
---|
205 | an RTEMS application, the value for this field corresponds |
---|
206 | to the setting of the macro @code{CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS} |
---|
207 | which is set automatically by @code{confdefs.h} based on the size |
---|
208 | of the User Extensions Table. |
---|
209 | |
---|
210 | @item User_extension_table |
---|
211 | is the address of the User |
---|
212 | Extension Table. This table contains the entry points for the |
---|
213 | static set of optional user extensions. If no user extensions |
---|
214 | are configured, then this entry should be NULL. The format of |
---|
215 | this table will be discussed below. |
---|
216 | When using the @code{confdefs.h} mechanism for configuring |
---|
217 | an RTEMS application, the User Extensions Table is named |
---|
218 | @code{Configuration_Initial_Extensions} and defined in |
---|
219 | confdefs.h. It is initialized based on the following |
---|
220 | macros: |
---|
221 | |
---|
222 | @itemize @bullet |
---|
223 | |
---|
224 | @item @code{CONFIGURE_INITIAL_EXTENSIONS} |
---|
225 | @item @code{STACK_CHECKER_EXTENSION} |
---|
226 | |
---|
227 | @end itemize |
---|
228 | |
---|
229 | The application may configure one or more initial user extension |
---|
230 | sets by setting the @code{CONFIGURE_INITIAL_EXTENSIONS} macro. By |
---|
231 | defining the @code{STACK_CHECKER_EXTENSION} macro, the task stack bounds |
---|
232 | checking user extension set is automatically included in the |
---|
233 | application. |
---|
234 | |
---|
235 | @item User_multiprocessing_table |
---|
236 | is the address of the Multiprocessor Configuration Table. This |
---|
237 | table contains information needed by RTEMS only when used in a multiprocessor |
---|
238 | configuration. This field must be NULL when RTEMS is used in a |
---|
239 | single processor configuration. |
---|
240 | When using the @code{confdefs.h} mechanism for configuring |
---|
241 | an RTEMS application, the Multiprocessor Configuration Table |
---|
242 | is automatically generated when the @code{CONFIGURE_MPTEST} |
---|
243 | is defined. If @code{CONFIGURE_MPTEST} is not defined, the this |
---|
244 | entry is set to NULL. The generated table has the name |
---|
245 | @code{Multiprocessing_configuration}. |
---|
246 | |
---|
247 | @item RTEMS_api_configuration |
---|
248 | is the address of the RTEMS API Configuration Table. This table |
---|
249 | contains information needed by the RTEMS API. This field should be |
---|
250 | NULL if the RTEMS API is not used. [NOTE: Currently the RTEMS API |
---|
251 | is required to support support components such as BSPs and libraries |
---|
252 | which use this API.] This table is built automatically and this |
---|
253 | entry filled in, if using the @code{confdefs.h} application |
---|
254 | configuration mechanism. The generated table has the name |
---|
255 | @code{Configuration_RTEMS_API}. |
---|
256 | |
---|
257 | @item POSIX_api_configuration |
---|
258 | is the address of the POSIX API Configuration Table. This table |
---|
259 | contains information needed by the POSIX API. This field should be |
---|
260 | NULL if the POSIX API is not used. This table is built automatically |
---|
261 | and this entry filled in, if using the @code{confdefs.h} application |
---|
262 | configuration mechanism. The @code{confdefs.h} application |
---|
263 | mechanism will fill this field in with the address of the |
---|
264 | @code{Configuration_POSIX_API} table of POSIX API is configured |
---|
265 | and NULL if the POSIX API is not configured. |
---|
266 | |
---|
267 | @end table |
---|
268 | |
---|
269 | @section RTEMS API Configuration Table |
---|
270 | |
---|
271 | The RTEMS API Configuration Table is used to configure the |
---|
272 | managers which constitute the RTEMS API for a particular application. |
---|
273 | For example, the user can configure the maximum number of tasks for |
---|
274 | this application. The RTEMS API Configuration Table is defined in |
---|
275 | the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
276 | |
---|
277 | @ifset is-C |
---|
278 | @example |
---|
279 | @group |
---|
280 | typedef struct @{ |
---|
281 | rtems_unsigned32 maximum_tasks; |
---|
282 | rtems_unsigned32 maximum_timers; |
---|
283 | rtems_unsigned32 maximum_semaphores; |
---|
284 | rtems_unsigned32 maximum_message_queues; |
---|
285 | rtems_unsigned32 maximum_partitions; |
---|
286 | rtems_unsigned32 maximum_regions; |
---|
287 | rtems_unsigned32 maximum_ports; |
---|
288 | rtems_unsigned32 maximum_periods; |
---|
289 | rtems_unsigned32 number_of_initialization_tasks; |
---|
290 | rtems_initialization_tasks_table *User_initialization_tasks_table; |
---|
291 | @} rtems_api_configuration_table; |
---|
292 | @end group |
---|
293 | @end example |
---|
294 | @end ifset |
---|
295 | |
---|
296 | @ifset is-Ada |
---|
297 | @example |
---|
298 | type API_Configuration_Table is |
---|
299 | record |
---|
300 | Maximum_Tasks : RTEMS.Unsigned32; |
---|
301 | Maximum_Timers : RTEMS.Unsigned32; |
---|
302 | Maximum_Semaphores : RTEMS.Unsigned32; |
---|
303 | Maximum_Message_queues : RTEMS.Unsigned32; |
---|
304 | Maximum_Partitions : RTEMS.Unsigned32; |
---|
305 | Maximum_Regions : RTEMS.Unsigned32; |
---|
306 | Maximum_Ports : RTEMS.Unsigned32; |
---|
307 | Maximum_Periods : RTEMS.Unsigned32; |
---|
308 | Number_Of_Initialization_Tasks : RTEMS.Unsigned32; |
---|
309 | User_Initialization_Tasks_Table : |
---|
310 | RTEMS.Initialization_Tasks_Table_Pointer; |
---|
311 | end record; |
---|
312 | |
---|
313 | type API_Configuration_Table_Pointer is access all API_Configuration_Table; |
---|
314 | @end example |
---|
315 | @end ifset |
---|
316 | |
---|
317 | @table @b |
---|
318 | @item maximum_tasks |
---|
319 | is the maximum number of tasks that |
---|
320 | can be concurrently active (created) in the system including |
---|
321 | initialization tasks. |
---|
322 | When using the @code{confdefs.h} mechanism for configuring |
---|
323 | an RTEMS application, the value for this field corresponds |
---|
324 | to the setting of the macro @code{CONFIGURE_MAXIMUM_TASKS}. |
---|
325 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_TASKS} |
---|
326 | macro defaults to 10. |
---|
327 | |
---|
328 | @item maximum_timers |
---|
329 | is the maximum number of timers |
---|
330 | that can be concurrently active in the system. |
---|
331 | When using the @code{confdefs.h} mechanism for configuring |
---|
332 | an RTEMS application, the value for this field corresponds |
---|
333 | to the setting of the macro @code{CONFIGURE_MAXIMUM_TIMERS}. |
---|
334 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_TIMERS} |
---|
335 | macro defaults to 0. |
---|
336 | |
---|
337 | @item maximum_semaphores |
---|
338 | is the maximum number of |
---|
339 | semaphores that can be concurrently active in the system. |
---|
340 | When using the @code{confdefs.h} mechanism for configuring |
---|
341 | an RTEMS application, the value for this field corresponds |
---|
342 | to the setting of the macro @code{CONFIGURE_MAXIMUM_SEMAPHORES}. |
---|
343 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_SEMAPHORES} |
---|
344 | macro defaults to 0. |
---|
345 | |
---|
346 | @item maximum_message_queues |
---|
347 | is the maximum number of |
---|
348 | message queues that can be concurrently active in the system. |
---|
349 | When using the @code{confdefs.h} mechanism for configuring |
---|
350 | an RTEMS application, the value for this field corresponds |
---|
351 | to the setting of the macro @code{CONFIGURE_MAXIMUM_MESSAGE_QUEUES}. |
---|
352 | If not defined by the application, then the |
---|
353 | @code{CONFIGURE_MAXIMUM_MESSAGE_QUEUES} macro defaults to 0. |
---|
354 | |
---|
355 | @item maximum_partitions |
---|
356 | is the maximum number of |
---|
357 | partitions that can be concurrently active in the system. |
---|
358 | When using the @code{confdefs.h} mechanism for configuring |
---|
359 | an RTEMS application, the value for this field corresponds |
---|
360 | to the setting of the macro @code{CONFIGURE_MAXIMUM_PARTITIONS}. |
---|
361 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_PARTITIONS} |
---|
362 | macro defaults to 0. |
---|
363 | |
---|
364 | @item maximum_regions |
---|
365 | is the maximum number of regions |
---|
366 | that can be concurrently active in the system. |
---|
367 | When using the @code{confdefs.h} mechanism for configuring |
---|
368 | an RTEMS application, the value for this field corresponds |
---|
369 | to the setting of the macro @code{CONFIGURE_MAXIMUM_REGIONS}. |
---|
370 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_REGIONS} |
---|
371 | macro defaults to 0. |
---|
372 | |
---|
373 | @item maximum_ports |
---|
374 | is the maximum number of ports into |
---|
375 | dual-port memory areas that can be concurrently active in the |
---|
376 | system. |
---|
377 | When using the @code{confdefs.h} mechanism for configuring |
---|
378 | an RTEMS application, the value for this field corresponds |
---|
379 | to the setting of the macro @code{CONFIGURE_MAXIMUM_PORTS}. |
---|
380 | If not defined by the application, then the @code{CONFIGURE_MAXIMUM_PORTS} |
---|
381 | macro defaults to 0. |
---|
382 | |
---|
383 | @item number_of_initialization_tasks |
---|
384 | is the number of initialization tasks configured. At least one |
---|
385 | RTEMS initialization task or POSIX initializatin must be configured |
---|
386 | in order for the user's application to begin executing. |
---|
387 | When using the @code{confdefs.h} mechanism for configuring |
---|
388 | an RTEMS application, the user must define the |
---|
389 | @code{CONFIGURE_RTEMS_INIT_TASKS_TABLE} to indicate that there |
---|
390 | is one or more RTEMS initialization task. If the application |
---|
391 | only has one RTEMS initialization task, then the automatically |
---|
392 | generated Initialization Task Table will be sufficient. The following |
---|
393 | macros correspond to the single initialization task: |
---|
394 | |
---|
395 | @itemize @bullet |
---|
396 | |
---|
397 | @item @code{CONFIGURE_INIT_TASK_NAME} - is the name of the task. |
---|
398 | If this macro is not defined by the application, then this defaults |
---|
399 | to the task name of @code{"UI1 "} for User Initialization Task 1. |
---|
400 | |
---|
401 | @item @code{CONFIGURE_INIT_TASK_STACK_SIZE} - is the stack size |
---|
402 | of the single initialization task. If this macro is not defined |
---|
403 | by the application, then this defaults to @code{RTEMS_MINIMUM_STACK_SIZE}. |
---|
404 | |
---|
405 | @item @code{CONFIGURE_INIT_TASK_PRIORITY} - is the initial priority |
---|
406 | of the single initialization task. If this macro is not defined |
---|
407 | by the application, then this defaults to 1. |
---|
408 | |
---|
409 | @item @code{CONFIGURE_INIT_TASK_ATTRIBUTES} - is the attributes |
---|
410 | of the single initialization task. If this macro is not defined |
---|
411 | by the application, then this defaults to @code{RTEMS_DEFAULT_ATTRIBUTES}. |
---|
412 | |
---|
413 | @item @code{CONFIGURE_INIT_TASK_ENTRY_POINT} - is the entry point |
---|
414 | of the single initialization task. If this macro is not defined |
---|
415 | by the application, then this defaults to the C language routine |
---|
416 | @code{Init}. |
---|
417 | |
---|
418 | @item @code{CONFIGURE_INIT_TASK_INITIAL_MODES} - is the initial execution |
---|
419 | modes of the single initialization task. If this macro is not defined |
---|
420 | by the application, then this defaults to @code{RTEMS_NO_PREEMPT}. |
---|
421 | |
---|
422 | @item @code{CONFIGURE_INIT_TASK_ARGUMENTS} - is the argument passed to the |
---|
423 | of the single initialization task. If this macro is not defined |
---|
424 | by the application, then this defaults to 0. |
---|
425 | |
---|
426 | |
---|
427 | @end itemize |
---|
428 | |
---|
429 | |
---|
430 | has the option to have |
---|
431 | value for this field corresponds |
---|
432 | to the setting of the macro @code{}. |
---|
433 | |
---|
434 | @item User_initialization_tasks_table |
---|
435 | is the address of the Initialization Task Table. This table contains the |
---|
436 | information needed to create and start each of the |
---|
437 | initialization tasks. The format of this table will be discussed below. |
---|
438 | When using the @code{confdefs.h} mechanism for configuring |
---|
439 | an RTEMS application, the value for this field corresponds |
---|
440 | to the setting of the macro @code{CONFIGURE_EXECUTIVE_RAM_WORK_AREA}. |
---|
441 | |
---|
442 | @end table |
---|
443 | |
---|
444 | @section POSIX API Configuration Table |
---|
445 | |
---|
446 | The POSIX API Configuration Table is used to configure the |
---|
447 | managers which constitute the POSIX API for a particular application. |
---|
448 | For example, the user can configure the maximum number of threads for |
---|
449 | this application. The POSIX API Configuration Table is defined in |
---|
450 | the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
451 | |
---|
452 | @ifset is-C |
---|
453 | @example |
---|
454 | @group |
---|
455 | typedef struct @{ |
---|
456 | void *(*thread_entry)(void *); |
---|
457 | @} posix_initialization_threads_table; |
---|
458 | |
---|
459 | typedef struct @{ |
---|
460 | int maximum_threads; |
---|
461 | int maximum_mutexes; |
---|
462 | int maximum_condition_variables; |
---|
463 | int maximum_keys; |
---|
464 | int maximum_timers; |
---|
465 | int maximum_queued_signals; |
---|
466 | int number_of_initialization_tasks; |
---|
467 | posix_initialization_threads_table *User_initialization_tasks_table; |
---|
468 | @} posix_api_configuration_table; |
---|
469 | @end group |
---|
470 | @end example |
---|
471 | @end ifset |
---|
472 | |
---|
473 | @ifset is-Ada |
---|
474 | @example |
---|
475 | type POSIX_Thread_Entry is access procedure ( |
---|
476 | Argument : in RTEMS.Address |
---|
477 | ); |
---|
478 | |
---|
479 | type POSIX_Initialization_Threads_Table_Entry is |
---|
480 | record |
---|
481 | Thread_Entry : RTEMS.POSIX_Thread_Entry; |
---|
482 | end record; |
---|
483 | |
---|
484 | type POSIX_Initialization_Threads_Table is array |
---|
485 | ( RTEMS.Unsigned32 range <> ) of |
---|
486 | RTEMS.POSIX_Initialization_Threads_Table_Entry; |
---|
487 | |
---|
488 | type POSIX_Initialization_Threads_Table_Pointer is access all |
---|
489 | POSIX_Initialization_Threads_Table; |
---|
490 | |
---|
491 | type POSIX_API_Configuration_Table_Entry is |
---|
492 | record |
---|
493 | Maximum_Threads : Interfaces.C.Int; |
---|
494 | Maximum_Mutexes : Interfaces.C.Int; |
---|
495 | Maximum_Condition_Variables : Interfaces.C.Int; |
---|
496 | Maximum_Keys : Interfaces.C.Int; |
---|
497 | Maximum_Timers : Interfaces.C.Int; |
---|
498 | Maximum_Queued_Signals : Interfaces.C.Int; |
---|
499 | Number_Of_Initialization_Tasks : Interfaces.C.Int; |
---|
500 | User_Initialization_Tasks_Table : |
---|
501 | RTEMS.POSIX_Initialization_Threads_Table_Pointer; |
---|
502 | end record; |
---|
503 | |
---|
504 | type POSIX_API_Configuration_Table is array ( RTEMS.Unsigned32 range <> ) of |
---|
505 | RTEMS.POSIX_API_Configuration_Table_Entry; |
---|
506 | |
---|
507 | type POSIX_API_Configuration_Table_Pointer is access all |
---|
508 | RTEMS.POSIX_API_Configuration_Table; |
---|
509 | @end example |
---|
510 | @end ifset |
---|
511 | |
---|
512 | @table @b |
---|
513 | @item maximum_threads |
---|
514 | is the maximum number of threads that |
---|
515 | can be concurrently active (created) in the system including |
---|
516 | initialization threads. |
---|
517 | When using the @code{confdefs.h} mechanism for configuring |
---|
518 | an RTEMS application, the value for this field corresponds |
---|
519 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_THREADS}. |
---|
520 | If not defined by the application, then the |
---|
521 | @code{CONFIGURE_MAXIMUM_POSIX_THREADS} macro defaults to 10. |
---|
522 | |
---|
523 | @item maximum_mutexes |
---|
524 | is the maximum number of mutexes that can be concurrently |
---|
525 | active in the system. |
---|
526 | When using the @code{confdefs.h} mechanism for configuring |
---|
527 | an RTEMS application, the value for this field corresponds |
---|
528 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_MUTEXES}. |
---|
529 | If not defined by the application, then the |
---|
530 | @code{CONFIGURE_MAXIMUM_POSIX_MUTEXES} macro defaults to 0. |
---|
531 | |
---|
532 | @item maximum_condition_variables |
---|
533 | is the maximum number of condition variables that can be |
---|
534 | concurrently active in the system. |
---|
535 | When using the @code{confdefs.h} mechanism for configuring |
---|
536 | an RTEMS application, the value for this field corresponds |
---|
537 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES}. |
---|
538 | If not defined by the application, then the |
---|
539 | @code{CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES} macro defaults to 0. |
---|
540 | |
---|
541 | @item maximum_keys |
---|
542 | is the maximum number of keys that can be concurrently active in the system. |
---|
543 | When using the @code{confdefs.h} mechanism for configuring |
---|
544 | an RTEMS application, the value for this field corresponds |
---|
545 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_KEYS}. |
---|
546 | If not defined by the application, then the |
---|
547 | @code{CONFIGURE_MAXIMUM_POSIX_KEYS} macro defaults to 0. |
---|
548 | |
---|
549 | @item maximum_timers |
---|
550 | is the maximum number of POSIX timers that can be concurrently active |
---|
551 | in the system. |
---|
552 | When using the @code{confdefs.h} mechanism for configuring |
---|
553 | an RTEMS application, the value for this field corresponds |
---|
554 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_TIMERS}. |
---|
555 | If not defined by the application, then the |
---|
556 | @code{CONFIGURE_MAXIMUM_POSIX_TIMERS} macro defaults to 0. |
---|
557 | |
---|
558 | @item maximum_queued_signals |
---|
559 | is the maximum number of queued signals that can be concurrently |
---|
560 | pending in the system. |
---|
561 | When using the @code{confdefs.h} mechanism for configuring |
---|
562 | an RTEMS application, the value for this field corresponds |
---|
563 | to the setting of the macro @code{CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS}. |
---|
564 | If not defined by the application, then the |
---|
565 | @code{CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS} macro defaults to 0. |
---|
566 | |
---|
567 | @item number_of_initialization_threads |
---|
568 | is the number of initialization threads configured. At least one |
---|
569 | initialization threads must be configured. |
---|
570 | When using the @code{confdefs.h} mechanism for configuring |
---|
571 | an RTEMS application, the user must define the |
---|
572 | @code{CONFIGURE_POSIX_INIT_THREAD_TABLE} to indicate that there |
---|
573 | is one or more POSIX initialization thread. If the application |
---|
574 | only has one POSIX initialization thread, then the automatically |
---|
575 | generated POSIX Initialization Thread Table will be sufficient. The following |
---|
576 | macros correspond to the single initialization task: |
---|
577 | |
---|
578 | @itemize @bullet |
---|
579 | |
---|
580 | @item @code{CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT} - is the entry |
---|
581 | point of the thread. If this macro is not defined by the application, |
---|
582 | then this defaults to the C routine @code{POSIX_Init}. |
---|
583 | |
---|
584 | @item @code{CONFIGURE_POSIX_INIT_TASK_STACK_SIZE} - is the stack size |
---|
585 | of the single initialization thread. If this macro is not defined |
---|
586 | by the application, then this defaults to |
---|
587 | @code{(RTEMS_MINIMUM_STACK_SIZE * 2)}. |
---|
588 | |
---|
589 | @end itemize |
---|
590 | |
---|
591 | @item User_initialization_threads_table |
---|
592 | is the address of the Initialization Threads Table. This table contains the |
---|
593 | information needed to create and start each of the initialization threads. |
---|
594 | The format of each entry in this table is defined in the |
---|
595 | @code{posix_initialization_threads_table} @value{STRUCTURE}. |
---|
596 | When using the @code{confdefs.h} mechanism for configuring |
---|
597 | an RTEMS application, the value for this field corresponds |
---|
598 | to the address of the @code{POSIX_Initialization_threads} structure. |
---|
599 | |
---|
600 | @end table |
---|
601 | |
---|
602 | @section CPU Dependent Information Table |
---|
603 | |
---|
604 | The CPU Dependent Information Table is used to |
---|
605 | describe processor dependent information required by RTEMS. |
---|
606 | This table is generally used to supply RTEMS with information |
---|
607 | only known by the Board Support Package. The contents of this |
---|
608 | table are discussed in the CPU Dependent Information Table |
---|
609 | chapter of the Applications Supplement document for a specific |
---|
610 | target processor. |
---|
611 | |
---|
612 | The @code{confdefs.h} mechanism does not support generating this |
---|
613 | table. It is normally filled in by the Board Support Package. |
---|
614 | |
---|
615 | @section Initialization Task Table |
---|
616 | |
---|
617 | The Initialization Task Table is used to describe |
---|
618 | each of the user initialization tasks to the Initialization |
---|
619 | Manager. The table contains one entry for each initialization |
---|
620 | task the user wishes to create and start. The fields of this |
---|
621 | data structure directly correspond to arguments to the |
---|
622 | @code{@value{DIRPREFIX}task_create} and |
---|
623 | @code{@value{DIRPREFIX}task_start} directives. The number of entries is |
---|
624 | found in the @code{number_of_initialization_tasks} entry in the |
---|
625 | Configuration Table. |
---|
626 | |
---|
627 | The format of each entry in the |
---|
628 | Initialization Task Table is defined in the following @value{LANGUAGE} |
---|
629 | @value{STRUCTURE}: |
---|
630 | |
---|
631 | @ifset is-C |
---|
632 | @example |
---|
633 | typedef struct @{ |
---|
634 | rtems_name name; |
---|
635 | rtems_unsigned32 stack_size; |
---|
636 | rtems_task_priority initial_priority; |
---|
637 | rtems_attribute attribute_set; |
---|
638 | rtems_task_entry entry_point; |
---|
639 | rtems_mode mode_set; |
---|
640 | rtems_task_argument argument; |
---|
641 | @} rtems_initialization_tasks_table; |
---|
642 | @end example |
---|
643 | @end ifset |
---|
644 | |
---|
645 | @ifset is-Ada |
---|
646 | @example |
---|
647 | type Initialization_Tasks_Table_Entry is |
---|
648 | record |
---|
649 | Name : RTEMS.Name; -- task name |
---|
650 | Stack_Size : RTEMS.Unsigned32; -- task stack size |
---|
651 | Initial_Priority : RTEMS.Task_priority; -- task priority |
---|
652 | Attribute_Set : RTEMS.Attribute; -- task attributes |
---|
653 | Entry_Point : RTEMS.Task_Entry; -- task entry point |
---|
654 | Mode_Set : RTEMS.Mode; -- task initial mode |
---|
655 | Argument : RTEMS.Unsigned32; -- task argument |
---|
656 | end record; |
---|
657 | |
---|
658 | type Initialization_Tasks_Table is array ( RTEMS.Unsigned32 range <> ) of |
---|
659 | RTEMS.Initialization_Tasks_Table_Entry; |
---|
660 | |
---|
661 | type Initialization_Tasks_Table_Pointer is access all |
---|
662 | Initialization_Tasks_Table; |
---|
663 | @end example |
---|
664 | @end ifset |
---|
665 | |
---|
666 | @table @b |
---|
667 | @item name |
---|
668 | is the name of this initialization task. |
---|
669 | |
---|
670 | @item stack_size |
---|
671 | is the size of the stack for this initialization task. |
---|
672 | |
---|
673 | @item initial_priority |
---|
674 | is the priority of this initialization task. |
---|
675 | |
---|
676 | @item attribute_set |
---|
677 | is the attribute set used during creation of this initialization task. |
---|
678 | |
---|
679 | @item entry_point |
---|
680 | is the address of the entry point of this initialization task. |
---|
681 | |
---|
682 | @item mode_set |
---|
683 | is the initial execution mode of this initialization task. |
---|
684 | |
---|
685 | @item argument |
---|
686 | is the initial argument for this initialization task. |
---|
687 | |
---|
688 | @end table |
---|
689 | |
---|
690 | A typical declaration for an Initialization Task Table might appear as follows: |
---|
691 | |
---|
692 | @ifset is-C |
---|
693 | @example |
---|
694 | rtems_initialization_tasks_table |
---|
695 | Initialization_tasks[2] = @{ |
---|
696 | @{ INIT_1_NAME, |
---|
697 | 1024, |
---|
698 | 1, |
---|
699 | DEFAULT_ATTRIBUTES, |
---|
700 | Init_1, |
---|
701 | DEFAULT_MODES, |
---|
702 | 1 |
---|
703 | |
---|
704 | @}, |
---|
705 | @{ INIT_2_NAME, |
---|
706 | 1024, |
---|
707 | 250, |
---|
708 | FLOATING_POINT, |
---|
709 | Init_2, |
---|
710 | NO_PREEMPT, |
---|
711 | 2 |
---|
712 | |
---|
713 | @} |
---|
714 | @}; |
---|
715 | @end example |
---|
716 | @end ifset |
---|
717 | |
---|
718 | @ifset is-Ada |
---|
719 | @example |
---|
720 | Initialization_Tasks : aliased RTEMS.Initialization_Tasks_Table( 1 .. 2 ) := ( |
---|
721 | (INIT_1_NAME, |
---|
722 | 1024, |
---|
723 | 1, |
---|
724 | RTEMS.Default_Attributes, |
---|
725 | Init_1'Access, |
---|
726 | RTEMS.Default_Modes, |
---|
727 | 1), |
---|
728 | (INIT_2_NAME, |
---|
729 | 1024, |
---|
730 | 250, |
---|
731 | RTEMS.Floating_Point, |
---|
732 | Init_2'Access, |
---|
733 | RTEMS.No_Preempt, |
---|
734 | 2) |
---|
735 | ); |
---|
736 | @end example |
---|
737 | @end ifset |
---|
738 | |
---|
739 | @section Driver Address Table |
---|
740 | |
---|
741 | The Device Driver Table is used to inform the I/O |
---|
742 | Manager of the set of entry points for each device driver |
---|
743 | configured in the system. The table contains one entry for each |
---|
744 | device driver required by the application. The number of |
---|
745 | entries is defined in the number_of_device_drivers entry in the |
---|
746 | Configuration Table. The format of each entry in the Device |
---|
747 | Driver Table is defined in |
---|
748 | the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
749 | |
---|
750 | @ifset is-C |
---|
751 | @example |
---|
752 | typedef struct @{ |
---|
753 | rtems_device_driver_entry initialization; |
---|
754 | rtems_device_driver_entry open; |
---|
755 | rtems_device_driver_entry close; |
---|
756 | rtems_device_driver_entry read; |
---|
757 | rtems_device_driver_entry write; |
---|
758 | rtems_device_driver_entry control; |
---|
759 | @} rtems_driver_address_table; |
---|
760 | @end example |
---|
761 | @end ifset |
---|
762 | |
---|
763 | @ifset is-Ada |
---|
764 | @example |
---|
765 | type Driver_Address_Table_Entry is |
---|
766 | record |
---|
767 | Initialization : RTEMS.Device_Driver_Entry; |
---|
768 | Open : RTEMS.Device_Driver_Entry; |
---|
769 | Close : RTEMS.Device_Driver_Entry; |
---|
770 | Read : RTEMS.Device_Driver_Entry; |
---|
771 | Write : RTEMS.Device_Driver_Entry; |
---|
772 | Control : RTEMS.Device_Driver_Entry; |
---|
773 | end record; |
---|
774 | |
---|
775 | type Driver_Address_Table is array ( RTEMS.Unsigned32 range <> ) of |
---|
776 | RTEMS.Driver_Address_Table_Entry; |
---|
777 | |
---|
778 | type Driver_Address_Table_Pointer is access all Driver_Address_Table; |
---|
779 | @end example |
---|
780 | @end ifset |
---|
781 | |
---|
782 | @table @b |
---|
783 | @item initialization |
---|
784 | is the address of the entry point called by |
---|
785 | @code{@value{DIRPREFIX}io_initialize} |
---|
786 | to initialize a device driver and its associated devices. |
---|
787 | |
---|
788 | @item open |
---|
789 | is the address of the entry point called by @code{@value{DIRPREFIX}io_open}. |
---|
790 | |
---|
791 | @item close |
---|
792 | is the address of the entry point called by @code{@value{DIRPREFIX}io_close}. |
---|
793 | |
---|
794 | @item read |
---|
795 | is the address of the entry point called by @code{@value{DIRPREFIX}io_read}. |
---|
796 | |
---|
797 | @item write |
---|
798 | is the address of the entry point called by @code{@value{DIRPREFIX}io_write}. |
---|
799 | |
---|
800 | @item control |
---|
801 | is the address of the entry point called by @code{@value{DIRPREFIX}io_control}. |
---|
802 | |
---|
803 | @end table |
---|
804 | |
---|
805 | Driver entry points configured as NULL will always |
---|
806 | return a status code of @code{@value{RPREFIX}SUCCESSFUL}. No user code will be |
---|
807 | executed in this situation. |
---|
808 | |
---|
809 | A typical declaration for a Device Driver Table might appear as follows: |
---|
810 | |
---|
811 | @ifset is-C |
---|
812 | @example |
---|
813 | rtems_driver_address_table Driver_table[2] = @{ |
---|
814 | @{ tty_initialize, tty_open, tty_close, /* major = 0 */ |
---|
815 | tty_read, tty_write, tty_control |
---|
816 | @}, |
---|
817 | @{ lp_initialize, lp_open, lp_close, /* major = 1 */ |
---|
818 | NULL, lp_write, lp_control |
---|
819 | @} |
---|
820 | @}; |
---|
821 | @end example |
---|
822 | @end ifset |
---|
823 | |
---|
824 | @ifset is-Ada |
---|
825 | @example |
---|
826 | @end example |
---|
827 | @end ifset |
---|
828 | |
---|
829 | More information regarding the construction and |
---|
830 | operation of device drivers is provided in the I/O Manager |
---|
831 | chapter. |
---|
832 | |
---|
833 | @section User Extensions Table |
---|
834 | |
---|
835 | The User Extensions Table is used to inform RTEMS of |
---|
836 | the optional user-supplied static extension set. This table |
---|
837 | contains one entry for each possible extension. The entries are |
---|
838 | called at critical times in the life of the system and |
---|
839 | individual tasks. The application may create dynamic extensions |
---|
840 | in addition to this single static set. The format of each entry |
---|
841 | in the User Extensions Table is defined in the following @value{LANGUAGE} |
---|
842 | @value{STRUCTURE}: |
---|
843 | |
---|
844 | @ifset is-C |
---|
845 | @example |
---|
846 | typedef User_extensions_routine rtems_extension; |
---|
847 | typedef User_extensions_thread_create_extension rtems_task_create_extension; |
---|
848 | typedef User_extensions_thread_delete_extension rtems_task_delete_extension; |
---|
849 | typedef User_extensions_thread_start_extension rtems_task_start_extension; |
---|
850 | typedef User_extensions_thread_restart_extension rtems_task_restart_extension; |
---|
851 | typedef User_extensions_thread_switch_extension rtems_task_switch_extension; |
---|
852 | typedef User_extensions_thread_begin_extension rtems_task_begin_extension; |
---|
853 | typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension; |
---|
854 | typedef User_extensions_fatal_extension rtems_fatal_extension; |
---|
855 | |
---|
856 | typedef User_extensions_Table rtems_extensions_table; |
---|
857 | |
---|
858 | typedef struct @{ |
---|
859 | rtems_task_create_extension thread_create; |
---|
860 | rtems_task_start_extension thread_start; |
---|
861 | rtems_task_restart_extension thread_restart; |
---|
862 | rtems_task_delete_extension thread_delete; |
---|
863 | rtems_task_switch_extension thread_switch; |
---|
864 | rtems_task_begin_extension thread_begin; |
---|
865 | rtems_task_exitted_extension thread_exitted; |
---|
866 | rtems_fatal_extension fatal; |
---|
867 | @} User_extensions_Table; |
---|
868 | @end example |
---|
869 | @end ifset |
---|
870 | |
---|
871 | @ifset is-Ada |
---|
872 | @example |
---|
873 | type Extensions_Table_Entry is |
---|
874 | record |
---|
875 | Thread_Create : RTEMS.Thread_Create_Extension; |
---|
876 | Thread_Start : RTEMS.Thread_Start_Extension; |
---|
877 | Thread_Restart : RTEMS.Thread_Restart_Extension; |
---|
878 | Thread_Delete : RTEMS.Thread_Delete_Extension; |
---|
879 | Thread_Switch : RTEMS.Thread_Switch_Extension; |
---|
880 | Thread_Post_Switch : RTEMS.Thread_Post_Switch_Extension; |
---|
881 | Thread_Begin : RTEMS.Thread_Begin_Extension; |
---|
882 | Thread_Exitted : RTEMS.Thread_Exitted_Extension; |
---|
883 | Fatal : RTEMS.Fatal_Error_Extension; |
---|
884 | end record; |
---|
885 | @end example |
---|
886 | @end ifset |
---|
887 | |
---|
888 | @table @b |
---|
889 | |
---|
890 | @item thread_create |
---|
891 | is the address of the |
---|
892 | user-supplied subroutine for the TASK_CREATE extension. If this |
---|
893 | extension for task creation is defined, it is called from the |
---|
894 | task_create directive. A value of NULL indicates that no |
---|
895 | extension is provided. |
---|
896 | |
---|
897 | @item thread_start |
---|
898 | is the address of the user-supplied |
---|
899 | subroutine for the TASK_START extension. If this extension for |
---|
900 | task initiation is defined, it is called from the task_start |
---|
901 | directive. A value of NULL indicates that no extension is |
---|
902 | provided. |
---|
903 | |
---|
904 | @item thread_restart |
---|
905 | is the address of the user-supplied |
---|
906 | subroutine for the TASK_RESTART extension. If this extension |
---|
907 | for task re-initiation is defined, it is called from the |
---|
908 | task_restart directive. A value of NULL indicates that no |
---|
909 | extension is provided. |
---|
910 | |
---|
911 | @item thread_delete |
---|
912 | is the address of the user-supplied |
---|
913 | subroutine for the TASK_DELETE extension. If this RTEMS |
---|
914 | extension for task deletion is defined, it is called from the |
---|
915 | task_delete directive. A value of NULL indicates that no |
---|
916 | extension is provided. |
---|
917 | |
---|
918 | @item thread_switch |
---|
919 | is the address of the user-supplied |
---|
920 | subroutine for the task context switch extension. This |
---|
921 | subroutine is called from RTEMS dispatcher after the current |
---|
922 | task has been swapped out but before the new task has been |
---|
923 | swapped in. A value of NULL indicates that no extension is |
---|
924 | provided. As this routine is invoked after saving the current |
---|
925 | task's context and before restoring the heir task's context, it |
---|
926 | is not necessary for this routine to save and restore any |
---|
927 | registers. |
---|
928 | |
---|
929 | @item thread_begin |
---|
930 | is the address of the user-supplied |
---|
931 | subroutine which is invoked immediately before a task begins |
---|
932 | execution. It is invoked in the context of the beginning task. |
---|
933 | A value of NULL indicates that no extension is provided. |
---|
934 | |
---|
935 | @item thread_exitted |
---|
936 | is the address of the user-supplied |
---|
937 | subroutine which is invoked when a task exits. This procedure |
---|
938 | is responsible for some action which will allow the system to |
---|
939 | continue execution (i.e. delete or restart the task) or to |
---|
940 | terminate with a fatal error. If this field is set to NULL, the |
---|
941 | default RTEMS TASK_EXITTED handler will be invoked. |
---|
942 | |
---|
943 | @item fatal |
---|
944 | is the address of the user-supplied |
---|
945 | subroutine for the FATAL extension. This RTEMS extension of |
---|
946 | fatal error handling is called from the |
---|
947 | @code{@value{DIRPREFIX}fatal_error_occurred} |
---|
948 | directive. If the user's fatal error handler returns or if this |
---|
949 | entry is NULL then the default RTEMS fatal error handler will be |
---|
950 | executed. |
---|
951 | |
---|
952 | @end table |
---|
953 | |
---|
954 | A typical declaration for a User Extension Table |
---|
955 | which defines the TASK_CREATE, TASK_DELETE, TASK_SWITCH, and |
---|
956 | FATAL extension might appear as follows: |
---|
957 | |
---|
958 | @ifset is-C |
---|
959 | @example |
---|
960 | rtems_extensions_table User_extensions = @{ |
---|
961 | task_create_extension, |
---|
962 | NULL, |
---|
963 | NULL, |
---|
964 | task_delete_extension, |
---|
965 | task_switch_extension, |
---|
966 | NULL, |
---|
967 | NULL, |
---|
968 | fatal_extension |
---|
969 | @}; |
---|
970 | @end example |
---|
971 | @end ifset |
---|
972 | |
---|
973 | @ifset is-Ada |
---|
974 | User_Extensions : RTEMS.Extensions_Table := ( |
---|
975 | Task_Create_Extension'Access, |
---|
976 | null, |
---|
977 | null, |
---|
978 | Task_Delete_Extension'Access, |
---|
979 | Task_Switch_Extension'Access, |
---|
980 | null, |
---|
981 | null, |
---|
982 | Fatal_Extension'Access |
---|
983 | ); |
---|
984 | @example |
---|
985 | |
---|
986 | @end example |
---|
987 | @end ifset |
---|
988 | |
---|
989 | More information regarding the user extensions is |
---|
990 | provided in the User Extensions chapter. |
---|
991 | |
---|
992 | @section Multiprocessor Configuration Table |
---|
993 | |
---|
994 | The Multiprocessor Configuration Table contains |
---|
995 | information needed when using RTEMS in a multiprocessor |
---|
996 | configuration. Many of the details associated with configuring |
---|
997 | a multiprocessor system are dependent on the multiprocessor |
---|
998 | communications layer provided by the user. The address of the |
---|
999 | Multiprocessor Configuration Table should be placed in the |
---|
1000 | @code{User_multiprocessing_table} entry in the primary Configuration |
---|
1001 | Table. Further details regarding many of the entries in the |
---|
1002 | Multiprocessor Configuration Table will be provided in the |
---|
1003 | Multiprocessing chapter. |
---|
1004 | |
---|
1005 | |
---|
1006 | When using the @code{confdefs.h} mechanism for configuring |
---|
1007 | an RTEMS application, the macro @code{CONFIGURE_MPTEST} must |
---|
1008 | be defined to automatically generate the Multiprocessor Configuration Table. |
---|
1009 | If @code{CONFIGURE_MPTEST}, is not defined, then a NULL pointer |
---|
1010 | is configured as the address of this table. |
---|
1011 | |
---|
1012 | The format of the Multiprocessor Configuration Table is defined in |
---|
1013 | the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
1014 | |
---|
1015 | @ifset is-C |
---|
1016 | @example |
---|
1017 | typedef struct @{ |
---|
1018 | rtems_unsigned32 node; |
---|
1019 | rtems_unsigned32 maximum_nodes; |
---|
1020 | rtems_unsigned32 maximum_global_objects; |
---|
1021 | rtems_unsigned32 maximum_proxies; |
---|
1022 | rtems_mpci_table *User_mpci_table; |
---|
1023 | @} rtems_multiprocessing_table; |
---|
1024 | @end example |
---|
1025 | @end ifset |
---|
1026 | |
---|
1027 | @ifset is-Ada |
---|
1028 | @example |
---|
1029 | type Multiprocessing_Table is |
---|
1030 | record |
---|
1031 | Node : RTEMS.Unsigned32; |
---|
1032 | Maximum_Nodes : RTEMS.Unsigned32; |
---|
1033 | Maximum_Global_Objects : RTEMS.Unsigned32; |
---|
1034 | Maximum_Proxies : RTEMS.Unsigned32; |
---|
1035 | User_MPCI_Table : RTEMS.MPCI_Table_Pointer; |
---|
1036 | end record; |
---|
1037 | |
---|
1038 | type Multiprocessing_Table_Pointer is access all Multiprocessing_Table; |
---|
1039 | @end example |
---|
1040 | @end ifset |
---|
1041 | |
---|
1042 | @table @b |
---|
1043 | @item node |
---|
1044 | is a unique processor identifier |
---|
1045 | and is used in routing messages between nodes in a |
---|
1046 | multiprocessor configuration. Each processor must have a unique |
---|
1047 | node number. RTEMS assumes that node numbers start at one and |
---|
1048 | increase sequentially. This assumption can be used to advantage |
---|
1049 | by the user-supplied MPCI layer. Typically, this requirement is |
---|
1050 | made when the node numbers are used to calculate the address of |
---|
1051 | inter-processor communication links. Zero should be avoided as |
---|
1052 | a node number because some MPCI layers use node zero to |
---|
1053 | represent broadcasted packets. Thus, it is recommended that |
---|
1054 | node numbers start at one and increase sequentially. |
---|
1055 | When using the @code{confdefs.h} mechanism for configuring |
---|
1056 | an RTEMS application, the value for this field corresponds |
---|
1057 | to the setting of the macro @code{CONFIGURE_MP_NODE_NUMBER}. |
---|
1058 | If not defined by the application, then the @code{CONFIGURE_MP_NODE_NUMBER} |
---|
1059 | macro defaults to the value of the @code{NODE_NUMBER} macro which is |
---|
1060 | set on the compiler command line by the RTEMS Multiprocessing Test Suites. |
---|
1061 | |
---|
1062 | |
---|
1063 | @item maximum_nodes |
---|
1064 | is the number of processor nodes in the system. |
---|
1065 | When using the @code{confdefs.h} mechanism for configuring |
---|
1066 | an RTEMS application, the value for this field corresponds |
---|
1067 | to the setting of the macro @code{CONFIGURE_MP_MAXIMUM_NODES}. |
---|
1068 | If not defined by the application, then the @code{CONFIGURE_MP_MAXIMUM_NODES} |
---|
1069 | macro defaults to the value 2. |
---|
1070 | |
---|
1071 | @item maximum_global_objects |
---|
1072 | is the maximum number of global objects which can exist at any |
---|
1073 | given moment in the entire system. If this parameter is not the |
---|
1074 | same on all nodes in the system, then a fatal error is generated |
---|
1075 | to inform the user that the system is inconsistent. |
---|
1076 | When using the @code{confdefs.h} mechanism for configuring |
---|
1077 | an RTEMS application, the value for this field corresponds |
---|
1078 | to the setting of the macro @code{CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS}. |
---|
1079 | If not defined by the application, then the |
---|
1080 | @code{CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS} macro defaults to the value 32. |
---|
1081 | |
---|
1082 | |
---|
1083 | @item maximum_proxies |
---|
1084 | is the maximum number of proxies which can exist at any given moment |
---|
1085 | on this particular node. A proxy is a substitute task control block |
---|
1086 | which represent a task residing on a remote node when that task blocks |
---|
1087 | on a remote object. Proxies are used in situations in which delayed |
---|
1088 | interaction is required with a remote node. |
---|
1089 | When using the @code{confdefs.h} mechanism for configuring |
---|
1090 | an RTEMS application, the value for this field corresponds |
---|
1091 | to the setting of the macro @code{CONFIGURE_MP_MAXIMUM_PROXIES}. |
---|
1092 | If not defined by the application, then the @code{CONFIGURE_MP_MAXIMUM_PROXIES} |
---|
1093 | macro defaults to the value 32. |
---|
1094 | |
---|
1095 | |
---|
1096 | @item User_mpci_table |
---|
1097 | is the address of the Multiprocessor Communications Interface |
---|
1098 | Table. This table contains the entry points of user-provided functions |
---|
1099 | which constitute the multiprocessor communications layer. This table |
---|
1100 | must be provided in multiprocessor configurations with all |
---|
1101 | entries configured. The format of this table and details |
---|
1102 | regarding its entries can be found in the next section. |
---|
1103 | When using the @code{confdefs.h} mechanism for configuring |
---|
1104 | an RTEMS application, the value for this field corresponds |
---|
1105 | to the setting of the macro @code{CONFIGURE_MP_MPCI_TABLE_POINTER}. |
---|
1106 | If not defined by the application, then the |
---|
1107 | @code{CONFIGURE_MP_MPCI_TABLE_POINTER} macro defaults to the |
---|
1108 | address of the table named @code{MPCI_table}. |
---|
1109 | |
---|
1110 | |
---|
1111 | @end table |
---|
1112 | |
---|
1113 | @section Multiprocessor Communications Interface Table |
---|
1114 | |
---|
1115 | This table defines the set of callouts that must be provided by |
---|
1116 | an Multiprocessor Communications Interface implementation. |
---|
1117 | |
---|
1118 | When using the @code{confdefs.h} mechanism for configuring |
---|
1119 | an RTEMS application, the name of this table is assumed |
---|
1120 | to be @code{MPCI_table} unless the application sets |
---|
1121 | the @code{CONFIGURE_MP_MPCI_TABLE_POINTER} when configuring a |
---|
1122 | multiprocessing system. |
---|
1123 | |
---|
1124 | The format of this table is defined in |
---|
1125 | the following @value{LANGUAGE} @value{STRUCTURE}: |
---|
1126 | |
---|
1127 | @ifset is-C |
---|
1128 | @example |
---|
1129 | typedef struct @{ |
---|
1130 | rtems_unsigned32 default_timeout; /* in ticks */ |
---|
1131 | rtems_unsigned32 maximum_packet_size; |
---|
1132 | rtems_mpci_initialization_entry initialization; |
---|
1133 | rtems_mpci_get_packet_entry get_packet; |
---|
1134 | rtems_mpci_return_packet_entry return_packet; |
---|
1135 | rtems_mpci_send_entry send; |
---|
1136 | rtems_mpci_receive_entry receive; |
---|
1137 | @} rtems_mpci_table; |
---|
1138 | @end example |
---|
1139 | @end ifset |
---|
1140 | |
---|
1141 | @ifset is-Ada |
---|
1142 | @example |
---|
1143 | type MPCI_Table is |
---|
1144 | record |
---|
1145 | Default_Timeout : RTEMS.Unsigned32; -- in ticks |
---|
1146 | Maximum_Packet_Size : RTEMS.Unsigned32; |
---|
1147 | Initialization : RTEMS.MPCI_Initialization_Entry; |
---|
1148 | Get_Packet : RTEMS.MPCI_Get_Packet_Entry; |
---|
1149 | Return_Packet : RTEMS.MPCI_Return_Packet_Entry; |
---|
1150 | Send : RTEMS.MPCI_Send_Entry; |
---|
1151 | Receive : RTEMS.MPCI_Receive_Entry; |
---|
1152 | end record; |
---|
1153 | |
---|
1154 | type MPCI_Table_Pointer is access all MPCI_Table; |
---|
1155 | @end example |
---|
1156 | @end ifset |
---|
1157 | |
---|
1158 | @table @b |
---|
1159 | @item default_timeout |
---|
1160 | is the default maximum length of time a task should block waiting for |
---|
1161 | a response to a directive which results in communication with a remote node. |
---|
1162 | The maximum length of time is a function the user supplied |
---|
1163 | multiprocessor communications layer and the media used. This |
---|
1164 | timeout only applies to directives which would not block if the |
---|
1165 | operation were performed locally. |
---|
1166 | |
---|
1167 | @item maximum_packet_size |
---|
1168 | is the size in bytes of the longest packet which the MPCI layer is capable |
---|
1169 | of sending. This value should represent the total number of bytes available |
---|
1170 | for a RTEMS interprocessor messages. |
---|
1171 | |
---|
1172 | @item initialization |
---|
1173 | is the address of the entry point for the initialization procedure of the |
---|
1174 | user supplied multiprocessor communications layer. |
---|
1175 | |
---|
1176 | @item get_packet |
---|
1177 | is the address of the entry point for the procedure called by RTEMS to |
---|
1178 | obtain a packet from the user supplied multiprocessor communications layer. |
---|
1179 | |
---|
1180 | @item return_packet |
---|
1181 | is the address of the entry point for the procedure called by RTEMS to |
---|
1182 | return a packet to the user supplied multiprocessor communications layer. |
---|
1183 | |
---|
1184 | @item send |
---|
1185 | is the address of the entry point for the procedure called by RTEMS to |
---|
1186 | send an envelope to another node. This procedure is part of the user |
---|
1187 | supplied multiprocessor communications layer. |
---|
1188 | |
---|
1189 | @item receive |
---|
1190 | is the address of the entry point for the |
---|
1191 | procedure called by RTEMS to retrieve an envelope containing a |
---|
1192 | message from another node. This procedure is part of the user |
---|
1193 | supplied multiprocessor communications layer. |
---|
1194 | |
---|
1195 | @end table |
---|
1196 | |
---|
1197 | More information regarding the required functionality of these |
---|
1198 | entry points is provided in the Multiprocessor chapter. |
---|
1199 | |
---|
1200 | @section Determining Memory Requirements |
---|
1201 | |
---|
1202 | Since memory is a critical resource in many real-time |
---|
1203 | embedded systems, the RTEMS Classic API was specifically designed to allow |
---|
1204 | unused managers to be forcibly excluded from the run-time environment. |
---|
1205 | This allows the application designer the flexibility to tailor |
---|
1206 | RTEMS to most efficiently meet system requirements while still |
---|
1207 | satisfying even the most stringent memory constraints. As |
---|
1208 | result, the size of the RTEMS executive is application |
---|
1209 | dependent. A Memory Requirements worksheet is provided in the |
---|
1210 | Applications Supplement document for a specific target |
---|
1211 | processor. This worksheet can be used to calculate the memory |
---|
1212 | requirements of a custom RTEMS run-time environment. To insure |
---|
1213 | that enough memory is allocated for future versions of RTEMS, |
---|
1214 | the application designer should round these memory requirements |
---|
1215 | up. The following Classic API managers may be optionally excluded: |
---|
1216 | |
---|
1217 | @itemize @bullet |
---|
1218 | @item signal |
---|
1219 | @item region |
---|
1220 | @item dual ported memory |
---|
1221 | @item event |
---|
1222 | @item multiprocessing |
---|
1223 | @item partition |
---|
1224 | @item timer |
---|
1225 | @item semaphore |
---|
1226 | @item message |
---|
1227 | @item rate monotonic |
---|
1228 | @end itemize |
---|
1229 | |
---|
1230 | RTEMS is designed to be built and installed as a library |
---|
1231 | that is linked into the application. As such, much of |
---|
1232 | RTEMS is implemented in such a way that there is a single |
---|
1233 | entry point per source file. This avoids having the |
---|
1234 | linker being forced to pull large object files in their |
---|
1235 | entirety into an application when the application references |
---|
1236 | a single symbol. |
---|
1237 | |
---|
1238 | RTEMS based applications must somehow provide memory |
---|
1239 | for RTEMS' code and data space. Although RTEMS' data space must |
---|
1240 | be in RAM, its code space can be located in either ROM or RAM. |
---|
1241 | In addition, the user must allocate RAM for the RTEMS RAM |
---|
1242 | Workspace. The size of this area is application dependent and |
---|
1243 | can be calculated using the formula provided in the Memory |
---|
1244 | Requirements chapter of the Applications Supplement document |
---|
1245 | for a specific target processor. |
---|
1246 | |
---|
1247 | All private RTEMS data variables and routine names used by |
---|
1248 | RTEMS begin with the underscore ( _ ) character followed by an |
---|
1249 | upper-case letter. If RTEMS is linked with an application, then |
---|
1250 | the application code should NOT contain any symbols which begin |
---|
1251 | with the underscore character and followed by an upper-case |
---|
1252 | letter to avoid any naming conflicts. All RTEMS directive names |
---|
1253 | should be treated as reserved words. |
---|
1254 | |
---|
1255 | @section Sizing the RTEMS RAM Workspace |
---|
1256 | |
---|
1257 | The RTEMS RAM Workspace is a user-specified block of |
---|
1258 | memory reserved for use by RTEMS. The application should NOT |
---|
1259 | modify this memory. This area consists primarily of the RTEMS |
---|
1260 | data structures whose exact size depends upon the values |
---|
1261 | specified in the Configuration Table. In addition, task stacks |
---|
1262 | and floating point context areas are dynamically allocated from |
---|
1263 | the RTEMS RAM Workspace. |
---|
1264 | |
---|
1265 | The @code{confdefs.h} mechanism calcalutes the size |
---|
1266 | of the RTEMS RAM Workspace automatically. It assumes that |
---|
1267 | all tasks are floating point and that all will be allocated |
---|
1268 | the miminum stack space. This calculation also automatically |
---|
1269 | includes the memory that will be allocated for internal use |
---|
1270 | by RTEMS. The following macros may be set |
---|
1271 | by the application to make the calculation |
---|
1272 | of memory required more accurate: |
---|
1273 | |
---|
1274 | @itemize @bullet |
---|
1275 | |
---|
1276 | CONFIGURE_MEMORY_OVERHEAD |
---|
1277 | CONFIGURE_EXTRA_TASK_STACKS |
---|
1278 | |
---|
1279 | @end itemize |
---|
1280 | |
---|
1281 | The starting address of the RTEMS RAM Workspace must |
---|
1282 | be aligned on a four-byte boundary. Failure to properly align |
---|
1283 | the workspace area will result in the |
---|
1284 | @code{@value{DIRPREFIX}fatal_error_occurred} |
---|
1285 | directive being invoked with the |
---|
1286 | @code{@value{RPREFIX}INVALID_ADDRESS} error code. |
---|
1287 | |
---|
1288 | A worksheet is provided in the @b{Memory Requirements} |
---|
1289 | chapter of the Applications Supplement document for a specific |
---|
1290 | target processor to assist the user in calculating the minimum |
---|
1291 | size of the RTEMS RAM Workspace for each application. The value |
---|
1292 | calculated with this worksheet is the minimum value that should |
---|
1293 | be specified as the @code{work_space_size} parameter of the |
---|
1294 | Configuration Table. |
---|
1295 | |
---|
1296 | The allocation of objects can operate in two modes. The default mode |
---|
1297 | has an object number ceiling. No more than the specified number of |
---|
1298 | objects can be allocated from the RTEMS RAM Workspace. The number of objects |
---|
1299 | specified in the particular API Configuration table fields are |
---|
1300 | allocated at initialisation. The second mode allows the number of |
---|
1301 | objects to grow to use the available free memory in the RTEMS RAM Workspace. |
---|
1302 | |
---|
1303 | The auto-extending mode can be enabled individually for each object |
---|
1304 | type by using the macro @code{rtems_resource_unlimited}. This takes a value |
---|
1305 | as a parameter, and is used to set the object maximum number field in |
---|
1306 | an API Configuration table. The value is an allocation unit size. When |
---|
1307 | RTEMS is required to grow the object table it is grown by this |
---|
1308 | size. The kernel will return the object memory back to the RTEMS RAM Workspace |
---|
1309 | when an object is destroyed. The kernel will only return an allocated |
---|
1310 | block of objects to the RTEMS RAM Workspace if at least half the allocation |
---|
1311 | size of free objects remain allocated. RTEMS always keeps one |
---|
1312 | allocation block of objects allocated. Here is an example of using |
---|
1313 | @code{rtems_resource_unlimited}: |
---|
1314 | |
---|
1315 | @example |
---|
1316 | #define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(5) |
---|
1317 | @end example |
---|
1318 | |
---|
1319 | The user is cautioned that future versions of RTEMS may not have the |
---|
1320 | same memory requirements per object. Although the value calculated is |
---|
1321 | suficient for a particular target processor and release of RTEMS, |
---|
1322 | memory usage is subject to change across versions and target |
---|
1323 | processors. The user is advised to allocate somewhat more memory than |
---|
1324 | the worksheet recommends to insure compatibility with future releases |
---|
1325 | for a specific target processor and other target processors. To avoid |
---|
1326 | problems, the user should recalculate the memory requirements each |
---|
1327 | time one of the following events occurs: |
---|
1328 | |
---|
1329 | @itemize @bullet |
---|
1330 | @item a configuration parameter is modified, |
---|
1331 | @item task or interrupt stack requirements change, |
---|
1332 | @item task floating point attribute is altered, |
---|
1333 | @item RTEMS is upgraded, or |
---|
1334 | @item the target processor is changed. |
---|
1335 | @end itemize |
---|
1336 | |
---|
1337 | Failure to provide enough space in the RTEMS RAM |
---|
1338 | Workspace will result in the |
---|
1339 | @code{@value{DIRPREFIX}fatal_error_occurred} directive |
---|
1340 | being invoked with the appropriate error code. |
---|