Skip to content

Commit ec65cac

Browse files
committed
zephyr/boards/rpi_pico: Add board configuration for rpi_pico.
Although the rpi_pico can already build and run with the zephyr port, this configuration improves it in a number of ways: - Use the USB CDC ACM as the REPL, rather than just a UART. - Enable I2C and SPI, and add I2C1. - Enable a filesystem, which matches exactly the rp2 port's RPI_PICO configuration. So switching between zephyr and rp2 is possible and will retain the filesystem. - Make the MicroPython GC heap make the most use of the available RAM. Signed-off-by: Damien George <[email protected]>
1 parent 0faddb3 commit ec65cac

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

ports/zephyr/boards/rpi_pico.conf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Disable floating point hardware.
2+
CONFIG_FPU=n
3+
4+
# Configure serial console over USB CDC ACM.
5+
CONFIG_USB_DEVICE_STACK_NEXT=y
6+
CONFIG_USBD_CDC_ACM_CLASS=y
7+
CONFIG_UART_LINE_CTRL=y
8+
9+
# Disable networking.
10+
CONFIG_NETWORKING=n
11+
12+
# Hardware features.
13+
CONFIG_FLASH=y
14+
CONFIG_FLASH_MAP=y
15+
CONFIG_I2C=y
16+
CONFIG_SPI=y
17+
18+
# MicroPython config.
19+
CONFIG_MICROPY_HEAP_SIZE=196608

ports/zephyr/boards/rpi_pico.overlay

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2025 Damien P. George
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
/* Use USB CDC ACM as the console. */
10+
zephyr,console = &cdc_acm_uart0;
11+
};
12+
};
13+
14+
/* Delete defined partitions and make a layout matching the rp2 port RPI_PICO configuration. */
15+
/delete-node/ &code_partition;
16+
&flash0 {
17+
partitions {
18+
compatible = "fixed-partitions";
19+
#address-cells = <1>;
20+
#size-cells = <1>;
21+
22+
/* Code slot: 640 KiB - 0x100 placed after second-stage bootloader. */
23+
code_partition: partition@100 {
24+
label = "code-partition";
25+
reg = <0x00000100 (DT_SIZE_K(640) - 0x100)>;
26+
read-only;
27+
};
28+
29+
/* Storage slot: 1408 KiB placed after code_partition. */
30+
storage_partition: partition@a0000 {
31+
label = "storage";
32+
reg = <0x000a0000 DT_SIZE_K(1408)>;
33+
};
34+
};
35+
};
36+
37+
&zephyr_udc0 {
38+
cdc_acm_uart0: cdc_acm_uart0 {
39+
compatible = "zephyr,cdc-acm-uart";
40+
};
41+
};
42+
43+
&i2c1 {
44+
clock-frequency = <I2C_BITRATE_STANDARD>;
45+
status = "okay";
46+
pinctrl-0 = <&i2c1_default>;
47+
pinctrl-names = "default";
48+
};

0 commit comments

Comments
 (0)