You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building bare-metal/embedded Rust projects with Crane requires several
workarounds due to the unique constraints of #![no_std] and #![no_main]
targets.
This environment variable takes precedence over .cargo/config.toml settings,
causing cargo to use the system linker (clang/gcc) instead of
embedded-specific linkers like flip-link.
Solution: Override the CARGO_TARGET_*_LINKER environment variable
directly in commonArgs:
This discussion was converted from issue #954 on January 07, 2026 00:24.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Building bare-metal/embedded Rust projects with Crane requires several
workarounds due to the unique constraints of
#![no_std]and#![no_main]targets.
1. Custom Linker Override
Problem: Crane's
mkCrossToolchainEnvautomatically setsCARGO_TARGET_*_LINKERenvironment variable:This environment variable takes precedence over
.cargo/config.tomlsettings,causing cargo to use the system linker (clang/gcc) instead of
embedded-specific linkers like
flip-link.Solution: Override the
CARGO_TARGET_*_LINKERenvironment variabledirectly in
commonArgs:2. Disable Tests
Problem: Embedded targets cannot run tests (no test harness, no std
library).
Solution: Set
doCheck = falseincommonArgs:3. Custom buildDepsOnly setup
Problem: Embedded projects may require custom linker scripts (e.g.,
memory.x)that must be included in both the dummy source and final build.
Solution: Use
extraDummyScriptto copy linker scripts andbuild.rs, andfilter them in source cleaning:
Problem: Crane's default dummy binary doesn't compile for some embedded projects. Embassy (https://embassy.dev) projects require additional setup like
#[entry]andbind_interrupts!macro.Solution: Provide custom
dummyrsanddummyBuildrsinbuildDepsOnly4. Complete Example
Beta Was this translation helpful? Give feedback.
All reactions