Crates.io | oxide-macros |
lib.rs | oxide-macros |
version | 0.4.2 |
source | src |
created_at | 2021-12-03 15:48:39.043798 |
updated_at | 2024-06-07 08:33:21.038646 |
description | Main entrypoint macro for AVRoxide |
homepage | https://avroxi.de/ |
repository | https://gitlab.com/snowgoonspub/avr-oxide |
max_upload_size | |
id | 491794 |
size | 32,612 |
An extremely simple Rust runtime for AVR microcontrollers.
For more information and documentation, see the AVRoxide site.
AVRoxide was borne out of my frustration with attempting to develop for an Arduino Nano Every microcontroller board using the Rust programming language.
The Arduino Nano Every uses a different version of AVR microcontroller to the other Arduino family of boards - the ATmega4809. While there are HAL1 crates available for various Arduino boards, none of them works with this microcontroller, and that's a shame - it's actually a super nice chip and a good upgrade on the ones used in the 'traditional' Arduino boards. So, support for it in Rust would obviously be nice to have.
Naturally, the first thing I tried to do was to adapt some of the existing HALs to work with the Nano Every. But this turned out to be a little trickier than I anticipated, and in any event I discovered there were some things that I didn't like about those HALs. This is in no way a reflection on the quality of thoes HALs - much more a reflection on my Rust abilities - but I found I wanted something a little simpler and easier to understand.
And so, the idea of putting together my own HAL come to mind. But, I also wanted to move a little higher up the pipeline - not just to abstract away the hardware, but also to put in place some standard patterns for things like a standard event loop that would hide some of the details of things like interrupt handling from the application developer.
Thus, AVRoxide is born! The Rusty runtime for AVR microcontrollers.
Note that '328P support is currently at a very, very early stage, with only basic port pins and serial USARTs working. This chip also brings a new set of Rust/LLVM code generation bugs and challenges, and I haven't worked out how to deal with them all yet.
Getting started guides are at https://avroxi.de/categories/gettingstarted/
This is a work in progress
It currently is functional, with a whole bunch of caveats about the readiness of Rust on AVR generally, and usable to build simple programs.
The intention is to expand it beyond the minimal set of devices currently supported, in due course.
Now and forever - use at your own risk :-).
THERE ARE HEISENBUGS Particularly involving multithreading. Since I have reached a point of total exasperation attempting to track them down, for the timebeing I'm going to worry about other things and hope I come across the solution while working on something else. So, really really, don't use this for anything critical right now - consider it an adventure game :-).
AVRoxide is built using the nightly
Rust toolchain for AVR. Since
10th May 2022, you can use the regular nightly
toolchain - thank you
to Patryk27 for getting it working!
Update, 2024: Some recent changes in nightly
are causing problems. But the
relatively recent 2024-05-01
toolchain works fine, so that's what I'm
currently using.
A Docker image containing a known-working version of the toolchain is also available on Docker Hub. This is the version used in my CICD to test the build; if you want to verify you can pull the same version using:
docker pull snowgoons/avr-rustbuilder:nightly-2024-06-06
Note that despite the later image date, this image also has the working
nightly-2024-05-01
toolchain and sources pre-installed.
Hardware Abstraction Layer ↩