diff options
author | 2020-11-15 17:27:08 +0000 | |
---|---|---|
committer | 2020-11-15 17:28:19 +0000 | |
commit | f957f05b665909f35da0054a5d87d7fa53196487 (patch) | |
tree | 379b0ada980b8e69d6fc827180106009ebf75cc0 /macros/src | |
parent | 9527c921923f6b8e19767b1bf52be758817d7035 (diff) | |
download | rtic-f957f05b665909f35da0054a5d87d7fa53196487.tar.gz rtic-f957f05b665909f35da0054a5d87d7fa53196487.tar.zst rtic-f957f05b665909f35da0054a5d87d7fa53196487.zip |
Move entry-point main into a separate module
Prevents conflict with user provided tasks named main
Diffstat (limited to 'macros/src')
-rw-r--r-- | macros/src/codegen.rs | 19 |
1 files changed, 11 insertions, 8 deletions
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 + } } )); |