soburi / arduino-on-zephyr

All achivements of this project have been merged into https://github.com/zephyrproject-rtos/gsoc-2022-arduino-core. Please use them.
20 stars 2 forks source link

Project status? #2

Closed beriberikix closed 2 years ago

beriberikix commented 4 years ago

Hello! Do you have any plans to continue work on this project?

It's a great idea :)

soburi commented 4 years ago

Hello! @beriberikix

I'm forcusing on https://github.com/soburi/openthread_nrf52_arduino now. I'm suspend this project now, because of my resource are too short to proceed this project.

One of a reason of suspend this project, ZephyrRTOS has well complete 'make config' system for build and configuration. I think that is not so suitable for put into arduino build system, because that has different principal. (Arduino is prefer configuration embedding into initialize code, but ZephyrOS is externalizing to 'make config' system.) I think that is good implements arduino subsystem library for ZephryRTOS, rather than build from arduino ide. (and it will be good to build IDE that make easy to configure and build on VSCode, such as PlatformIO, I think.)

beriberikix commented 4 years ago

The openthread project is super cool - I use to work on OpenThread and I'm glad to see your Arduino support.

Agree a Zephyr subsystem approach would be very nice. I'm not very familiar with how Zephyr's library system works, have you looked into it?

Agree that bundling make and west would be non-standard but I know plenty communities who do it. I'd love to see some CI/CD pipeline that auto-generates the configs and folders based on the latest devices supported in Zephyr. Hopefully someone else might be interested in collaborating or if you find more time :)

soburi commented 4 years ago

Hi! @beriberikix.

Agree a Zephyr subsystem approach would be very nice. I'm not very familiar with how Zephyr's library system works, have you looked into it?

I just created trial codes. https://github.com/soburi/zephyr/tree/arduino-api

It is deriverd from v2.1.0

Zephyr's subsystem is just a library, in my understanding.

Creating Zephyr's library is simple. It require only copy from 'arduino-on-zephyr' project into subsys/arduino-api and add Kconfig and CMakeLists.txt. CMakeLists.txt can select sources to compile from board configuration. But only compiling sources that required by the sample now. (It is proof of concept!)

'arduino-on-zephyr' has complex build system. It became hard to maintain. This trial code implements Arduino-API as library, not contains (tricky) build scripts, has good affinity with Zephyr system.

Subsystem is just a library, it can also contain main() function. It can implements arduino's loop which calls setup() and loop() function. This implements makes user program can be written with arduino manner. (see samples/arduino_blinky, I'm test with nrf52840_pca10056)

Result of this modification, we get two benefit.

  1. We can use Arduino-style API and setup()/loop() structure in Zephyr RTOS environment.
  2. It is completely fit wit Zephyr's CMake system. Easy to run CI/CD with west or other tools, I think.

(I think, Arduino designing that easiness with API and IDE (and Board). API is just one of a part. I also want an easy-to-use IDE for ZephyrRTOS, that like a PlatformIO)

(And there is one serious problem. Arduint-API is GPL codes, this code can not push into mainstream! (Zephyr is licenced with Apache license!))

Regards.

leojrfs commented 4 years ago

Zephyr is now supported on PlatformIO, so having arduino api with it sounds amazing! https://community.platformio.org/t/official-support-for-zephyr-project/11268

regarding mainstreaming, could we maybe create a separate repo GPL licensed as a module or something rather?

https://docs.zephyrproject.org/latest/guides/modules.html

soburi commented 4 years ago

HI, @leojrfs

Zephyr is now supported on PlatformIO, so having arduino api with it sounds amazing!

That's good news! 👍

https://docs.zephyrproject.org/latest/guides/modules.html

OK, I'll considering to make this module as external.

beriberikix commented 4 years ago

Are you on the Slack channel? It would be good to share this idea with the community and see if there is any feedback!

Personally, I think having both Arduino IDE support and PlatformIO support would be ideal (and maybe even different implementations.) With the Arduino IDE you open up Zephyr to a lot more users and making things like access to OpenThread more generally available. PlatformIO is a much more powerful tool and is preferred by any with more experience developing embedded systems.

Besides modules, is it worth considering external libraries? I was looking here, which might make it easier to hook into the Arduino IDE's build system.

soburi commented 4 years ago

@beriberikix,

Are you on the Slack channel?

I joined the channel as @soburi now.

Personally, I think having ...

I agree Arduino IDE and PlatformIO has different focus and users. I believe there is different value than PlatformIO to provide zephyr package (this repository). And I love Arduino!

Both PlatformIO and my Arduino package are just a wrapper for zephyr build system. It's means following zephyr build rule, will make both system works well.

Here is trial code to make as a module.

https://github.com/soburi/arduino-on-zephyr/tree/modulize (provide module) https://github.com/soburi/zephyr/tree/external_module (using module)

Only adding few configuration files to work as module to work. And it seem not break original Arduino integration.

I think external library is seem good for importing already exists code that is not following zephyr build rule. For example, OpenThread is use configure & make not cmake, OpenThread is build with external library method in zephyr sources.

In this case, build as a module is more prefer way rather than external library in zephyr system, I think.

Thus, remaining problem is packaging and distribute module and Arduino package from this repository. module is download directly from github by west comannd. No need to special things for distributing, just push a code. Arduino package is bit more complex. But only some file was added to make module. It maybe able to ignore, I think. I need to maintain a package because it suspended for a while, but it maybe not hard.

beriberikix commented 2 years ago

@soburi hello! Do you plan on maintaining this project any further? If so, great! But if not, I was wondering if you'd consider updating the README and point people to https://github.com/zephyrproject-rtos/gsoc-2022-arduino-core (we just cut the first release) and optionally making this repo read-only. We'd love to build a community around this new Zephyr-sponsored repo!

soburi commented 2 years ago

Hi, @beriberikix

I ported the function that the implementation has been completed in this project, but not yet implemented in gsoc-2022-arduino-core.

https://github.com/zephyrproject-rtos/gsoc-2022-arduino-core/pull/56 https://github.com/zephyrproject-rtos/gsoc-2022-arduino-core/pull/54 https://github.com/zephyrproject-rtos/gsoc-2022-arduino-core/pull/51

Once these features are ported, this project can finish its historic role. I will archive this project once these features (or alternative implementation) are implemented in gsoc2022.

beriberikix commented 2 years ago

Amazing! Can you also join the Zephyr Discord to discuss? There's a dedicated arduino channel.

soburi commented 2 years ago

Amazing! Can you also join the Zephyr Discord to discuss? There's a dedicated arduino channel.

OK. I can response in discord channel.

soburi commented 2 years ago

All features porting is done. This project will archived.