Crates.io | wpilib |
lib.rs | wpilib |
version | 0.4.0 |
source | src |
created_at | 2018-05-29 08:12:45.507499 |
updated_at | 2019-01-16 19:40:24.582409 |
description | FRC's WPILib written in Rust. |
homepage | |
repository | https://github.com/Lytigas/first-rust-competition |
max_upload_size | |
id | 67568 |
size | 85,276 |
Program your FRC robot in rust.
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 update stable
arm-linux-gnueabi-gcc
. For example, the official FRC toolchain
(arm-frc-linux-gnueabi-gcc
) is available for various platforms here, or you
can install a generic toolchain with your package manager of choice (sudo apt-get install gcc-arm-linux-gnueabi
on
Ubuntu).~/.cargo/config
file with the following information:
[target.arm-unknown-linux-gnueabi]
linker = "<path-to-arm-linux-gnueabi-gcc>"
Mine is at /usr/bin/arm-frc-linux-gnueabi-gcc
on Ubuntu.
You can also use the name of the command, provided it's in the PATH.rustup target add arm-unknown-linux-gnueabi
to install the Rust stdlib for ARM-based Linux.wpilib = ...
to [dependencies]
in Cargo.toml
.Setup:
arm-frc-linux-gnueabi-*
from the official FRC toolchain, or acquire a different arm compiler and export CXX_FRC="/path/to or name of arm C++ compiler"
. This is necessary to load compiler headers.make all
. This will likely take a minute or two. The process will:
After the initial make all
, use cargo
(with two caveats, see below) to build as normal. If the WPILib submodule updates, run make all
again.
Pull-requests to make the build process more cross platform are welcome. If you want to contribute but can't get the build working, you can use the CI docker image by invoking the .ci/pull-request.sh
script.
This project includes a build script that generates bindings on top of WPIlib, handles linking, and exposes its shared libs with a symlink for cargo-frc to consume. Because of this, the script is by default configured only to run when it needs to update the
symlink (another version of this crate has changed it). During development, to force the script to run use
cargo build --features dev
.
Also note that using cargo build
in the workspace root will always fail, because wpilib
can only be built successfully on arm, whereas cargo-frc
needs to be native. In the future, building for x86 may enable WPILib simulation.
cargo-frc
, the third-party cargo subcommand for this project.This library is distributed under the terms of both the MIT license and the Apache License (Version 2.0). By contributing, you agree to license your contribution under these terms.
See LICENSE-APACHE, LICENSE-MIT, for details.
While getting the HAL to work, I got lots of help from looking at KyleStach's rust-wpilib.