What should confdefs.h do if CONFIGURE_INIT is not defined?

Joel Sherrill joel at rtems.org
Tue Dec 17 14:13:46 UTC 2019


On Tue, Dec 17, 2019 at 2:43 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> Hello,
>
> I plan to move content from confdefs.h to separate header files for
> configuration groups. What should confdefs.h do if CONFIGURE_INIT is not
> defined?
>
> Should we do the consistency checks for example if CONFIGURE_INIT is not
> defined, e.g.
>
> #if defined(CONFIGURE_UNLIMITED_OBJECTS)
>    #if !defined(CONFIGURE_UNIFIED_WORK_AREAS) && \
>       !defined(CONFIGURE_EXECUTIVE_RAM_SIZE) && \
>       !defined(CONFIGURE_MEMORY_OVERHEAD)
>       #error "CONFIGURE_UNLIMITED_OBJECTS requires a unified work area,
> an executive RAM size, or a defined workspace memory overhead"
>    #endif
>
> vs.
>
> #ifdef CONFIGURE_INIT
> #if defined(CONFIGURE_UNLIMITED_OBJECTS)
>    #if !defined(CONFIGURE_UNIFIED_WORK_AREAS) && \
>       !defined(CONFIGURE_EXECUTIVE_RAM_SIZE) && \
>       !defined(CONFIGURE_MEMORY_OVERHEAD)
>       #error "CONFIGURE_UNLIMITED_OBJECTS requires a unified work area,
> an executive RAM size, or a defined workspace memory overhead"
>    #endif
>
> What about includes, e.g.
>
> #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
>    #include <rtems/clockdrv.h>
>
>    #ifdef CONFIGURE_INIT
>      RTEMS_SYSINIT_ITEM(
>        _Clock_Initialize,
>        RTEMS_SYSINIT_DEVICE_DRIVERS,
>        RTEMS_SYSINIT_ORDER_THIRD
>      );
>    #endif
> #endif
>
> vs.
>
> #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
>    #ifdef CONFIGURE_INIT
>      #include <rtems/clockdrv.h>
>
>      RTEMS_SYSINIT_ITEM(
>        _Clock_Initialize,
>        RTEMS_SYSINIT_DEVICE_DRIVERS,
>        RTEMS_SYSINIT_ORDER_THIRD
>      );
>    #endif
> #endif
>
> ?
>
> My approach would be to place all the define evaluations into a #ifdef
> CONFIGURE_INIT guard, so that #include <rtems/confdefs.h> provides
> nothing to the C compiler if CONFIGURE_INIT is not defined.
>

Originally, the intent was that user code could use CONFIGURE_MAXIMUM_xxx
if CONFIGURE_INIT was not defined. We likely don't do this much in the
tests but
you could have a header file which did all the CONFIGURE_xxx defines, then
include <rtems/confdefs.h>. Every application file could use the
CONFIGURE_xxx
macros if you did an "appconf.h" type header. Then a "appconf.c" could
define
CONFIGURE_INIT and include rtems/confdefs.h.

Do we have all the rtems_xxx which fetch configuration data documented?
Those
may largely cover the use case I described.

Now I generally recommend putting RTEMS configuration and an init task
to start RTEMS services in a dedicated file and invoking main() to start
the application. There are some of the rtems-examples which follow this
pattern.

--joel


> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-brains.de
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20191217/b7875e1e/attachment.html>


More information about the devel mailing list