1 | # |
---|
2 | # $Id$ |
---|
3 | # |
---|
4 | |
---|
5 | Configuring a System Using the Template in confdefs.h |
---|
6 | ===================================================== |
---|
7 | |
---|
8 | The file confdefs.h is a Configuration Template file which can be |
---|
9 | used to greatly simplify the creation and maintenance of RTEMS |
---|
10 | Configuration Tables. The basic concepts are: |
---|
11 | |
---|
12 | + confdefs.h provides defaults for all configuration parameters |
---|
13 | |
---|
14 | + applications specify only those values they wish to override |
---|
15 | |
---|
16 | + confdefs.h can be the only file which knows the precise layout |
---|
17 | of the RTEMS Configuration Tables. |
---|
18 | |
---|
19 | The Configuration Template setup is used by all RTEMS tests to |
---|
20 | simplify the maintenance of the tests. |
---|
21 | |
---|
22 | Here is the section from the system.h file from test tm21 from |
---|
23 | the Timing Test Suite: |
---|
24 | |
---|
25 | /* configuration information */ |
---|
26 | |
---|
27 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
28 | #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER |
---|
29 | |
---|
30 | #define CONFIGURE_MAXIMUM_TASKS 102 |
---|
31 | #define CONFIGURE_MAXIMUM_TIMERS 100 |
---|
32 | #define CONFIGURE_MAXIMUM_SEMAPHORES 100 |
---|
33 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 100 |
---|
34 | #define CONFIGURE_MAXIMUM_PARTITIONS 100 |
---|
35 | #define CONFIGURE_MAXIMUM_REGIONS 100 |
---|
36 | #define CONFIGURE_MAXIMUM_PORTS 100 |
---|
37 | #define CONFIGURE_MAXIMUM_PERIODS 100 |
---|
38 | |
---|
39 | #define CONFIGURE_TICKS_PER_TIMESLICE 0 |
---|
40 | |
---|
41 | #include <confdefs.h> |
---|
42 | |
---|
43 | |
---|
44 | The above example overrides a number of the configuration parameters. |
---|
45 | It informs the template that it is a member of the Timing Suite, |
---|
46 | requires a console and timer driver, and that it needs 102 tasks, |
---|
47 | 100 timers, 100 semaphores, 100 message queues, 100 partitions, |
---|
48 | 100 regions, 100 ports, and 100 periods. By default, the test |
---|
49 | would have gotten no drivers, 10 tasks, and no other RTEMS objects. |
---|
50 | |
---|
51 | The following shows the configuration tables generated by the |
---|
52 | template by default. |
---|
53 | |
---|
54 | |
---|
55 | #include <bsp.h> |
---|
56 | |
---|
57 | #define NULL_DRIVER_TABLE_ENTRY \ |
---|
58 | { NULL, NULL, NULL, NULL, NULL, NULL } |
---|
59 | |
---|
60 | rtems_driver_address_table Device_drivers[] = { |
---|
61 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
62 | CONSOLE_DRIVER_TABLE_ENTRY, |
---|
63 | #endif |
---|
64 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
65 | CLOCK_DRIVER_TABLE_ENTRY, |
---|
66 | #endif |
---|
67 | #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER |
---|
68 | STUB_DRIVER_TABLE_ENTRY, |
---|
69 | #endif |
---|
70 | NULL_DRIVER_TABLE_ENTRY, |
---|
71 | }; |
---|
72 | |
---|
73 | rtems_initialization_tasks_table Initialization_tasks[] = { |
---|
74 | { rtems_build_name( 'U', 'I', '1', ' ' ), /* init task name */ |
---|
75 | RTEMS_MINIMUM_STACK_SIZE, /* init task stack size */ |
---|
76 | 1, /* init task priority */ |
---|
77 | RTEMS_DEFAULT_ATTRIBUTES, /* init task attributes */ |
---|
78 | Init, /* init task entry point */ |
---|
79 | RTEMS_NO_PREEMPT, /* init task initial mode */ |
---|
80 | 0 /* init task argument list */ |
---|
81 | } |
---|
82 | }; |
---|
83 | |
---|
84 | #ifdef CONFIGURE_MP_APPLICATION |
---|
85 | /* |
---|
86 | * NODE_NUMBER is assumed to be set on the compile line. |
---|
87 | */ |
---|
88 | |
---|
89 | rtems_multiprocessing_table Multiprocessing_configuration = { |
---|
90 | NODE_NUMBER, /* local node number */ |
---|
91 | 2, /* maximum # nodes in system */ |
---|
92 | 32, /* maximum # global objects */ |
---|
93 | 32, /* maximum # proxies */ |
---|
94 | &MPCI_table /* pointer to MPCI config table */ |
---|
95 | }; |
---|
96 | #endif |
---|
97 | |
---|
98 | /* |
---|
99 | * CONFIGURE_EXECUTIVE_RAM_SIZE is a rough guess based on the number of |
---|
100 | * tasks in the system plus enough extra to get a whole 64K extra. |
---|
101 | * |
---|
102 | * The NULL address for the workspace area is assumed to be assigned |
---|
103 | * at startup time by the BSP. |
---|
104 | */ |
---|
105 | |
---|
106 | rtems_configuration_table Configuration = { |
---|
107 | NULL, /* executive RAM work area */ |
---|
108 | CONFIGURE_EXECUTIVE_RAM_SIZE, /* executive RAM size */ |
---|
109 | 10, /* maximum # tasks */ |
---|
110 | 0, /* maximum # timers */ |
---|
111 | 0, /* maximum # semaphores */ |
---|
112 | 0, /* maximum # message queues */ |
---|
113 | 0, /* maximum # messages */ |
---|
114 | 0, /* maximum # partitions */ |
---|
115 | 0, /* maximum # regions */ |
---|
116 | 0, /* maximum # dp memory areas */ |
---|
117 | 0, /* maximum # periods */ |
---|
118 | 0, /* maximum # user extensions */ |
---|
119 | RTEMS_MILLISECONDS_TO_MICROSECONDS(10), /* # us in a tick */ |
---|
120 | 50, /* # ticks in a timeslice */ |
---|
121 | sizeof (Initialization_tasks) / sizeof(rtems_initialization_tasks_table), |
---|
122 | /* number of init tasks */ |
---|
123 | Initialization_tasks, /* init task(s) table */ |
---|
124 | sizeof (Device_drivers) / sizeof(rtems_driver_address_table), |
---|
125 | /* number of device drivers */ |
---|
126 | Device_drivers, /* pointer to driver address table */ |
---|
127 | NULL, /* pointer to initial extensions */ |
---|
128 | #ifdef CONFIGURE_MP_APPLICATION |
---|
129 | &Multiprocessing_configuration |
---|
130 | #else |
---|
131 | NULL /* ptr to MP config table */ |
---|
132 | #endif |
---|
133 | }; |
---|