Trezor Bench
Trezor Bench is a VS Code extension for building and debugging Trezor firmware. It is intended for developers working in the trezor-firmware repository and brings its cargo-based build workflow into VS Code.
Choose the active build context — model, target, component, preset — in a dedicated view, and the rest follows it:
- xtask integration — build options and workflows in the UI instead of on the command line
- run
build, clippy, check, and clean as VS Code tasks
- flash or upload the resulting artifacts to a device
- IntelliSense — C/C++ IntelliSense (cpptools or clangd) driven by the compile database of the active context, plus automatic Rust Analyzer configuration for the selected build configuration
- Debugging — start a debug session for the active context without writing a
launch.json
The extension is intended for use with the new cargo-based build system. It does not support the legacy SCons-based firmware build scripts used in older repository layouts.

How to Install
Install Trezor Bench from the Visual Studio Marketplace to receive automatic updates.
Alternatively, download the latest .vsix package from the release page. Then, in VS Code, open the Command Palette, run Extensions: Install from VSIX..., and select the extension package file.
Enable this extension only in the trezor-firmware repository, and disable it in other workspaces.
Before starting VS Code, enter the trezor-firmware development shell from the repository root and launch VS Code from that shell so it inherits the environment:
- run
nix-shell for the standard development environment
- run
nix-shell --arg devTools true if you also want tools such as openocd for ST-Link debugging
The extension doesn't require most of these VS Code settings, but they are recommended for a smoother experience with the new build system. The repository does not include a shared .vscode/settings.json, so it is worth creating one locally and adapting it to your environment. The following example is a good starting point:
{
"git.detectSubmodulesLimit": 20,
"git.detectSubmodules": true,
"python.useEnvironmentsExtension": false,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.terminal.activateEnvironment": true,
"terminal.integrated.env.linux": {
"VIRTUAL_ENV": "${workspaceFolder}/.venv",
"PATH": "${workspaceFolder}/.venv/bin:${env:PATH}",
},
"terminal.integrated.env.osx": {
"VIRTUAL_ENV": "${workspaceFolder}/.venv",
"PATH": "${workspaceFolder}/.venv/bin:${env:PATH}",
},
"rust-analyzer.linkedProjects": [
"${workspaceFolder}/core/embed/Cargo.toml",
],
"rust-analyzer.cargo.targetDir": true,
"rust-analyzer.checkOnSave": true,
"rust-analyzer.cargo.extraEnv": {
"IS_RUST_ANALYZER": "true",
"VIRTUAL_ENV": "${workspaceFolder}/.venv",
"PYTHONPATH": "${workspaceFolder}/.venv/lib/python3.14/site-packages",
"SCM_REVISION": "0000000000000000000000000000000000000000",
},
"C_Cpp.default.configurationProvider": "cepetr.tbench",
"rust-analyzer.cachePriming.enable": false,
"rust-analyzer.lru.capacity": 64,
"editor.inlayHints.enabled": "off",
"npm.autoDetect": "off",
"js/ts.tsc.autoDetect": "off",
"files.watcherExclude": {
"core/build-xtask/**": true,
"core/build/**": true,
"tests/ui_tests/reporting/master_cache/**": true,
"tests/ui_tests/screens/**": true,
"**/.git/**": true,
},
}
IS_RUST_ANALYZER instructs build.rs scripts to minimize their work, including skipping C code compilation, so Rust Analyzer can run quickly and avoid failures when all features are enabled.
SCM_REVISION is set by xtask during regular builds, but Rust Analyzer runs without xtask, so it does not receive this value automatically. The example above supplies a placeholder revision through rust-analyzer.cargo.extraEnv for analysis.
Do not specify the following settings in settings.json. Trezor Bench automatically passes them to Rust Analyzer based on the selected build configuration:
rust-analyzer.cargo.features
rust-analyzer.cargo.target
rust-analyzer.cargo.allTargets
rust-analyzer.check.extraArgs
Values explicitly defined in settings.json take precedence over those supplied by the extension, preventing automatic configuration from working as intended.
How To Use
Open the Trezor Bench activity-bar container and use the Configuration view:
- Choose the active build context in
Build Selection.
- Adjust build options in
Build Options if needed.
- Start with
Build to produce the artifacts for the active configuration.
- Check
Build Artifacts to confirm that the expected outputs were created.
- After a successful build, use
Flash to Device or Upload to Device to send the firmware to hardware when needed.
- Use
Start Debugging when the active configuration provides a valid executable and debug support.
The extension can also show the current build context in the status bar and makes key actions available from the Command Palette. It ships no keyboard shortcuts of its own, so you can bind the Trezor Bench: ... commands to whatever keys you prefer in Keyboard Shortcuts.
Workspace Requirements
The extension is designed for the trezor-firmware repository opened as a VS Code workspace folder. Multi-root windows are supported: Trezor Bench selects one folder — the first with a tbench.toml, else the first with the default manifest, else the first folder — and ignores the others. Changing which folder qualifies (for example by removing the selected folder) requires reloading the window.
The extension relies on repository-specific manifest data, paths, and generated artifacts that are already present in the workspace. For more information, see the product specification.
Development
This extension was developed entirely with AI assistance — GitHub Copilot and Claude — following a spec-driven workflow based on spec-kit. Every feature starts as a specification and plan under specs/, which is then turned into tasks and implemented.