On Mon, Jun 20, 2022 at 6:26 PM Tomek CEDRO wrote: > > On Mon, Jun 20, 2022 at 5:30 PM wrote: > > I dont think there is much to do with the drivers: > > Nuttx have already many drivers written in C, and from uPython, you just > > can open(), read(), write(), close() the character drivers. For example, > > if you like to read a pressure sensor what is already supported (BMP180 > > for example, a pressure sensor connected by I2C), all the hardware stuff > > is done already in C. uPython only needs to open the BMP180, and ready. > > > > This is the big different of (u)Python on Nuttx compared with uPython on > > bare metal. The uPython on bare metal implementation must implement > > every hardware/sensor by itself. uPython on Nuttx can reuse all existing > > sensors, actors, and so on. > (..) > > Using existing NuttX drivers should be possible in ported MP (i.e. > filesystem device read/write). But also what worked on bare MP should > work on MP+NuttX. I would not take the path of using existing NuttX > drivers to implement underlying drivers for MicroPython because that > would not be the generic way.
Sorry, local distraction and it that part sounds contrary what I wrote before. What I mean is I want any code work on generic set of drivers. So code would be fully portable between bare-metal MicroPython and MicroPython on NuttX both ways. That would be probably implemented using NuttX as build target for MicroPython just as current Unix build target. Generic drivers will be "glue" and will use underlying character/block devices implemented by NuttX so we are independent from underlying hardware. Using existing target drivers of MicroPython on NuttX would imply problems with NuttX drivers and vice-versa. Thus "the glue drivers and build target concept". Sure existing BMP180 driver of NuttX could be used on MP on NuttX. But that would not work the other way - you would not run that code on bare metal MicroPython. If no portability is required this is fine and may be even more efficient. However, I would like to have a solution that would work both ways in the first place and that would be my ultimate goal :-) -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info