[En-Nut-Discussion] Disabling drivers during compile time

Thiago A. Corrêa thiago.correa at gmail.com
Mon Oct 7 17:09:09 CEST 2013


Hi,


      In all of Nut/OS, we are constantly comming up with bogus driver
settings just to satisfy the build. Stuff there were not in the board
.conf file or selected by the user in the configurator but needs to
end up in one of the cfg headers.

      I'm considering using macros to disable the compilation of
drivers that don't have all necessary config information, something
along the lines of:


<settings macro handling here>

NUT_REQUIRED_SETTING("hd44780", LCD_ROWS)

NUT_BEGIN_DRIVER("hd44780")
<driver code goes here>
NUT_END_DRIVER()



This would expand to something like:

#ifndef NUT_DRIVER_hd44780_DISABLED

<driver code>

#else
#warning "Driver hd44780 is disabled"
#endif

       What do you think? Does anyone have a better idea?
       I don't think it's pretty, but it's less ugly than what we have
been doing IMHO :)

Kind Regards,
     Thiago A. Correa


More information about the En-Nut-Discussion mailing list