diff options
author | 2020-08-27 11:21:56 +0000 | |
---|---|---|
committer | 2020-09-01 14:50:06 +0000 | |
commit | 76cf14c520091d00985f845203580e14c611ed14 (patch) | |
tree | 786278fef57314138f4a50eb59be0dac8a9deb5f /macros/src/codegen.rs | |
parent | c5e6d1fa49e3596227a8ee8fe89e2e4f66db3169 (diff) | |
download | rtic-76cf14c520091d00985f845203580e14c611ed14.tar.gz rtic-76cf14c520091d00985f845203580e14c611ed14.tar.zst rtic-76cf14c520091d00985f845203580e14c611ed14.zip |
Brutally yank out multicore
Diffstat (limited to 'macros/src/codegen.rs')
-rw-r--r-- | macros/src/codegen.rs | 91 |
1 files changed, 36 insertions, 55 deletions
diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index 2433684c..73531c9b 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -30,65 +30,60 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { let mut root = vec![]; let mut user = vec![]; - // generate a `main` function for each core - for core in 0..app.args.cores { - let assertion_stmts = assertions::codegen(core, analysis, extra); + // generate the `main` function + let assertion_stmts = assertions::codegen(analysis); - let (const_app_pre_init, pre_init_stmts) = pre_init::codegen(core, &app, analysis, extra); + let pre_init_stmts = pre_init::codegen(&app, analysis, extra); - let (const_app_init, root_init, user_init, call_init) = - init::codegen(core, app, analysis, extra); + let (const_app_init, root_init, user_init, call_init) = + init::codegen(app, analysis, extra); - let (const_app_post_init, post_init_stmts) = - post_init::codegen(core, &app, analysis, extra); + let (const_app_post_init, post_init_stmts) = + post_init::codegen(&app, analysis); - let (const_app_idle, root_idle, user_idle, call_idle) = - idle::codegen(core, app, analysis, extra); + let (const_app_idle, root_idle, user_idle, call_idle) = + idle::codegen(app, analysis, extra); - user.push(quote!( - #user_init + user.push(quote!( + #user_init - #user_idle - )); + #user_idle + )); - root.push(quote!( - #(#root_init)* + root.push(quote!( + #(#root_init)* - #(#root_idle)* - )); + #(#root_idle)* + )); - const_app.push(quote!( - #(#const_app_pre_init)* + const_app.push(quote!( + #const_app_init - #const_app_init + #(#const_app_post_init)* - #(#const_app_post_init)* + #const_app_idle + )); - #const_app_idle - )); + let main = util::suffixed("main"); + let section = util::link_section("text"); + mains.push(quote!( + #[no_mangle] + #section + unsafe extern "C" fn #main() -> ! { + let _TODO: () = (); - let cfg_core = util::cfg_core(core, app.args.cores); - let main = util::suffixed("main", core); - let section = util::link_section("text", core); - mains.push(quote!( - #[no_mangle] - #section - #cfg_core - 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 - } - )); - } let (const_app_resources, mod_resources) = resources::codegen(app, analysis, extra); @@ -106,18 +101,6 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { let const_app_schedule = schedule::codegen(app, extra); - let cores = app.args.cores.to_string(); - let cfg_core = quote!(#[cfg(core = #cores)]); - let msg = format!( - "specified {} core{} but tried to compile for more than {0} core{1}", - app.args.cores, - if app.args.cores > 1 { "s" } else { "" } - ); - let check_excess_cores = quote!( - #cfg_core - compile_error!(#msg); - ); - let name = &app.name; let device = extra.device; quote!( @@ -141,8 +124,6 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { /// Always include the device crate which contains the vector table use #device as _; - #check_excess_cores - #(#const_app)* #(#const_app_resources)* |