# # $Id$ # Configuring a System Using the Template in confdefs.h ===================================================== The file confdefs.h is a Configuration Template file which can be used to greatly simplify the creation and maintenance of RTEMS Configuration Tables. The basic concepts are: + confdefs.h provides defaults for all configuration parameters + applications specify only those values they wish to override + confdefs.h can be the only file which knows the precise layout of the RTEMS Configuration Tables. The Configuration Template setup is used by all RTEMS tests to simplify the maintenance of the tests. Here is the section from the system.h file from test tm21 from the Timing Test Suite: /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER #define CONFIGURE_MAXIMUM_TASKS 102 #define CONFIGURE_MAXIMUM_TIMERS 100 #define CONFIGURE_MAXIMUM_SEMAPHORES 100 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 100 #define CONFIGURE_MAXIMUM_PARTITIONS 100 #define CONFIGURE_MAXIMUM_REGIONS 100 #define CONFIGURE_MAXIMUM_PORTS 100 #define CONFIGURE_MAXIMUM_PERIODS 100 #define CONFIGURE_TICKS_PER_TIMESLICE 0 #include The above example overrides a number of the configuration parameters. It informs the template that it is a member of the Timing Suite, requires a console and timer driver, and that it needs 102 tasks, 100 timers, 100 semaphores, 100 message queues, 100 partitions, 100 regions, 100 ports, and 100 periods. By default, the test would have gotten no drivers, 10 tasks, and no other RTEMS objects. The following shows the configuration tables generated by the template by default. #include #define NULL_DRIVER_TABLE_ENTRY \ { NULL, NULL, NULL, NULL, NULL, NULL } rtems_driver_address_table Device_drivers[] = { #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER CONSOLE_DRIVER_TABLE_ENTRY, #endif #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER CLOCK_DRIVER_TABLE_ENTRY, #endif #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER STUB_DRIVER_TABLE_ENTRY, #endif NULL_DRIVER_TABLE_ENTRY, }; rtems_initialization_tasks_table Initialization_tasks[] = { { rtems_build_name( 'U', 'I', '1', ' ' ), /* init task name */ RTEMS_MINIMUM_STACK_SIZE, /* init task stack size */ 1, /* init task priority */ RTEMS_DEFAULT_ATTRIBUTES, /* init task attributes */ Init, /* init task entry point */ RTEMS_NO_PREEMPT, /* init task initial mode */ 0 /* init task argument list */ } }; #ifdef CONFIGURE_MP_APPLICATION /* * NODE_NUMBER is assumed to be set on the compile line. */ rtems_multiprocessing_table Multiprocessing_configuration = { NODE_NUMBER, /* local node number */ 2, /* maximum # nodes in system */ 32, /* maximum # global objects */ 32, /* maximum # proxies */ &MPCI_table /* pointer to MPCI config table */ }; #endif /* * CONFIGURE_EXECUTIVE_RAM_SIZE is a rough guess based on the number of * tasks in the system plus enough extra to get a whole 64K extra. * * The NULL address for the workspace area is assumed to be assigned * at startup time by the BSP. */ rtems_configuration_table Configuration = { NULL, /* executive RAM work area */ CONFIGURE_EXECUTIVE_RAM_SIZE, /* executive RAM size */ 10, /* maximum # tasks */ 0, /* maximum # timers */ 0, /* maximum # semaphores */ 0, /* maximum # message queues */ 0, /* maximum # messages */ 0, /* maximum # partitions */ 0, /* maximum # regions */ 0, /* maximum # dp memory areas */ 0, /* maximum # periods */ 0, /* maximum # user extensions */ RTEMS_MILLISECONDS_TO_MICROSECONDS(10), /* # us in a tick */ 50, /* # ticks in a timeslice */ sizeof (Initialization_tasks) / sizeof(rtems_initialization_tasks_table), /* number of init tasks */ Initialization_tasks, /* init task(s) table */ sizeof (Device_drivers) / sizeof(rtems_driver_address_table), /* number of device drivers */ Device_drivers, /* pointer to driver address table */ NULL, /* pointer to initial extensions */ #ifdef CONFIGURE_MP_APPLICATION &Multiprocessing_configuration #else NULL /* ptr to MP config table */ #endif };