source: rtems/doc/user/conf.t @ f70598c7

4.104.114.84.95
Last change on this file since f70598c7 was 3a0a97a, checked in by Joel Sherrill <joel.sherrill@…>, on 10/25/99 at 19:48:42

Fixed line too long problems.

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