Refactor microcontroller dev boards to use composition#508
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors microcontroller dev-board wrapper implementations (ESP32 + iCE40) toward the newer composition-based wrapper APIs, adds pin filtering to prevent wrapped models from allocating non-existent pins, and updates/removes examples accordingly.
Changes:
- Add
PinMapUtil.filter_pins(...)and broaden pin assignment parsing to support pin names (not only pin numbers) for wrapper remapping. - Refactor iCE40UP and ESP32-family wrapper/device models to use the newer wrapper composition style and pin filtering.
- Update example netlist reference outputs and remove the RobotOwl example artifacts/tests.
Reviewed changes
Copilot reviewed 58 out of 59 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
edg/abstract_parts/PinMappable.py |
Adds pin filtering support and pinname-aware matching in pin mapping utilities. |
edg/parts/microcontroller/Ice40up.py |
Refactors iCE40UP device/wrapper structure to the newer wrapper style and updates pin/peripheral resources. |
edg/abstract_parts/IoController.py |
Refactors IO export/wrap plumbing to better support transforms and wrapper composition. |
edg/parts/microcontroller/test_mcu_wrapper.py |
Updates microcontroller wrapper tests (now targeting ESP32-C3 wrapper flow). |
edg/abstract_parts/test_pinmappable.py |
Extends unit tests for pin mapping/allocation behaviors with the new filtering functionality. |
examples/test_fcml.py |
Updates the FPGA instantiation to the refactored iCE40UP API. |
examples/test_deskcontroller.py |
Updates refinements to match refactored MCU wrapper parameter structure. |
examples/UsbSourceMeasure/UsbSourceMeasure.net.ref |
Refreshes golden netlist output to match refactored wrapper/program header mapping. |
examples/SevenSegment/SevenSegment.net.ref |
Refreshes golden netlist output to match refactored wrapper/program header mapping. |
examples/test_robotowl.py |
Removes the RobotOwl example test (example deleted/out of support scope). |
examples/RobotOwl/RobotOwl.kicad_pro |
Removes RobotOwl KiCad project artifact as part of example deletion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+345
to
+358
| elif isinstance(resource, PeripheralFixedPin): | ||
| filtered_keys = [] | ||
| for key, pin in resource.inner_allowed_pins.items(): | ||
| if pin in allowed_pins or resource.inner_pinnames[key] in allowed_pins: | ||
| filtered_keys.append(key) | ||
| if filtered_keys: | ||
| return PeripheralFixedPin( | ||
| resource.name, | ||
| resource.port_model, | ||
| {k: v for k, v in resource.inner_allowed_pins.items() if k in filtered_keys}, | ||
| {k: v for k, v in resource.inner_pinnames.items() if k in filtered_keys}, | ||
| ) | ||
| else: | ||
| return None |
Comment on lines
214
to
217
| # hard macros I2C and SPI | ||
| PeripheralAnyResource("I2C1", i2c_model), | ||
| PeripheralAnyResource("I2C1", i2c_model), | ||
| PeripheralAnyResource("SPI1", spi_model), |
ducky64
added a commit
that referenced
this pull request
Jun 1, 2026
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.
Refactors the ESP32 and iCE40 microcontroller devices to use the new wrapper APIs microcontroller style from #502, #497
Deprecates BaseIoControllerExportable, now that all usages have been refactored out.
Add pin filtering to PinMapUtil and implement it in device models. This is needed to restrict automatic allocation in wrapped microcontroller models, otherwise they allocate pins that don't exist on the modules. Add pin filtering to all wrappers.
Allow pin names as part of pin_assign specifications; this is needed by wrapper remapping if the pin name and GPIO name don't line up.
Fix the ground connection style of wrappers to account for when ground is unneeded in power source mode.
Other refactorings:
Resolves #389