diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-11-23 13:21:59 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-11-23 13:21:59 +0000 |
| commit | a4f9e7cbcc8cb3ff679b4677a85a06d514b0c465 (patch) | |
| tree | acb48252c134b900eca51299995e84a95fbd0cd3 /embassy-executor | |
| parent | de95ab264d8ee2bf5ba9c3615ecb1b44e3940694 (diff) | |
| parent | 04a7d976733e021395ff26e26dfa983e67b773a0 (diff) | |
Merge #1071
1071: refactor: autodetect macro variant r=Dirbaio a=lulf
Apply heuristics using target_arch, target_os and target_family to determine which variant of the entry point to use.
Co-authored-by: Ulf Lilleengen <[email protected]>
Diffstat (limited to 'embassy-executor')
| -rw-r--r-- | embassy-executor/Cargo.toml | 5 | ||||
| -rw-r--r-- | embassy-executor/src/lib.rs | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml index 45b0955bf..6fa1dd7fb 100644 --- a/embassy-executor/Cargo.toml +++ b/embassy-executor/Cargo.toml | |||
| @@ -29,9 +29,8 @@ flavors = [ | |||
| 29 | 29 | ||
| 30 | [features] | 30 | [features] |
| 31 | default = [] | 31 | default = [] |
| 32 | std = ["embassy-macros/std", "critical-section/std"] | 32 | std = ["critical-section/std"] |
| 33 | wasm = ["dep:wasm-bindgen", "dep:js-sys", "embassy-macros/wasm"] | 33 | wasm = ["dep:wasm-bindgen", "dep:js-sys"] |
| 34 | riscv = ["embassy-macros/riscv"] | ||
| 35 | 34 | ||
| 36 | # Enable nightly-only features | 35 | # Enable nightly-only features |
| 37 | nightly = [] | 36 | nightly = [] |
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 @@ | |||
| 8 | pub(crate) mod fmt; | 8 | pub(crate) mod fmt; |
| 9 | 9 | ||
| 10 | #[cfg(feature = "nightly")] | 10 | #[cfg(feature = "nightly")] |
| 11 | pub use embassy_macros::{main, task}; | 11 | pub use embassy_macros::task; |
| 12 | 12 | ||
| 13 | cfg_if::cfg_if! { | 13 | cfg_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 | ||
