17 releases (11 breaking)
|0.18.0||Mar 31, 2023|
|0.15.0||Jan 28, 2023|
|0.13.0||Jul 12, 2022|
|0.12.0||Nov 24, 2021|
|0.8.0||Jun 30, 2020|
#26 in Embedded development
581 downloads per month
This crate provides a cargo subcommand to work with embedded targets.
It can flash targets, just like cargo-flash but can do much more, such as logging RTT output from the target, opening a GDB server connected to the target, and much more functionality such as ITM to come!
Various chip families including but not limited to nRF5x, STM32 and LPC800 can be worked with using DAPLink, ST-Link or J-Link. It supports all the targets & probes probe-rs supports.
If you think
cargo-embed makes your embedded journey more enjoyable or even earns you money, please consider supporting the project on Github Sponsors for better support and more features.
You can install this utility with cargo after installing the prerequisites listed below:
cargo install cargo-embed
You can use it like any cargo command would be used
cargo embed <args>
This will do following in sequence:
- build your binary
- detect a probe
- (if enabled) upload the contents onto the connected target
- (if enabled) reset the target
- (if enabled) start RTT host side
- (if enabled) start gdb debugging
If you've enabled rtt (see Configuration) the RTT UI will appear automatically.
||Switch to tab
|Any character||Add the character to the pending input|
||Delete the last character of the pending input|
||Send the pending input|
||Clear current tab|
You can configure
cargo-embed with a file called
.embed.toml) in your project directory. That file should be added to your git history.
For local-only configuration overrides, you can create an
.embed.local.toml) file and add that to your
Config file precedence:
- Default configuration
Instead of a TOML file, you can also use a JSON or YAML file. Choose what suits you best!
You can find all available options in the default.toml. Commented out options are the ones that are
None by default.
cargo-embed can be built using cargo, after installing the necessary prerequisites. See the list below for your operating
FTDI support is optional. You can enable it with the
ftdi feature. You also need the correct prerequisites from the next section installed.
cargo-embed depends on the libusb and optionally on libftdi libraries, which need to be installed to build cargo-embed.
On Ubuntu or Debian, the following packages need to be installed:
> sudo apt install -y pkg-config libusb-1.0-0-dev libftdi1-dev libudev-dev
For Fedora or CentOS
> dnf install systemd-devel libusbx-devel
You may also need to remove old versions of libusb:
> sudo apt remove libusb-dev
On Windows you can use vcpkg to install the prerequisites:
# dynamic linking 64-bit > vcpkg install libftdi1:x64-windows libusb:x64-windows > set VCPKGRS_DYNAMIC=1 # static linking 64-bit > vcpkg install libftdi1:x64-windows-static-md libusb:x64-windows-static-md
On macOS, homebrew is the suggested method to install libftdi:
> brew install libftdi
We use Sentry to record crash data. This helps us trace crashes better.
No data will ever be transmitted without your consent!
All data is transmitted completely anonymously.
This is an OPT-IN feature. On crash, cargo-embed will ask you whether to transmit the data or not. You can also set whether to do this for all times with an environment variable to omit the message in the future.
If you do not wish to have sentry integrated at all, you can also build cargo-embed without sentry by using