BareMetal Application
This example provides a minimal bare metal demo app that demonstrates how to easily create a bare metal C application and load it/run it on the riscv soc from RaspberryPi RP2350.
Here, we will focus on a printing simple string over serial console for simplicity and clarity.
Setting up the environment
Please remember to set up pico-sdk and picotool alongwith and riscv toolchain first. The sdk and tools for rp2350 are installed in ~/.pico-sdk/ with VSCode Plugin. It can also be installed with prebuilt binaries present at pico-sdk-tools. To use the tools and sdk installed to another location set the following :
export PICO_SDK_PATH=~/example_sdk/sdk/2.0.0/
export PICO_TOOLCHAIN_PATH=~/example_sdk/toolchain/13_2_Rel1
export picotool_DIR=~/example_sdk/picotool/2.0.0/picotool
Getting the sources
Clone the baremetal application repository.
git clone https://github.com/disdi/bare-metal-riscv
cd bare-metal-riscv
Building the baremetal application
Execute the below commands:
make PICO_BOARD=sparkfun_promicro_rp2350 PICO_SDK_PATH=~/.pico-sdk/ build
make flash
Note
The resulting binaries (print.uf2
) will be written in the build
folder. Transfer this binary file to the Pico board with a micro USB cable and holding down the BOOTSEL button.
Running the baremetal application
To run baremetal application, connect a bi-directional logic level converter set at 3.3V between development machine and Pico with TX, RX and GND.
RISC-V from RPI should be seen on ttyUSB serial terminal.