/rust-arduino-elegoo

Rewriting the Elegoo Super Starter Kit tutorials in Rust

Primary LanguageRust

Rust Arduino Elegoo

Description

This repository contains the necessary Rust code to go through the Elegoo UNO Project Super Starter Kit Tutorials.

The Elegoo UNO R3 is really just an Arduino Uno board, which is based on the ATmega328p architecture.

Prerequisites

Archlinux setup

# install tools
$ pacman -S rustup arduino-avr-core

# configure rust
$ rustup toolchain install nightly
$ rustup component add --toolchain nightly rust-src

# add user to `uucp` group to be able to write to serial device
# you will need to logout & login for change to take effect
$ usermod -aG uucp <username>

# compile and flash examples/
# you might have to change the `SERIAL_PORT` in the `Makefile`
$ rustup override set nightly
$ make build EXAMPLE=<example>
$ make flash EXAMPLE=<example>

Cargo build

The flash memory is 32 KB, of which 0.5 KB is used by the bootloader. We need executables that can fit in that space.

I needed to add this to the Cargo.toml file so the compilation would work:

[profile.release]
panic = "abort"
codegen-units = 1
debug = false
lto = true
opt-level = "z"

Ressources

Archwiki

Github

Rust