rust-wpilib is an equivalent to WPILib, rewritten in Rust. The goal of this project is to create a lightweight alternative to WPILib for FIRST Robotics Competition teams who would prefer to use the language for its safety guarantees.
This repository is designed to be compiled for a RoboRIO, the processor used in the FIRST Robotics Competition. To cross compile for RoboRIO, you have to do a few things:
rustup target add arm-unknown-linux-gnueabi
to install the Rust stdlib for ARM-based Linux.arm-linux-gnueabi-gcc
. For example, the official FRC toolchain
(arm-frc-linux-gnueabi-gcc
) is available here, or you
can install a generic toolchain with your package manager of choice (sudo apt-get install gcc-arm-linux-gnueabi
on
Ubuntu).Edit your ~/.cargo/config
file with the following information:
[target.arm-unknown-linux-gnueabi]
linker = "<path-to-arm-linux-gnueabi-gcc>"
This library is not currently published on crates.io. However, you can directly declare it as a dependency:
Cargo.toml:
[dependencies]
wpilib = { git = "https://github.com/robotrs/rust-wpilib" }
You can build your own project for the RoboRIO by passing --target=arm-unknown-linux-gnueabi
when building.
To build this library on its own, just run cargo build --target=arm-unknown-linux-gnueabi
. To make sure that
everything links properly, you may also want to run cargo build --example test_robot --target=arm-unknown-linux-gnueabi
.