diff options
author | 2020-06-30 20:12:17 +0000 | |
---|---|---|
committer | 2020-06-30 20:12:17 +0000 | |
commit | 629acdd70f06bd27ada1203fef3ba406d3de7d84 (patch) | |
tree | 644e4b079b38e3489539c6cc84d1ce60a5a7b5f7 /macros/src | |
parent | 8a4f9c6b8ae91bebeea0791680f89375a78bffc6 (diff) | |
parent | d9e8b6866260172fd5244c5f734c7ba0893b7d62 (diff) | |
download | rtic-629acdd70f06bd27ada1203fef3ba406d3de7d84.tar.gz rtic-629acdd70f06bd27ada1203fef3ba406d3de7d84.tar.zst rtic-629acdd70f06bd27ada1203fef3ba406d3de7d84.zip |
Merge #338
338: Fixes an issue where one could double take the cortex_m Peripheral r=japaric a=korken89
Closes #321
Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
Diffstat (limited to 'macros/src')
-rw-r--r-- | macros/src/codegen/pre_init.rs | 7 |
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); |