Fix clash with defmt

This commit is contained in:
Emil Fresk 2022-05-24 05:51:44 +02:00
parent 1a24c725d2
commit b15bda2d39
4 changed files with 12 additions and 6 deletions

View file

@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0"
name = "cortex-m-rtic-macros" name = "cortex-m-rtic-macros"
readme = "../README.md" readme = "../README.md"
repository = "https://github.com/rtic-rs/cortex-m-rtic" repository = "https://github.com/rtic-rs/cortex-m-rtic"
version = "1.1.2" version = "1.1.3"
[lib] [lib]
proc-macro = true proc-macro = true

View file

@ -28,7 +28,11 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream
.filter_map(|(_, task)| { .filter_map(|(_, task)| {
if !util::is_exception(&task.args.binds) { if !util::is_exception(&task.args.binds) {
let interrupt_name = &task.args.binds; let interrupt_name = &task.args.binds;
Some(quote!(assert!((#device::Interrupt::#interrupt_name as u32) < 32);)) Some(quote!(
if (#device::Interrupt::#interrupt_name as u32) > 31 {
::core::panic!("An interrupt above value 31 is used while in armv6");
}
))
} else { } else {
None None
} }

View file

@ -55,7 +55,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream
); );
// Compile time assert that this priority is supported by the device // Compile time assert that this priority is supported by the device
stmts.push(quote!( stmts.push(quote!(
const _: () = assert!((1 << #nvic_prio_bits) >= #priority as usize, #es); const _: () = if (1 << #nvic_prio_bits) < #priority as usize { ::core::panic!(#es); };
)); ));
stmts.push(quote!( stmts.push(quote!(
@ -84,7 +84,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream
); );
// Compile time assert that this priority is supported by the device // Compile time assert that this priority is supported by the device
stmts.push(quote!( stmts.push(quote!(
const _: () = assert!((1 << #nvic_prio_bits) >= #priority as usize, #es); const _: () = if (1 << #nvic_prio_bits) < #priority as usize { ::core::panic!(#es); };
)); ));
stmts.push(quote!(core.SCB.set_priority( stmts.push(quote!(core.SCB.set_priority(
@ -109,7 +109,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream
); );
// Compile time assert that this priority is supported by the device // Compile time assert that this priority is supported by the device
stmts.push(quote!( stmts.push(quote!(
const _: () = assert!((1 << #nvic_prio_bits) >= #priority as usize, #es); const _: () = if (1 << #nvic_prio_bits) < #priority as usize { ::core::panic!(#es); };
)); ));
let mono_type = &monotonic.ty; let mono_type = &monotonic.ty;

View file

@ -66,7 +66,9 @@ impl Barrier {
} }
pub fn wait(&self) { pub fn wait(&self) {
while !self.inner.load(Ordering::Acquire) {} while !self.inner.load(Ordering::Acquire) {
core::hint::spin_loop()
}
} }
} }