You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Frank-Christian Kruegel <nu...@istda.com> on 2021/05/05 07:56:57 UTC

How to share code and Kconfig between different boards

Hi.

I've created several board support packages, each in its own out-of-tree 
directory. Ive configured them as custom boards with a relative path 
like ...

+- nuttx
+- apps
+- company-boards
|  +- board1
|  +- board2
|  +- board3
+- company-apps
|  +- app1
|  +- app2
...

Works fine.

These boards have different microcontrollers from different 
architectures, but they all have common hardware and configuration 
items. It would be very helpful, it i could share code between the 
boards like...

+- company-boards
|  +- board1
|     +-Kconfig
|     +-src
|  +- board2
|     +-Kconfig
|     +-src
|  +- board3
|     +-Kconfig
|     +-src
|  +- board-common  <-- NEW SHARED DIRECTORY
|     +-Kconfig
|     +-src

so I can reference the common codefrom each board. The shared code is 
kernel code, custom drivers, driver initialisation etc, no application 
logic, and since it is very specific to my hardware the nuttx tree is 
not a good place for it.

How do I do it the correct way?

I've notices that the board Kconfig gets copied over to 
nuttx/boards/dummy, so a mere "source ../../board-common/Kconfig" 
doesn't work. I managed to make Kconfig work by using "source 
$TOPDIR/../company-boards/board-common/Kconfig". Now I'm stuck with 
makefiles.

Best regards

Frank-Christian

Re: How to share code and Kconfig between different boards

Posted by Abdelatif Guettouche <ab...@gmail.com>.
> I'm not sure if there's support for custom-board common-code (in the same sense as for in-tree boards).

There is, it works the same way as the in-tree boards.  But I think
what's being asked here is something common between different boards
of different architectures?
I think what you suggested should work (provided that this is some
external driver and not board logic).

On Wed, May 5, 2021 at 2:15 PM Matias N. <ma...@imap.cc> wrote:
>
> I'm not sure if there's support for custom-board common-code (in the same sense as for in-tree boards). In any case, we've introduced an external/ directory for the purpose of adding external OS level code. Simply point nuttx/external symlink to your common directory.
>
> Best,
> Matias
>
> On Wed, May 5, 2021, at 04:56, Frank-Christian Kruegel wrote:
> > Hi.
> >
> > I've created several board support packages, each in its own out-of-tree
> > directory. Ive configured them as custom boards with a relative path
> > like ...
> >
> > +- nuttx
> > +- apps
> > +- company-boards
> > |  +- board1
> > |  +- board2
> > |  +- board3
> > +- company-apps
> > |  +- app1
> > |  +- app2
> > ...
> >
> > Works fine.
> >
> > These boards have different microcontrollers from different
> > architectures, but they all have common hardware and configuration
> > items. It would be very helpful, it i could share code between the
> > boards like...
> >
> > +- company-boards
> > |  +- board1
> > |     +-Kconfig
> > |     +-src
> > |  +- board2
> > |     +-Kconfig
> > |     +-src
> > |  +- board3
> > |     +-Kconfig
> > |     +-src
> > |  +- board-common  <-- NEW SHARED DIRECTORY
> > |     +-Kconfig
> > |     +-src
> >
> > so I can reference the common codefrom each board. The shared code is
> > kernel code, custom drivers, driver initialisation etc, no application
> > logic, and since it is very specific to my hardware the nuttx tree is
> > not a good place for it.
> >
> > How do I do it the correct way?
> >
> > I've notices that the board Kconfig gets copied over to
> > nuttx/boards/dummy, so a mere "source ../../board-common/Kconfig"
> > doesn't work. I managed to make Kconfig work by using "source
> > $TOPDIR/../company-boards/board-common/Kconfig". Now I'm stuck with
> > makefiles.
> >
> > Best regards
> >
> > Frank-Christian
> >

Re: How to share code and Kconfig between different boards

Posted by "Matias N." <ma...@imap.cc>.
I'm not sure if there's support for custom-board common-code (in the same sense as for in-tree boards). In any case, we've introduced an external/ directory for the purpose of adding external OS level code. Simply point nuttx/external symlink to your common directory.

Best,
Matias

On Wed, May 5, 2021, at 04:56, Frank-Christian Kruegel wrote:
> Hi.
> 
> I've created several board support packages, each in its own out-of-tree 
> directory. Ive configured them as custom boards with a relative path 
> like ...
> 
> +- nuttx
> +- apps
> +- company-boards
> |  +- board1
> |  +- board2
> |  +- board3
> +- company-apps
> |  +- app1
> |  +- app2
> ...
> 
> Works fine.
> 
> These boards have different microcontrollers from different 
> architectures, but they all have common hardware and configuration 
> items. It would be very helpful, it i could share code between the 
> boards like...
> 
> +- company-boards
> |  +- board1
> |     +-Kconfig
> |     +-src
> |  +- board2
> |     +-Kconfig
> |     +-src
> |  +- board3
> |     +-Kconfig
> |     +-src
> |  +- board-common  <-- NEW SHARED DIRECTORY
> |     +-Kconfig
> |     +-src
> 
> so I can reference the common codefrom each board. The shared code is 
> kernel code, custom drivers, driver initialisation etc, no application 
> logic, and since it is very specific to my hardware the nuttx tree is 
> not a good place for it.
> 
> How do I do it the correct way?
> 
> I've notices that the board Kconfig gets copied over to 
> nuttx/boards/dummy, so a mere "source ../../board-common/Kconfig" 
> doesn't work. I managed to make Kconfig work by using "source 
> $TOPDIR/../company-boards/board-common/Kconfig". Now I'm stuck with 
> makefiles.
> 
> Best regards
> 
> Frank-Christian
>