pros 0.0.10

Rust bindings for PROS
Documentation

Pros-rs

Work in progress opinionated Rust bindings for the PROS library and kernel.

This project is still early in development

Make sure to check out the todo list (TODO.md)

Compiling

Pros-rs has a few dependancies, namely:

  • Rust (obviously)
  • The Arm Gnu Toolchain (arm-none-eabi-gcc)
  • Clang
  • Pros (pros-cli)

Read the installation guide for your OS to see how to install all of them.

Windows

Windows is always tricky to compile things on, but luckily you won't have to do too much.

First install Clang. To install Clang either install it manually, or if you dont mind it being outdated, run the installer.

Next install the Arm GNU Toolchain which has an installer here

Next install the pros cli, instructions are here

Finally, find the directory of the Arm GNU Toolchain and navigate to arm-none-eabi/include. Copy the new path. What we need to do now is set the CPATH environment variable to that path. To set the environment variable temporarily you can run a command in the terminal. If you use cmd run set CPATH=<paste path here>, If you use powershell run $env:CPATH = <paste path here>. To chage the environment variable permanently search in the task bar for "Edit Environment Variables" and open it. Once you are there create a new entry named CPATH and set it to the copied path.

After all that, you are done! To compile and the project rust run cargo r.

Linux

The easiest way to get things working on linux is to install nix and direnv, or if you are on nixos, just install direnv.

Installing nix is easy, just follow their instructions. Installing direnv is also easy, follow their guide

Your may have to enable some options to get nix and direnv to work together, but once that is done they are completely set up.

Unfortunately the pros-cli isn't packaged for nixpkgs, which means that you need to install it manually with pip install --user pros-cli. On nixos though, you are unfortunately out of luck, at least for now.

Run direnv allow and then cargo r. And you should be good!

MacOS

This project depends on the Xcode Command Line Tools. Chances are that if you develop on MacOS you have them already, but if not you can install them with xcode-select --install.

Most of the other dependencies can easily be installed with Homebrew.

Install the Arm GNU Toolchain with brew install osx-cross/arm/arm-gcc-bin.

Install pros-cli with brew install purduesigbots/pros/pros-cli.

And you are done! Compile the project with cargo build.

Compiling for WASM

To build projects in this repository for WebAssembly, run cargo build --target wasm32-unknown-unknown -Zbuild-std=std,panic_abort. The extra build-std argument is neccesary because this repository's .cargo/config.toml enables build-std but only for core, alloc, and compiler_builtins. WebAssembly does come with std but there is currently no way to conditionally enable build-std.