Skip to content

Commit

Permalink
Merge #643
Browse files Browse the repository at this point in the history
643: Fix clash with defmt r=AfoHT a=korken89

Fixes #642

Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
  • Loading branch information
bors[bot] and korken89 authored May 24, 2022
2 parents 1a24c72 + b15bda2 commit 5fe6350
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0"
name = "cortex-m-rtic-macros"
readme = "../README.md"
repository = "https://github.com/rtic-rs/cortex-m-rtic"
version = "1.1.2"
version = "1.1.3"

[lib]
proc-macro = true
Expand Down
6 changes: 5 additions & 1 deletion macros/src/codegen/assertions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream
.filter_map(|(_, task)| {
if !util::is_exception(&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 {
None
}
Expand Down
6 changes: 3 additions & 3 deletions macros/src/codegen/pre_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
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!(
Expand Down Expand Up @@ -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
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(
Expand All @@ -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
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;
Expand Down
4 changes: 3 additions & 1 deletion src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ impl Barrier {
}

pub fn wait(&self) {
while !self.inner.load(Ordering::Acquire) {}
while !self.inner.load(Ordering::Acquire) {
core::hint::spin_loop()
}
}
}

Expand Down

0 comments on commit 5fe6350

Please sign in to comment.