Skip to content
forked from rust-lang/rust

A safe, concurrent, practical language.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

dylanmckay/rust

Rust with AVR support

Gitter

This project adds support for the AVR microcontroller to Rust.

It uses the AVR-LLVM backend.

This will compile Rust with AVR support. This will not create a fully-fledged cross-compiler, however, as it does not compile any libraries such as libcore or liblibc. To do this, the --target=avr-unknown-unknown flag must be passed to configure, which is not fully supported yet due to bugs.

# Grab the avr-rust sources
git clone https://github.com/avr-rust/rust.git

# Create a directory to place built files in
mkdir build && cd build

# Generate Makefile using settings suitable for an experimental compiler
../rust/configure \
  --enable-debug \
  --disable-docs \
  --enable-llvm-assertions \
  --enable-debug-assertions \
  --enable-optimize \
  --prefix=/opt/avr-rust

# Build the compiler, optionally install it to /opt/avr-rust
make
make install

# Register the toolchain with rustup
rustup toolchain link avr-toolchain $(realpath $(find . -name 'stage1'))

# Optionally enable the avr toolchain globally
rustup default avr-toolchain

Usage

With Xargo (recommended)

Take a look at the example blink program.

Vanilla rustc

AVR support is enabled by passing the --target avr-unknown-unknown flag to rustc.

Note that the Rust libcore library (essentially required for every Rust program), must be manually compiled for it to be used, as it will not be built for AVR during compiler compilation (yet). Work is currently being done in order to allow libcore to be automatically compiled for AVR.

About

A safe, concurrent, practical language.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 94.5%
  • HTML 3.3%
  • Python 0.5%
  • JavaScript 0.4%
  • Makefile 0.3%
  • C++ 0.3%
  • Other 0.7%