aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorLouis <louis@dnge.de>2026-11-11 10:08:41 +0100
committerLouis <louis@dnge.de>2026-11-11 10:08:41 +0100
commit2e433fcd0d1afadd8ab786dd30d7d4546bdee43d (patch)
treef2a5603703d56b08c1eaa672eaf529ec4b2cc3fa /README.md
downloadhw-toolchain-2e433fcd0d1afadd8ab786dd30d7d4546bdee43d.tar.gz
hw-toolchain: placer, routers and KiCad helpers for agent-driven hardware work
Rust placer (simulated annealing) and negotiated-congestion router for 2-layer KiCad boards, pnr.sh to place, route, DRC-check and install candidates, Python KiCad helpers, repo conventions (AGENTS.md) and the tool documentation under knowledge/. Konnect (KiCad MCP, AGPL) as a submodule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'README.md')
-rw-r--r--README.md54
1 files changed, 54 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5705eba
--- /dev/null
+++ b/README.md
@@ -0,0 +1,54 @@
+# hw-toolchain
+
+Tools and conventions for building KiCad boards with an AI agent in the loop. At its core is an automatic **placer and router for 2-layer KiCad boards**, written in Rust:
+
+- **Placer** (`tools/placer`): simulated annealing over footprint positions and rotations. Its cost terms come from hand placement: ratsnest length and crossings, decoupling distance, fan-out bands, groups, links and replicated channels.
+- **Router** (`tools/router-rs`): a 0.05 mm grid router with negotiated congestion (PathFinder), so all nets route at once with no net order. It adds cleanup passes, a pour-connectivity model for the ground plane, escape lines for module interfaces, and a TOML config per board.
+- **pnr.sh**: places 32 candidates, routes all of them, checks the best ones with KiCad's DRC and installs the one you pick.
+
+Around it are KiCad helpers in Python (headless "Update PCB from Schematic", a schematic generator, a placement checker, board composition from routed modules, connector tabs, thermal vias, 3D model checks), an `AGENTS.md` with repo conventions for coding agents, and the notes in `knowledge/` that record how the tools work and what was learned using them.
+
+## Quick start: route your board
+
+Requirements: KiCad 10 (`kicad-cli` and a Python with `pcbnew`) and Rust stable.
+
+``` sh
+git clone https://git.dnge.de/hw-toolchain && cd hw-toolchain
+cargo build --release --manifest-path tools/router-rs/Cargo.toml
+cargo build --release --manifest-path tools/placer/Cargo.toml
+
+# myboard/ holds myboard.kicad_pro/.kicad_sch/.kicad_pcb + placement.toml + route.toml
+sh tools/pnr.sh run path/to/myboard # place 32 ×, route all, DRC the best 6
+sh tools/pnr.sh install path/to/myboard rank_00
+```
+
+The minimal `placement.toml` and `route.toml`, routing an already placed board, and what to do when a board does not route: **[knowledge/tooling/pnr.md](knowledge/tooling/pnr.md)**.
+
+Reference: [Rust router and route.toml](knowledge/tooling/rust-router.md), [Placer and placement.toml](knowledge/tooling/placer.md), [Placement for routing](knowledge/topics/placement-for-routing.md). Everything else: [knowledge/index.md](knowledge/index.md).
+
+The tools are found relative to themselves. The board can live anywhere.
+
+- KiCad paths: macOS is detected; elsewhere, set `KICAD_PYTHON` and `KICAD_CLI` ([tools/kicad_env.sh](tools/kicad_env.sh)).
+- Your own KiCad libraries go in `libraries/` next to `tools/`, or set `HW_ROOT` to the repo that has them ([tools/kicad_paths.py](tools/kicad_paths.py)).
+
+## Use it as the base of your hardware repo
+
+`AGENTS.md` describes a monorepo layout (libraries, modules, projects, knowledge) and the rules an agent follows in it. To keep your boards private and still track this repo:
+
+``` sh
+git submodule add https://git.dnge.de/hw-toolchain toolchain
+ln -s toolchain/tools tools
+mkdir -p knowledge && ln -s ../toolchain/knowledge/tooling knowledge/tooling
+printf 'Read toolchain/AGENTS.md first; it holds the shared conventions.\n\n# My additions\n' > AGENTS.md
+```
+
+## Status
+
+- Used on a dozen real 2-layer boards: industrial I/O modules on DIN rail, ESP32/CH32 + Ethernet, RTD front ends.
+- Two layers only. Differential pairs are routed as single nets (bundles only attract).
+- No thermal-spoke check in the pour model.
+- The DIN-rail tools assume one specific housing format ([knowledge/topics/din-rail-format.md](knowledge/topics/din-rail-format.md)). The rest is general.
+
+## License
+
+MIT, see [LICENSE](LICENSE). The `tools/konnect` submodule ([Konnect](https://github.com/mixelpixx/Konnect), the KiCad MCP server) is a separate project under AGPL-3.0.