Showing posts from January, 2018

Supporting the new Embedded HAL

Recently, @japaric posted a about a new approach to an Embedded HAL in Rust. This is something that's been kicked around on #rust-embedded for a while, but it was great to see it get to a point it could be pushed out to the wider world. I run the Cambridge Rust Meetup and the post coincided with our next Hack-n-Learn evening. The purpose of these evenings is to work through problems together and I decided it would be fun to try and implement the Embedded HAL on my LM4F120 chip crate, and then fix the Stellaris Launchpad examples to use the new HAL. To engage some of the attendees new to Rust, I thought it would help if I did it live on the big projector and talked through the changes as I made them. Well, despite a quick 10 minute break for pizza (thanks Cambridge Consultants ) I managed to get the changes completed to the UART driver in under two hours. Here's what I had to do. The old UART driver in the LM4F120 crate used my earlier Embedded Serial HAL . That looke

Embedded Rust in 2018

I recently picked up an embedded project that I hadn't touched for a few months, so I could add some new features. I was disappointed to note that it no longer compiled - nothing in the code had changed, but it only compiles with Nightly Rust and that had recently had a bunch of changes that completely broke my build. This is then a tale about what I'd like to see from Rust in 2018. I know there's been a lot of interest in WASM and other 'high level' applications, but Rust also lends itself very well to embedded development . I have a demonstration project for the Texas Instruments Stellaris Launchpad (now rebadged the Tiva-C Launchpad ). This project comprises approximately three Assembler instructions (to bounce into the hardfault handler ), and the rest is Rust - no C required! Exception handlers, setting the stack pointer and initialising the .data and .bss segments can all be done in pure Rust. Thanks to brilliant work by the likes of @japaric , with the Xa