From d9e8b6866260172fd5244c5f734c7ba0893b7d62 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Tue, 30 Jun 2020 21:23:35 +0200 Subject: 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 --- macros/src/codegen/pre_init.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'macros/src') diff --git a/macros/src/codegen/pre_init.rs b/macros/src/codegen/pre_init.rs index 1f1735d..c6bd61e 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); -- cgit v1.2.3