From f957f05b665909f35da0054a5d87d7fa53196487 Mon Sep 17 00:00:00 2001 From: Henrik Tjäder Date: Sun, 15 Nov 2020 17:27:08 +0000 Subject: Move entry-point main into a separate module Prevents conflict with user provided tasks named main --- macros/src/codegen.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'macros/src/codegen.rs') diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index 8309473a..acd03d77 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -57,19 +57,22 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { let main = util::suffixed("main"); mains.push(quote!( - #[no_mangle] - unsafe extern "C" fn #main() -> ! { - let _TODO: () = (); + pub mod rtic_ext { + use super::*; + #[no_mangle] + unsafe extern "C" fn #main() -> ! { + let _TODO: () = (); - #(#assertion_stmts)* + #(#assertion_stmts)* - #(#pre_init_stmts)* + #(#pre_init_stmts)* - #call_init + #call_init - #(#post_init_stmts)* + #(#post_init_stmts)* - #call_idle + #call_idle + } } )); -- cgit v1.2.3