> ## Documentation Index
> Fetch the complete documentation index at: https://docs.embedder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Benches

> Set up a lab machine as a bench with one command, then flash, read serial output, and debug boards on it from your own sessions.

A bench is a machine with your boards, probes and instruments attached. Set it up once with `embedder bench start`. Your sessions on other computers can then flash, read serial output and debug through it, and it can take [GitHub and Slack jobs](https://docs.embedder.com/headless/bench-jobs.md).

## Prepare the machine

The bench machine runs macOS, Linux or Windows. On it:

1. [Install Embedder](https://docs.embedder.com/cli/overview.md#install).

2. Connect the board, the debug probe and any instruments.

3. Install the device drivers, and make sure your account can open the USB serial ports and probes. On Linux, add your account to the `dialout` and `plugdev` groups, and check that your probes' udev rules allow it.

4. Install the flashing tools your board needs, such as probe-rs or OpenOCD:

   | Machine | probe-rs | OpenOCD |
   | - | - | - |
   | macOS | `brew install probe-rs-tools` | `brew install openocd` |
   | Linux | `cargo install probe-rs-tools` | `sudo apt-get install -y openocd` |

   On macOS, run `brew` as your normal user, not with `sudo`. On Windows, install probe-rs with `winget install probe-rs.probe-rs`.

5. To let the bench take jobs, clone the firmware repositories you want it to work on.

## Set up a bench

On the bench machine, open a terminal in a repository folder, or in the folder that holds your checkouts, and run:

```bash theme={"theme":"css-variables"}
embedder bench start
```

The command signs you in, checks the machine, installs the bench service, adds the bench to your account, and opens the bench's **Connect work** page. `embedder bench setup` is the same command.

**1. Sign in**

If you aren't signed in, the command shows a one-time code and opens the sign-in page in your browser. Check that the code there matches, then approve.

Over SSH, or on a machine without a display, nothing opens on the bench. The command prints a link and a code instead: open the link on your laptop or phone and enter the code.

**2. Answer the questions**

The command names the bench after the machine. To pick another name, run it with `--name lab-mac`.

It then asks **Who can use** the bench. Use the arrow keys and `Enter` to choose:

| Choice | Effect |
| - | - |
| **Only me** | The default. Only you can use the bench and send it jobs. |
| **Team** followed by a team name | Everyone on that team can use it fully: flash, debug, read and write files, and run any program or shell command on the machine. Their GitHub and Slack requests can run on it too. |
| **Decide later on the web page** | The bench stays personal until you share it. |

It may also ask:

* **Copy** a folder **so jobs can read it?** On macOS, jobs can't read toolchains under **Documents**, **Desktop** or **Downloads**. Choose **Yes** to copy the folder to `~/.embedder/readable/`.
* **Take jobs on this bench for every repo** your team **connects?** This appears when the folder has no GitHub checkouts.

The command asks only when it runs in an interactive terminal. Otherwise, it uses the defaults.

**3. Check the results**

Under **This machine**, the command lists what it found:

| Row | Shows |
| - | - |
| **Board** | Each serial port that looks like a board, such as `CP2102 USB to UART Bridge Controller on /dev/cu.usbserial-0001`. |
| **Flashers** | The flashing tools on `PATH`, such as probe-rs, OpenOCD, esptool.py, nrfjprog, JLinkExe or west. |
| **Toolchains** | Toolchain folders jobs can read. |
| **Network** | Whether the machine reaches Embedder. |
| **Proxy** | The proxy the service uses, if any. |
| **Repos** | GitHub checkouts in the current folder, its direct subfolders and any `--repo-dir` folder. |

Under **Setting up**, each step ends with a check and how long it took. When the bench comes online, the command reports whether requests can reach it:

```text theme={"theme":"css-variables"}
✓ Ready: GitHub requests for acme/firmware reach lab-mac
  Who can use it: only you

Review it at https://app.embedder.com/benches/<bench-id>/connect (opened in your browser)
```

A line that starts with **◐ Partial** or **◐ Offline** says what's left to do. Finish it on the **Connect work** page, which the command opens in your browser. Over SSH, open the link it prints on your laptop or phone.

The bench service starts at login and keeps running after you close the terminal. Keep the machine powered, online, signed in and connected to the board.

| Machine | The service runs as |
| - | - |
| macOS | A login item for your account. |
| Linux | A systemd user service. If Embedder can't keep it running after you sign out, the command says so. |
| Windows | A scheduled task named **Embedder Service** that starts when you sign in. |

If the folder has GitHub checkouts, the bench takes jobs for those repositories, one at a time. See [Run jobs on a bench](https://docs.embedder.com/headless/bench-jobs.md) to change this.

### Run the command again

Running `embedder bench start` again on the same machine is safe. It keeps the bench's name, sharing and job settings, asks no questions, checks the machine, and restarts the service if needed. Run it whenever the bench is offline or a check fails.

To diagnose the machine without changing anything, run:

```bash theme={"theme":"css-variables"}
embedder bench doctor
```

It checks the service, your Embedder account, the network, the board, serial access, flashing tools, toolchains and the Python runtime for instruments. It prints a fix for each check that fails.

### Options

| Option | Effect |
| - | - |
| `--name <name>` | Name the bench. The default is the machine's name. |
| `--personal` | Only you can use it. This is the default. |
| `--team <name>` | Share it with a team. |
| `--decide-later` | Keep it personal for now, and choose who can use it on the web page. |
| `--repo-dir <folder>` | Also look for GitHub checkouts in this folder. Repeat it for more folders. |
| `--jobs` | Take jobs without asking. Add `--repos acme/firmware,acme/bootloader` or `--repos all`, and `--max-jobs <n>`. |
| `--copy-readable`, `--no-copy-readable` | On macOS, copy toolchain folders out of **Documents**, **Desktop** and **Downloads**, or leave them, without asking. |
| `--no-open` | Don't open the browser at the end. |
| `--now` | Restart a running service without waiting for running work to finish. |

## Check a bench on the web

In [the Embedder app](https://app.embedder.com), choose **Benches** in the sidebar and select the bench's name. Its page shows:

* Who can use it, **Only you** or **Shared with the team**, and whether it's **Online, seen just now** or **Offline** with when it was last seen.
* **Takes jobs**, with how many jobs it runs at once. See [Run jobs on a bench](https://docs.embedder.com/headless/bench-jobs.md).
* The bench's checks. Failing checks are listed first, marked **Broken** or **Warning**. When checks are more than a day old, the page asks you to run them again.
* **Recent requests**, with where each was asked and how it ended.

To get fresh results, choose **Run checks**. The page shows when the bench picks the request up, then **Results are in**.

Choose **Send a test request** to check the bench end to end. The bench clones a repository it takes jobs for and reads the board's serial port for 5 seconds. Nothing is flashed. The result shows each step, such as **Read 5 lines from /dev/cu.usbserial-0001** with the output.

Choose **Connect work** to open the bench's **Connect work** page. It walks you through what GitHub and Slack requests need. See [Connect work to a bench](https://docs.embedder.com/headless/bench-jobs.md#connect-work-to-a-bench).

## Choose who can use a bench

A bench you set up is personal until you share it. Sharing a bench with a team gives every member full access, including running any program on the machine. With jobs on, their GitHub and Slack requests can also run on it.

```bash theme={"theme":"css-variables"}
embedder bench share lab-mac --team "Firmware Team"
embedder bench unshare lab-mac
```

`unshare` makes the bench personal again. Add `--team <name>` to take it out of one team only. Teammates' running jobs stop within 30 seconds.

On the **Benches** page, the bench's row also lists the teams that can use it. Choose **+** to give a team access, or **×** beside a team to remove it.

## Use a bench in a session

Choose where a session runs before you start it:

* **In VS Code**, select the environment button at the top of the chat. It shows **Local** until you pick a bench. Under **Where should this run?**, choose the bench under **Benches**. Embedder starts a new chat on it.
* **In the terminal UI**, run `/env`, then choose the bench under **BENCHES**.

Your code stays on your computer. Flashing, serial and debugging run on the bench. Sessions on **Local** use the boards attached to your own computer.

In the terminal UI, `/bridge` opens the **Benches** manager. To select a bench for the current chat directly, run `/bridge <name>`, for example `/bridge lab-mac`.

Bench serial ports start with `bridge:`. Confirm the ports and target before you ask Embedder to flash:

```text theme={"theme":"css-variables"}
Use the lab-mac bench. Identify its attached target and serial port, then run
the project's boot check without changing firmware.
```

Benches you set up, and benches shared with your team, appear in the picker on their own. To use a teammate's personal bench, ask them to [share it with your team](#choose-who-can-use-a-bench).

### Add a bench with a code

A bench that isn't in anyone's account yet can be added from your computer with a code. On the bench machine, run:

```bash theme={"theme":"css-variables"}
embedder bench code
```

It prints a code that lasts 15 minutes and a complete `embedder bench add` line with the bench's fingerprint. If the bench already belongs to a team, it prints the command to check it instead. On your computer, run the line it printed:

```bash theme={"theme":"css-variables"}
embedder bench add K7QP-2M4X --name lab-mac --fp 3f9a1c2e7b04d5a8
```

The command asks who can use the bench, then checks the connection and the serial ports. In VS Code, you can choose **+ Add a bench…** in the picker and enter the **Code**, **Name** and **Fingerprint** instead.

## Work through a bench

| Task | How it works | Guide |
| - | - | - |
| Flash firmware | Embedder uploads your built artifact and programs it with probe-rs or OpenOCD on the bench. | [Flash through a bench](https://docs.embedder.com/debug-mode/flashing.md#flash-through-a-bridge), [probe-rs](https://docs.embedder.com/debug-mode/probe-rs.md) |
| Read serial output | Use the bench's `bridge:` ports like local ports. | [UART](https://docs.embedder.com/debug-mode/uart.md) |
| Capture RTT | Embedder takes a time-limited capture, only after it has flashed that firmware through the bench in the same session. | [RTT through a bench](https://docs.embedder.com/debug-mode/rtt.md#use-rtt-through-a-bridge) |
| Capture logic signals | A DSLogic analyzer on the bench records the capture, and Embedder copies it back to your project. | [DSLogic on a bench](https://docs.embedder.com/debug-mode/dslogic.md#use-an-analyzer-on-a-bridge-host) |

To run a command on the bench machine, such as listing probes, use `embedder bench exec`:

```bash theme={"theme":"css-variables"}
embedder bench exec lab-mac probe-rs list
```

To see who is using the bench's hardware right now, run `embedder bench watch lab-mac`. On the bench machine, `embedder bench queue` lists who holds and who waits for each probe or board.

## Describe the boards on a bench

Embedder chooses how to flash from the boards described in `~/.embedder/bench/hardware.toml` on the bench machine. Describe a board when Embedder can't detect the target, or when you flash with OpenOCD. After Embedder flashes a target that isn't described yet, it saves that target to the file.

The bench reads the file each time Embedder checks its hardware, so you don't need to restart it. Add a `[[board]]` table for each board:

```toml theme={"theme":"css-variables"}
[[board]]
name = "nucleo-f446"
debugInterface = "st-link"
openocdTarget = "stm32f4x"
```

| Key | What it does |
| - | - |
| `name` | Required. The board's label, shown when Embedder reports what it flashed. |
| `mcu` | The chip name probe-rs uses, such as `nRF52832_xxAA`. When it's set, Embedder flashes with probe-rs. |
| `debugInterface` | `st-link`, `jlink` or `cmsis-dap`. Needed with `openocdTarget` for OpenOCD. |
| `openocdTarget` | The OpenOCD target configuration, without the folder or `.cfg`, such as `stm32f4x`. Embedder flashes with OpenOCD only when `mcu` isn't set. |
| `flashBase` | The flash address in hex, such as `0x08000000`, for programming a raw `.bin` image with OpenOCD. |
| `adapterSerial` | The probe for probe-rs to use when several are attached, as `VID:PID:Serial`. |

* When the file describes several boards, Embedder asks for the chip name and flashes with probe-rs. To flash with OpenOCD, describe only that board in the file.
* Use the exact key names and values above. Embedder skips a board with an invalid value, such as `stlink` instead of `st-link` or a `flashBase` without `0x`.
* Boards that Embedder saves can include other keys, such as `serialPort`. Leave them as they are.

## Check a bench from your computer

```bash theme={"theme":"css-variables"}
embedder bench list
embedder bench verify lab-mac
```

`list` shows your benches, whether each is online, and who can use it. `verify` checks a bench end to end: the connection, serial ports, flashing tools, GDB server and file transfer. Leave the name out when you have one bench online. Resolve missing tools or device permissions on the bench machine, then run `embedder bench doctor` there.

## Stop or remove a bench

| To | Do this |
| - | - |
| Restart the bench service | On the bench machine, run `embedder service restart`. Running work finishes first, for up to 30 minutes. Add `--now` to restart at once. |
| Stop it until the next sign-in | On the bench machine, run `embedder service stop`. This stops running work. |
| Stop it starting at sign-in | On the bench machine, run `embedder service uninstall`. |
| Read the service log | On the bench machine, run `embedder service logs`, or `embedder service logs -f` to follow it. |
| Remove the bench for everyone | Run `embedder bench remove lab-mac` and confirm. You need to be its owner, or an admin of a team it's shared with or of the organization. |
| Revoke it on the web | On the **Benches** page, choose the trash control on the bench's row and confirm **Revoke**. To delete a revoked bench from the list, choose it again and confirm **Remove**. |

To add a removed bench again, run `embedder bench reclaim --confirm` on the bench machine, then `embedder bench start`.

## Troubleshoot

* **Benches isn't in the sidebar, or `embedder bench start` says benches aren't available:** ask your Embedder administrator.
* **Sign-in waits:** approve the request in the browser where the code was shown. Over SSH, open the printed link on another device and enter the code.
* **◐ Offline, or No word from the bench service in 60 s:** check that the machine can reach Embedder, then run `embedder bench start` again. Read the log with `embedder service logs`.
* **Board shows no serial ports found:** check the USB cable, target power, drivers and device permissions, then run `embedder bench doctor`.
* **Flashers shows none on PATH:** install probe-rs or OpenOCD as described in [Prepare the machine](#prepare-the-machine), then run `embedder bench start` again.
* **Toolchains says a folder stays unreadable to jobs:** on macOS, run `embedder bench start --copy-readable` to copy it out of the protected folder.
* **Old bridge service:** `embedder bench doctor` found a bridge service from an older Embedder. Remove it, because it conflicts with the bench.
* **On Linux, the service runs only while you're signed in:** Embedder couldn't keep your user services running after sign-out. Ask the machine's administrator to enable lingering for your account.
* **Embedder finds no target, or ignores a board:** check the entries in the [board file](#describe-the-boards-on-a-bench) for misspelled keys or invalid values, or give Embedder the chip name.
* **A command is rejected:** the machine may limit which programs the bench can run. Ask the machine's administrator.

See [CLI reference](https://docs.embedder.com/headless/cli-reference.md#bench-commands) for every bench command and option.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.