[RFC] How can we stabilize the library?
Use stable rust
Many crates (like cortex-m, cortex-m-rt etc.) can now be used using only stable features of Rust. As the tock kernel itself is language-agnostic it should be no problem to move libtock-rs to stable rust.
Advantages:
- less effort to adapt libtock-rs to the newest Rust versions
- a more stable api
Disadvantages:
- some things (like inline assembly) may be more difficult to use
- some features may even be unavailable
- tock os kernel and libtock-rs may use different versions
Define a "supported" version of the kernel
libtock-c and libtock-rs tend to diverge. Some drivers are only supported in libtock-c and some examples exist only for libtock-rs. Moreover, the abi was changed in incompatible ways. I have some suggestions (non-exhaustive) here
- tag revisions of libtock-rs when they are tested with the corresponding tock kernel version
- define something like a supported version of "master" as we currently do in the Readme
Stabilize the toolchain
My main tool for testing and developing libtock-rs is the run-example script. However, other boards are (accidentally) not supported. We could
- adapt the script to support all boards
- set up a more fancy toolchain
I'd be interested in your opinions.
Have you tried removing the feature flags one by one? I did, but I got stuck very early (Don't remember where exactly).
Off the top of my head, the following two things would get in the way:
- Stable rust does not support #![no_std] binaries yet, as some of the lang items you must implement in a binary are unstable.
- Inline assembly is unstable.
I don't know exactly about the details, however, you can build no-std-binaries (which are probably actually libraries) using stable rust and the cortex-m-rt crate. Regarding inline assembly: We are using so little of it, we could link the few lines against an external assembly-file, if we wanted.
After https://github.com/tock/libtock-rs/pull/380 is merged and Rust ~~1.39.0~~ 1.59.0 is released (which stabilizes asm! and global_asm!), libtock-rs will work on stable Rust.
There are a couple things that will still require a nightly toolchain:
-
cargo miri - Providing a global memory allocater. IIRC, this was blocked on https://github.com/rust-lang/rust/issues/66741
I think that should be Rust 1.59.0
I think that should be Rust 1.59.0
Good catch, fixed.