Software setup

To run the template project provided on gitlab, you need to install the following:

We expect you to use Linux for this course. It is not inherently impossible to run the software on Windows or OSX, but it has not been tested, and we will provide no support. If you're new to Linux, we highly recommend Fedora Linux to get started.

You might find that many online resources will recommend Ubuntu to get started, but especially for Rust development this may prove to be a pain. If you install Rust through the installer, it will work, but if you installed rust through apt it might not. Fedora is also quite an easy introduction to Linux, but will likely provide a better experience.

The rust nightly compiler

  • We recommend you update using rustup update to get the newest version of the rust compiler, even if you already had a version of the rust compiler installed.
  • If you don't have rust installed, INSTALL RUSTUP FIRST. Follow these instructions: https://www.rust-lang.org/tools/install
  • If you use either Ubuntu or Debian, the version of rust that came with your operating system might be very old (check using the command shown above). Download a new version of rust using rustup, using the installation instructions on https://www.rust-lang.org/tools/install
  • Specifically install the nightly version of rust by running rustup toolchain add nightly

The cross-compiler for ARM architectures

  • This is actually very simple to install, use rustup target add thumbv6m-none-eabi.
  • If you followed Software Systems before, you should've done something similar for the Embedded Systems assignment but with thumbv7m-none-eabi as a target instead.
  • You can check if you have this target installed with rustup target list

Cargo-binutils.

  • You can install this with cargo install cargo-binutils
  • If you have issues with this tool, you can try running rustup update and then rustup component add llvm-tools-preview
  • Make sure that the binaries of cargo-binutils are in your path. If you're not sure, look if your PATH (run echo $PATH) contains /home/yourname/.cargo/bin

Using the template

You can upload code to your drone controller board, simply by running cargo run in the root folder of your project. The runner will automatically find the correct serial port to use. We do recommend you carefully read the README.md of your template, and the comments in the source code of the template. Especially the comments in the main.rs file of the runner folder.

We recommend you to use the template provided to you, as well as the tudelft-quadrupel library. However, we are almost certain it won't suit everyone's needs. Although you are required to write your code in Rust, you are allowed to either ignore the library code we provide you and create your own, or modify it to suit your needs.

You can find the template source code and library source code on Gitlab, as well as our upload script

If you'd like to modify the library, it might be good to know how you can easily use a modified version of the library in your project.

In your Cargo.toml you can specify dependencies like this:

tudelft-quadrupel = "1.0"

But you can replace this with:

# note that this doesn't work very nicely in group projects, 
# since everyone needs the library at this path for it to work
tudelft-quadrupel = {path="../some/other/path/on/your/system"}

However, you can still also specify a version as a fallback for other people in a group:

tudelft-quadrupel = {version="1.0.0", path="../some/other/path/on/your/system"}

Lastly, you can specify a git dependency which might be preferable:

tudelft-quadrupel = {
  git="git+https://gitlab.ewi.tudelft.nl/cese/embedded-systems-lab/tudelft-quadrupel.git", 
  branch="some-branch"
}

The repository can of course be your own, as long as it's publicly available

Uploading to the board

To upload to the board, you might need to be in the dialout (or uucp, depending on your system) group on linux to have permission to use the serial port. You will see that the /dev/ttyUSB0 file is owned by a group that you need to be in to access it (ls -la /dev/ttyUSB0). You can check whether you have the required group by running the groups command.

It is possible that the owning group of the file does not actually exist, in that case you need to create it. To do so, refer to this archwiki page

It is also possible to set up udev rules for this.

To upload code to the board, you can just run cargo run --release as mentioned above. However, before every upload the chip should be reset. Usually, this works by pressing the small button on the board (which temporarily cuts power to it) or by flipping the switch off and on. You can also unplug and replug the board to your pc to accomplish this (in a few rare cases this might even be necessary, trying a different USB port might help in that case as well. However, this shouldn't happen often). After that you can run the cargo run --release and the upload should work.

In general: press the button on the board before every upload!