mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
check that the app is not compiled for more cores than were specified
This commit is contained in:
parent
596cf585ea
commit
df4a7fd3e5
1 changed files with 14 additions and 0 deletions
|
@ -101,6 +101,18 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
|
||||||
|
|
||||||
let const_app_schedule = schedule::codegen(app, extra);
|
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 name = &app.name;
|
||||||
let device = extra.device;
|
let device = extra.device;
|
||||||
quote!(
|
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
|
/// Always include the device crate which contains the vector table
|
||||||
use #device as _;
|
use #device as _;
|
||||||
|
|
||||||
|
#check_excess_cores
|
||||||
|
|
||||||
#(#const_app)*
|
#(#const_app)*
|
||||||
|
|
||||||
#(#const_app_resources)*
|
#(#const_app_resources)*
|
||||||
|
|
Loading…
Reference in a new issue