v0.1.0
v0.1.0 — Initial Release
cargo device is a Cargo subcommand that unifies cross-compilation, deployment, and remote execution of Rust projects on embedded Linux devices. Define your devices once in .cargo/config.toml, then build, deploy, and run with a single command.
Commands
cargo device build <device>— cross-compile for the target devicecargo device run <device>— build, deploy via rsync, and run on the device with stdout/stderr streamed locallycargo device sync <device>— rsync directories to the device without buildingcargo device list— print a table of all configured devices
Configuration
Devices are defined in .cargo/config.toml and committed to git. Machine-specific overrides (IP address, SDK path) live in .cargo/device.local.toml, which stays gitignored.
[device.raspi]
target = "aarch64-unknown-linux-gnu"
linker = "aarch64-linux-gnu-gcc"
ssh_host = "pi@192.168.1.42" # override in device.local.toml
deploy_path = "/tmp/myapp"
sync_dirs = ["models/", "config/"]Build backends
| Configuration | Backend |
|---|---|
sdk defined |
Source SDK env script (Yocto/Buildroot), then cargo build |
linker defined |
Set CARGO_TARGET_*_LINKER, then cargo build |
| Neither | cross build fallback (requires Docker) |
desktop / no target |
Plain cargo build / cargo run |
Workspace support
Set package (and optionally binary) on the device config to target a specific crate in a workspace. cargo device injects -p <package> automatically.
Remote binary arguments
Pass cargo flags before --, binary arguments after:
cargo device run raspi --release -- status --verboseOther highlights
--verbose/-vflag for debug-level tracing (respectsRUST_LOG)deploy_pathis created automatically on first deploy (ssh mkdir -p)~expanded indeploy_pathandssh_key- Shell-escaped SSH commands — safe with spaces and special characters in paths
featuresandno_default_featuresfields on device config
Installation
cargo install cargo-deviceRequires ssh and rsync on the host. See the README for system dependency details and configuration examples.