As Alan said `drivers/` should remain independent from `arch`.
The clean separation of arch from the rest of the code is one of the nicest
things about NuttX and it should stay that way.

But the problem of reusing the same low-level driver code across different
arch implementations is an unsolved problem and I think it's important to
solve it.

A certain amount of duplicate code is not a problem, but an infinitely
growing
amount of duplicate code is a problem and this is something we will see in
the future
as new chips are created (STM32 are the best example of this problem).

wt., 27 sie 2024 o 15:16 Alan C. Assis <acas...@gmail.com> napisał(a):

> Actually inside drivers/ are supposed to have only generic drivers (upper
> half drivers that work with all chips).
>
> Please don't use drivers/ for arch specific drivers, that is not the way
> NuttX is supposed to be.
>
> Today we don't have a simple way to share arch drivers, as you can see for
> each stm32, stm32f7, stm32h7, etc the drivers are implemented/duplicated
> again.
>
> This is something we need to fix the right way!
>
> BR,
>
> Alan
>
> On Tue, Aug 27, 2024 at 5:24 AM Sebastien Lorquet <sebast...@lorquet.fr>
> wrote:
>
> > Hi,
> >
> > My personal opinion: use arch/arm/src/rp23xx and arch/risc-v/src/rp23xx
> >
> > With shared drivers in drivers/rp23xx
> >
> > And separate board configs for arm and riscv.
> >
> > Not sure if nuttx wants to support an hybrid arm+riscv port as a single
> > build !
> >
> > So there is no need to invent new dirs.
> >
> > Sebastien
> >
> >
> > On 26/08/2024 20:42, Marco Casaroli wrote:
> > > Hello,
> > >
> > > I got my hands on some Raspberry Pi Pico 2 boards and I can finally run
> > > NuttX on them.
> > >
> > > It took some work, since the M33 core is a bit different than the M0 on
> > the
> > > old RP2040.
> > >
> > > It is working now (nsh and usbnsh configs at least) and even ostest is
> > > passing.
> > >
> > > For my initial PoC, I just edited many files in the rp2040 port but I
> > will
> > > create a new rp23xx port and I have some questions on how to organize
> the
> > > files:
> > >
> > > 1 Where should I put the arch files? Should I put them in
> > > arch/arm/src/rp23xx or should they be in a different path that could be
> > > reused by the RISC-V and ARM boards? Should we make another arch subdir
> > > like arch/multi? Or just have rp23xx in both risc-v and arm
> directories?
> > If
> > > so, then what about the files that are the same and could be reused.
> > Where
> > > to put them? Should I care to reuse these files or I can just copy them
> > > over when we make the risc-v port?
> > >
> > > 2. How should I differentiate the boards? should I call
> > > raspberry-pi-pico2-arm and raspberry-pi-pico2-riscv?
> > >
> > > 3. Some of the files could be shared / reused by rp2040 (ARM Cortex M0)
> > and
> > > rp23xx (riscv and ARM Cortex M33), how should I proceed to reuse these
> > > files and have them in a common directory. What directory would be
> best?
> > >
> > > I plan on pushing a PR with the modifications later this week.
> > >
> > > Thank you!
> > >
> >
>

Reply via email to