zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.94k stars 6.66k forks source link

native drivers and backends not yet supported with embedded C libraries #60096

Open aescolar opened 1 year ago

aescolar commented 1 year ago

Now that we have the native_sim targets, we can build Zephyr as a Linux application, with the choice of using an embedded C library. When the user selects to use an embedded libC, a few of the old native_posix drivers will not work, as in that case they will not have direct access to the host libraries. The solution is to refactor those drivers into a top and a bottom. The bottom, the part which does the host accesses, is built separately from the rest of Zephyr (in the same context as the native simulator "runner", with the host libraries and include paths, but without the Zephyr include paths). The top is built in Zephyr context.

For the most trivial accesses to the host, the runner already includes a few host call trampolines, so drivers/test code can call directly from the "embedded world" into the host via those trampolines.

This list keeps track of the progress for native (posix/sim) drivers which are not yet supported with the embedded C libraries:

The whole list of drivers and backends can be found here: https://docs.zephyrproject.org/latest/boards/posix/native_sim/doc/index.html#native-sim-peripherals

CC: @jhedberg @MarkoSagadin @henrikbrixandersen @martinjaeger @tmon-nordic @jfischer-no @finikorg @jukkar @tbursztyka @nvlsianpu @vanwinkeljan @de-nordic @nordic-krch @Laczen

aescolar commented 1 year ago

Help with the pending ones would be very welcome. You can see in the currently queued PRs that the changes needed to support building them with embedded libC are relatively straight-forward, but it would be of course easier for those who are already familiar with the drivers code. For drivers that require HW, specially if that HW is not too normal ( CAN :) ) a voluntary with the HW who could also try it out would be necessary.

tmon-nordic commented 1 year ago

I don't think the porting of USB native posix makes sense - it has broken design and does not really implement what USBIP expects. We could however, aim with the new stack (device-next) USBIP implementation to be supported with embedded C libraries.

aescolar commented 1 year ago

@tmon-nordic Up to you guys (USB maintainers).