diff options
Diffstat (limited to 'embassy-executor-macros')
| -rw-r--r-- | embassy-executor-macros/src/lib.rs | 25 | ||||
| -rw-r--r-- | embassy-executor-macros/src/macros/main.rs | 6 |
2 files changed, 31 insertions, 0 deletions
diff --git a/embassy-executor-macros/src/lib.rs b/embassy-executor-macros/src/lib.rs index 8e737db6a..962ce2e75 100644 --- a/embassy-executor-macros/src/lib.rs +++ b/embassy-executor-macros/src/lib.rs | |||
| @@ -70,6 +70,31 @@ pub fn main_cortex_m(args: TokenStream, item: TokenStream) -> TokenStream { | |||
| 70 | main::run(args.into(), item.into(), &main::ARCH_CORTEX_M).into() | 70 | main::run(args.into(), item.into(), &main::ARCH_CORTEX_M).into() |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /// Creates a new `executor` instance and declares an application entry point for Cortex-A/R | ||
| 74 | /// spawning the corresponding function body as an async task. | ||
| 75 | /// | ||
| 76 | /// The following restrictions apply: | ||
| 77 | /// | ||
| 78 | /// * The function must accept exactly 1 parameter, an `embassy_executor::Spawner` handle that it | ||
| 79 | /// can use to spawn additional tasks. | ||
| 80 | /// * The function must be declared `async`. | ||
| 81 | /// * The function must not use generics. | ||
| 82 | /// * Only a single `main` task may be declared. | ||
| 83 | /// | ||
| 84 | /// ## Examples | ||
| 85 | /// Spawning a task: | ||
| 86 | /// | ||
| 87 | /// ``` rust | ||
| 88 | /// #[embassy_executor::main] | ||
| 89 | /// async fn main(_s: embassy_executor::Spawner) { | ||
| 90 | /// // Function body | ||
| 91 | /// } | ||
| 92 | /// ``` | ||
| 93 | #[proc_macro_attribute] | ||
| 94 | pub fn main_cortex_ar(args: TokenStream, item: TokenStream) -> TokenStream { | ||
| 95 | main::run(args.into(), item.into(), &main::ARCH_CORTEX_AR).into() | ||
| 96 | } | ||
| 97 | |||
| 73 | /// Creates a new `executor` instance and declares an architecture agnostic application entry point spawning | 98 | /// Creates a new `executor` instance and declares an architecture agnostic application entry point spawning |
| 74 | /// the corresponding function body as an async task. | 99 | /// the corresponding function body as an async task. |
| 75 | /// | 100 | /// |
diff --git a/embassy-executor-macros/src/macros/main.rs b/embassy-executor-macros/src/macros/main.rs index 95722b19b..a0e7b3401 100644 --- a/embassy-executor-macros/src/macros/main.rs +++ b/embassy-executor-macros/src/macros/main.rs | |||
| @@ -37,6 +37,12 @@ pub static ARCH_CORTEX_M: Arch = Arch { | |||
| 37 | executor_required: false, | 37 | executor_required: false, |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | pub static ARCH_CORTEX_AR: Arch = Arch { | ||
| 41 | default_entry: None, | ||
| 42 | flavor: Flavor::Standard, | ||
| 43 | executor_required: false, | ||
| 44 | }; | ||
| 45 | |||
| 40 | pub static ARCH_SPIN: Arch = Arch { | 46 | pub static ARCH_SPIN: Arch = Arch { |
| 41 | default_entry: None, | 47 | default_entry: None, |
| 42 | flavor: Flavor::Standard, | 48 | flavor: Flavor::Standard, |
