Embedded system code for Rivanna 2
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.
- OCI-compliant container runtime (e.g.
docker
,podman
) - ST-LINK driver (open-source (recommended) or official)
- PlatformIO or any other software that can connect to a serial console
- To open an interactive session:
- 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
- With Docker:
- 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.
- Install the Remote - Containers extension.
- Open the Rivanna2 repository.
- Type
Ctrl+Shift+P
and run theRemote-Containers: Open Folder in Container
command. This will open the current folder (Rivanna2) inside of the container. - From there, opening a new terminal will open a shell inside of the container.
./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
.
./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 of the container.)
./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 of the container.)
- The PCB layouts and associated schematics for all boards can be found on the associated repositories on CADLAB.io.
- All boards use the STM32G473CCT3 MCU.
- The instructions on the UVA Solar Car Team Website were used to help set up this project.