From 5d6847ab7b32d8c9fa243c7dc10ed5a235e06b79 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 11 Apr 2017 23:15:05 -0500 Subject: [PATCH] partial thumv6m-none-eabi support --- build.rs | 6 ++++++ src/lib.rs | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 19625e56c9..ef67dce3ce 100644 --- a/build.rs +++ b/build.rs @@ -10,6 +10,12 @@ use std::path::PathBuf; use syn::{Ident, IntTy, Lit}; fn main() { + let target = env::var("TARGET").unwrap(); + + if target.starts_with("thumbv6m") { + println!("cargo:rustc-cfg=thumbv6m"); + } + let bits = if env::var_os("CARGO_FEATURE_P2").is_some() { 2 } else if env::var_os("CARGO_FEATURE_P3").is_some() { diff --git a/src/lib.rs b/src/lib.rs index 38f020f20b..6d8d366cdd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,8 +10,11 @@ use core::marker::PhantomData; use core::cell::UnsafeCell; use cortex_m::interrupt::Nr; +#[cfg(not(thumbv6m))] use cortex_m::register::{basepri, basepri_max}; -use typenum::{Cmp, Equal, Greater, Less, Unsigned}; +use typenum::{Cmp, Equal, Unsigned}; +#[cfg(not(thumbv6m))] +use typenum::{Greater, Less}; pub use cortex_m::ctxt::{Context, Local}; #[doc(hidden)] @@ -85,6 +88,7 @@ where /// For the duration of the critical section, tasks whose priority level is /// smaller than or equal to the resource `CEILING` will be prevented from /// preempting the current task. + #[cfg(not(thumbv6m))] pub fn lock( &'static self, _priority: &P, @@ -176,6 +180,7 @@ where } /// See [Resource.lock](./struct.Resource.html#method.lock) + #[cfg(not(thumbv6m))] pub fn lock( &'static self, _priority: &P,