Skip to content

Commit 7d1d764

Browse files
committed
boards: Added support for the Raspberry Pi Pico board
Added support for Raspberry Pi's Pico board, using the RP2040 SoC. Signed-off-by: Yonatan Schachter <[email protected]>
1 parent 5d49e53 commit 7d1d764

File tree

10 files changed

+237
-0
lines changed

10 files changed

+237
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
/boards/arm/quick_feather/ @kowalewskijan @kgugala
131131
/boards/arm/rak4631_nrf52840/ @gpaquet85
132132
/boards/arm/rak5010_nrf52840/ @gpaquet85
133+
/boards/arm/rpi_pico/ @yonsch
133134
/boards/arm/ronoth_lodev/ @NorthernDean
134135
/boards/arm/xmc45_relax_kit/ @parthitce
135136
/boards/arm/sam4e_xpro/ @nandojve

boards/arm/rpi_pico/Kconfig.board

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2021 Yonatan Schachter
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_RPI_PICO
5+
bool "Raspberry Pi Pico Board"
6+
depends on SOC_RP2040
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2021 Yonatan Schachter
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if BOARD_RPI_PICO
5+
6+
config BOARD
7+
default "rpi_pico"
8+
9+
config RP2_FLASH_W25Q080
10+
default y
11+
12+
endif # BOARD_RPI_PICO

boards/arm/rpi_pico/board.cmake

Whitespace-only changes.
136 KB
Loading

boards/arm/rpi_pico/doc/index.rst

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
.. _rpi_pico:
2+
3+
Raspberry Pi Pico
4+
#################
5+
6+
Overview
7+
********
8+
9+
The Raspberry Pi Pico is a small, low-cost, versatile board from
10+
Raspberry Pi. It is equipped with an RP2040 SoC, an on-board LED,
11+
a USB connector, and an SWD interface. The USB bootloader allows it
12+
to be flashed without any adapter, in a drag-and-drop manner.
13+
It is also possible to flash and debug the Pico with its SWD interface,
14+
using an external adapter.
15+
16+
Hardware
17+
********
18+
- Dual core Arm Cortex-M0+ processor running up to 133MHz
19+
- 264KB on-chip SRAM
20+
- 2MB on-board QSPI flash with XIP capabilities
21+
- 26 GPIO pins
22+
- 3 Analog inputs
23+
- 2 UART peripherals
24+
- 2 SPI controllers
25+
- 2 I2C controllers
26+
- 16 PWM channels
27+
- USB 1.1 controller (host/device)
28+
- 8 Programmable I/O (PIO) for custom peripherals
29+
- On-board LED
30+
31+
32+
.. figure:: img/rpi_pico.png
33+
:width: 150px
34+
:align: center
35+
:alt: Raspberry Pi Pico
36+
37+
Raspberry Pi Pico (Image courtesy of Raspberry Pi)
38+
39+
Supported Features
40+
==================
41+
42+
The rpi_pico board configuration supports the following
43+
hardware features:
44+
45+
.. list-table::
46+
:header-rows: 1
47+
48+
* - Peripheral
49+
- Kconfig option
50+
- Devicetree compatible
51+
* - NVIC
52+
- N/A
53+
- :dtcompatible:`arm,v6m-nvic`
54+
* - UART
55+
- :kconfig:`CONFIG_SERIAL`
56+
- :dtcompatible:`rpi,pico-uart`
57+
* - GPIO
58+
- :kconfig:`CONFIG_GPIO`
59+
- :dtcompatible:`rpi,pico-gpio`
60+
61+
Programming and Debugging
62+
*************************
63+
64+
Flashing
65+
========
66+
67+
Using an SWD adapter
68+
--------------------
69+
70+
The Raspberry Pi Pico has an SWD interface that can be used to program
71+
and debug the on board RP2040. This interface can be utilized by openocd.
72+
However, to use it with the RP2040, a custom fork of openocd is needed.
73+
This fork can be found here: https://github.com/raspberrypi/openocd
74+
75+
Depending on the interface used (such as JLink), you might need to
76+
checkout to a branch that supports this interface, before proceeding.
77+
Build and install openocd as described in the README.
78+
79+
When openocd is installed, you can flash the board with the following
80+
command (assuming JLink is used):
81+
82+
.. code-block:: console
83+
84+
$ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/rp2040.cfg -c "adapter speed 2000" -c 'targets rp2040.core0' -c 'program path/to/zephyr.elf verify reset exit'
85+
86+
Debugging
87+
=========
88+
89+
The SWD interface can also be used to debug the board. To achieve this,
90+
install openocd as described for flashing the board. Also, install gdb-multiarch.
91+
Then run the following command:
92+
93+
.. code-block:: console
94+
95+
$ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/rp2040.cfg -c "adapter speed 2000" -c 'targets rp2040.core0'
96+
97+
On another terminal, run:
98+
99+
.. code-block:: console
100+
101+
$ gdb-multiarch
102+
103+
Inside gdb, run:
104+
105+
.. code-block:: console
106+
107+
(gdb) tar ext :3333
108+
(gdb) file path/to/zephyr.elf
109+
110+
You can then start debugging the board.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2021, Yonatan Schachter
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <dt-bindings/pinctrl/rpi-pico-rp2040-pinctrl.h>
7+
8+
&pinctrl {
9+
uart0_default: uart0_default {
10+
group1 {
11+
pinmux = <UART0_TX_P0>;
12+
};
13+
group2 {
14+
pinmux = <UART0_RX_P1>;
15+
input-enable;
16+
};
17+
};
18+
};

