Skip to content

Commit

Permalink
instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
ImplFerris committed Oct 20, 2024
1 parent f1d3e02 commit 90da4e3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Binary file added src/images/bootsel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 14 additions & 2 deletions src/running.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
# Running the program
Before we explore further examples, let’s cover the general steps to build and run any program on the Raspberry Pi Pico 2.


## Build and Run for ARM
```sh
# build the program
cargo build --target=thumbv8m.main-none-eabihf
```

To Flash your application onto the Pico 2, press and hold the BOOTSEL button. While holding it, connect the Pico 2 to your computer using a micro USB cable. You can release the button once the USB is plugged in.

<img style="display: block; margin: auto;" alt="bootsel" src="./images/bootsel.png"/>

```sh
# Run the program
cargo run --bin blinky --target=thumbv8m.main-none-eabihf
cargo run --target=thumbv8m.main-none-eabihf
```
**Note:** The example codes include a runner configuration in the `.cargo/config.toml` file, defined as:
`runner = "picotool load -u -v -x -t elf"`. This means that when you execute `cargo run`, it actually invokes the `picotool` with the `load` subcommand to flash the program.


## Build and Run for RISC-V
```sh
# build the program
cargo build --target=riscv32imac-unknown-none-elf
```

Follow the same BOOTSEL steps as described above.
```sh
# Run the program
cargo run --bin blinky --target=riscv32imac-unknown-none-elf
cargo run --target=riscv32imac-unknown-none-elf
```
13 changes: 12 additions & 1 deletion src/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ picotool is a tool for working with RP2040/RP2350 binaries, and interacting with

Here’s a quick summary of the steps I followed:
```sh
# Install dependencies
sudo apt install build-essential pkg-config libusb-1.0-0-dev cmake

mkdir embedded && cd embedded

# Clone the Pico SDK
git clone https://github.com/raspberrypi/pico-sdk
cd pico-sdk
git submodule update --init lib/mbedtls
cd ../

# Set the environment variable for the Pico SDK
PICO_SDK_PATH=/MY_PATH/embedded/pico-sdk

Expand All @@ -21,13 +28,17 @@ git clone https://github.com/raspberrypi/picotool
Build and install Picotool
```sh
cd picotool
cmake ../
mkdir build && cd build
# cmake ../
cmake -DPICO_SDK_PATH=/var/ws/embedded/pico-sdk/ ../
make -j8
sudo make install
```

On Linux you can add udev rules in order to run picotool without sudo:
```sh
cd ../
# In picotool cloned directory
sudo cp udev/99-picotool.rules /etc/udev/rules.d/
```

Expand Down

0 comments on commit 90da4e3

Please sign in to comment.