aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2022-11-22 22:04:42 +0100
committerUlf Lilleengen <[email protected]>2022-11-23 13:54:59 +0100
commit04a7d976733e021395ff26e26dfa983e67b773a0 (patch)
treec910e1015bbeb04ea26f1b53db5feb28827889d3 /embassy-executor/src
parent2fa2c1a6fe9c79f11f7382a63ba6a13fe1bae1be (diff)
refactor: autodetect macro variant
Export all main macro per target architecture from embassy-macros, and select the appropriate macro in embassy-executor.
Diffstat (limited to 'embassy-executor/src')
-rw-r--r--embassy-executor/src/lib.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/embassy-executor/src/lib.rs b/embassy-executor/src/lib.rs
index e4cbd04b9..4c7e2f4cd 100644
--- a/embassy-executor/src/lib.rs
+++ b/embassy-executor/src/lib.rs
@@ -8,18 +8,22 @@
8pub(crate) mod fmt; 8pub(crate) mod fmt;
9 9
10#[cfg(feature = "nightly")] 10#[cfg(feature = "nightly")]
11pub use embassy_macros::{main, task}; 11pub use embassy_macros::task;
12 12
13cfg_if::cfg_if! { 13cfg_if::cfg_if! {
14 if #[cfg(cortex_m)] { 14 if #[cfg(cortex_m)] {
15 #[path="arch/cortex_m.rs"] 15 #[path="arch/cortex_m.rs"]
16 mod arch; 16 mod arch;
17 pub use arch::*; 17 pub use arch::*;
18 #[cfg(feature = "nightly")]
19 pub use embassy_macros::main_cortex_m as main;
18 } 20 }
19 else if #[cfg(target_arch="riscv32")] { 21 else if #[cfg(target_arch="riscv32")] {
20 #[path="arch/riscv32.rs"] 22 #[path="arch/riscv32.rs"]
21 mod arch; 23 mod arch;
22 pub use arch::*; 24 pub use arch::*;
25 #[cfg(feature = "nightly")]
26 pub use embassy_macros::main_riscv as main;
23 } 27 }
24 else if #[cfg(all(target_arch="xtensa", feature = "nightly"))] { 28 else if #[cfg(all(target_arch="xtensa", feature = "nightly"))] {
25 #[path="arch/xtensa.rs"] 29 #[path="arch/xtensa.rs"]
@@ -30,11 +34,15 @@ cfg_if::cfg_if! {
30 #[path="arch/wasm.rs"] 34 #[path="arch/wasm.rs"]
31 mod arch; 35 mod arch;
32 pub use arch::*; 36 pub use arch::*;
37 #[cfg(feature = "nightly")]
38 pub use embassy_macros::main_wasm as main;
33 } 39 }
34 else if #[cfg(feature="std")] { 40 else if #[cfg(feature="std")] {
35 #[path="arch/std.rs"] 41 #[path="arch/std.rs"]
36 mod arch; 42 mod arch;
37 pub use arch::*; 43 pub use arch::*;
44 #[cfg(feature = "nightly")]
45 pub use embassy_macros::main_std as main;
38 } 46 }
39} 47}
40 48