aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/pre_init.rs
diff options
context:
space:
mode:
authorGravatar Emil Fresk <emil.fresk@gmail.com> 2020-06-30 21:23:35 +0200
committerGravatar Emil Fresk <emil.fresk@gmail.com> 2020-06-30 22:06:57 +0200
commitd9e8b6866260172fd5244c5f734c7ba0893b7d62 (patch)
tree644e4b079b38e3489539c6cc84d1ce60a5a7b5f7 /macros/src/codegen/pre_init.rs
parent8a4f9c6b8ae91bebeea0791680f89375a78bffc6 (diff)
downloadrtic-d9e8b6866260172fd5244c5f734c7ba0893b7d62.tar.gz
rtic-d9e8b6866260172fd5244c5f734c7ba0893b7d62.tar.zst
rtic-d9e8b6866260172fd5244c5f734c7ba0893b7d62.zip
Fixes an issue where one could double take the cortex_m Peripheral
Added qemu test Added comment Typo Add cfg for homogeneous More cfg Now multicore working Add .run file
Diffstat (limited to 'macros/src/codegen/pre_init.rs')
-rw-r--r--macros/src/codegen/pre_init.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/macros/src/codegen/pre_init.rs b/macros/src/codegen/pre_init.rs
index 1f1735d2..c6bd61e8 100644
--- a/macros/src/codegen/pre_init.rs
+++ b/macros/src/codegen/pre_init.rs
@@ -43,6 +43,13 @@ pub fn codegen(
let mut core: rtic::export::Peripherals = core::mem::transmute(());
));
+ if app.args.cores == 1 {
+ stmts.push(quote!(
+ // To set the variable in cortex_m so the peripherals cannot be taken multiple times
+ let _ = cortex_m::Peripherals::steal();
+ ));
+ }
+
let device = extra.device;
let nvic_prio_bits = quote!(#device::NVIC_PRIO_BITS);