aboutsummaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorGravatar Emil Fresk <emil.fresk@gmail.com> 2022-05-24 05:51:44 +0200
committerGravatar Emil Fresk <emil.fresk@gmail.com> 2022-05-24 08:31:31 +0200
commitb15bda2d39e708c23027264dfa1acd72deb0b59b (patch)
treeef7676d4fcad579efbbd2f8325bf68f0e9b06a14 /macros
parent1a24c725d2c6889b68056f4804b588611271c1fd (diff)
downloadrtic-b15bda2d39e708c23027264dfa1acd72deb0b59b.tar.gz
rtic-b15bda2d39e708c23027264dfa1acd72deb0b59b.tar.zst
rtic-b15bda2d39e708c23027264dfa1acd72deb0b59b.zip
Fix clash with defmt
Diffstat (limited to 'macros')
-rw-r--r--macros/Cargo.toml2
-rw-r--r--macros/src/codegen/assertions.rs6
-rw-r--r--macros/src/codegen/pre_init.rs6
3 files changed, 9 insertions, 5 deletions
diff --git a/macros/Cargo.toml b/macros/Cargo.toml
index e4f5cc23..f9d8add7 100644
--- a/macros/Cargo.toml
+++ b/macros/Cargo.toml
@@ -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
diff --git a/macros/src/codegen/assertions.rs b/macros/src/codegen/assertions.rs
index 36ab0364..f6a098b5 100644
--- a/macros/src/codegen/assertions.rs
+++ b/macros/src/codegen/assertions.rs
@@ -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
}
diff --git a/macros/src/codegen/pre_init.rs b/macros/src/codegen/pre_init.rs
index ae2fd050..3d541a47 100644
--- a/macros/src/codegen/pre_init.rs
+++ b/macros/src/codegen/pre_init.rs
@@ -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!(
@@ -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(
@@ -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;