Establish the hardware facts
- Open the firmware workspace and run
/projectto select the project. - Run
/peripheraland add the fitted part. For a part outside the catalog, add a custom peripheral from its datasheet PDF. - Provide the exact datasheet revision, relevant errata, the MCU reference manual, and the complete schematic set for this board. To add a PDF that is already in your workspace to the project’s documents, ask Embedder. It asks you to confirm before adding the file.
- If the workspace isn’t configured yet, run
/init. Check the toolchain, SDK version, build and test commands, flash method, and monitoring setup it records inEMBEDDER.md.
U4 and the source path with your own. Resolve any conflict that affects wiring, electrical limits, or initialization before you continue.
Define the driver contract
Run/plan to agree on the driver’s interface and limits before Embedder changes several modules. In Plan mode, Embedder reads code, documents, and schematics and writes a plan. It doesn’t edit your source or run a build.
Retry only operations that the device lets you repeat safely. Repeating a command, clearing a status bit, or reading a FIFO can change the device’s state.
Choose reuse or a custom implementation
Ask Embedder to inspect the existing SDK, HAL, and drivers before it adds code. Prefer an existing driver when it supports the exact device and the behavior you need. Check its version, license, supported modes, and error handling. A similarly named part may use a different register map. For a custom driver, separate device behavior from bus access so host tests can supply controlled responses. Keep board pins, bus instances, and interrupt routing in the project’s board layer. Respect generated-code boundaries and the project’s existing style. Check the reference documents for the details that differ between parts:- MCU peripherals: clock enables, reset order, pin multiplexing, interrupt flags, and DMA requirements, from the reference manual and errata.
- External devices: framing, byte order, command sequences, reserved bits, and read or write side effects, from the datasheet.
Implement and test in stages
Review the plan, then approve it so Embedder implements it in Act mode. In VS Code, select Approve & Execute on the plan card. Start with initialization and one bounded transaction before you add buffered, interrupt, or DMA operation.Validate on the intended board
Confirm the board revision, fitted part, firmware file, and probe or port. Set up the UART, logic analyzer, or oscilloscope from its guide, including voltage limits and channel assignments./debug. Keep the existing evidence, and follow the attachment precautions before you connect a debugger. Halting changes timing, so reproduce timing-sensitive results while the firmware runs normally.
Keep the regression repeatable
Ask Embedder to save the verified sequence as a hardware script under.embedder/hardware/, with the bench settings, bounded waits, pass conditions, and cleanup. Hardware scripts run in Act or Debug mode.