Repository navigation
ci(mg24): drop dead-fork PR override, apply repo v1.27.0 patches for USER_C_MODULES - #38
Conversation
…USER_C_MODULES Same dead-fork failure as PR Seeed-Studio#37 (upstream PR #18030 closed unmerged, source fork deleted -> 'upload-pack: not our ref'), but unlike nRF54L15/nRF52840 this board genuinely uses USER_C_MODULES (src/cmodules/modadc + modrtc), so the override cannot simply be deleted. The repo's shared 0001-zephyr-xiao-nrf54lm20b-runtime.patch already carries PR #18030's entire one-file diff (include py/usermod.cmake + MICROPY_SOURCE_USERMOD + MICROPY_INC_USERMOD in ports/zephyr), and py/usermod.cmake at v1.27.0 appends /micropython.cmake to directory entries, so the existing -DUSER_C_MODULES="dir;dir" keeps working unchanged. Also drops the 'sed 4096 -> 4096 * 2' hack on main.c: v1.27.0 moved flash storage to zephyr_storage.c which reads erase_block_size from the devicetree (4096 is only the fallback). Cross-impact of running the shared patch script on this job was checked: the BT advertiser-option shim is version-guarded (#ifdef), and xiao_nrf54lm20b_imu_power.c is CONFIG_BOARD-guarded (compiles to an empty translation unit on xiao_mg24). Zephyr v4.2.0, board overlays and the USER_C_MODULES list are unchanged. Ref Seeed-Studio#28 Co-Authored-By: Claude <noreply@anthropic.com>
Environment change notes (pre-merge summary)What this board was building on before (the "old environment"): The workflow overrode the git reset --hard origin/master
gh pr checkout 18030 # upstream micropython PR, "zephyr: supports adding external user modules"
sed -i '116s/4096)/4096 * 2)/' ./main.c
What it builds on now: The repo-wide pin — Test status / caveat: ✅ CI compiles green (artifacts:
|
Per-board MicroPython smoke tests in example/ (matching the existing per-board test scripts like xiao_stm32c5_full_test.py), run over the board REPL after flashing the CI firmware artifact. Both were executed against the v1.27.0 master builds on real hardware (2026-09-29): xiao_nrf54l15 6/6 PASS, xiao_mg24 7/7 PASS. Findings from the hardware run that are encoded in the tests: - mg24: the user C modules (PR #38, USER_C_MODULES) register with uppercase names -- MP_REGISTER_MODULE(MP_QSTR_ADC, ...) etc, so the importable modules are ADC / RTC / CAN / PDM / LowPWR, and the callable classes live inside (ADC.ADC, RTC.RTC), consistent with example/boards/xiao.py and every shipped example. An early draft of this test did `import adc` / `import rtc` and reported ImportError; that was a test bug, not a firmware bug. The test now also exercises ADC.ADC(("adc0", ch)).read_uv() across channels and an RTC.RTC() datetime round-trip. - nrf54l15: gc threshold lowered 50K -> 32K. The zephyr port default CONFIG_MICROPY_HEAP_SIZE is 49152, leaving 48000 usable bytes after GC bookkeeping (measured: free+alloc == 48000 exactly), so a >50K assertion can never pass on the default build. - Script headers document how to run: both boards expose the REPL via the onboard debug bridge CDC port (mpremote required for raw-paste flow control); the MCU USB peripheral is not wired to the USB-C connector, so no other USB serial device is expected. The LED check is visual. RA4M1 smoke test follows in a separate PR once its hardware run is done. Co-Authored-By: Claude <noreply@anthropic.com>
Problem (ref #28)
Same dead-fork failure as #37: the workflow overrode
lib/micropythonwithgit reset --hard origin/master+gh pr checkout 18030, and upstream micropython PR #18030 was closed unmerged with its source fork since deleted →upload-pack: not our ref, CI red.But unlike nRF54L15/nRF52840 in #37, this board genuinely uses the feature: it passes
-DUSER_C_MODULES=src/cmodules/modadc;src/cmodules/modrtc, so the override can't just be deleted.Fix
Build at the repo-wide pin (v1.27.0 submodule) and run
tools/apply_micropython_patches.sh. The repo's shared0001-zephyr-xiao-nrf54lm20b-runtime.patchalready carries PR #18030's entire one-file diff:And
py/usermod.cmakeat v1.27.0 appends/micropython.cmaketo directory entries (IS_DIRECTORYbranch), so the existing-DUSER_C_MODULES="dir;dir"keeps working unchanged — our cmodules are already in native format (add_library INTERFACE+target_link_libraries(usermod ...)).Also drops the
sed '116s/4096)/4096 * 2)/'hack: v1.27.0 moved flash storage tozephyr_storage.c, which readserase_block_sizefrom the devicetree (4096 is only theDT_PROP_ORfallback) — the hardcoded doubling is superseded.Cross-impact of the shared patch set on this job (checked)
#ifdef(new/old Zephyr names) → fine on Zephyr v4.2.0xiao_nrf54lm20b_imu_power.cadded to zephyr port sources:#if defined(CONFIG_BOARD_XIAO_NRF54LM20B_...)guard → empty translation unit on xiao_mg24Scope
./tools/apply_micropython_patches.shxiao_mg24board, overlays/conf,USER_C_MODULESlist🤖 Generated with Claude Code