diff options
Diffstat (limited to 'embassy-executor')
| -rw-r--r-- | embassy-executor/Cargo.toml | 80 | ||||
| -rw-r--r-- | embassy-executor/README.md | 2 | ||||
| -rw-r--r-- | embassy-executor/gen_config.py | 6 | ||||
| -rw-r--r-- | embassy-executor/src/lib.rs | 3 |
4 files changed, 81 insertions, 10 deletions
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml index 4dcd03b0f..c71452398 100644 --- a/embassy-executor/Cargo.toml +++ b/embassy-executor/Cargo.toml | |||
| @@ -36,6 +36,8 @@ embassy-executor-macros = { version = "0.4.0", path = "../embassy-executor-macro | |||
| 36 | embassy-time = { version = "0.2", path = "../embassy-time", optional = true} | 36 | embassy-time = { version = "0.2", path = "../embassy-time", optional = true} |
| 37 | critical-section = "1.1" | 37 | critical-section = "1.1" |
| 38 | 38 | ||
| 39 | document-features = "0.2.7" | ||
| 40 | |||
| 39 | # needed for riscv | 41 | # needed for riscv |
| 40 | # remove when https://github.com/rust-lang/rust/pull/114499 is merged | 42 | # remove when https://github.com/rust-lang/rust/pull/114499 is merged |
| 41 | portable-atomic = { version = "1.5", optional = true } | 43 | portable-atomic = { version = "1.5", optional = true } |
| @@ -53,66 +55,126 @@ critical-section = { version = "1.1", features = ["std"] } | |||
| 53 | 55 | ||
| 54 | [features] | 56 | [features] |
| 55 | 57 | ||
| 56 | # Architecture | 58 | ## Enable nightly-only features |
| 59 | nightly = ["embassy-executor-macros/nightly"] | ||
| 60 | |||
| 61 | # Enables turbo wakers, which requires patching core. Not surfaced in the docs by default due to | ||
| 62 | # being an complicated advanced and undocumented feature. | ||
| 63 | # See: https://github.com/embassy-rs/embassy/pull/1263 | ||
| 64 | turbowakers = [] | ||
| 65 | |||
| 66 | ## Use timers from `embassy-time` | ||
| 67 | integrated-timers = ["dep:embassy-time"] | ||
| 68 | |||
| 69 | #! ### Architecture | ||
| 57 | _arch = [] # some arch was picked | 70 | _arch = [] # some arch was picked |
| 71 | ## std | ||
| 58 | arch-std = ["_arch", "critical-section/std"] | 72 | arch-std = ["_arch", "critical-section/std"] |
| 73 | ## Cortex-M | ||
| 59 | arch-cortex-m = ["_arch", "dep:cortex-m"] | 74 | arch-cortex-m = ["_arch", "dep:cortex-m"] |
| 75 | ## RISC-V 32 | ||
| 60 | arch-riscv32 = ["_arch", "dep:portable-atomic"] | 76 | arch-riscv32 = ["_arch", "dep:portable-atomic"] |
| 77 | ## WASM | ||
| 61 | arch-wasm = ["_arch", "dep:wasm-bindgen", "dep:js-sys"] | 78 | arch-wasm = ["_arch", "dep:wasm-bindgen", "dep:js-sys"] |
| 62 | 79 | ||
| 63 | # Enable the thread-mode executor (using WFE/SEV in Cortex-M, WFI in other embedded archs) | 80 | #! ### Executor |
| 81 | |||
| 82 | ## Enable the thread-mode executor (using WFE/SEV in Cortex-M, WFI in other embedded archs) | ||
| 64 | executor-thread = [] | 83 | executor-thread = [] |
| 65 | # Enable the interrupt-mode executor (available in Cortex-M only) | 84 | ## Enable the interrupt-mode executor (available in Cortex-M only) |
| 66 | executor-interrupt = [] | 85 | executor-interrupt = [] |
| 67 | 86 | ||
| 68 | # Enable nightly-only features | 87 | #! ### Task Arena Size |
| 69 | nightly = ["embassy-executor-macros/nightly"] | 88 | #! Sets the [task arena](#task-arena) size. Necessary if you’re not using `nightly`. |
| 70 | 89 | #! | |
| 71 | turbowakers = [] | 90 | #! <details> |
| 72 | 91 | #! <summary>Preconfigured Task Arena Sizes:</summary> | |
| 73 | integrated-timers = ["dep:embassy-time"] | 92 | #! <!-- rustdoc requires the following blank line for the feature list to render correctly! --> |
| 93 | #! | ||
| 74 | 94 | ||
| 75 | # BEGIN AUTOGENERATED CONFIG FEATURES | 95 | # BEGIN AUTOGENERATED CONFIG FEATURES |
| 76 | # Generated by gen_config.py. DO NOT EDIT. | 96 | # Generated by gen_config.py. DO NOT EDIT. |
| 97 | ## 64 | ||
| 77 | task-arena-size-64 = [] | 98 | task-arena-size-64 = [] |
| 99 | ## 128 | ||
| 78 | task-arena-size-128 = [] | 100 | task-arena-size-128 = [] |
| 101 | ## 192 | ||
| 79 | task-arena-size-192 = [] | 102 | task-arena-size-192 = [] |
| 103 | ## 256 | ||
| 80 | task-arena-size-256 = [] | 104 | task-arena-size-256 = [] |
| 105 | ## 320 | ||
| 81 | task-arena-size-320 = [] | 106 | task-arena-size-320 = [] |
| 107 | ## 384 | ||
| 82 | task-arena-size-384 = [] | 108 | task-arena-size-384 = [] |
| 109 | ## 512 | ||
| 83 | task-arena-size-512 = [] | 110 | task-arena-size-512 = [] |
| 111 | ## 640 | ||
| 84 | task-arena-size-640 = [] | 112 | task-arena-size-640 = [] |
| 113 | ## 768 | ||
| 85 | task-arena-size-768 = [] | 114 | task-arena-size-768 = [] |
| 115 | ## 1024 | ||
| 86 | task-arena-size-1024 = [] | 116 | task-arena-size-1024 = [] |
| 117 | ## 1280 | ||
| 87 | task-arena-size-1280 = [] | 118 | task-arena-size-1280 = [] |
| 119 | ## 1536 | ||
| 88 | task-arena-size-1536 = [] | 120 | task-arena-size-1536 = [] |
| 121 | ## 2048 | ||
| 89 | task-arena-size-2048 = [] | 122 | task-arena-size-2048 = [] |
| 123 | ## 2560 | ||
| 90 | task-arena-size-2560 = [] | 124 | task-arena-size-2560 = [] |
| 125 | ## 3072 | ||
| 91 | task-arena-size-3072 = [] | 126 | task-arena-size-3072 = [] |
| 127 | ## 4096 (default) | ||
| 92 | task-arena-size-4096 = [] # Default | 128 | task-arena-size-4096 = [] # Default |
| 129 | ## 5120 | ||
| 93 | task-arena-size-5120 = [] | 130 | task-arena-size-5120 = [] |
| 131 | ## 6144 | ||
| 94 | task-arena-size-6144 = [] | 132 | task-arena-size-6144 = [] |
| 133 | ## 8192 | ||
| 95 | task-arena-size-8192 = [] | 134 | task-arena-size-8192 = [] |
| 135 | ## 10240 | ||
| 96 | task-arena-size-10240 = [] | 136 | task-arena-size-10240 = [] |
| 137 | ## 12288 | ||
| 97 | task-arena-size-12288 = [] | 138 | task-arena-size-12288 = [] |
| 139 | ## 16384 | ||
| 98 | task-arena-size-16384 = [] | 140 | task-arena-size-16384 = [] |
| 141 | ## 20480 | ||
| 99 | task-arena-size-20480 = [] | 142 | task-arena-size-20480 = [] |
| 143 | ## 24576 | ||
| 100 | task-arena-size-24576 = [] | 144 | task-arena-size-24576 = [] |
| 145 | ## 32768 | ||
| 101 | task-arena-size-32768 = [] | 146 | task-arena-size-32768 = [] |
| 147 | ## 40960 | ||
| 102 | task-arena-size-40960 = [] | 148 | task-arena-size-40960 = [] |
| 149 | ## 49152 | ||
| 103 | task-arena-size-49152 = [] | 150 | task-arena-size-49152 = [] |
| 151 | ## 65536 | ||
| 104 | task-arena-size-65536 = [] | 152 | task-arena-size-65536 = [] |
| 153 | ## 81920 | ||
| 105 | task-arena-size-81920 = [] | 154 | task-arena-size-81920 = [] |
| 155 | ## 98304 | ||
| 106 | task-arena-size-98304 = [] | 156 | task-arena-size-98304 = [] |
| 157 | ## 131072 | ||
| 107 | task-arena-size-131072 = [] | 158 | task-arena-size-131072 = [] |
| 159 | ## 163840 | ||
| 108 | task-arena-size-163840 = [] | 160 | task-arena-size-163840 = [] |
| 161 | ## 196608 | ||
| 109 | task-arena-size-196608 = [] | 162 | task-arena-size-196608 = [] |
| 163 | ## 262144 | ||
| 110 | task-arena-size-262144 = [] | 164 | task-arena-size-262144 = [] |
| 165 | ## 327680 | ||
| 111 | task-arena-size-327680 = [] | 166 | task-arena-size-327680 = [] |
| 167 | ## 393216 | ||
| 112 | task-arena-size-393216 = [] | 168 | task-arena-size-393216 = [] |
| 169 | ## 524288 | ||
| 113 | task-arena-size-524288 = [] | 170 | task-arena-size-524288 = [] |
| 171 | ## 655360 | ||
| 114 | task-arena-size-655360 = [] | 172 | task-arena-size-655360 = [] |
| 173 | ## 786432 | ||
| 115 | task-arena-size-786432 = [] | 174 | task-arena-size-786432 = [] |
| 175 | ## 1048576 | ||
| 116 | task-arena-size-1048576 = [] | 176 | task-arena-size-1048576 = [] |
| 117 | 177 | ||
| 118 | # END AUTOGENERATED CONFIG FEATURES | 178 | # END AUTOGENERATED CONFIG FEATURES |
| 179 | |||
| 180 | #! </details> \ No newline at end of file | ||
diff --git a/embassy-executor/README.md b/embassy-executor/README.md index 80ecfc71a..aa9d59907 100644 --- a/embassy-executor/README.md +++ b/embassy-executor/README.md | |||
| @@ -22,7 +22,7 @@ Tasks are allocated from the arena when spawned for the first time. If the task | |||
| 22 | The arena size can be configured in two ways: | 22 | The arena size can be configured in two ways: |
| 23 | 23 | ||
| 24 | - Via Cargo features: enable a Cargo feature like `task-arena-size-8192`. Only a selection of values | 24 | - Via Cargo features: enable a Cargo feature like `task-arena-size-8192`. Only a selection of values |
| 25 | is available, check `Cargo.toml` for the list. | 25 | is available, see [Task Area Sizes](#task-arena-size) for reference. |
| 26 | - Via environment variables at build time: set the variable named `EMBASSY_EXECUTOR_TASK_ARENA_SIZE`. For example | 26 | - Via environment variables at build time: set the variable named `EMBASSY_EXECUTOR_TASK_ARENA_SIZE`. For example |
| 27 | `EMBASSY_EXECUTOR_TASK_ARENA_SIZE=4321 cargo build`. You can also set them in the `[env]` section of `.cargo/config.toml`. | 27 | `EMBASSY_EXECUTOR_TASK_ARENA_SIZE=4321 cargo build`. You can also set them in the `[env]` section of `.cargo/config.toml`. |
| 28 | Any value can be set, unlike with Cargo features. | 28 | Any value can be set, unlike with Cargo features. |
diff --git a/embassy-executor/gen_config.py b/embassy-executor/gen_config.py index e427d29f4..cf32bd530 100644 --- a/embassy-executor/gen_config.py +++ b/embassy-executor/gen_config.py | |||
| @@ -45,6 +45,12 @@ things = "" | |||
| 45 | for f in features: | 45 | for f in features: |
| 46 | name = f["name"].replace("_", "-") | 46 | name = f["name"].replace("_", "-") |
| 47 | for val in f["vals"]: | 47 | for val in f["vals"]: |
| 48 | things += f"## {val}" | ||
| 49 | if val == f["default"]: | ||
| 50 | things += " (default)\n" | ||
| 51 | else: | ||
| 52 | things += "\n" | ||
| 53 | |||
| 48 | things += f"{name}-{val} = []" | 54 | things += f"{name}-{val} = []" |
| 49 | if val == f["default"]: | 55 | if val == f["default"]: |
| 50 | things += " # Default" | 56 | things += " # Default" |
diff --git a/embassy-executor/src/lib.rs b/embassy-executor/src/lib.rs index 4c6900a6d..eea118ade 100644 --- a/embassy-executor/src/lib.rs +++ b/embassy-executor/src/lib.rs | |||
| @@ -3,6 +3,9 @@ | |||
| 3 | #![doc = include_str!("../README.md")] | 3 | #![doc = include_str!("../README.md")] |
| 4 | #![warn(missing_docs)] | 4 | #![warn(missing_docs)] |
| 5 | 5 | ||
| 6 | //! ## Feature flags | ||
| 7 | #![doc = document_features::document_features!(feature_label = r#"<span class="stab portability"><code>{feature}</code></span>"#)] | ||
| 8 | |||
| 6 | // This mod MUST go first, so that the others see its macros. | 9 | // This mod MUST go first, so that the others see its macros. |
| 7 | pub(crate) mod fmt; | 10 | pub(crate) mod fmt; |
| 8 | 11 | ||
