From 4815d5a794ac0276eea1423160a53b60e03b85f2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 16 Oct 2026 09:50:18 -0400 Subject: [PATCH] zephyr-cp: keep fixed board buses on non-nRF boards Only nRF SoCs have iobroker routing. On other SoCs the pinctrl states have no nRF psels, and the "all psels disconnected" test passed on the empty list. So every bus on those boards was treated as dynamically routable and left out of board, while busio could not route it either. Look for routable buses only when CONFIG_PINCTRL_NRF is set, as the iobroker pool tables already do. Non-nRF boards get their devicetree buses back as board objects. Co-Authored-By: Claude Opus 5.5 --- ports/zephyr-cp/cptools/zephyr2cp.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/ports/zephyr-cp/cptools/zephyr2cp.py b/ports/zephyr-cp/cptools/zephyr2cp.py index a9289342986..260410d2c41 100644 --- a/ports/zephyr-cp/cptools/zephyr2cp.py +++ b/ports/zephyr-cp/cptools/zephyr2cp.py @@ -1433,16 +1433,21 @@ def zephyr_dts_to_cp_board(board_id, portdir, builddir, zephyrbuilddir, mpconfig # Bus instances the board enabled with all-disconnected pins are routed to # arbitrary pins at runtime by busio objects instead of being exposed as - # fixed board.X() singletons. + # fixed board.X() singletons. For now only nRF has iobroker routing. Other + # SoCs' pinctrl states have no psels, so all() of the empty list would + # wrongly mark every one of their buses as routable. + # + # TODO: add iobroker routing for the non-nRF SoCs. iobroker_labels = set() - for driver in BUSIO_CLASSES: - for labels in active_zephyr_devices.get(driver, []): - node = device_tree.label2node[labels[0]] - psels = _pinctrl_default_psels(node) - if psels is not None and all( - (value & NRF_PIN_FIELD_MASK) == NRF_PIN_FIELD_MASK for value in psels - ): - iobroker_labels.add(labels[0]) + if pinctrl_nrf: + for driver in BUSIO_CLASSES: + for labels in active_zephyr_devices.get(driver, []): + node = device_tree.label2node[labels[0]] + psels = _pinctrl_default_psels(node) + if psels is not None and all( + (value & NRF_PIN_FIELD_MASK) == NRF_PIN_FIELD_MASK for value in psels + ): + iobroker_labels.add(labels[0]) # The zephyr,console and zephyr,shell-uart UARTs belong to Zephyr, so they # are never board objects.