Hi everyone!

Sorry for the very late reply! Vacation and then a tough September...

I am still very interested in linking external drivers to NuttX.
I am already studying the code on how to implement this.

Has anyone else worked on this?


Στις Τετ, 12 Αυγ 2020 στις 7:36 μ.μ., ο/η Matias N. <mat...@imap.cc> έγραψε:

> I'd also prefer to have this on NuttX directly.
>
> Regarding drivers/platform, I understand it is merely a way for the build
> system to link
> your directory to drivers/platform, right? If so, your suggestion to make
> the target of this link
> configurable would mostly handles this.
>
> On Wed, Aug 12, 2020, at 13:16, Fotis Panagiotopoulos wrote:
> > Yes I am aware of your Workspace Manager. It helped me a lot to set up my
> > workspace. I am grateful for this contribution.
> > But I just don't like to use external tools, or rely on "hacks" for such
> a
> > common thing. Maybe for more "exotic" modifications to the kernel...
> >
> > Indeed we have A). Through boards/common.
> >
> > But we also kinda have B) through drivers/platform. So the proposition is
> > to improve this to truly have the ability to define out-of-tree
> high-level
> > drivers.
> >
> > Στις Τετ, 12 Αυγ 2020 στις 7:03 μ.μ., ο/η Matias N. <mat...@imap.cc>
> έγραψε:
> >
> > > Right, so what I was trying to get at is that there are two separate
> > > topics here: a) board-common drivers (ie: they depend on a given board
> > > family such as stm32) and b) board-independent drivers (they use only
> nuttx
> > > generic interfaces).
> > >
> > > a) is already supported (although only for stm32 and cxd65xx) while b)
> is
> > > not. Maybe the best way would be to use the same scheme for both
> somehow.
> > >
> > > On Wed, Aug 12, 2020, at 12:53, Fotis Panagiotopoulos wrote:
> > > > As a matter of fact, the exact driver that I am working on now, is
> for an
> > > > out-of-board device.
> > > > It uses a UART and an SPI to create a high-level interface towards an
> > > > external, physically separated device.
> > > >
> > > > It does not require anything special from the board, other than an
> UART
> > > and
> > > > SPI. And in fact will be used on multiple different boards, using
> MCUs
> > > from
> > > > different vendors (NXP & ST).
> > > >
> > > >
> > > > Στις Τετ, 12 Αυγ 2020 στις 6:47 μ.μ., ο/η Fotis Panagiotopoulos <
> > > > f.j.pa...@gmail.com> έγραψε:
> > > >
> > > > > Hi Matias,
> > > > >
> > > > > Within nuttx/drivers lie high-level drivers, that do not depend
> > > directly
> > > > > on any board. As I get it the purpose of nuttx/drivers/platform is
> to
> > > > > extend NuttX drivers out-of-tree, exactly as
> CONFIG_ARCH_BOARD_CUSTOM
> > > does
> > > > > for custom boards.
> > > > >
> > > > > Within board/src lie drivers specific to the selected board.
> Low-level
> > > > > drivers that make the very specific hardware to work with NuttX.
> > > > >
> > > > > So as long as NuttX architecture has two layers of drivers, I
> believe
> > > it
> > > > > is beneficial to have them separated.
> > > > > I indeed added board-specific drivers in my board dir.
> > > > > And I want to use drivers/platform for non-board-dependent stuff.
> > > Think of
> > > > > a character device driver for an I2C chip. You instantiate this
> > > providing
> > > > > an I2C driver, and use it without ever caring about the actual
> board.
> > > > >
> > > > > How I actually plan to use it.
> > > > > I want to make various "driver packs" as different repositories.
> When
> > > you
> > > > > start a new project you get the desired "packs" as git submodules,
> > > creating
> > > > > a collection of only the needed drivers. Each one is developed and
> > > > > versioned separately.
> > > > >
> > > > > I have already done the same regarding the various boards.
> > > > > This allows me to have a very modular workspace, and maximize code
> > > > > reusability.
> > > > > (This is also why the directories structure is important to me. I
> have
> > > to
> > > > > specify the exact structure that my projects will have to support
> this
> > > kind
> > > > > of modularity).
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Στις Τετ, 12 Αυγ 2020 στις 6:15 μ.μ., ο/η Abdelatif Guettouche <
> > > > > abdelatif.guettou...@gmail.com> έγραψε:
> > > > >
> > > > >> Take a look under boards/arm/cxd56xx/drivers for an idea of what
> that
> > > > >> folder might contain.
> > > > >> During dirlink that folder is linked to drivers/platform if it's
> not
> > > > >> present a dummy folder is linked.
> > > > >> I understand that Spresense has some special mechanisms to access
> on
> > > > >> board drivers (the sequencer?) and the logic is grouped under
> > > > >> cxd56xx/drivers.
> > > > >> We'll need Alin's input for a detailed explanation.
> > > > >>
> > > > >> I'm not sure how Fotis will/wants to use it.  I also wanted to
> ask.
> > > > >> Thus far I personally only had to use common/.
> > > > >>
> > > > >> On Wed, Aug 12, 2020 at 3:56 PM Matias N. <mat...@imap.cc> wrote:
> > > > >> >
> > > > >> > Hi,
> > > > >> > I'm trying to follow the discussion to understand what would the
> > > final
> > > > >> layout look for board specific drivers now. I was unaware of this
> > > > >> CONFIG_SPECIFIC_DRIVERS option. What is the role of
> drivers/platform?
> > > I
> > > > >> would expect board specific drivers to be under the board
> directory.
> > > > >> >
> > > > >> > Best,
> > > > >> > Matias
> > > > >> >
> > > > >> > On Wed, Aug 12, 2020, at 12:13, Abdelatif Guettouche wrote:
> > > > >> > > It's PR1571, there was no need to update any config as I kept
> the
> > > > >> same name.
> > > > >> > >
> > > > >> > > On Wed, Aug 12, 2020 at 3:51 PM Abdelatif Guettouche
> > > > >> > > <abdelatif.guettou...@gmail.com> wrote:
> > > > >> > > >
> > > > >> > > > I'll provide a PR for review.
> > > > >> > > > The change by itself is simple, we just need to add one
> config
> > > > >> option
> > > > >> > > > to nuttx/drivers/Kconfig.
> > > > >> > > > However we need to update all of Spresense defconfigs (for
> now
> > > only
> > > > >> > > > Spresense uses this folder).
> > > > >> > > >
> > > > >> > > > On Wed, Aug 12, 2020 at 2:33 PM Fotis Panagiotopoulos
> > > > >> > > > <f.j.pa...@gmail.com> wrote:
> > > > >> > > > >
> > > > >> > > > > Unfortunately I am not sure whether I can help with a PR.
> I
> > > don't
> > > > >> feel that
> > > > >> > > > > I understand the NuttX build system well enough to proceed
> > > with
> > > > >> such a
> > > > >> > > > > change.
> > > > >> > > > > Could you help on this?
> > > > >> > > > >
> > > > >> > > > > Of course I can help with testing too.
> > > > >> > > > >
> > > > >> > > > > Στις Τετ, 12 Αυγ 2020 στις 4:29 μ.μ., ο/η David Sidrane <
> > > > >> > > > > david.sidr...@nscdg.com> έγραψε:
> > > > >> > > > >
> > > > >> > > > > > I am volunteering to help test any of these type
> changes.
> > > There
> > > > >> were many
> > > > >> > > > > > subtle breakages in the past that tended to slip
> through.
> > > Also
> > > > >> once all
> > > > >> > > > > > this
> > > > >> > > > > > settles out, it so needs to be documented.
> > > > >> > > > > >
> > > > >> > > > > > -----Original Message-----
> > > > >> > > > > > From: Abdelatif Guettouche [mailto:
> > > > >> abdelatif.guettou...@gmail.com]
> > > > >> > > > > > Sent: Wednesday, August 12, 2020 6:41 AM
> > > > >> > > > > > To: dev@nuttx.apache.org
> > > > >> > > > > > Subject: Re: Board-specific drivers in NuttX 9.1.0.
> > > > >> > > > > >
> > > > >> > > > > > Note that this common board organisation and these two
> > > folders
> > > > >> are
> > > > >> > > > > > relatively new and didn't get as much attention as they
> > > need.
> > > > >> > > > > > That said, I like the second suggestion.  Would you
> like to
> > > > >> prepare a
> > > > >> > > > > > PR and see what others have to say?  I could do that if
> you
> > > > >> want.
> > > > >> > > > > >
> > > > >> > > > > > On Wed, Aug 12, 2020 at 12:31 PM Fotis Panagiotopoulos
> > > > >> > > > > > <f.j.pa...@gmail.com> wrote:
> > > > >> > > > > > >
> > > > >> > > > > > > Thank you very much.
> > > > >> > > > > > > Indeed it now works perfectly.
> > > > >> > > > > > >
> > > > >> > > > > > > However I would propose a little change on this.
> > > > >> > > > > > > Currently board drivers require a specific directory
> > > > >> structure, and this
> > > > >> > > > > > > non-obvious (for me) config entry.
> > > > >> > > > > > >
> > > > >> > > > > > > Why not instead handle external drivers exactly like
> > > external
> > > > >> boards?
> > > > >> > > > > > > That is, add CONFIG_ARCH_DRIVERS_CUSTOM,
> > > > >> CONFIG_ARCH_DRIVERS_CUSTOM_DIR,
> > > > >> > > > > > > CONFIG_ARCH_DRIVERS_CUSTOM_DIR_RELPATH etc in
> > > > >> nuttx/drivers/Kconfig and
> > > > >> > > > > > > have the user select whether they need external
> drivers
> > > and
> > > > >> where should
> > > > >> > > > > > > they be located, instead of implying things.
> > > > >> > > > > > >
> > > > >> > > > > > > Or, at a minimum, I believe CONFIG_SPECIFIC_DRIVERS
> could
> > > be
> > > > >> defined in
> > > > >> > > > > > > nuttx/drivers/Kconfig. Since the build system uses
> this
> > > > >> symbol, nuttx
> > > > >> > > > > > > should define it, instead of relying on external
> Kconfigs.
> > > > >> > > > > > >
> > > > >> > > > > > > Στις Τετ, 12 Αυγ 2020 στις 2:02 μ.μ., ο/η Abdelatif
> > > > >> Guettouche <
> > > > >> > > > > > > abdelatif.guettou...@gmail.com> έγραψε:
> > > > >> > > > > > >
> > > > >> > > > > > > > > It's the drivers/Kconfig that
> > > > >> > > > > > > > defines it (i.e. you add it), you can then enable it
> > > from
> > > > >> menuconfig.
> > > > >> > > > > > > >
> > > > >> > > > > > > > To be clear I meant the "drivers" folder that's
> linked
> > > to
> > > > >> "platform"
> > > > >> > > > > > > > not the toplevel nuttx/drivers.
> > > > >> > > > > > > >
> > > > >> > > > > > > > On Wed, Aug 12, 2020 at 12:51 PM Abdelatif
> Guettouche
> > > > >> > > > > > > > <abdelatif.guettou...@gmail.com> wrote:
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > As far as I can tell it's the same, current
> master[1],
> > > > >> 9.1[2],
> > > > >> > > > > > 9.0[3],
> > > > >> > > > > > > > 8.1[4]
> > > > >> > > > > > > > > I do have some flashes about the necessity of a
> > > drivers
> > > > >> folder
> > > > >> > > > > > > > > alongside the board folder with custom boards,
> but I
> > > > >> can't remember.
> > > > >> > > > > > > > > That was an issue, it's now resolved.
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > > But the code is not included in the build. I
> > > checked my
> > > > >> Make.defs,
> > > > >> > > > > > > > > > and
> > > > >> > > > > > > > it
> > > > >> > > > > > > > > > is similar to other Make.defs of the other
> drivers:
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > You need CONFIG_SPECIFIC_DRIVERS set.  It's the
> > > > >> drivers/Kconfig that
> > > > >> > > > > > > > > defines it (i.e. you add it), you can then enable
> it
> > > from
> > > > >> menuconfig.
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > 1.
> > > > >> > > > > > > >
> > > > >> > > > > >
> > > > >>
> > >
> https://github.com/apache/incubator-nuttx/tree/master/boards/arm/cxd56xx
> > > > >> > > > > > > > > 2.
> > > > >> > > > > > > >
> > > > >> > > > > >
> > > > >>
> > >
> https://github.com/apache/incubator-nuttx/tree/releases/9.1/boards/arm/cxd56xx
> > > > >> > > > > > > > > 3.
> > > > >> > > > > > > >
> > > > >> > > > > >
> > > > >>
> > >
> https://github.com/apache/incubator-nuttx/tree/releases/9.0/boards/arm/cxd56xx
> > > > >> > > > > > > > > 4.
> > > > >> > > > > > > >
> > > > >> > > > > >
> > > > >>
> > >
> https://github.com/apache/incubator-nuttx/tree/nuttx-8.1/boards/arm/cxd56xx
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > On Wed, Aug 12, 2020 at 10:57 AM Fotis
> Panagiotopoulos
> > > > >> > > > > > > > > <f.j.pa...@gmail.com> wrote:
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > NB: You'll need this patch too:
> > > > >> > > > > > > > > > >
> > > https://github.com/apache/incubator-nuttx/pull/1480
> > > > >> > > > > > > > > > <
> > > https://github.com/apache/incubator-nuttx/pull/1480>
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > Oh, I didn't realize that I had to patch v9.1.0
> with
> > > > >> this. I
> > > > >> > > > > > thought
> > > > >> > > > > > > > it was
> > > > >> > > > > > > > > > already included in the latest releases. After
> > > > >> patching, linking of
> > > > >> > > > > > > > > > my
> > > > >> > > > > > > > > > drivers folder into nuttx/drivers/platform
> works.
> > > > >> > > > > > > > > > Kconfig is parsed, and the new options appear in
> > > > >> menuconfig.
> > > > >> > > > > > > > > > But the code is not included in the build. I
> > > checked my
> > > > >> Make.defs,
> > > > >> > > > > > > > > > and
> > > > >> > > > > > > > it
> > > > >> > > > > > > > > > is similar to other Make.defs of the other
> drivers:
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > >     CSRCS += driver.c
> > > > >> > > > > > > > > >     DEPPATH += --dep-path platform
> > > > >> > > > > > > > > >     VPATH += :platform
> > > > >> > > > > > > > > >     CFLAGS += $(shell $(INCDIR) "$(CC)"
> > > > >> > > > > > > > > > $(TOPDIR)$(DELIM)drivers$(DELIM)platform)
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > The structure has not changed, Xiang patch
> made it
> > > > >> possible to
> > > > >> > > > > > > > > > > omit
> > > > >> > > > > > > > > > > the "drivers" folder when it's not needed, in
> that
> > > > >> case a dummy
> > > > >> > > > > > > > folder
> > > > >> > > > > > > > > > > is linked
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > As I see, in v9.0.0, the structure was:
> > > > >> > > > > > > > > > └── boards_dir
> > > > >> > > > > > > > > >     └── board1
> > > > >> > > > > > > > > >         └── drivers
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > but in v9.1.0 it is
> > > > >> > > > > > > > > > └── boards_dir
> > > > >> > > > > > > > > >     ├── board1
> > > > >> > > > > > > > > >     └── drivers
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > or am I missing anything?
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > Στις Τετ, 12 Αυγ 2020 στις 5:22 π.μ., ο/η Xiang
> > > Xiao <
> > > > >> > > > > > > > > > xiaoxiang781...@gmail.com> έγραψε:
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > You can try
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > >
> > > > >>
> > >
> https://github.com/apache/incubator-nuttx/tree/master/boards/arm/cxd56xx
> > > > >> > > > > > > > > > > and compare the difference with yours.
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > -----Original Message-----
> > > > >> > > > > > > > > > > > From: Nathan Hartman <
> hartman.nat...@gmail.com>
> > > > >> > > > > > > > > > > > Sent: Wednesday, August 12, 2020 5:34 AM
> > > > >> > > > > > > > > > > > To: dev@nuttx.apache.org
> > > > >> > > > > > > > > > > > Subject: Re: Board-specific drivers in NuttX
> > > 9.1.0.
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > On Tue, Aug 11, 2020 at 1:14 PM Fotis
> > > > >> Panagiotopoulos <
> > > > >> > > > > > > > > > > f.j.pa...@gmail.com>
> > > > >> > > > > > > > > > > > wrote:
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > The structure proposed by Xiang Xiao is not
> > > working
> > > > >> for me.
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > By looking in the Makefiles, I did
> understand
> > > > >> that the
> > > > >> > > > > > > > > > > > > structure
> > > > >> > > > > > > > has
> > > > >> > > > > > > > > > > > > changed a bit.
> > > > >> > > > > > > > > > > > > Now my structure is:
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > ├── CustomBoard
> > > > >> > > > > > > > > > > > > │   ├── defconfig
> > > > >> > > > > > > > > > > > > │   ├── include
> > > > >> > > > > > > > > > > > > │   ├── Kconfig
> > > > >> > > > > > > > > > > > > │   ├── Make.defs
> > > > >> > > > > > > > > > > > > │   ├── scripts
> > > > >> > > > > > > > > > > > > │   └── src
> > > > >> > > > > > > > > > > > > └── drivers
> > > > >> > > > > > > > > > > > >     ├── driver.c
> > > > >> > > > > > > > > > > > >     ├── driver.h
> > > > >> > > > > > > > > > > > >     ├── Kconfig
> > > > >> > > > > > > > > > > > >     └── Make.defs
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > But still it does not work.
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > Any ideas what may break it?
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > Maybe need to make distclean, followed by
> > > > >> tools/configure.sh,
> > > > >> > > > > > to
> > > > >> > > > > > > > refresh
> > > > >> > > > > > > > > > > NuttX's symbolic links?
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > Nathan
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > >
> > > > >> > >
> > > > >>
> > > > >
> > > >
> > >
> >
>

Reply via email to