💾 Archived View for gem.snowgoons.ro › posts › 2021-08-24-Introducing-AVR-Oxide › index.gmi captured on 2023-11-14 at 07:43:55. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-06-14)

-=-=-=-=-=-=-

gem.snowgoons.ro

Regular readers of this blog (haha) will know that I've been working sporadically on getting a working environment for Rust application development on the Arduino Nano Every.

Rust

Arduino Nano Every

This has been not without its challenges, mainly related to a lack of support for the ATmega4809 chip the Nano Every is based on. I've already worked with two very respectable options - Ruduino and avr-hal which between them got me a long way.

ATmega4809

Ruduino

avr-hal

Neither entirely satisfied me, though. In both cases, get anything working was a little bit of a struggle and involved a certain amount of hacking things around. Also, "idiomatic Rust" can sometimes be incredibly hard to read (one of my few concerns with Rust is that it can be a write-only language when used entirely correctly), which made working out what changes I needed to make to get things working painfully difficult at times. This is a reflection on me far more than either of these projects, but it meant I found myself spending more time searching in frustration to find out how something ought to be achieved than in actually writing the application code I wanted to write.

What I really wanted was something much simpler, a crate I could link into my project which would provide me with a simple abstraction of the device hardware (maybe not idiomatically entirely perfect Rust, but easy to understand,) so I could then write code that twiddles I/O lines, waits for interrupts, and uses basic timer facilities without too much work.

Also, critically, it needs to actually work on the ATmega4809. Right now, the one in the Arduino Nano, but in future also some hypothetical variant that isn't actually Arduino based (I have in mind incorporating the chip directly into some of my own board designs.)

Such a thing doesn't seem to exist right now. So, rather than complain, I decided to write it myself.

Introducing AVR-Oxide

Why AVR-Oxide? Because it's a Rusty AVR of course!

What is it?

It's a simple hardware abstraction library and basic runtime for Rust on AVR devices. The aim is to provide:

Sounds good; does it exist?

Well yes, yes it does. At the time of writing, we have a basic implementation that can reliably give an application programmer access to the pins of an Arduino Nano Every board, with access to timer interrupts for scheduled or polling tasks.

A little packing up into a crate, and a little documentation, and we should be ready to go. I hope within a couple of days I'll be able to release it to the world; in the meantime, stay tuned and feel free to write in the comments below if this'll be useful to you! (I know at least one reader has been attempting the same journey as me...)

--------------------

Home - gem.snowgoons.ro