Skip to content

ports/zephyr-cp: add ranges; to the rpi_pico flash partitions - #11234

Merged
tannewt merged 2 commits into
adafruit:mainfrom
MakerClassCZ:zephyr-cp-rpi-pico-ranges
Aug 26, 2026
Merged

ports/zephyr-cp: add ranges; to the rpi_pico flash partitions#11234
tannewt merged 2 commits into
adafruit:mainfrom
MakerClassCZ:zephyr-cp-rpi-pico-ranges

Conversation

@lynt-smitka

Copy link
Copy Markdown

Without ranges; the partition addresses stay flash-relative and never translate to the XIP window:

  • CONFIG_RP2_REQUIRES_SECOND_STAGE_BOOT is not selected (its Kconfig check expects the code partition at 0x10000100), so the image has no second-stage bootloader.
  • The generated UF2 targets 0x00000100 instead of 0x10000000.

Verified: the UF2 first block moves 0x00000100 -> 0x10000000, RP2_REQUIRES_SECOND_STAGE_BOOT=y, and the image boots from UF2 on an RP2040 board.

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.

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! One comment... comment.

Comment thread ports/zephyr-cp/boards/rpi_pico_rp2040.overlay Outdated

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt
tannewt merged commit 9f8b53f into adafruit:main Aug 26, 2026
43 checks passed
tannewt pushed a commit that referenced this pull request Aug 31, 2026
Each of these overlays deletes the partitions node its board DTS declares
and rebuilds it without re-declaring ranges;. Devicetree then leaves the
child addresses untranslated and every partition resolves to a bare offset.

On the two RP2040 boards the code partition lands at 0x100 instead of
0x10000100, so RP2_REQUIRES_SECOND_STAGE_BOOT no longer matches, the second
stage bootloader is not linked in and the UF2 is built for the wrong
address. Same as #11234, which covered rpi_pico_zephyr.

On stm32wba65i_dk1 the partitions resolve to 0x0, 0x10000, 0x108000 and
0x1e0000 rather than 0x08000000 upwards. flash_map computes a mapped
partition's offset as DT_REG_ADDR(partition) - DT_REG_ADDR(memory), so
every flash_area offset on that board underflows.

Each board's own DTS declares ranges; on that node, so this only puts back
what the overlay dropped. Partition offsets and sizes are unchanged.
@lynt-smitka
lynt-smitka deleted the zephyr-cp-rpi-pico-ranges branch September 2, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants