Rivanna2S

Embedded system code for Rivanna 2S

Development

The recommended approach for development is to use the rivanna2-env container. It contains all of the necessary tools to build the firmware for each board.

Prerequisites

Running the development container

  • To open an interactive session (must be run in WSL if on Windows):
    • With Docker: docker run -it -v $(pwd)/:/root/Rivanna2:Z ghcr.io/solarcaratuva/rivanna2-env
    • With Podman: podman run -it -v .:/root/Rivanna2:Z ghcr.io/solarcaratuva/rivanna2-env
  • Alternatively, you can connect to the container in VSCode, which will allow you to open new shells inside of the container to easily run commands. This will also provide features like code autocomplete and IDE compilation errors.
    1. Install the Remote - Containers extension.
    2. Open the Rivanna2 repository.
    3. Type Ctrl+Shift+P and run the Remote-Containers: Open Folder in Container command. This will open the current folder (Rivanna2) inside of the container.
    4. From there, opening a new terminal will open a shell inside of the container.

Compiling

./compile.sh - This script will run mbed-tools compile with the correct environment and toolchain arguments. This will compile the firmware for all boards. Before running this the first time, run mbed-tools deploy, which will download the version of Mbed OS specified in mbed-os.lib. Must be run inside the development container.

Uploading

./upload_{ecu, motor, power_aux, solar}.sh - This script will check that the correct board is connected and upload the corresponding firmware to the board. (Since the container does not have access to the ST-LINK USB device, this command will have to be run outside the container. Must be run in WSL with the ST-LINK attached to WSL using WSL-USB if on Windows.)

Monitoring

./monitor.sh - This script will run pio device monitor with the correct baud rate. (Since the container does not have access to the ST-LINK USB device, this command will have to be run outside the container. If on windows, copy and paste the command from monitor.sh into powershell and run from there.)

Hardware

Software environment