From 1dac7b3808b6b493cb5b6009b18794de8ed4c4f4 Mon Sep 17 00:00:00 2001 From: Vladimir Smitka Date: Sun, 23 Aug 2026 18:42:44 +0000 Subject: [PATCH] ports/zephyr-cp: add `ranges;` to the rpi_pico flash partitions The overlay redefines &flash0's partitions with flash-relative addresses but without ranges;, so they never translate to the XIP window. Two consequences: CONFIG_RP2_REQUIRES_SECOND_STAGE_BOOT is not selected (its Kconfig tests for a code partition at 0x10000100), so the image ships without a second-stage bootloader; and the generated UF2 targets 0x00000100 instead of 0x10000000. The RP2040 boot ROM will not run the result. Presumably unnoticed because CI and developers flash over SWD, where the ELF loads fine. boards/adafruit/metro_rp2350 upstream in Zephyr uses this exact pattern. Built raspberrypi_rpi_pico_zephyr before and after: the UF2 first block address moves from 0x00000100 to 0x10000000 and RP2_REQUIRES_SECOND_STAGE_BOOT=y gets selected. An RP2040 image built this way boots from UF2 on a PicoPad. --- ports/zephyr-cp/boards/rpi_pico_rp2040.overlay | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/zephyr-cp/boards/rpi_pico_rp2040.overlay b/ports/zephyr-cp/boards/rpi_pico_rp2040.overlay index 1cdd4ca2033..283debbe939 100644 --- a/ports/zephyr-cp/boards/rpi_pico_rp2040.overlay +++ b/ports/zephyr-cp/boards/rpi_pico_rp2040.overlay @@ -2,6 +2,13 @@ /delete-node/ partitions; partitions { + /* + * Without `ranges;` the addresses below stay flash-relative: the code partition resolves + * to 0x100 instead of 0x10000100, so RP2_REQUIRES_SECOND_STAGE_BOOT is not selected (its + * Kconfig tests for 0x10000100) and the image ships without a second-stage bootloader, + * while the generated UF2 targets 0x00000100. Neither is loadable by the RP2040 boot ROM. + */ + ranges; #address-cells = <1>; #size-cells = <1>;