On Mon, Jun 20, 2022 at 5:30 PM wrote: > great to see your success on uPython for Nuttx. For your "I will have to > see how much work with peripheral drivers will be out there in bare > metal MP to NuttX,", 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. > > Good luck!
Thank you but no success yet only an idea.. the whole work is still ahead :-) I was thinking about glue between peripheral drivers in MP and existing driver infrastructure in NuttX.. probably a glue will have to be created in MP in order to use existing drivers in NuttX. That would be probably most generic and future proof way. Probably NuttX will have to become a dedicated target for MP build. We probably do not want to use existing MicroPython hardware drivers for a specific target (i.e. writing peripheral registers) as this would interfere with existing drivers in NuttX (i.e. /dev/gpio). That would allow running MP just as another application while other applications will work in the background. Maybe a "hard" switch from NuttX to MP would be necessary in the first step. I would like MP to be just another application to run on NuttX. Also as there are other drivers available outside MP repository I would prefer to stick only to the bare-metal set of drivers (i.e. GPIO, SPI, I2C) that are provided by a given MP target (i.e. ESP32/-C3) so we could just glue them to NuttX target and work on a generic MP build inside NuttX. 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. Reality will verify all concepts :-) -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info