|
96 | 96 | "D12", |
97 | 97 | "D13", |
98 | 98 | ], |
| 99 | + "nordic,expansion-board-header": [ |
| 100 | + "P1_04", |
| 101 | + "P1_05", |
| 102 | + "P1_06", |
| 103 | + "P1_07", |
| 104 | + "P1_08", |
| 105 | + "P1_09", |
| 106 | + "P1_10", |
| 107 | + "P1_11", |
| 108 | + "P1_12", |
| 109 | + "P1_13", |
| 110 | + "P1_14", |
| 111 | + ], |
99 | 112 | "arducam,dvp-20pin-connector": [ |
100 | 113 | "SCL", |
101 | 114 | "SDA", |
@@ -544,16 +557,26 @@ def zephyr_dts_to_cp_board(board_id, portdir, builddir, zephyrbuilddir): # noqa |
544 | 557 | all_ioports.append(node.labels[0]) |
545 | 558 | if status == "okay": |
546 | 559 | ioports[node.labels[0]] = set(range(0, ngpios)) |
547 | | - if gpio_map and compatible[0] != "gpio-nexus": |
548 | | - i = 0 |
549 | | - for offset, t, label in gpio_map._markers: |
550 | | - if not label: |
551 | | - continue |
552 | | - num = int.from_bytes(gpio_map.value[offset + 4 : offset + 8], "big") |
553 | | - if (label, num) not in board_names: |
554 | | - board_names[(label, num)] = [] |
555 | | - board_names[(label, num)].append(CONNECTORS[compatible[0]][i]) |
556 | | - i += 1 |
| 560 | + if gpio_map and compatible and compatible[0] != "gpio-nexus": |
| 561 | + connector_pins = CONNECTORS.get(compatible[0], None) |
| 562 | + if connector_pins is None: |
| 563 | + logger.warning(f"Unsupported connector mapping compatible: {compatible[0]}") |
| 564 | + else: |
| 565 | + i = 0 |
| 566 | + for offset, t, label in gpio_map._markers: |
| 567 | + if not label: |
| 568 | + continue |
| 569 | + if i >= len(connector_pins): |
| 570 | + logger.warning( |
| 571 | + f"Connector mapping for {compatible[0]} has more pins than names; " |
| 572 | + f"stopping at {len(connector_pins)}" |
| 573 | + ) |
| 574 | + break |
| 575 | + num = int.from_bytes(gpio_map.value[offset + 4 : offset + 8], "big") |
| 576 | + if (label, num) not in board_names: |
| 577 | + board_names[(label, num)] = [] |
| 578 | + board_names[(label, num)].append(connector_pins[i]) |
| 579 | + i += 1 |
557 | 580 | if "gpio-leds" in compatible: |
558 | 581 | for led in node.nodes: |
559 | 582 | led = node.nodes[led] |
|
0 commit comments