diff options
author | 2019-06-24 14:15:00 +0200 | |
---|---|---|
committer | 2019-06-24 14:15:00 +0200 | |
commit | df4a7fd3e5df370a83fcdc24aa628bed3fa9f543 (patch) | |
tree | a62715941efd9c4116da4c9ee09fb79b4ff426b0 /macros/src/codegen.rs | |
parent | 596cf585ea8dc278d88e0652dffbacbc75de04c6 (diff) | |
download | rtic-df4a7fd3e5df370a83fcdc24aa628bed3fa9f543.tar.gz rtic-df4a7fd3e5df370a83fcdc24aa628bed3fa9f543.tar.zst rtic-df4a7fd3e5df370a83fcdc24aa628bed3fa9f543.zip |
check that the app is not compiled for more cores than were specified
Diffstat (limited to 'macros/src/codegen.rs')
-rw-r--r-- | macros/src/codegen.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index a3515994..8a548323 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -101,6 +101,18 @@ 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!( @@ -124,6 +136,8 @@ 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)* |