Skip to content

Commit

Permalink
Add bringup for baremetal application
Browse files Browse the repository at this point in the history
Signed-off-by: Saket Sinha <[email protected]>
  • Loading branch information
disdi committed Sep 10, 2024
1 parent 80ed246 commit 10c4f78
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
47 changes: 47 additions & 0 deletions source/baremetal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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 <https://raspberrypi.com/products/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 <https://github.com/raspberrypi/pico-vscode/>`_.
It can also be installed with prebuilt binaries present at `pico-sdk-tools <https://github.com/raspberrypi/pico-sdk-tools/releases/tag/v2.0.0-2>`_.
To use the tools and sdk installed to another location set the following :

.. literalinclude:: scripts/baremetal.sh
:start-after: # set up env
:end-before: # /set up env

Getting the sources
-------------------

Clone the baremetal application repository.

.. literalinclude:: scripts/baremetal.sh
:start-after: # clone
:end-before: # /clone

Building the baremetal application
----------------------------------

Execute the below commands:

.. literalinclude:: scripts/baremetal.sh
:start-after: # build
:end-before: # /build

.. 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.

6 changes: 6 additions & 0 deletions source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

introduction

.. toctree::
:caption: BareMetal
:maxdepth: 1

baremetal

.. toctree::
:caption: Zephyr
:maxdepth: 2
Expand Down
27 changes: 27 additions & 0 deletions source/scripts/baremetal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -e

# get prerequisites
wget https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/pico-sdk-tools-2.0.0-x86_64-lin.tar.gz
wget https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-x86_64-lin.tar.gz
wget https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/picotool-2.0.0-x86_64-lin.tar.gz
# /get prerequisites

# set up env
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
# /set up env

# clone
git clone https://github.com/disdi/bare-metal-riscv
cd bare-metal-riscv
# /clone

# build
make PICO_BOARD=sparkfun_promicro_rp2350 PICO_SDK_PATH=~/.pico-sdk/ build
make flash
# /build


0 comments on commit 10c4f78

Please sign in to comment.