This skill should be used when the user asks to "write the firmware for this board", "start the firmware", "firmware for my PCB", "review my firmware", "is the firmware ready to release" or "check the firmware against the board". It builds firmware step by step from the board's pin map, bring-up sketch and host tests first, and reviews the source against the production rules and the board's pins with file and line evidence.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Firmware Build?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gkochievi-firmware-build)
---
name: firmware-build
description: This skill should be used when the user asks to "write the firmware for this board", "start the firmware", "firmware for my PCB", "review my firmware", "is the firmware ready to release" or "check the firmware against the board". It builds firmware step by step from the board's pin map, bring-up sketch and host tests first, and reviews the source against the production rules and the board's pins with file and line evidence.
---
# Firmware: from the board's pins to a reviewed release
This skill is the path; the knowledge is in `embedded-firmware` (toolchains per MCU, project structure, the sixteen production rules, flashing, testing, updates). Load `embedded-firmware` at the start and keep to its rules.
## Building firmware for a board
1. **Collect the inputs.**
- The pin map. A board made by `kicad-generator` has it ready in the `firmware/` folder of its build: `pins.json`, `board_pins.h`, and for the matching families a Kconfig file, a Zephyr overlay and MicroPython constants (written by `kicad-generator/generator/firmware_pins.py`). Use those files as they are: a pin is changed on the board, never in the firmware.
- For any other board, write `config.h` from the schematic or netlist and check boot, strapping and programming pins with `microcontrollers`.
- The exact MCU or module, what every output drives, and what must happen when power drops or the controller stops. An open answer here goes to `hardware-grilling` before any code.
Done when every pin the firmware will touch has a name, a number and a source.
2. **Choose the toolchain** with the table in `embedded-firmware`, and say why.
3. **Write the bring-up sketch first**: boot banner with the version, bus scan, every output toggled, every input printed, analog readings in millivolts. It proves the board before the application hides the faults.
4. **Write the state table and the failure cases** (power loss, bus fault, reset in the middle of an operation, a failed update) and get the user's agreement before the state machine.
5. **Build module by module**, each with its host tests: configuration and shared types, storage, inputs and outputs, power, the state machine, display, network and updates.
6. **Review the source** (next section) and fix every Blocker and Major.
7. **On the hardware**: `bringup-and-test` for the first power-up and the test plan; flashing and debugging as in `embedded-firmware`.
8. **Release**: version constant, dated changelog, the SBOM from `embedded-firmware/scripts/fw_sbom.py`, and a plain statement of what was tested: host tests only, built with the real toolchain, or run on hardware.
## Reviewing firmware
1. Run `scripts/fw_review.py <firmware folder> --pins <pins.json of the board>`. Without a pin file it still checks the rules below and duplicate pins.
2. Open every finding at its file and line and decide: a defect, or a false alarm with a reason. A false alarm gets a `fw-review: ignore <rule>` comment with that reason in the source.
3. Read for what a text check cannot see, rule by rule from `embedded-firmware`: outputs held off through reset and boot, nothing switching on by itself after a reset or a failed update, fail-safe polarity, bus recovery and a fault state, integer money and counters, debounced inputs, validation of everything received, and what was locked on production parts.
4. Report by severity with the evidence line, the same way `board-review` does, and say what was not checked: nothing was built, nothing was run.
What the script checks:
| Area | Finding |
|---|---|
| Pin map | a pin with another number than on the board (Blocker), a GPIO the board does not connect, two names on one GPIO, a board signal the firmware never uses |
| Watchdog | none set up, or one switched off; the reset cause never read |
| Power | brown-out detection switched off |
| Timing | a timer compared with a stored time instead of a difference (fails at the counter wrap); long blocking delays |
| Interrupts | delay, printing, allocation or a bus call inside a handler |
| Start-up | waiting for the serial port without a time limit |
| Secrets | a password, key or token in the source, a private key block; values are never printed in the report |
| Updates | an update server without a password, an update fetched over plain http, no rollback or "image is valid" step |
| Storage, release | settings stored with no CRC anywhere, no version constant, no tests |
The checks read text. A finding is a place to look, and a clean report is not a proof.
## Next step
When this is done, say what comes next: `bringup-and-test` on the real board; after a release, `hardware-retro` when something went wrong on the way.