Rust can target AVR through the avr-hal crate, but you'll need a nightly compiler, Linux build tools, and the ravedude uploader to move from source to a working board.
Check which Uno and Rust target you have
The avr-hal template supports Arduino Uno alongside Leonardo, Mega, Nano, and other common boards.
Install the Linux build and flashing tools
On Ubuntu, install the AVR C library, GCC cross-compiler, avrdude uploader, and udev development headers:
sudo apt install avr-libc gcc-avr pkg-config avrdude libudev-dev build-essentialOther distributions use different package names: Arch ships systemd and pkgconf, Fedora provides systemd-devel and pkgconf-pkg-config. Then install cargo-generate and ravedude with stable Rust:
cargo +stable install cargo-generate
cargo +stable install ravedudeRavedude wraps avrdude and integrates flashing into cargo run, so you can build and upload in one command.
Create a minimal Uno project
Generate a new project from the avr-hal template:
cargo generate --git https://github.com/Rahix/avr-hal-template.gitThe tool will prompt you to name the project and select a board. Choose Arduino Uno from the list.
[target.'cfg(target_arch = "avr")']
runner = "ravedude"Change into the project directory:
cd your-project-nameBuild and flash the first program
Connect your Uno to the Linux machine via USB. The board usually appears as /dev/ttyACM0 or /dev/ttyUSB0. If ravedude's auto-detection doesn't find it, set the port explicitly:
export RAVEDUDE_PORT=/dev/ttyACM0From the project directory, build and upload the template's blinky example:
cargo runThe command prints avrdude's progress and verification steps. The on-board LED should blink.
Diagnose build and upload failures
sudo usermod -a -G dialout $USERIf avrdude cannot open the port, confirm the device path with ls /dev/tty* before and after plugging in the Uno, then pass the correct path via RAVEDUDE_PORT or the port key in Ravedude.toml.
Understand the limits of Rust on the Uno
Rust for AVR requires a nightly compiler. The project supports basic GPIO, timers, PWM, SPI, and UART through avr-hal's abstractions. Check the examples directory in the avr-hal repository for ADC, interrupt, and display code that runs on the Uno; not every example has been ported to every board, but the patterns transfer.
Frequently asked questions
How do I write to the serial console from Rust?
The avr-hal examples show UART initialization and writing. Configure ravedude to open a console after flashing by setting open-console = true and serial-baudrate in Ravedude.toml. Ravedude will display the serial output after the upload completes.
Explore avr-hal examples
Once you've flashed the template's blinky program, browse the avr-hal Arduino Uno examples for GPIO, timers, PWM, SPI, UART, and interrupt patterns you can adapt to your own Uno projects.
Verification status: Supported by official documentation only under the conditions below; not reproduced in a test environment by IGPROD. Checked 2026-10-18.
Conditions:
- The documented avr-hal workflow requires a nightly Rust compiler for AVR.
- The listed Linux package command applies to Ubuntu; ravedude separately lists dependencies for other Linux distributions.
- The reader must select Arduino Uno when generating the template and connect the board to flash it.
Related guides
- Rust in Visual Studio vs VS Code: which editor to set up for Rust and what each supports.
Sources:
Leave a comment
Your email address will not be published. Required fields are marked *