Repository navigation
Read Zephyr and nRF Connect SDK partitions, add region spaces - #11
Merged
Merged
Conversation
`memmap from-partitions` now also reads Zephyr's merged zephyr.dts and nRF Connect SDK Partition Manager files (partitions.yml, pm_static.yml), telling the formats apart by content. - Devicetree: one column per flash with fixed-partitions, addresses mapped through `ranges`, erase-block-size as sectors, fixed-subpartitions nested and zoomed into, and notes for MCUboot's boot partition, slots and scratch. SPI, QSPI and FlexSPI flash is drawn in its own space from 0. - Partition Manager: one column per region, `span` containers nested, and notes for MCUboot, the image header, NSIB, TF-M and the app. - W114: a partition that partly overlaps another or lies outside its flash is left out. A stale `app` in pm_static.yml gives way. - Regions take an optional top-level `space:`. Regions in different spaces may overlap, placement and gap filling run per space, and a `/` column draws only the default space. Checked against the generated headers of real builds: 1395 devicetree builds (7521 entries) and 222 Partition Manager builds (2144 entries), all matching. Five fixtures cover what the readers need; docs/from-partitions.md has the details. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memmap from-partitionsnow also reads Zephyr's mergedzephyr.dtsand nRF Connect SDK Partition Manager files (partitions.yml,pm_static.yml), telling the formats apart by content. It builds on #10.fixed-partitions, with addresses mapped throughrangesthe way Zephyr maps them. This includes 2-cell addresses and flash behind two levels ofranges.erase-block-sizebecomessectors, so partition edges are checked (W100).fixed-subpartitionsare nested and zoomed into.sizeproperty in bits, or fromregon older STM32 QSPI boards..dts, an overlay orzephyr.dts.preis refused, with a hint to pass the build's merged file.spancontainers are nested, even when they hold other containers.mcuboot_pad), the nRF Secure Immutable Bootloader (NSIB) slots, TF-M and the app.pm_static.yml, a staleappentry gives way, since the build placesappitself.space:on top-level regions (core schema change)/column draws only the default space, and gives E020 when every region has a space.describeshows the space.spacerender byte-identically, and every existing golden is unchanged.--sdkconfig,--flash-size,--table-offsetand--bootloader-offsetare refused for the new formats, since nothing in them would use those values.Not done: the MCUboot image header and trailer are not marked for Zephyr builds, because the devicetree does not record them. There are no slot-size rules either, since those depend on the upgrade mode.
Testing
Ground truth:
zephyr.dts+devicetree_generated.hpairs from 311 repos (7,521 entries) all match the header's address and size macros.partitions.yml+pm_config.hpairs from 86 repos (2,144 entries) all match.Corpus: 1,047 real files from 458 repos ran through the importer without a crash, and every warning and error was checked by hand.
space.Committed fixtures: five, each covering something the others don't:
nrf5340_subpartitions: subpartitions mapped byranges;mcxn947_flexspi: two levels ofranges, FlexSPI NOR;stm32_mcuboot_scratch: STM32 base address, MCUboot scratch, QSPI sized byreg;nrf5340_tfm_pm: nested containers, external flash, OTP;apppm_static.yml.Each has a golden config, and two have golden SVGs.
Review: reviewed by a second model. Its findings are fixed and covered by tests.
uv run pytest(809 passed),uv run mypyanduv run ruff checkare clean.Docs:
docs/from-partitions.md, README and AGENTS.md cover the new formats, W114 and thespacerecipe.🤖 Generated with Claude Code