forked from riscvarchive/risc-v-getting-started-guide
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bringup for baremetal application
Signed-off-by: Saket Sinha <[email protected]>
- Loading branch information
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|