From 48abc26e8577e6b57c46dce40e63022fac2c9375 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Wed, 14 Oct 2020 20:27:43 +0200 Subject: [PATCH] Detect if the rt flag is defined in the PAC/HAL Better error message Improved error string Update UI tests --- macros/src/codegen.rs | 2 +- macros/src/codegen/pre_init.rs | 4 ++-- macros/src/codegen/spawn_body.rs | 5 ++--- macros/src/codegen/timer_queue.rs | 3 +-- macros/src/codegen/util.rs | 2 +- ui/single/locals-cfg.stderr | 6 ------ 6 files changed, 7 insertions(+), 15 deletions(-) diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index f230d3956d..e89776c5a5 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -144,7 +144,7 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { /// Implementation details mod #name { /// Always include the device crate which contains the vector table - use #device as _; + use #device as you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml; #(#imports)* #(#user_imports)* diff --git a/macros/src/codegen/pre_init.rs b/macros/src/codegen/pre_init.rs index 9c5f35ec37..2aaf9ebded 100644 --- a/macros/src/codegen/pre_init.rs +++ b/macros/src/codegen/pre_init.rs @@ -53,14 +53,14 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec TokenStream2 { let spawnee = &app.software_tasks[name]; let priority = spawnee.args.priority; @@ -42,12 +42,11 @@ pub fn codegen( ) }; - let device = extra.device; let enum_ = util::interrupt_ident(); let interrupt = &analysis.interrupts.get(&priority); let pend = { quote!( - rtic::pend(#device::#enum_::#interrupt); + rtic::pend(you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::#enum_::#interrupt); ) }; diff --git a/macros/src/codegen/timer_queue.rs b/macros/src/codegen/timer_queue.rs index 030158e205..0abbf49d2f 100644 --- a/macros/src/codegen/timer_queue.rs +++ b/macros/src/codegen/timer_queue.rs @@ -72,7 +72,6 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec Vec Ident { pub fn interrupt_ident() -> Ident { let span = Span::call_site(); - Ident::new("Interrupt", span) + Ident::new("interrupt", span) } /// Whether `name` is an exception with configurable priority diff --git a/ui/single/locals-cfg.stderr b/ui/single/locals-cfg.stderr index 53cdacc32f..0af1293f25 100644 --- a/ui/single/locals-cfg.stderr +++ b/ui/single/locals-cfg.stderr @@ -33,9 +33,3 @@ error: duplicate lang item in crate `panic_halt` (which `$CRATE` depends on): `p = note: the lang item is first defined in crate `std` (which `$CRATE` depends on) = note: first definition in `std` loaded from /usr/share/rust/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-f14aca24435a5414.rlib = note: second definition in `panic_halt` loaded from $DIR/target/tests/target/x86_64-unknown-linux-gnu/debug/deps/libpanic_halt-33949299fdfa2375.rmeta - -error: duplicate lang item in crate `panic_semihosting`: `panic_impl`. - | - = note: the lang item is first defined in crate `panic_halt` (which `$CRATE` depends on) - = note: first definition in `panic_halt` loaded from $DIR/target/tests/target/x86_64-unknown-linux-gnu/debug/deps/libpanic_halt-33949299fdfa2375.rmeta - = note: second definition in `panic_semihosting` loaded from $DIR/target/tests/target/x86_64-unknown-linux-gnu/debug/deps/libpanic_semihosting-f97442f9ee5cfc78.rmeta