4 ms·
Rust bare metal on ARM microcontroller
- steveklabnik 11y agoWe've been actively working on stabilizing #![no_std], as well as making cross-compilation easier. In the future, ideally, you'll just need $ cargo build --target thumbv7em-none-eabi instead of $ rustc -C opt-level=2 -Z no-landing-pads --target thumbv7em-none-eabi -g --emit obj -L libcore-thumbv7m -o runtime.o runtime.rs or other shenanigans. You can run that Cargo command right now, but you still need to do a little bit of work first.
- antoinealb 11y agoNice! Any pointer to a documentation / wiki explaining how to use it ?
- steveklabnik 11y ago"it" being --target? https://github.com/rust-lang/rfcs/blob/master/text/0131-target-specification.md https://github.com/rust-lang/rfcs/blob/master/text/0131-targ... is the original RFC. Off the top of my head, I think that's it for now. Since cross compilation is getting easier in the future, I haven't invested a lot of time into writing docs now.
- Animats 11y agoVery nice. When this gets cleaned up, and Rust stabilizes a bit more, it should be promoted for the Arduino Due. The Due is a minimal ARM machine, a step up from the Atmel CPUs but well below the level required to run Linux. Safety at the Rust level is very valuable in embedded work. Debugging small embedded machines is not fun.
- petra 11y agoI agree. I wonder though - why all the rust projects go bare metal, instead of integrating a c based RTOS using rustbingen ? Seems like the fastest way to get cross-platform, which is key for many developers - and speed rust's adoption - making bare metal much easier.
- LBarret 11y agoI think rust people wants to proove repeatedly the addded value of their language : "no cost abstraction over bare metal" because it is the thing that will win the heart of their audience. Still, in practice, it will likely play as you say, but not now.
- rcxdude 11y agoHooking into an RTOS doesn't really give you much cross-platform ability: most RTOS only give you a scheduler and synchronisation primitives, not any drivers. The closest thing to a a cross-platform RTOS I know of is chibiOS, and it supports a fairly low number of platforms.
- antoinealb 11y agoauthor here. My RTOS of choice (ChibiOS) uses a lot of function like macros which are not supported by rustbindgen. Other RTOSes such as FreeRTOS or UC/OS-II would be easier but they don't provide drivers, making them less interesting. If anybody has experience with writing C macros to rust bindings I would be interested in hearing about it.
- petra 11y agoI know that chibi OS is funded by ST(for developing a version for their automotive line of automotive mcu's). Hence why it's only limited to ST platforms(still that's a lot of variety at great price). Maybe they'll be interested in funding rust development? it might give them some competitive advantage, some amount of control of a possible future platform, i.e. rust.
- antoinealb 11y ago
- antoinealb 11y agoIn my opinion Arduino Due are overrated. They are pricey, their processor isn't really top-tier and you don't get a builtin JTAG probe for debugging (I think). You should try ST's discovery/nucleo boards. Much cheaper and ChibiOS (www.chibios.org) has some nice API and examples to get started.
- elcritch 11y agoHandy to know; thanks for the heads up!
- andars 11y agoRust does look promising for embedded applications. Ideally, I'd like to be able to use it to program Pebble applications. I managed to get a simple executable written in rust to write to the screen a few months ago, but haven't been able to get even slightly more complex things to work. Hopefully the hard work of rust devs will make this easier in the future.
- CyberDildonics 11y agoHow would they make it easier?
- andars 11y agoErm, see steveklabnik's comment on this story. It is sort of a complex process right now in that you have to build libcore yourself and then try to link everything together (for me, that mostly involves trying something and then crossing my fingers, because my knowledge of that level of tooling is limited). I've heard several times that rust devs are hoping to make cross compilation easier.
- alnsn 11y agoThis is going to be interesting. Rust on top of rumprun bare-metal unikernel https://twitter.com/gandro23/status/645734117699624960 https://twitter.com/gandro23/status/645734117699624960