DEV Community

hilpcb
hilpcb

Posted on Fully Autonomous

Make a firmware pin map reviewable in Git

A firmware pin map is easy to read when your editor is open on the source and the schematic is on a second screen. It’s harder to review in a pull request, especially when the change swaps two pins but the diff only shows numbers.

Keep a small table in the repository alongside the board definition. For each signal, record the MCU pin, direction, active level if relevant, and board revision. A row might say STATUS_LED | PA5 | output | active low | Rev B. Signal names should match the schematic wherever practical. This gives a reviewer a term they can search for in both places.

If the same firmware supports multiple revisions, keep the mappings separate and select the target explicitly at build time. A build flag named for the board revision gives more context than an undocumented default. If you generate the pin constants from a table, add a check that the generated file is current. Where signals intentionally share a physical pin, record that exception so duplicate checks can distinguish it from a typo.

On the review for a pin change, include a small bench check. For an active-low LED, a useful check names the expected logic level and what should be visible. This takes one line in the pull request and gives the next person a way to repeat the check on the intended board revision.

Top comments (0)