aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarnaby Walters <[email protected]>2023-12-22 19:05:16 +0100
committerBarnaby Walters <[email protected]>2023-12-22 19:05:16 +0100
commit6bbc316312b2ba372ea05c52924d99bc4fb5382a (patch)
treef653e192f72b0762c9bd185a9f9ba0194bac3c88
parent87c03037e320ce30c0cd34fe97e0365e1b11aa9a (diff)
[embassy-executor] improved documentation
* Feature auto-documentation * Task arena sizes in a <details> list * Non-documented comment explaining turbowakers with see-also link Further improvements: * Are the task-arena-size-* numbers sizes in bytes? or something else? * Task arena section could benefit from advice about how to choose a suitable size
-rw-r--r--embassy-executor/Cargo.toml80
-rw-r--r--embassy-executor/README.md2
-rw-r--r--embassy-executor/gen_config.py6
-rw-r--r--embassy-executor/src/lib.rs3
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
36embassy-time = { version = "0.2", path = "../embassy-time", optional = true} 36embassy-time = { version = "0.2", path = "../embassy-time", optional = true}
37critical-section = "1.1" 37critical-section = "1.1"
38 38
39document-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
41portable-atomic = { version = "1.5", optional = true } 43portable-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
59nightly = ["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
64turbowakers = []
65
66## Use timers from `embassy-time`
67integrated-timers = ["dep:embassy-time"]
68
69#! ### Architecture
57_arch = [] # some arch was picked 70_arch = [] # some arch was picked
71## std
58arch-std = ["_arch", "critical-section/std"] 72arch-std = ["_arch", "critical-section/std"]
73## Cortex-M
59arch-cortex-m = ["_arch", "dep:cortex-m"] 74arch-cortex-m = ["_arch", "dep:cortex-m"]
75## RISC-V 32
60arch-riscv32 = ["_arch", "dep:portable-atomic"] 76arch-riscv32 = ["_arch", "dep:portable-atomic"]
77## WASM
61arch-wasm = ["_arch", "dep:wasm-bindgen", "dep:js-sys"] 78arch-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)
64executor-thread = [] 83executor-thread = []
65# Enable the interrupt-mode executor (available in Cortex-M only) 84## Enable the interrupt-mode executor (available in Cortex-M only)
66executor-interrupt = [] 85executor-interrupt = []
67 86
68# Enable nightly-only features 87#! ### Task Arena Size
69nightly = ["embassy-executor-macros/nightly"] 88#! Sets the [task arena](#task-arena) size. Necessary if you’re not using `nightly`.
70 89#!
71turbowakers = [] 90#! <details>
72 91#! <summary>Preconfigured Task Arena Sizes:</summary>
73integrated-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
77task-arena-size-64 = [] 98task-arena-size-64 = []
99## 128
78task-arena-size-128 = [] 100task-arena-size-128 = []
101## 192
79task-arena-size-192 = [] 102task-arena-size-192 = []
103## 256
80task-arena-size-256 = [] 104task-arena-size-256 = []
105## 320
81task-arena-size-320 = [] 106task-arena-size-320 = []
107## 384
82task-arena-size-384 = [] 108task-arena-size-384 = []
109## 512
83task-arena-size-512 = [] 110task-arena-size-512 = []
111## 640
84task-arena-size-640 = [] 112task-arena-size-640 = []
113## 768
85task-arena-size-768 = [] 114task-arena-size-768 = []
115## 1024
86task-arena-size-1024 = [] 116task-arena-size-1024 = []
117## 1280
87task-arena-size-1280 = [] 118task-arena-size-1280 = []
119## 1536
88task-arena-size-1536 = [] 120task-arena-size-1536 = []
121## 2048
89task-arena-size-2048 = [] 122task-arena-size-2048 = []
123## 2560
90task-arena-size-2560 = [] 124task-arena-size-2560 = []
125## 3072
91task-arena-size-3072 = [] 126task-arena-size-3072 = []
127## 4096 (default)
92task-arena-size-4096 = [] # Default 128task-arena-size-4096 = [] # Default
129## 5120
93task-arena-size-5120 = [] 130task-arena-size-5120 = []
131## 6144
94task-arena-size-6144 = [] 132task-arena-size-6144 = []
133## 8192
95task-arena-size-8192 = [] 134task-arena-size-8192 = []
135## 10240
96task-arena-size-10240 = [] 136task-arena-size-10240 = []
137## 12288
97task-arena-size-12288 = [] 138task-arena-size-12288 = []
139## 16384
98task-arena-size-16384 = [] 140task-arena-size-16384 = []
141## 20480
99task-arena-size-20480 = [] 142task-arena-size-20480 = []
143## 24576
100task-arena-size-24576 = [] 144task-arena-size-24576 = []
145## 32768
101task-arena-size-32768 = [] 146task-arena-size-32768 = []
147## 40960
102task-arena-size-40960 = [] 148task-arena-size-40960 = []
149## 49152
103task-arena-size-49152 = [] 150task-arena-size-49152 = []
151## 65536
104task-arena-size-65536 = [] 152task-arena-size-65536 = []
153## 81920
105task-arena-size-81920 = [] 154task-arena-size-81920 = []
155## 98304
106task-arena-size-98304 = [] 156task-arena-size-98304 = []
157## 131072
107task-arena-size-131072 = [] 158task-arena-size-131072 = []
159## 163840
108task-arena-size-163840 = [] 160task-arena-size-163840 = []
161## 196608
109task-arena-size-196608 = [] 162task-arena-size-196608 = []
163## 262144
110task-arena-size-262144 = [] 164task-arena-size-262144 = []
165## 327680
111task-arena-size-327680 = [] 166task-arena-size-327680 = []
167## 393216
112task-arena-size-393216 = [] 168task-arena-size-393216 = []
169## 524288
113task-arena-size-524288 = [] 170task-arena-size-524288 = []
171## 655360
114task-arena-size-655360 = [] 172task-arena-size-655360 = []
173## 786432
115task-arena-size-786432 = [] 174task-arena-size-786432 = []
175## 1048576
116task-arena-size-1048576 = [] 176task-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
22The arena size can be configured in two ways: 22The 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 = ""
45for f in features: 45for 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.
7pub(crate) mod fmt; 10pub(crate) mod fmt;
8 11