- Clone repository
- Install rust
- With rustup (https://www.rust-lang.org/tools/install)
- Install the rust ARM toolchain
$ rustup target add arm-unknown-linux-gnueabi
- Install RoboRIO toolchain
- From https://github.com/wpilibsuite/roborio-toolchain/releases
- Unzip and copy the
roborio/
folder to./toolchain/
(copy the roborio folder itself, not the contents inside)
- Install clang (required by bindgen)
- Follow https://rust-lang.github.io/rust-bindgen/requirements.html
- For Mac, install homebrew if you haven't already (https://brew.sh/)
- Follow https://rust-lang.github.io/rust-bindgen/requirements.html
- Install wpilib/vendor dependencies
- Run the
install_deps.py
script$ cd frc-sys && ./install_deps.py
- Run the
- Compile 2021 swerve robot test package
$ cargo build -p r2021-swerve --release
- Code editor
- Recommended: VSCode + rust-analyzer extention
- Alternative: IntelliJ Ultimate/CLion + rust extension
βββ frc - package containing friendly wrappers around frc-sys
βββ frc-sys - package containing generated rust bindings to frc libraries
β βββ include - frc headers installed with install_deps.py
β βββ lib - frc libraries installed with install_deps.py
β βββ src - frc autogenerated bindings
β βββ vendordeps - frc dependency JSON files
β βββ wrappers - frc C headers to generate rust bindings from
βββ r2021-swerve - 2021 swerve robot (mainly for testing)
βββ toolchain - roborio toolchain
Reference: https://github.com/frc1678/robot-code-public/blob/master/docs/gdb.md
- Debug server on robot
- ssh into robot
- Kill autostarting code
$ . /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t 2> /dev/null
- Run gdbserver
$ gdbserver localhost:2345 ./frcUserProgram
- Run gdb on computer
- Install gdb (Mac)
toolchain/roborio/bin/arm-frc2021-linux-gnueabi-gdb
works but crashes randomly a lot- Install with homebrew
- Use the solution here https://stackoverflow.com/questions/54541783/installing-gdb-with-all-targets-on-mac-with-homebrew to install ARM target as well
- Run gdb
$ gdb target/arm-unknown-linux-gnueabi/debug/rswerve
- Setup remote
target remote roborio-846-frc.local:2345
set sysroot remote:/
- Start robot code
continue
- Setup remote
- Install gdb (Mac)