[En-Nut-Discussion] Where to define PIN mapping

Harald Kipp harald.kipp at egnite.de
Wed Feb 20 10:36:56 CET 2013


Hi Henrik,

On 20.02.2013 01:39, Henrik Maier wrote:
> On 19/02/2013 9:38 PM, Harald Kipp wrote:
>> user needs to reconfigure the pins in the Configurator. But in most
>> cases the board.conf file already contains a required definitions for
>> the driver.
> 
> If I am correct, board.conf does not help unless the driver developer
> added the required option to a .nut file.

Right. And, furthermore, it sometimes requires to update several
board.conf files as well.


> While it is relatively easy to add #ifdefs and #defines to driver files
> to facilitate the pin configuration, I found it not so straight forward
> with the .conf and .nut files.

Changing headers is easier for the Nut/OS developer, but the
disadvantage for the application developer is, that he either must

* update the repository

or

* update his local copy after every bugfix release

If he got a local board.conf, he almost never needs to change that one.
We really have many board prototypes and a few custom boards, which
never appeared in the public repository. I can create new versions for
them by simply loading the the related board.conf file. That's quite
convenient.

Anyway, Nut/OS is flexible enough to allow both. If you think your
settings are easier to implement in board.h, nobody will stop you. I'd
just recommend the Configurator way.

In any case, using board.h in Nut/OS library code may result in
unforeseen cross dependencies. My experience tells me, that it is a
mistake to mix application-specific and library-specific headers. So I'd
highly recommend using board.h only in applications, that need to be
portable. In board-specific projects I do not use dev/board.h, because
it makes things more complex than they need to be.

Also note, that most board specific setting had been moved out of
dev/board.h into

#include <arch/target/board/boardname.h>


Regards,

Harald



More information about the En-Nut-Discussion mailing list