For the purposes of embedded programming, it would be nice to be able to compile a crate that uses processor-specific features (inline asm, magic addresses, etc.) for multiple processor models. It could look like this: #[cfg(target_cpu = "atmega328p")]
. This predicate could get the CPU model from a custom target json (defined in the top/bin crate) and compare it with the input.
I tried quite a few workarounds to compensate for this, but they don't work:
- using cargo features, a slightly bigger dependency tree will end up with gigantic feature lists
- using
build.rs
never really worked as I haven't really figured out how to pass information into dependencies, since I can't change their env vars nor rustc flags.
The same problem is present for CPU crystal frequency.