From caf48d8a9593cfd408a230600173e510e397c7dd Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 5 Jan 2022 13:30:46 +0100 Subject: [PATCH] macros: initialize chip before executor. The executor will call into the chip's time-driver, which may need the chip to be initialized. --- embassy-macros/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/embassy-macros/src/lib.rs b/embassy-macros/src/lib.rs index cdbc2517..44a8d3b9 100644 --- a/embassy-macros/src/lib.rs +++ b/embassy-macros/src/lib.rs @@ -370,16 +370,14 @@ pub fn main(args: TokenStream, item: TokenStream) -> TokenStream { ::core::mem::transmute(t) } - let mut executor = #embassy_path::executor::Executor::new(); - - let executor = unsafe { make_static(&mut executor) }; - #chip_setup + let mut executor = #embassy_path::executor::Executor::new(); + let executor = unsafe { make_static(&mut executor) }; + executor.run(|spawner| { spawner.must_spawn(__embassy_main(spawner, p)); }) - } }; result.into()