You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-17Lines changed: 25 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -10,30 +10,36 @@
10
10
<ahref="https://repl.it/@yvt/R3-Kernel-Hosted-Port#main.rs"><b>Try it on Repl.it</b></a>
11
11
</p>
12
12
13
-
R3 is a proof-of-concept of a static RTOS that utilizes Rust's compile-time function evaluation mechanism for static configuration (creation of kernel objects and memory allocation).
13
+
R3 is a proof-of-concept of a static RTOS that utilizes Rust's compile-time function evaluation mechanism for static configuration (creation of kernel objects and memory allocation) and const traits to decouple kernel interfaces from implementation.
14
14
15
15
-**All kernel objects are defined statically** for faster boot times, compile-time checking, predictable execution, reduced RAM consumption, no runtime allocation failures, and extra security.
16
-
-The kernel and its configurator **don't require an external build tool or a specialized procedural macro**, maintaining transparency.
17
-
- The kernel is split into a target-independent portion and a target-specific portion. The target-specific portion (called *a port*) is provided as a separate crate. An application **combines them using the trait system**.
16
+
-A kernel and its configurator **don't require an external build tool or a specialized procedural macro**, maintaining transparency and inter-crate composability.
17
+
- The kernel API is **not tied to a specific kernel implementation**. Kernels are provided as separate crates, one of which an application chooses and instantiates using the trait system.
18
18
- Leverages Rust's type safety for access control of kernel objects. Safe code can't access an object that it doesn't own.
19
19
20
-
## Features
21
-
22
-
- Traditional uniprocessor tickless real-time kernel with preemptive scheduling
20
+
## R3 API
23
21
24
22
-**Tasks** are kernel objects associated with application threads and encapsulate their execution states. Tasks can be activated by application code or automatically at boot time. Tasks are assigned priorities (up to 2¹⁵ levels on a 32-bit target, though the implementation is heavily optimized for a smaller number of priorities), which can be changed at runtime. A task can enable **Priority Boost** to temporarily raise its priority to higher than any other tasks. The number of tasks is only limited by memory available.
25
23
26
-
-This kernel provides a unified interface to control **interrupt lines** and register **interrupt handlers**. In addition, the Arm M-Profile port supports **unmanaged interrupt lines**, which aren't masked when the kernel is handling a system call.
24
+
-R3 provides a unified interface to control **interrupt lines** and register **interrupt handlers**. In addition, the Arm M-Profile port supports **unmanaged interrupt lines**, which aren't masked when the kernel is handling a system call.
27
25
28
-
-This kernel supports common synchronization primitives such as **mutexes**, **semaphores**, and **event groups**. The mutexes can use [the priority ceiling protocol] to avoid unbounded priority inversion and mutual deadlock. Tasks can **park** themselves.
26
+
-R3 supports common synchronization primitives such as **mutexes**, **semaphores**, and **event groups**. The mutexes can use [the priority ceiling protocol] to avoid unbounded priority inversion and mutual deadlock. Tasks can **park** themselves.
29
27
30
28
- The kernel timing mechanism drives **software timers** and a **system-global clock** with microsecond precision. The system clock can be rewound or fast-forwarded for drift compensation. The timing algorithm has a logarithmic time complexity and is therefore scalable. The implementation is robust against a large interrupt processing delay.
31
29
32
30
- The utility library includes safe container types such as **`Mutex`** and **`RecursiveMutex`**, which are built upon low-level synchronization primitives.
The R3 original kernel is provided as a separate package [`r3_kernel`][].
37
+
38
+
- Traditional uniprocessor tickless real-time kernel with preemptive scheduling
39
+
34
40
- Supports **Arm M-Profile** (all versions shipped so far), **Armv7-A** (no FPU), **RISC-V** as well as **the simulator port** that runs on a host system.
Copy file name to clipboardExpand all lines: doc/guidelines.md
+6-8Lines changed: 6 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -61,17 +61,15 @@ Exceptions:
61
61
62
62
### Optional features should be documented properly (CC-DOC-OPT-FEATURES)
63
63
64
-
All optional features of `r3` must be listed and explained in the crate-level documentation.
64
+
All optional features of `r3`and `r3_kernel`must be listed and explained in the crate-level documentation.
65
65
66
66
In addition, every public item gated by such features must have [`#[doc(cfg(feature = ...))]` attribute](https://github.com/rust-lang/rust/issues/43781), which displays the required feature on the generated documentation.
67
67
68
68
```rust
69
-
/// Get the current [system time].
70
-
///
71
-
/// [system time]: crate#kernel-timing
69
+
/// Get the current system time.
72
70
#[cfg(feature ="system_time")]
73
71
#[doc(cfg(feature ="system_time"))]
74
-
fntime() ->Result<Time, TimeError>;
72
+
pubfntime() ->Result<Time, TimeError>;
75
73
```
76
74
77
75
## Testing
@@ -107,18 +105,18 @@ The runtime overhead caused by unused features should be minimized or eliminated
107
105
108
106
Example: If no startup hooks are defined, the compiler will simply remove the startup hook initialization loop because it can figure out that `STARTUP_HOOKS` has no elements.
109
107
110
-
- If the usage of such features can be detected statically in a configuration macro (e.g., `r3::build!`), the macro should control the type choices based on that.
108
+
- If the usage of such features can be detected statically in a configuration macro (e.g., `r3_kernel::build!`), the macro should control the type choices based on that.
111
109
112
110
Examples:
113
111
114
112
-`r3_portkit::tickful::TickfulState` (used by timer drivers) chooses the optimal algorithm based on parameters.
115
113
116
114
- Kernel objects are defined statically and their control blocks are stored in static arrays.
117
115
118
-
- If the above options are infeasible, expose either a `CfgBuilder` method or a Cargo feature to let downstream crates and application developers specify whether a feature should be compiled in.
116
+
- If the above options are infeasible, expose either a method in `Cfg` or a Cargo feature to let downstream crates and application developers specify whether a feature should be compiled in.
119
117
120
118
Examples:
121
119
122
120
- The system clock is controlled by `system_time` feature. The system time is tracked by an internal variable that is updated on timer interrupts, and there's no hope of the compiler optimizing this out. It's impossible for `build!` to detect the usage of `System::time()`. The system clock is not tied to any particular kernel objects, so the software components dependent on the system clock might not have a configuration function. On the other hand, Cargo features are designed exactly for this use case.
123
121
124
-
- Application code can change task priorities at runtime. The maximum (lowest) priority affects the size of internal kernel structures, but it's impossible for `build!` to figure that out. Therefore, `CfgBuilder` exposes `num_task_priority_levels` method.
122
+
- Application code can change task priorities at runtime. The maximum (lowest) priority affects the size of internal kernel structures, but it's impossible for `build!` to figure that out. Therefore, `Cfg` exposes `num_task_priority_levels` method.
0 commit comments