diff options
author | 2018-04-26 01:52:07 +0200 | |
---|---|---|
committer | 2018-04-26 01:52:07 +0200 | |
commit | bff66f8fa796e305df93f28d9a5e352eb51596e5 (patch) | |
tree | c6878210d90f8e7e8029a36cf8ebf23326c4f592 /build.rs | |
parent | 00d6faae149c062e79a822b8d46b6b5e7e972f57 (diff) | |
download | cortex-m-bff66f8fa796e305df93f28d9a5e352eb51596e5.tar.gz cortex-m-bff66f8fa796e305df93f28d9a5e352eb51596e5.tar.zst cortex-m-bff66f8fa796e305df93f28d9a5e352eb51596e5.zip |
make compilable on stable
Diffstat (limited to 'build.rs')
-rw-r--r-- | build.rs | 42 |
1 files changed, 41 insertions, 1 deletions
@@ -1,18 +1,58 @@ +extern crate cc; + use std::env; fn main() { let target = env::var("TARGET").unwrap(); + if target.starts_with("thumb") && env::var_os("CARGO_FEATURE_INLINE_ASM").is_none() { + // NOTE we need to place each routine in a separate assembly file or the linker won't be + // able to discard the unused routines + let mut build = cc::Build::new(); + build + .file("asm/basepri_r.s") + .file("asm/bkpt.s") + .file("asm/control.s") + .file("asm/cpsid.s") + .file("asm/cpsie.s") + .file("asm/dmb.s") + .file("asm/dsb.s") + .file("asm/faultmask.s") + .file("asm/isb.s") + .file("asm/msp_r.s") + .file("asm/msp_w.s") + .file("asm/nop.s") + .file("asm/primask.s") + .file("asm/psp_r.s") + .file("asm/psp_w.s") + .file("asm/sev.s") + .file("asm/wfe.s") + .file("asm/wfi.s"); + + if env::var_os("CARGO_FEATURE_CM7_R0P1").is_some() { + build.file("asm/basepri_max-cm7-r0p1.s"); + build.file("asm/basepri_w-cm7-r0p1.s"); + } else { + build.file("asm/basepri_max.s"); + build.file("asm/basepri_w.s"); + } + + build.compile("asm"); + } + if target.starts_with("thumbv6m-") { + println!("cargo:rustc-cfg=cortex_m"); println!("cargo:rustc-cfg=armv6m"); } else if target.starts_with("thumbv7m-") { + println!("cargo:rustc-cfg=cortex_m"); println!("cargo:rustc-cfg=armv7m"); } else if target.starts_with("thumbv7em-") { + println!("cargo:rustc-cfg=cortex_m"); println!("cargo:rustc-cfg=armv7m"); //println!("cargo:rustc-cfg=armv7em"); } - if target.ends_with("eabihf") { + if target.ends_with("-eabihf") { println!("cargo:rustc-cfg=has_fpu"); } } |