The Pico Explorer Base is an expansion board for the Raspberry Pi Pico board developed by the Raspberry Pi Foundation based on the RP2040 chip.
First, follow the Tock Getting Started guide
The Raspberry Pi Pico can be programmed via an SWD connection, which requires the Pico to be connected to a regular Raspberry Pi device that exposes the necessary pins. The kernel is transferred to the Raspberry Pi Pico using a custom version of OpenOCD.
To install OpenOCD on the Raspberry Pi run the following commands on the Pi:
$ sudo apt-get update
$ sudo apt install automake autoconf build-essential texinfo libtool libftdi-dev libusb-1.0-0-dev git
$ git clone https://github.com/raspberrypi/openocd.git --recursive --branch rp2040 --depth=1
$ cd openocd
$ ./bootstrap
$ ./configure --enable-ftdi --enable-sysfsgpio --enable-bcm2835gpio
$ make -j4
$ sudo make install
$ cd ~
Enable SSH on the Raspberry Pi by following the instructions on the Raspberry Pi website.
Next, connect the SWD pins of the Pico (the tree lower wires) to GND, GPIO 24, and GPIO 25 of the Raspberry Pi. You can follow the schematic in the official documentation and connect the blue, black, and purple wires.
Also connect the other three wires as shown in the schematic, which will connect the Pico UART to the Raspberry Pi. This will enable the serial communication between the two devices.
cd
into boards/raspberry_pi_pico
directory and run:
$ make
(or)
$ make debug
Connect via ssh to the Raspberry Pi and forward port 3333. Then start OpenOCD on the Pi.
$ ssh pi@<pi_IP> -L 3333:localhost:3333
(wait to connect)
$ openocd -f interface/raspberrypi-swd.cfg -f target/rp2040.cfg
You can also open a serial console on the Raspberry Pi for debug messages.
$ sudo apt install minicom
$ minicom -b 115200 -o -D /dev/serial0
On the local computer use gdb-multiarch on Linux or arm-none-eabi-gdb on MacOS to deploy tock.
$ arm-none-eabi-gdb tock/target/thumbv6m-none-eabi/release/raspberry_pi_pico.elf
(gdb) target remote :3333
(gdb) load
(gdb) continue
Apps are built out-of-tree. Once an app is built, you can add the path to it in the Makefile (APP variable), then run:
$ make program
This will generate a new ELF file that can be deployed on the Raspberry Pi Pico via gdb and OpenOCD as described in the section above.