Split up confdefs.h into multiple header files?

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Feb 13 15:47:56 UTC 2020


Hello,

this is a first proposal how to split up confdefs.h.

The general approach is to place the default configuration of things in
librtemscpu.a. The benefit is that the application configuration object file
will only include data structures which have a user-defined value.

The component based header files include their dependencies explicitly. It
should be possible to include component based header files separately to 
ease
testing. For example we could use this template:

   #ifndef _RTEMS_CONFDEFS_FOOBAR_H
   #define _RTEMS_CONFDEFS_FOOBAR_H

   #ifndef __CONFIGURATION_TEMPLATE_h
   #error "Do not include this file directly, use <rtems/confdefs.h> 
instead"
   #endif

   #if defined(CONFIGURE_INIT) && \
     defined(CONFIGURE_FOOBAR_STUFF) && \
     defined(CONFIGURE_MORE_FOOBAR_STUFF)

   /* Foobar includes */

   #ifdef __cplusplus
   extern "C" {
   #endif /* __cplusplus */

   /* Configure foobar. */

   #ifdef __cplusplus
   }
   #endif /* __cplusplus */

   #endif /* CONFIGURE_INIT */

   #endif /* _RTEMS_CONFDEFS_FOOBAR_H */

In case CONFIGURE_INIT is not defined, then including <rtems/confdefs.h> 
should
expose nothing to the C compiler.

Here is a first proposal to group the configuration in components:

rtems/
   confdefs.h
     This file just includes the component based header files listed below.
   confdefs/
     bdbuf.h
     classicobj.h
       Classic API objects
     classictasksinit.h
       Classic initialization task
     driverclock.h
       Clock driver and related configuration, e.g. 
CONFIGURE_MICROSECONDS_PER_TICK
     driverconsolesimple.h
       Simple console driver configuration
     driverlegacy.h
       Legacy IO driver configuration table
     extensions.h
       User extensions, internal extensions
     filesystem.h
       Filesystem configuration
     general.h
       Basic stuff which is mandatory to configure, e.g. ISR stacks, 
per-CPU information
     libpci.h
       PCI library configuration
     malloc.h
       Malloc configuration
     mpci.h
       MPCI specific configuration options
     msgq.h
       General message queue configuration
     obsolete.h
       Warning about the use of obsolete configure options
     posixkeys.h
       POSIX keys
     posixobj.h
       POSIX objects
     posixthreadsinit.h
       POSIX initialization threads
     scheduler.h
       Scheduler configuration
     support.h
       Support macros for confdefs header files
     threads.h
       General thread configuration (e.g. thread control block)
     unlimited.h
       Unlimited objects configuration



More information about the devel mailing list