1010
1111# Getting Started
1212
13- ## Blinky on the Raspberry Pi Pico
13+ ## Blinky on the Raspberry Pi Pico and Pico 2
1414
1515This tutorial assumes that you're programming a [Raspberry Pi
1616Pico](https://www.raspberrypi.com/products/raspberry-pi-pico/). This hardware
@@ -20,6 +20,11 @@ it does support other hardware, such as Microchip's `ATSAMD51J19` which was
2020used for the [2024 SYCL](https://sycl.it)
2121[Badge](https://github.com/ZigEmbeddedGroup/sycl-badge/blob/main/docs/introduction/).
2222
23+ If you're using a Raspberry Pi Pico 2 instead, you can follow the same tutorial.
24+ The main change is in your `build.zig`, where the board target should be
25+ `mb.ports.rp2xxx.boards.raspberrypi.pico2_arm` instead of
26+ `mb.ports.rp2xxx.boards.raspberrypi.pico`.
27+
2328## Let's Begin
2429
2530Quickly check that you have Zig `0.15.1` installed by running `zig version`.
@@ -59,6 +64,12 @@ pub fn build(b: *std.Build) void {
5964}
6065```
6166
67+ If you're building for a Pico 2, change the target line to:
68+
69+ ```zig
70+ .target = mb.ports.rp2xxx.boards.raspberrypi.pico2_arm,
71+ ```
72+
6273and for your `src/main.zig`, let's start with a classic blinky program. Yes,
6374most of the main stdlib is available for use on an MCU with Zig:
6475
@@ -104,11 +115,11 @@ zig-out/firmware/blinky.elf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SY
104115
105116## Programming the MCU
106117
107- To activate the UF2 bootloader, power must be applied to the pico while the
108- `BOOTSEL` button is held. This is best done by connecting a button from `RUN`
109- to ground, pressing both buttons, and releasing the `RUN` button first, then
110- `BOOTSEL`. The other option is to plug/unplug the USB cable which is awkward
111- and gets tiresome.
118+ To activate the UF2 bootloader, power must be applied to the Pico or Pico 2
119+ while the `BOOTSEL` button is held. This is best done by connecting a button
120+ from `RUN` to ground, pressing both buttons, and releasing the `RUN` button
121+ first, then `BOOTSEL`. The other option is to plug/unplug the USB cable which
122+ is awkward and gets tiresome.
112123
113124Copy the uf2 file into the mounted drive. Execution should take place immediately.
114125
0 commit comments