summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-06-23 12:40:11 +1000
committerDamien George <damien@micropython.org>2025-07-08 11:15:11 +1000
commitec65cac971263975b32ec9fc73db512fdeb21ad7 (patch)
tree358966cad2fe1baff71ca812c58e59d738322f38
parent0faddb3c8a0f44e04577c8f6e46bf0d1e976d2c9 (diff)
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 <damien@micropython.org>
-rw-r--r--ports/zephyr/boards/rpi_pico.conf19
-rw-r--r--ports/zephyr/boards/rpi_pico.overlay48
2 files changed, 67 insertions, 0 deletions
diff --git a/ports/zephyr/boards/rpi_pico.conf b/ports/zephyr/boards/rpi_pico.conf
new file mode 100644
index 000000000..6b31bc9f9
--- /dev/null
+++ b/ports/zephyr/boards/rpi_pico.conf
@@ -0,0 +1,19 @@
+# Disable floating point hardware.
+CONFIG_FPU=n
+
+# Configure serial console over USB CDC ACM.
+CONFIG_USB_DEVICE_STACK_NEXT=y
+CONFIG_USBD_CDC_ACM_CLASS=y
+CONFIG_UART_LINE_CTRL=y
+
+# Disable networking.
+CONFIG_NETWORKING=n
+
+# Hardware features.
+CONFIG_FLASH=y
+CONFIG_FLASH_MAP=y
+CONFIG_I2C=y
+CONFIG_SPI=y
+
+# MicroPython config.
+CONFIG_MICROPY_HEAP_SIZE=196608
diff --git a/ports/zephyr/boards/rpi_pico.overlay b/ports/zephyr/boards/rpi_pico.overlay
new file mode 100644
index 000000000..d63ed73bd
--- /dev/null
+++ b/ports/zephyr/boards/rpi_pico.overlay
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 Damien P. George
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/ {
+ chosen {
+ /* Use USB CDC ACM as the console. */
+ zephyr,console = &cdc_acm_uart0;
+ };
+};
+
+/* Delete defined partitions and make a layout matching the rp2 port RPI_PICO configuration. */
+/delete-node/ &code_partition;
+&flash0 {
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ /* Code slot: 640 KiB - 0x100 placed after second-stage bootloader. */
+ code_partition: partition@100 {
+ label = "code-partition";
+ reg = <0x00000100 (DT_SIZE_K(640) - 0x100)>;
+ read-only;
+ };
+
+ /* Storage slot: 1408 KiB placed after code_partition. */
+ storage_partition: partition@a0000 {
+ label = "storage";
+ reg = <0x000a0000 DT_SIZE_K(1408)>;
+ };
+ };
+};
+
+&zephyr_udc0 {
+ cdc_acm_uart0: cdc_acm_uart0 {
+ compatible = "zephyr,cdc-acm-uart";
+ };
+};
+
+&i2c1 {
+ clock-frequency = <I2C_BITRATE_STANDARD>;
+ status = "okay";
+ pinctrl-0 = <&i2c1_default>;
+ pinctrl-names = "default";
+};