cargo-embed

与微控制器一起工作的 cargo 扩展。「a cargo extension for working with microcontrollers」

Github星跟蹤圖

cargo-embed

crates.io documentation Actions Status chat

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.

Support

If you think cargo-embedded 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.

Installation

You can install this utility with cargo after installing the prerequisites listed below:

cargo install cargo-embed

Usage

You can use it like any cargo command would be used

cargo embed <args>

This will do following in sequence:

  1. build your binary
  2. detect a probe
  3. (if enabled) upload the contents onto the connected target
  4. (if enabled) reset the target
  5. (if enabled) start RTT host side
  6. (if enabled) start gdb debugging

RTT UI

If you've enabled rtt (see Configuration) the RTT UI will appear automatically.

Keyboard shortcuts, Command, Action, -, -, ^c, Quit, Fn{n}, Switch to tab n, Any character, Add the character to the pending input, Backspace, Delete the last character of the pending input, Enter, Send the pending input, PgUp, Scroll up, PgDn, Scroll Down, ## Configuration

You can configure cargo-embed with a file called Embed.toml (or .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 (or .embed.local.toml) file and add that to your .gitignore.

Config file precedence:

  1. Embed.local.*
  2. .embed.local.*
  3. Embed.*
  4. .embed.*
  5. 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.

Building

cargo-embed can be built using cargo, after installing the necessary prerequisites. See the list below for your operating
system.

FTDI Support

FTDI support is optional. You can enable it with the ftdi feature. You also need the correct prerequisites from the next section installed.

Prerequisites

cargo-embed depends on the libusb and optionally on libftdi libraries, which need to be installed to build cargo-embed.

Linux

On Ubuntu or Debian, the following packages need to be installed:

> sudo apt install -y pkg-config libusb-1.0-0-dev libftdi1-dev

You may also need to remove old versions of libusb:

> sudo apt remove libusb-dev

Windows

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

macOS

On macOS, homebrew is the suggested method to install libftdi:

> brew install libftdi

Sentry logging

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 --no-default-features.

主要指標

概覽
名稱與所有者probe-rs/cargo-embed
主編程語言Rust
編程語言Rust (語言數: 1)
平台
許可證Apache License 2.0
所有者活动
創建於2020-04-09 17:30:24
推送於2023-01-14 11:50:37
最后一次提交2023-01-14 11:45:20
發布數11
最新版本名稱v0.13.0 (發布於 )
第一版名稱v0.6.0 (發布於 )
用户参与
星數286
關注者數11
派生數35
提交數570
已啟用問題?
問題數0
打開的問題數0
拉請求數255
打開的拉請求數0
關閉的拉請求數101
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?