zeroclaw-labs/zeroclaw · error
Build failed:\n{}
Error message
Build failed:\n{} What it means
flash_nucleo_firmware runs `cargo build --release --target thumbv7em-none-eabihf` inside firmware/nucleo and bails with cargo's stderr when the build exits non-zero. The most common cause is the embedded target not being installed in the active rustup toolchain; dependency fetch failures or firmware compile errors also surface here with full stderr.
Source
Thrown at crates/zeroclaw-hardware/src/peripherals/nucleo_flash.rs:50
let repo_root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let firmware_dir = repo_root.join("firmware").join("nucleo");
if !firmware_dir.join("Cargo.toml").exists() {
anyhow::bail!(
"Nucleo firmware not found at {}. Run from zeroclaw repo root.",
firmware_dir.display()
);
}
println!("Building ZeroClaw Nucleo firmware...");
let build = Command::new("cargo")
.args(["build", "--release", "--target", TARGET])
.current_dir(&firmware_dir)
.output()
.context("cargo build failed")?;
if !build.status.success() {
let stderr = String::from_utf8_lossy(&build.stderr);
anyhow::bail!("Build failed:\n{}", stderr);
}
let elf_path = firmware_dir
.join("target")
.join(TARGET)
.join("release")
.join("nucleo");
if !elf_path.exists() {
anyhow::bail!(
"Built binary not found at {}",
elf_path.display().to_string()
);
}
println!("Flashing to Nucleo-F401RE (connect via USB)...");
let flash = Command::new("probe-rs")
.args([View on GitHub (pinned to 88bb9c8533)
Solutions
- Install the target: `rustup target add thumbv7em-none-eabihf`
- Read the embedded stderr — can't-find-core errors name the exact target; code errors name file and line
- Verify standalone: `cd firmware/nucleo && cargo build --release --target thumbv7em-none-eabihf`
- Ensure the required toolchain is present and crates.io is reachable (or deps are vendored)
Defensive patterns
Strategy: validation
Validate before calling
let installed = std::process::Command::new("rustup")
.args(["target", "list", "--installed"])
.output()?;
if !String::from_utf8_lossy(&installed.stdout).contains("thumbv7em-none-eabihf") {
std::process::Command::new("rustup")
.args(["target", "add", "thumbv7em-none-eabihf"])
.status()?;
}
flash_nucleo_firmware()?; Try / catch
if let Err(e) = flash_nucleo_firmware() {
let chain = format!("{e:#}"); // embedded cargo stderr names the exact failure
if chain.contains("can't find crate for `core`") || chain.contains("not installed") {
// missing target: rustup target add thumbv7em-none-eabihf, then retry
}
} Prevention
- Pre-install thumbv7em-none-eabihf on machines that flash Nucleo firmware
- Build firmware/nucleo standalone once before automating the full flash flow
- Pin the toolchain firmware/nucleo requires (rust-toolchain.toml) in CI images
When it happens
Trigger: Calling flash_nucleo_firmware() without thumbv7em-none-eabihf installed (`rustup target list --installed`), offline without vendored crates.io dependencies, or with a compile error in firmware/nucleo itself.
Common situations: First embedded build on a new machine (rustup ships without cross targets); CI containers without cached targets; toolchain mismatch with firmware/nucleo's rust-toolchain.toml (Embassy firmware).
Related errors
- Built binary not found at {}
- probe-rs not found. Install it: cargo install probe-rs-too
- Nucleo firmware not found at {}. Run from zeroclaw repo root
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/0827b7fc9995a111.
Report an issue: GitHub.