This repo hosts the firmware used by the rp2040 powered PCB for the OIST smartphone robot project.
- Download the most recent firmware release robot.uf2
- Take a small screwdriver and flip the External/Phone USB switch toward External USB Side (See image below)
- Use the screwdriver to push and hold the BOOTSEL Button
- Attach a USB cable between the external USB port and your PC.
- Release the BOOTSEL Button. You should now see the board appear as an external USB device.
- Drag and drop robot.uf2 to this external USB device. The device will automatically restart and disconnect from your PC. The new firmware should now be running.
- Return the External/Phone USB switch to Phone USB Side.
The above wiring diagram assumes you have the debugprobe firmware running on your Raspberry Pi Pico. See here for documenation on how to do this.
The recommended way to build, flash, and debug the firmware is by using the provided Docker image and Makefile. All dependencies are managed via Docker for a reproducible and easy workflow.
First, pull the Docker image:
docker pull topher217/smartphone-robot-firmware:latest
Build the firmware using the Makefile (from the firmware
directory):
make firmware
Flash the firmware to the device:
make flash
Debugging is a two-step process:
-
Start OpenOCD in one terminal:
make openocd
This will start OpenOCD in a Docker container and show its output. Leave this terminal open.
-
Start GDB in a second terminal:
make debug
This will connect GDB to the running OpenOCD server in the same container.
- To stop OpenOCD, simply press
Ctrl+C
in the terminal where you ranmake openocd
. - If you ever need to forcibly clean up the debug container (e.g., after an unexpected exit), run:
make docker-clean
To open an interactive shell in the Docker environment:
make shell
The firmware source is in the src/
directory. Header files are in include/
.
After making changes, rebuild the firmware using:
make firmware
If you need to update or change the Docker image, run the following command from the docker
directory:
cd docker && docker build -t topher217/smartphone-robot-firmware:latest .
All Docker files are located in the docker/
directory.