diff options
author | 2022-04-20 13:02:55 +0200 | |
---|---|---|
committer | 2022-04-20 13:05:22 +0200 | |
commit | 0f8bdbdd3f2739e37d788493cb83cf2d9c557f4e (patch) | |
tree | 42fe0077801e832320d23322f2259332e6d88d1f /macros/src | |
parent | 9f38a39377a7ff03d0f4371feda083ba09064f5e (diff) | |
download | rtic-0f8bdbdd3f2739e37d788493cb83cf2d9c557f4e.tar.gz rtic-0f8bdbdd3f2739e37d788493cb83cf2d9c557f4e.tar.zst rtic-0f8bdbdd3f2739e37d788493cb83cf2d9c557f4e.zip |
Added check for resource usage and to generate an compile error for thumbv6 exceptions
Diffstat (limited to 'macros/src')
-rw-r--r-- | macros/src/codegen/shared_resources.rs | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/macros/src/codegen/shared_resources.rs b/macros/src/codegen/shared_resources.rs index e3109c82..f944e3e5 100644 --- a/macros/src/codegen/shared_resources.rs +++ b/macros/src/codegen/shared_resources.rs @@ -110,12 +110,32 @@ pub fn codegen( let mut prio_to_masks = HashMap::new(); let device = &extra.device; + let mut uses_exceptions_with_resources = false; for (&priority, name) in interrupt_ids.chain(app.hardware_tasks.values().flat_map(|task| { if !util::is_exception(&task.args.binds) { Some((&task.args.priority, &task.args.binds)) } else { - // TODO: exceptions not implemented + // If any resource to the exception uses non-lock-free or non-local resources this is + // not allwed on thumbv6. + uses_exceptions_with_resources = uses_exceptions_with_resources + || task + .args + .shared_resources + .iter() + .map(|(ident, access)| { + if access.is_exclusive() { + if let Some(r) = app.shared_resources.get(ident) { + !r.properties.lock_free + } else { + false + } + } else { + false + } + }) + .any(|v| v); + None } })) { @@ -146,5 +166,13 @@ pub fn codegen( const #masks_name: [u32; 3] = [#(#mask_arr),*]; )); + if uses_exceptions_with_resources { + mod_app.push(quote!( + #[doc(hidden)] + #[allow(non_camel_case_types)] + const __rtic_internal_V6_ERROR: () = rtic::export::v6_panic(); + )); + } + (mod_app, mod_resources) } |