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 <yonatan.schachter@gmail.com>
This commit is contained in:
parent
a2aa02dbc8
commit
3266e82055
|
@ -130,6 +130,7 @@
|
|||
/boards/arm/quick_feather/ @kowalewskijan @kgugala
|
||||
/boards/arm/rak4631_nrf52840/ @gpaquet85
|
||||
/boards/arm/rak5010_nrf52840/ @gpaquet85
|
||||
/boards/arm/rpi_pico/ @yonsch
|
||||
/boards/arm/ronoth_lodev/ @NorthernDean
|
||||
/boards/arm/xmc45_relax_kit/ @parthitce
|
||||
/boards/arm/sam4e_xpro/ @nandojve
|
||||
|
|
6
boards/arm/rpi_pico/Kconfig.board
Normal file
6
boards/arm/rpi_pico/Kconfig.board
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Copyright (c) 2021 Yonatan Schachter
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config BOARD_RPI_PICO
|
||||
bool "Raspberry Pi Pico Board"
|
||||
depends on SOC_RP2040
|
12
boards/arm/rpi_pico/Kconfig.defconfig
Normal file
12
boards/arm/rpi_pico/Kconfig.defconfig
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Copyright (c) 2021 Yonatan Schachter
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if BOARD_RPI_PICO
|
||||
|
||||
config BOARD
|
||||
default "rpi_pico"
|
||||
|
||||
config RP2_FLASH_W25Q080
|
||||
default y
|
||||
|
||||
endif # BOARD_RPI_PICO
|
0
boards/arm/rpi_pico/board.cmake
Normal file
0
boards/arm/rpi_pico/board.cmake
Normal file
BIN
boards/arm/rpi_pico/doc/img/rpi_pico.png
Normal file
BIN
boards/arm/rpi_pico/doc/img/rpi_pico.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 136 KiB |
110
boards/arm/rpi_pico/doc/index.rst
Normal file
110
boards/arm/rpi_pico/doc/index.rst
Normal file
|
@ -0,0 +1,110 @@
|
|||
.. _rpi_pico:
|
||||
|
||||
Raspberry Pi Pico
|
||||
#################
|
||||
|
||||
Overview
|
||||
********
|
||||
|
||||
The Raspberry Pi Pico is a small, low-cost, versatile board from
|
||||
Raspberry Pi. It is equipped with an RP2040 SoC, an on-board LED,
|
||||
a USB connector, and an SWD interface. The USB bootloader allows it
|
||||
to be flashed without any adapter, in a drag-and-drop manner.
|
||||
It is also possible to flash and debug the Pico with its SWD interface,
|
||||
using an external adapter.
|
||||
|
||||
Hardware
|
||||
********
|
||||
- Dual core Arm Cortex-M0+ processor running up to 133MHz
|
||||
- 264KB on-chip SRAM
|
||||
- 2MB on-board QSPI flash with XIP capabilities
|
||||
- 26 GPIO pins
|
||||
- 3 Analog inputs
|
||||
- 2 UART peripherals
|
||||
- 2 SPI controllers
|
||||
- 2 I2C controllers
|
||||
- 16 PWM channels
|
||||
- USB 1.1 controller (host/device)
|
||||
- 8 Programmable I/O (PIO) for custom peripherals
|
||||
- On-board LED
|
||||
|
||||
|
||||
.. figure:: img/rpi_pico.png
|
||||
:width: 150px
|
||||
:align: center
|
||||
:alt: Raspberry Pi Pico
|
||||
|
||||
Raspberry Pi Pico (Image courtesy of Raspberry Pi)
|
||||
|
||||
Supported Features
|
||||
==================
|
||||
|
||||
The rpi_pico board configuration supports the following
|
||||
hardware features:
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Peripheral
|
||||
- Kconfig option
|
||||
- Devicetree compatible
|
||||
* - NVIC
|
||||
- N/A
|
||||
- :dtcompatible:`arm,v6m-nvic`
|
||||
* - UART
|
||||
- :kconfig:`CONFIG_SERIAL`
|
||||
- :dtcompatible:`rpi,pico-uart`
|
||||
* - GPIO
|
||||
- :kconfig:`CONFIG_GPIO`
|
||||
- :dtcompatible:`rpi,pico-gpio`
|
||||
|
||||
Programming and Debugging
|
||||
*************************
|
||||
|
||||
Flashing
|
||||
========
|
||||
|
||||
Using an SWD adapter
|
||||
--------------------
|
||||
|
||||
The Raspberry Pi Pico has an SWD interface that can be used to program
|
||||
and debug the on board RP2040. This interface can be utilized by openocd.
|
||||
However, to use it with the RP2040, a custom fork of openocd is needed.
|
||||
This fork can be found here: https://github.com/raspberrypi/openocd
|
||||
|
||||
Depending on the interface used (such as JLink), you might need to
|
||||
checkout to a branch that supports this interface, before proceeding.
|
||||
Build and install openocd as described in the README.
|
||||
|
||||
When openocd is installed, you can flash the board with the following
|
||||
command (assuming JLink is used):
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ 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'
|
||||
|
||||
Debugging
|
||||
=========
|
||||
|
||||
The SWD interface can also be used to debug the board. To achieve this,
|
||||
install openocd as described for flashing the board. Also, install gdb-multiarch.
|
||||
Then run the following command:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/rp2040.cfg -c "adapter speed 2000" -c 'targets rp2040.core0'
|
||||
|
||||
On another terminal, run:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ gdb-multiarch
|
||||
|
||||
Inside gdb, run:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
(gdb) tar ext :3333
|
||||
(gdb) file path/to/zephyr.elf
|
||||
|
||||
You can then start debugging the board.
|
18
boards/arm/rpi_pico/rpi_pico-pinctrl.dtsi
Normal file
18
boards/arm/rpi_pico/rpi_pico-pinctrl.dtsi
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Yonatan Schachter
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <dt-bindings/pinctrl/rpi-pico-rp2040-pinctrl.h>
|
||||
|
||||
&pinctrl {
|
||||
uart0_default: uart0_default {
|
||||
group1 {
|
||||
pinmux = <UART0_TX_P0>;
|
||||
};
|
||||
group2 {
|
||||
pinmux = <UART0_RX_P1>;
|
||||
input-enable;
|
||||
};
|
||||
};
|
||||
};
|
69
boards/arm/rpi_pico/rpi_pico.dts
Normal file
69
boards/arm/rpi_pico/rpi_pico.dts
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Yonatan Schachter
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
#include <rpi_pico/rp2040.dtsi>
|
||||
#include "rpi_pico-pinctrl.dtsi"
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &uart0;
|
||||
zephyr,code-partition = &code_partition;
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
led0: led_0 {
|
||||
gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
|
||||
label = "LED";
|
||||
};
|
||||
};
|
||||
|
||||
aliases {
|
||||
led0 = &led0;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
reg = <0x10000000 DT_SIZE_M(2)>;
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
/* Reserved memory for the second stage bootloader */
|
||||
second_stage_bootloader: partition@0 {
|
||||
label = "second_stage_bootloader";
|
||||
reg = <0x00000000 0x100>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
/*
|
||||
* Usable flash. Starts at 0x100, after the bootloader. The partition
|
||||
* size is 2MB minus the 0x100 bytes taken by the bootloader.
|
||||
*/
|
||||
code_partition: partition@100 {
|
||||
label = "code-partition";
|
||||
reg = <0x100 (DT_SIZE_M(2) - 0x100)>;
|
||||
read-only;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
pinctrl-0 = <&uart0_default>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
status = "okay";
|
||||
};
|
13
boards/arm/rpi_pico/rpi_pico.yaml
Normal file
13
boards/arm/rpi_pico/rpi_pico.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
identifier: rpi_pico
|
||||
name: RaspberryPi-Pico
|
||||
type: mcu
|
||||
arch: arm
|
||||
flash: 2048
|
||||
ram: 264
|
||||
toolchain:
|
||||
- zephyr
|
||||
- gnuarmemb
|
||||
- xtools
|
||||
supported:
|
||||
- uart
|
||||
- gpio
|
8
boards/arm/rpi_pico/rpi_pico_defconfig
Normal file
8
boards/arm/rpi_pico/rpi_pico_defconfig
Normal file
|
@ -0,0 +1,8 @@
|
|||
CONFIG_SOC_SERIES_RP2XXX=y
|
||||
CONFIG_SOC_RP2040=y
|
||||
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_CONSOLE=y
|
||||
CONFIG_UART_CONSOLE=y
|
||||
CONFIG_GPIO=y
|
||||
CONFIG_USE_DT_CODE_PARTITION=y
|
Loading…
Reference in a new issue