In RTOS, the operating system will provide an incomplete (compared to linux-gnu) system call interface for use. It is often possible to create a POSIX compatibility layer so that some key POSIX system interfaces can be used. In this case, Is it possible to use the std module corresponding to the system interface implemented by this part, while keeping other modules in the #![no_std] environment. Or is there any library that can implement upper-level functions from the provided system-level interface (such as implementing a complete upper-level File abstraction from system calls such as write/read)
I can see three options, in order from worst to best:
- You could provide a crate for the RTOS that implements API-compatible parts of
std
, requiring everyone to provide an option to use this crate in theirno_std
crate if they can make use of those features. - You could provide an implementation of
std
for your RTOS that panics (or otherwise fails) in lots of places because it simply can't implement that module - for example, all ofstd::net
might panic or return an error if your RTOS has no networking support. - You could work with upstream (via Zulip and the Rust Internals forum) to put together a suitable proposal for a further split of
std
(which is already split intocore
andalloc
) into convenient pieces, justified by many RTOSes implementing subsets of features.
3 Likes
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.