Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions website/content/docs/getting-started.smd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# Getting Started

## Blinky on the Raspberry Pi Pico
## Blinky on the Raspberry Pi Pico and Pico 2

This tutorial assumes that you're programming a [Raspberry Pi
Pico](https://www.raspberrypi.com/products/raspberry-pi-pico/). This hardware
Expand All @@ -20,6 +20,11 @@ it does support other hardware, such as Microchip's `ATSAMD51J19` which was
used for the [2024 SYCL](https://sycl.it)
[Badge](https://github.com/ZigEmbeddedGroup/sycl-badge/blob/main/docs/introduction/).

If you're using a Raspberry Pi Pico 2 instead, you can follow the same tutorial.
The main change is in your `build.zig`, where the board target should be
`mb.ports.rp2xxx.boards.raspberrypi.pico2_arm` instead of
`mb.ports.rp2xxx.boards.raspberrypi.pico`.

## Let's Begin

Quickly check that you have Zig `0.15.1` installed by running `zig version`.
Expand Down Expand Up @@ -59,6 +64,12 @@ pub fn build(b: *std.Build) void {
}
```

If you're building for a Pico 2, change the target line to:

```zig
.target = mb.ports.rp2xxx.boards.raspberrypi.pico2_arm,
```

and for your `src/main.zig`, let's start with a classic blinky program. Yes,
most of the main stdlib is available for use on an MCU with Zig:

Expand Down Expand Up @@ -104,11 +115,11 @@ zig-out/firmware/blinky.elf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SY

## Programming the MCU

To activate the UF2 bootloader, power must be applied to the pico while the
`BOOTSEL` button is held. This is best done by connecting a button from `RUN`
to ground, pressing both buttons, and releasing the `RUN` button first, then
`BOOTSEL`. The other option is to plug/unplug the USB cable which is awkward
and gets tiresome.
To activate the UF2 bootloader, power must be applied to the Pico or Pico 2
while the `BOOTSEL` button is held. This is best done by connecting a button
from `RUN` to ground, pressing both buttons, and releasing the `RUN` button
first, then `BOOTSEL`. The other option is to plug/unplug the USB cable which
is awkward and gets tiresome.

Copy the uf2 file into the mounted drive. Execution should take place immediately.

Expand Down
Loading