-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
160 lines (155 loc) · 6.85 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
---
layout: default
---
<p>
Drone is an Embedded Operating System for writing real-time applications in
Rust. It aims to bring modern development approaches without compromising
performance into the world of embedded programming.
</p>
<h1>Quick Tour</h2>
<div class="quick-tour">
<ul class="quick-tour-tabs">
<li><a href="#templates" class="item active">Getting Started</a></li>
<li><a href="#async_await" class="item">Async/Await</a></li>
<li><a href="#heap" class="item">Dynamic Memory</a></li>
<li><a href="#registers" class="item">Memory-Mapped Registers</a></li>
<li><a href="#threads" class="item">Threads</a></li>
<li><a href="#peripherals" class="item">Generic Peripherals</a></li>
<li><a href="#log" class="item">Logging</a></li>
<li><a href="#safety" class="item">Safety</a></li>
</ul>
<div class="quick-tour-content">
<div id="templates" class="quick-tour-block active">
<p>
<code>cargo</code> takes development comfort to the next level,
and Drone extends its philosophy to the embedded world. If your
target chip and debug probe are supported by Drone, you can
flash your first program and get a feedback right away!
</p>
<figure class="highlight"><pre class="solarized">{% include templates %}</pre></figure>
</div>
<div id="async_await" class="quick-tour-block">
<p>
Each interrupt is an executor for <code>async</code>
tasks. Thanks to Rust's zero-cost asynchronous programming your
interrupt handlers look like a conventional synchronous code,
except they don't need separate stacks.
</p>
{% highlight rust %}{% include async_await.rs %}{% endhighlight %}
</div>
<div id="heap" class="quick-tour-block">
<p>
Drone includes a dynamic memory allocator that allows you to use
familiar
Rust's <code>Box</code>, <code>Vec</code>, <code>String</code>, <code>Arc</code>,
and other dynamic types. It is lock-free, deterministic, and has
a small code footprint, which makes it useful even on simplest
micro-controllers. The cost is that it requires tuning for each
particular application. Drone automates this by providing
utilities for collecting real-time allocator statistics and
calculating an optimized layout configuration.
</p>
<figure class="highlight"><pre class="solarized">{% include heap %}</pre></figure>
</div>
<div id="registers" class="quick-tour-block">
<p>
Drone provides a rich API for working safely with memory-mapped
registers. An application starts with a set of zero-sized unique
tokens for all available registers. A token can have move or
copy semantics, can be shareable with atomic access or
non-shareable with non-atomic access, can be split into
individual register field tokens.
</p>
{% highlight rust %}{% include registers.rs %}{% endhighlight %}
</div>
<div id="threads" class="quick-tour-block">
<p>
Drone uses interrupt-based preemptive priority scheduling, where
tasks with same priorities are executed cooperatively. An
application has a predefined number of threads corresponding to
hardware interrupts, but each thread can run dynamic number of
fibers.
</p>
{% highlight rust %}{% include threads.rs %}{% endhighlight %}
</div>
<div id="peripherals" class="quick-tour-block">
<p>
Registers and individual register fields can be grouped into
peripheral blocks. Drone makes a great effort to abstract from
different instances of one peripheral type. Even if these
instances have minor differences.
</p>
{% highlight rust %}{% include peripherals.rs %}{% endhighlight %}
</div>
<div id="log" class="quick-tour-block">
<p>
Drone provides an abstract logging facade designed after ARM
Serial Wire Output. The output can be captured with a generic
USB-UART adapter. It has 32 multiplexed streams and supports
atomic packets up to 4 bytes. Familiar Rust macros
like <code>print!</code>, <code>eprint!</code>, <code>dbg!</code>
are mapped to reserved #0 and #1 ports that work as standard
output and standard error respectively.
</p>
{% highlight rust %}{% include log.rs %}{% endhighlight %}
</div>
<div id="safety" class="quick-tour-block">
<p>
Drone provides safe API for inherently unsafe low-level
operations. The only required unsafe function is the entry-point
located at <code>src/bin.rs</code>, which is a separate
compilation unit. You can even write a whole micro-controller
firmware with <code>#![forbid(unsafe_code)]</code> at the top
of <code>src/lib.rs</code>.
</p>
{% highlight rust %}{% include safety.rs %}{% endhighlight %}
</div>
</div>
</div>
<h1>Design Principles</h2>
<ul>
<li>
<p>
<em>Energy effective from the start</em>. Drone encourages
interrupt-driven execution model.
</p>
</li>
<li>
<p>
<em>Hard Real-Time</em>. Drone relies on atomic operations instead
of using critical sections.
</p>
</li>
<li>
<p>
<em>Fully preemptive multi-tasking with strict priorities</em>. A
higher priority task takes precedence with minimal latency.
</p>
</li>
<li>
<p>
<em>Highly concurrent</em>. Multi-tasking is cheap and safe,
following Rust's Fearless Concurrency principle.
</p>
</li>
<li>
<p>
<em>Message passing concurrency</em>. Drone ships with
synchronization primitives out of the box.
</p>
</li>
<li>
<p>
<em>Single stack by default</em>. Drone concurrency primitives are
essentially stack-less state machines. But <em>stackful tasks are
still supported</em>.
</p>
</li>
<li>
<p>
<em>Dynamic memory enabled</em>. Drone lets you use convenient data
structures like mutable strings or vectors while still staying
deterministic and code efficient.
</p>
</li>
</ul>