Conversation
cumin777
force-pushed
the
refactor/retire-a6-module-patch
branch
from
September 20, 2026 09:10
1686607 to
21a84d3
Compare
Contributor
Author
|
This PR has been verified. It is recommended to wait for the version management to be implemented before merging. |
… platformio-build.py patch _patch_platformio_extra_modules monkey-patched the framework package's scripts/platformio/platformio-build.py to append platform-provisioned modules (_pio/modules) to the ZEPHYR_MODULES CMake variable. The patch was needle-based and not reliably idempotent: a stale floating-URL platform install re-inserted its block on every build (14 duplicate copies found on a real machine), and marker drift on a framework package update would silently drop the module instead -- showing up as '1200-bps DFU touch stopped working'. Replace it with Zephyr's own out-of-tree module mechanism: set the ZEPHYR_EXTRA_MODULES environment variable, which Zephyr's CMake reads through zephyr_get()'s ENV scope (cmake/modules/extensions.cmake). _register_xiao_modules_via_env() collects the framework-cache modules (xiao_dfu_reset, sdk-edge-ai, edge-impulse-sdk-zephyr) plus the XIAO_EDGE_AI_DIR / XIAO_EDGE_IMPULSE_DIR developer overrides and registers them after all provisioning. The dead PIO_NCS_MODULES SCons variable is removed with it. Existing installs keep previously injected blocks in their cached platformio-build.py; those are harmless (dedup-guarded) and simply no longer maintained. Known limitation (accepted): ZEPHYR_EXTRA_MODULES is transient. Zephyr's MERGE-mode zephyr_get() never writes the ENV value into CMakeCache.txt, so a cmake/ninja reconfigure started outside a PlatformIO-driven process (fresh shell, IDE CMake integration) silently drops these modules, where the retired -DZEPHYR_MODULES= injection persisted in the cache. Builds driven by 'pio run' always inherit the variable and are unaffected; after editing CMake files, re-run 'pio run'. Documented in _register_xiao_modules_via_env()'s docstring. Also add docs/zephyr-patch-inventory.md (was untracked): A6 marked retired with no upstream destination, zephyr.py line references re-anchored after the deletion, totals adjusted (A 6->5, total 17->16, upstreamable ~11->~10). Validation (local platform tree, framework-zephyr 4.4.0): - 20B zephyr-blink: CONFIG_XIAO_DFU_RESET=y, xiao_dfu_reset symbols in firmware.elf (incl. __init_xiao_dfu_init) - 20B edgeai-classification: CONFIG_NRF_EDGEAI=y, Axon/EdgeAI symbols in firmware.elf -- sdk-edge-ai registered through the env var only - stm32c5 zephyr-blink: cannectivity/uf2_dfu_reset/xiao_dfu_reset all present in build.ninja via the env mechanisms - installed platformio-build.py stayed unpatched across all builds Co-Authored-By: Claude <noreply@anthropic.com>
cumin777
force-pushed
the
refactor/retire-a6-module-patch
branch
from
September 21, 2026 09:06
21a84d3 to
5f11a38
Compare
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
Retire the
_patch_platformio_extra_modulesmonkey-patch (inventory item A6) and replace it with Zephyr's own out-of-tree module mechanism.Why: the patch edited the framework package's
scripts/platformio/platformio-build.py(needle-based) to append platform-provisioned modules toZEPHYR_MODULES. It was not reliably idempotent — a stale floating-URL platform install re-inserted its block on every build (14 duplicate copies found on a real machine), and marker drift on a framework package update would silently drop the module, surfacing as "1200-bps DFU touch stopped working".What:
_register_xiao_modules_via_env(): collects_pio/modulescache modules (xiao_dfu_reset,sdk-edge-ai,edge-impulse-sdk-zephyr) plusXIAO_EDGE_AI_DIR/XIAO_EDGE_IMPULSE_DIRdeveloper overrides, and registers them via theZEPHYR_EXTRA_MODULESenv var — which Zephyr's CMake reads throughzephyr_get()'s ENV scope (cmake/modules/extensions.cmake). Called after all provisioning.PIO_NCS_MODULESSCons variable removed.platformio-build.pyfor module discovery.Existing installs keep previously injected blocks in their cached
platformio-build.py— harmless (dedup-guarded), simply no longer maintained.Validation (local platform tree, framework-zephyr 4.4.0)
zephyr-blinkCONFIG_XIAO_DFU_RESET=y;xiao_dfu_resetsymbols infirmware.elfincl.__init_xiao_dfu_initedgeai-classificationCONFIG_NRF_EDGEAI=y; 118 Axon/EdgeAI symbols infirmware.elf— sdk-edge-ai registered through the env var onlyseeed-xiao-stm32c5zephyr-blinkbuild.ninjavia the env mechanismsplatformio-build.pystayed unpatched across all three buildsnRF54L15 has no example set and uses no XIAO modules (its Kconfig gates on the 20B board symbol), so it is unaffected by construction.
🤖 Generated with Claude Code