Re:Rust's 2019 Roadmap
by cornstalks on Tuesday April 23, 2019 @01:32PM
(#19730883)
Several of these items are very relevant for the embedded world (custom registries, custom allocators, unsafe code guidelines, etc.). They just didn’t use the word “embed” in this short post.
[ Parent
| on HN ]
Do you know how difficult it is to write a position-independent blob that runs all by itself? Consider something like a boot loader or kernel, starting from a random location in memory. Can it run without needing assembly language?
For example, C can often do this. You ask the linker to put a particular function first and to make everything position-independent. There can be some problems with the GNU toolchain stubbornly insisting on making a GOT, but the language is otherwise fully capable.
Re:Rust's 2019 Roadmap
by thenewwazoo on Tuesday April 23, 2019 @03:26PM
(#19731982)
It's very easy, in fact. Because you don't use the stdlib, it requires handling some language items (the equivalent of having to write your own _start routine, for example). You set up vector tables just like normal, and you decorate things to tell the linker where to put them.
The canonical example is https://github.com/rust-embedded/cortex-m-rt if you want to get into the guts of how it works. For a more user-focused overview, check out https://github.com/rust-embedded/cortex-m-quickstart, which is a good starting point from which to drill down.