diff options
author | 2019-03-18 18:39:19 +0000 | |
---|---|---|
committer | 2019-03-18 18:39:19 +0000 | |
commit | 1d40f01c80b4a02f79bcf59510a7c92862edaafc (patch) | |
tree | e291c56b97880f03650be7c097c06a7ca6ec1b0e /cortex-m-rt/build.rs | |
parent | 02317e6431274955188b69a7b463ab24a528b30e (diff) | |
parent | bb25ff4507f72859b4b6f09a0b81632873053abf (diff) | |
download | cortex-m-1d40f01c80b4a02f79bcf59510a7c92862edaafc.tar.gz cortex-m-1d40f01c80b4a02f79bcf59510a7c92862edaafc.tar.zst cortex-m-1d40f01c80b4a02f79bcf59510a7c92862edaafc.zip |
Merge #182
182: Add thumbv8m.main support. r=korken89 a=thejpster
* Add thumbv8m.main support.
* Also adds feature flags into build.rs so SecureFault gets included.
Co-authored-by: Jonathan 'theJPster' Pallant <github@thejpster.org.uk>
Diffstat (limited to 'cortex-m-rt/build.rs')
-rw-r--r-- | cortex-m-rt/build.rs | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/cortex-m-rt/build.rs b/cortex-m-rt/build.rs index a978146..5a8fb9c 100644 --- a/cortex-m-rt/build.rs +++ b/cortex-m-rt/build.rs @@ -8,7 +8,6 @@ fn main() { let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); has_fpu(&target); - let is_armv6m = is_armv6m(&target); if target.starts_with("thumbv") { fs::copy( @@ -43,7 +42,23 @@ INCLUDE device.x"# f }; - let max_int_handlers = if is_armv6m { 32 } else { 240 }; + let max_int_handlers = if target.starts_with("thumbv6m-") { + println!("cargo:rustc-cfg=cortex_m"); + println!("cargo:rustc-cfg=armv6m"); + 32 + } else if target.starts_with("thumbv7m-") || target.starts_with("thumbv7em-") { + println!("cargo:rustc-cfg=cortex_m"); + println!("cargo:rustc-cfg=armv7m"); + 240 + } else if target.starts_with("thumbv8m") { + println!("cargo:rustc-cfg=cortex_m"); + println!("cargo:rustc-cfg=armv8m"); + 240 + } else { + // Non ARM target. We assume you're just testing the syntax. + // This value seems as soon as any + 240 + }; // checking the size of the interrupts portion of the vector table is sub-architecture dependent writeln!( @@ -58,6 +73,10 @@ handlers."); max_int_handlers ).unwrap(); + if target.ends_with("-eabihf") { + println!("cargo:rustc-cfg=has_fpu"); + } + println!("cargo:rustc-link-search={}", out.display()); println!("cargo:rerun-if-changed=build.rs"); @@ -69,12 +88,3 @@ fn has_fpu(target: &str) { println!("cargo:rustc-cfg=has_fpu"); } } - -fn is_armv6m(target: &str) -> bool { - if target.starts_with("thumbv6m-") { - println!("cargo:rustc-cfg=armv6m"); - true - } else { - false - } -} |