Skip to content

Getting started

better_erc runs in three places: the berc command line tool, the KiCad fork's schematic editor, and the desktop app. This page installs berc, runs the checks on a KiCad project and sets up readable git diffs.

Installing berc

You need a Rust toolchain, 1.92 or newer, from rustup. Install the command line tool straight from the repository:

cargo install --locked --git https://github.com/romixlab/better_erc berc

From a clone, just install builds and installs both binaries, berc and the desktop app better_erc. Without just, install them by hand:

cargo install --locked --path berc             # the berc command line tool
cargo install --locked --path better_erc_app   # the desktop app (binary better_erc)

berc --version shows the version, the git commit it was built from and that commit's time.

The mx3 part store as a part source (berc parts refresh and berc fp accept without --from) is the cargo feature mx3, off by default: cargo install --locked --path berc --features mx3. It adds an HTTP client (reqwest with rustls); the default build has no network code.

Shell completion: add source <(COMPLETE=bash berc) to ~/.bashrc, source <(COMPLETE=zsh berc) to ~/.zshrc, or COMPLETE=fish berc | source to ~/.config/fish/config.fish.

Checking a KiCad project

Point berc check at a project's directory, its .kicad_pro or its root .kicad_sch:

berc check hw/board                  # findings worst first, the checks that could not run and why
berc explain I2C-3                   # what a check catches, why it matters, how to fix it
berc checks list --project hw/board  # every catalogue check: ran, not run (and why), planned

Each finding names its check, such as I2C-3, and the parts and nets it is about. A check that lacks data, such as a rail voltage, does not guess: the report lists it as not run, with what would enable it. The project file gives that data, sets thresholds and records waivers. Checks in CI covers JSON, SARIF and Markdown output, exit codes and baselines.

From Rust, the same run is erc_checks::check_path (or erc_checks::Project::open and check); see the check engine.

Checking inside KiCad

The KiCad fork links better_erc into eeschema through the better_erc_cxx bridge. Its Electrical Rules Checker runs the better_erc checks beside KiCad's own, on the open sheets including unsaved edits, and lists the drawing style findings in a group of their own. The fork is the vhrd/10.0 branch of romixlab/kicad-source-mirror.

Readable git diffs

berc textconv turns KiCad files into sorted, line-oriented text, so git diff shows changed parts, values, nets and settings instead of raw s-expressions. Set it up once per machine and once per repository:

git config --global diff.kicad.textconv "berc textconv"
printf '*.kicad_sch diff=kicad\n*.kicad_pcb diff=kicad\n*.kicad_pro diff=kicad\n' >> .gitattributes
git diff

Readable git diffs has the details.

The desktop app

Start the app with better_erc once installed, or just run from a clone. It opens any design the importers read, shows its findings with their explanations, and has tabs for nets, I2C buses and footprint review.