zephyr-rust
zephyr-rust copied to clipboard
Rust app interface
What about adding rust to Zephyr in such a way that instead of generating bindings for the whole zephyr system, we would simply define a messaging interface for rust and then use zephyr mailbox to communicate between rust and C components? We could for example use cbor as binary format and cddl to define interface messages.
I think this is tantamount to defining a stable binary API to Zephyr in general, which could be done, but doesn't need to be specific to Rust.
It would be possible to create a stable C ABI without needing message passing. i.e. if you could define a binary format for the methods and data passed to them, they could be implemented with direct function calls. The real issue is defining the API in a way that satisfies most use cases without being too bloated. Zephyr's design goal seems to be maximizing compile-time configuration to minimize binary size, and the only goal is source-level compatibility. zephyr-rust requires some kconfig features to reasonably support libstd which sets a floor for the kernel size, but the goal is to allow Rust app code to be nearly as efficient as C.
It might make sense for Zephyr to have a stable binary interface for applications. I don't know if anyone is working on something like this, but it might be useful for applications in any language.