boards/arm/rpi_pico/rpi_pico.dts

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (c) 2021 Yonatan Schachter
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <rpi_pico/rp2040.dtsi>
10+
#include "rpi_pico-pinctrl.dtsi"
11+
12+
/ {
13+
chosen {
14+
zephyr,sram = &sram0;
15+
zephyr,flash = &flash0;
16+
zephyr,console = &uart0;
17+
zephyr,code-partition = &code_partition;
18+
};
19+
20+
leds {
21+
compatible = "gpio-leds";
22+
led0: led_0 {
23+
gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
24+
label = "LED";
25+
};
26+
};
27+
28+
aliases {
29+
led0 = &led0;
30+
};
31+
};
32+
33+
&flash0 {
34+
reg = <0x10000000 DT_SIZE_M(2)>;
35+
36+
partitions {
37+
compatible = "fixed-partitions";
38+
#address-cells = <1>;
39+
#size-cells = <1>;
40+
41+
/* Reserved memory for the second stage bootloader */
42+
second_stage_bootloader: partition@0 {
43+
label = "second_stage_bootloader";
44+
reg = <0x00000000 0x100>;
45+
read-only;
46+
};
47+
48+
/*
49+
* Usable flash. Starts at 0x100, after the bootloader. The partition
50+
* size is 2MB minus the 0x100 bytes taken by the bootloader.
51+
*/
52+
code_partition: partition@100 {
53+
label = "code-partition";
54+
reg = <0x100 (DT_SIZE_M(2) - 0x100)>;
55+
read-only;
56+
};
57+
};
58+
};
59+
60+
&uart0 {
61+
current-speed = <115200>;
62+
status = "okay";
63+
pinctrl-0 = <&uart0_default>;
64+
pinctrl-names = "default";
65+
};
66+
67+
&gpio0 {
68+
status = "okay";
69+
};

boards/arm/rpi_pico/rpi_pico.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
identifier: rpi_pico
2+
name: RaspberryPi-Pico
3+
type: mcu
4+
arch: arm
5+
flash: 2048
6+
ram: 264
7+
toolchain:
8+
- zephyr
9+
- gnuarmemb
10+
- xtools
11+
supported:
12+
- uart
13+
- gpio
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CONFIG_SOC_SERIES_RP2XXX=y
2+
CONFIG_SOC_RP2040=y
3+
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000
4+
CONFIG_SERIAL=y
5+
CONFIG_CONSOLE=y
6+
CONFIG_UART_CONSOLE=y
7+
CONFIG_GPIO=y
8+
CONFIG_USE_DT_CODE_PARTITION=y

0 commit comments

Comments
 (0)