Skip to content

Commit 911a44b

Browse files
committed
doc(r3): clarify that the static configuration is a compile-time operation
1 parent 02a652d commit 911a44b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/r3/src/lib.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ A system type at least implements [`r3::kernel::raw::KernelBase`][] (see [the pa
6161

6262
## Static Configuration
6363

64-
An embedded system is designed to serve a particular purpose, so it's often possible to predict many aspects of its operation, such as how many kernel objects of each kind are going to be used and how much memory is allocated in ROM and RAM. The process of collecting such information and specializing a kernel for a particular application is called **static configuration**.
64+
An embedded system is designed to serve a particular purpose, so it's often possible to predict many aspects of its operation, such as how many kernel objects of each kind are going to be used and how much memory is allocated in ROM and RAM. The process of collecting such information and specializing a kernel for a particular application *at compile time* is called **static configuration**.
6565

66-
Kernel objects are **defined** (we use this specific word for static creation) in a **configuration function** having the signature `for<C> const fn (&mut `[`r3::kernel::Cfg`][]`<C>, ...) -> T where C: `[`r3::kernel::raw_cfg::CfgBase`][]. For each system type, an application provides a **top-level configuration function**, which defines all kernel objects belonging to that system type. A kernel-provided **build macro** processes its output (which mainly involves defining `static` items to store the state of all defined kernel objects) and somehow associates it with the system type.
66+
Kernel objects are **defined** (we use this specific word for static creation) in a **configuration function** having the signature `for<C> const fn (&mut `[`r3::kernel::Cfg`][]`<C>, ...) -> T where C: `[`~const`][]` `[`r3::kernel::raw_cfg::CfgBase`][]. For each system type, an application provides a **top-level configuration function**, which defines all kernel objects belonging to that system type. A kernel-provided **build macro** processes its output (which mainly involves defining `static` items to store the state of all defined kernel objects) and somehow associates it with the system type.
6767

6868
<span class="center">![static_cfg]</span>
6969

@@ -105,6 +105,7 @@ fn task_body(_: usize) {
105105
[`r3::kernel::Cfg`]: crate::kernel::Cfg
106106
[`r3::kernel::raw_cfg::CfgBase`]: crate::kernel::raw_cfg::CfgBase
107107
[`Task`]: crate::kernel::Task
108+
[`~const`]: https://github.com/rust-lang/rust/issues/77463
108109

109110
Configuration functions are highly composable as they can make nested calls to other configuration functions. In some sense, this is a way to attribute a certain semantics to a group of kernel objects, encapsulate them, and expose a higher-level interface. For example, a [mutex object] similar to `std::sync::Mutex` can be created by combining [`kernel::Mutex`]`<System>` (a low-level mutex object) and a [`hunk::Hunk`]`<System, UnsafeCell<T>>` (a typed hunk), which in turn is built on top of [`kernel::Hunk`]`<System>` (a low-level untyped hunk).
110111

0 commit comments

Comments
 (0)