Skip to content

Commit 793072c

Browse files
Merge pull request RIOT-OS#10162 from danpetry/doc/rdm1-RIOT-design-goals
doc/rdm: RFC - design goals
2 parents 5d63e28 + c3bd937 commit 793072c

File tree

2 files changed

+338
-1
lines changed

2 files changed

+338
-1
lines changed

doc/memos/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
The index below lists the RDMs that were published so far.
44

5-
- [RDM0 : RIOT Developer Memo Format, Publishing and Maintenance Process](./rdm0000.md)
5+
- [RDM0 : RIOT Developer Memo Format, Publishing and Maintenance Process](./rdm0000.md)
6+
- [RDM1 : RIOT Design Goals](./rdm0001.md)

doc/memos/rdm0001.md

+336
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,336 @@
1+
2+
- RDM: 1
3+
- Title: RIOT Design Goals
4+
- Author: Daniel Petry
5+
- Status: Active
6+
- Type: Consensus
7+
- Created: May 2019
8+
9+
## Abstract
10+
11+
This document presents key design aspects of the RIOT operating system: its
12+
application contexts and design rationales. It aims to reflect a consensus on
13+
the reasoning behind RIOT design, in order to help new contributors get up to
14+
speed more quickly and provide common ground for technical debates.
15+
16+
## Status
17+
18+
This document is a product of the community of RIOT maintainers, and aims to
19+
represent the consensus within this community. The content of this document is
20+
licensed with a Creative Commons CC-BY-SA license.
21+
22+
## Terminology
23+
24+
Throughout this document, the term "users" refers to developers who are using
25+
RIOT as a basis to implement application software, without editing RIOT's
26+
source code. The term "developers" refers to contributors to the source code of
27+
RIOT.
28+
29+
# 1. Introduction
30+
31+
The RIOT developer community has grown from a state of a few developers in
32+
relatively close contact to a highly distributed worldwide organisation with
33+
members joining continuously. As a result, passing on underlying understanding
34+
and assumptions that drive design decisions via word-of-mouth is no longer
35+
feasible.
36+
37+
This document represents the consensus on a set of generalised, loose
38+
requirements for RIOT (in a voluntary open source context, gathering strict
39+
requirements is neither possible nor welcome).
40+
41+
The first section discusses some of the concrete [use cases](#2-use-cases)
42+
which RIOT is driven by, to give a broad awareness to the developer where and
43+
how their features will be used. Based on this bigger picture, the [design
44+
philosophies](#3-design-philosophies) in the second section provide specific
45+
guidance for design. These include a focus on constrained devices, a short
46+
learning curve, and the versatility to support a huge variety of devices and
47+
functionality.
48+
49+
# 2. Use cases
50+
51+
RIOT is a general purpose IoT operating system for low-end devices, such as
52+
those described in [1]. These devices have a low memory footprint of kilobytes
53+
rather than megabytes, going down to a few kilobytes in certain cases. As such,
54+
RIOT targets separate use cases from embedded Linux. Below is a comprehensive,
55+
but non-exhaustive list of RIOT use cases, including the general requirements
56+
placed on the devices for each one.
57+
58+
These requirements demonstrate the need for RIOT to support an extremely large
59+
number of hardware configurations: various microcontrollers bundled with
60+
various sensors and actuators and various network transceivers (radio and
61+
wired). On these, a large variety of software configurations is run: various
62+
link layer technologies and network protocol stacks, serving user application
63+
logic requiring various levels of complexity, reliability, or real-time
64+
support.
65+
66+
## 2.1. Environmental sensing
67+
68+
Networks of remote sensor nodes can be deployed to monitor the environment (air
69+
composition, temperature, light intensity, water quality...), or
70+
assist with urban planning. These devices can be distributed on their own or
71+
fit to infrastructure. In particular, the devices need to:
72+
73+
- Collect data on timescales of the order of hours or longer.
74+
- Potentially be able to send data over long ranges with low power.
75+
- Potentially operate for years without power infrastructure or maintenance.
76+
77+
## 2.2. Rapid prototyping, research, and experimentation
78+
79+
In experimentation and hacking situations, development needs to be easily
80+
accessible, and allow a short development time and quick results. In
81+
particular, this means that the software and hardware should:
82+
83+
- Let users easily write, load and run applications.
84+
- Let users easily port third party libraries.
85+
- Be usable with or without different features, including networking.
86+
- Come with an easy-to-use, versatile toolkit that has a minimum of setup time.
87+
- Let users easily run the same programs on different hardware.
88+
89+
## 2.3. Logistic tracking
90+
91+
Sensors that record environmental conditions and location can be used to manage
92+
goods in transit. In particular, these sensors need to:
93+
94+
- Last for several months without charging.
95+
- Securely collect, store and transmit sensitive data.
96+
- Send data over long ranges to regional infrastructure.
97+
98+
## 2.4. Physical system monitoring and control
99+
100+
Distributed networks of sensors (torque, rotary position...) and actuators
101+
(motors, solenoids...) can be employed in certain control applications, such as
102+
automotive systems, robotics, or Industry 4.0. In particular, the nodes need to:
103+
104+
- Collect and send data with a low latency, or at least a well synchronized
105+
timestamp.
106+
- Potentially run control algorithms themselves.
107+
- Have the timing precision to support time sensitive control.
108+
109+
## 2.5. Edge systems for building management and automation
110+
111+
Various sensing (light, temperature, humidity...) and environmental control
112+
tasks (heating, ventilation, access control...) can be done by edge nodes in
113+
buildings. In particular, the nodes need to be able to:
114+
115+
- Connect to building management system components from a range of vendors
116+
via a range of domain specific protocols, such as BACnet and Modbus.
117+
- Integrate with in-house cyber security management systems.
118+
119+
## 2.6. Smart home
120+
121+
Smart home use cases have monitoring and control aims which overlap with
122+
commercial building management. However, in the smart home there is less
123+
technical equipment, different protocols, and different system management
124+
criteria. In particular, the nodes here need to be able to:
125+
126+
- Connect to home networking equipment from a range of vendors via common
127+
protocols for constrained devices in the home, such as BLE, 802.15.4 and
128+
WiFi.
129+
- Ensure the privacy of end users in an easy-to-use fashion.
130+
131+
## 2.7. Daughterboards
132+
133+
Plug-in boards can give devices immediate support for a protocol or standard,
134+
or let them outsource a task from the main processor. In particular, this
135+
requires the board to:
136+
137+
- Support on-chip low-level wired communication.
138+
139+
## 2.8. Education
140+
141+
The broad technical scope of RIOT makes it useful as a basis for education.
142+
In particular, this requires:
143+
144+
- The presence of didactic materials related to RIOT.
145+
- The presence of tooling suitable to a classroom context.
146+
147+
# 3. Design philosophies
148+
149+
Below are the design philosophies that are typically followed by developers to
150+
cater for the above use cases. The sections below include descriptions of
151+
tradeoffs between the philosophies, and where the resolutions typically fall.
152+
153+
## Suitability for constrained devices
154+
155+
"Constrained" means that available memory, energy, and processor cycles are so
156+
reduced as to become a dominant consideration in design requirements [1].
157+
158+
#### Energy efficiency
159+
160+
RIOT nodes sometimes need to last for several years without external power, so
161+
they need to manage energy carefully. RIOT's tickless scheduler lets devices
162+
sleep while they aren't active.
163+
164+
Developers of modules outside the core should leverage the benefits and address
165+
the programming challenges of such a scheduler. An idling device should
166+
conserve energy wherever possible, by default. For case specific power
167+
management, appropriate control should be available to the user. This should
168+
not include having to cope with scheduler details or set hardware power modes
169+
explicitly.
170+
171+
#### Small memory footprint
172+
173+
Apart from being optimized for low memory usage, RIOT is modular so unused
174+
features don't use up precious RAM or flash. Almost all features are provided
175+
as optional modules that have to be enabled explicitly at compile time. A
176+
minimal RIOT configuration starts at around <2KiB flash and <1.5KiB RAM
177+
(including stack space for one thread and ISRs).
178+
179+
Starting from there, the memory usage depends on the enabled features:
180+
181+
- Non-networked control loop / sensing applications can fit on very small MCUs
182+
(eg., an Atmega328P with 2KiB RAM)
183+
- 6lowPAN networking currently starts at ~40KiB ROM and ~10KiB RAM
184+
- A 6LoWPAN enabled CoAP server and COSE end-to-end security (with ed25519
185+
signatures in software) requires ~60KiB ROM and ~15KiB RAM
186+
- a file system adds ~15 KiB ROM and ~2 KiB RAM
187+
188+
#### Networking
189+
190+
RIOT should deliver communication robustness and interoperability. We prefer
191+
open standards over proprietary solutions.
192+
193+
The interfaces to network stacks (netdev, sock) are designed to be agnostic to
194+
the stack itself. The stacks themselves can therefore be interchanged freely.
195+
The design of the default networking stack (GNRC) prioritizes modularity and
196+
extensibility over memory usage. This ensures that users can adapt the stack to
197+
their use cases, and developers can easily extend it as further standards and
198+
amendments are published.
199+
200+
## Short learning curve
201+
202+
RIOT's use cases involve makers, researchers in (non-)computer science fields,
203+
broadly skilled engineers making vertically integrated IoT proofs-of-concept,
204+
and experienced embedded C developers.
205+
206+
These should be comfortable using RIOT and its tooling, on typical platforms.
207+
RIOT should demand as little RIOT-specific learning as possible. It should,
208+
therefore, adhere to common systems and networking standards.
209+
210+
## Versatility
211+
212+
The use cases for real-time embedded systems are manifold, and so are their
213+
requirements. Therefore, design decisions in RIOT should not prefer one
214+
technology or one protocol over another.
215+
216+
Default configurations should support as many users and use cases as possible.
217+
RIOT should aim at providing everything users need, either in its code base or
218+
in the external packages it supports. The list of hardware, algorithms and
219+
other elements that RIOT supports should constantly be expanding.
220+
221+
## Vendor and technology independence
222+
223+
Vendors and technologies are supported equally, except for a bias towards open
224+
standards. This means users can choose what's best for them, without being led
225+
by RIOT. Moreover, RIOT is Free Software [2], which means users are free to use
226+
it as they wish without lock-in.
227+
228+
## Modularity
229+
230+
RIOT decomposes into fine-grained modules. This level of modularity lets RIOT
231+
address many different memory, functionality, and performance demands. It also
232+
helps development efforts to scale in a widely distributed community.
233+
234+
Modules should be abstracted from one another as cleanly as possible. It should
235+
be easy for users to manage or exploit this modularity, for example through
236+
configuration methods, easy integration of third-party source code, or
237+
different levels of modularity. The granularity of sub-modules for a module
238+
should be chosen pragmatically, taking the type, context, and impact of the
239+
module into account. Users shouldn't want to split modules, but they shouldn't
240+
be unnecessarily fine-grained either.
241+
242+
## Cross-hardware portability
243+
244+
Users might want to write a program for one piece of hardware, and later run it
245+
on another. RIOT should let user code be completely portable, so long as it
246+
remains valid with the hardware.
247+
248+
The hardware abstraction layer should be stable, well defined and consistent.
249+
Above the HAL, the only thing that modules should know about hardware is
250+
whether its build dependencies are provided or not. If they aren't, the module
251+
should adapt accordingly, or not compile.
252+
253+
## Real-time capabilities
254+
255+
Different real-time guarantees are required for different use cases. Low
256+
frequency sensing needs only soft real-time support and can handle less timing
257+
accuracy so long as the timers support long timescales. Sensing and control
258+
applications which do not require hard real-time guarantees are also supported.
259+
260+
RIOT should deliver soft real-time guarantees which address the use cases given
261+
in section 2. It should provide timers which can competently handle the
262+
timescales of any application.
263+
264+
## Interoperability
265+
266+
RIOT nodes need to communicate reliably with non-RIOT nodes by carefully
267+
implementing open protocol standards or identical technological specifications.
268+
269+
RIOT should support standards once they have reached a certain level of
270+
maturity and popularity. It should be configurable so that users can choose
271+
which (optional) features of specifications they want to include. Whatever the
272+
configuration, nodes should handle all possible traffic in a compliant manner.
273+
274+
## Stability
275+
276+
Nodes shouldn't fail because of RIOT, whatever the platform. Assuming perfect
277+
hardware and a moderately well-written application, they should be able to run
278+
indefinitely.
279+
280+
The testing and peer review processes that ensure this should be under
281+
continuous review and refinement, including automating them where it's
282+
possible. Error handling should guarantee stability with minimal memory usage.
283+
284+
## Unified APIs
285+
286+
RIOT wants to ease development for users by providing a similar "look and feel"
287+
across all our APIs.
288+
289+
RIOT's interfaces should only differ in the ways that their modules differ.
290+
Where possible, layers should exist that sit on top of a certain class of
291+
modules to give an identical interface to the user. Semantic and naming
292+
conventions should be consistent throughout the system.
293+
294+
## Cyber security
295+
296+
RIOT nodes need to be resilient against cyber attacks.
297+
298+
It should be hard against all the threats a node is likely to experience,
299+
depending on the situation, including those from computers with many times
300+
their processing power. Security should be as easy to use as possible while
301+
still strong. Security flaws should be patched as quickly as possible by
302+
servicing a security alert channel with high priority. Convenient updating
303+
mechanisms should allow users to apply patches to their nodes, wherever they
304+
are.
305+
306+
# Acknowledgements
307+
308+
This document follows previous work on documenting RIOT's design priorities [3]
309+
[4].
310+
311+
Thanks to E. Baccelli, K. Bannister, M. Lenders, M. Rottleuthner, K. Schleiser,
312+
T. Schmidt, M. Waehlisch, K. Zandberg, and all others who have contributed to
313+
the review of this document.
314+
315+
# References
316+
317+
[1] [C. Bormann, M. Ersue, A. Keranen: "Terminology for Constrained-Node
318+
Networks.", RFC, No. 7228, RFC-Editor, May 2014.](https://tools.ietf.org/html/rfc7228) \
319+
[2] [“What Is Free Software?” _GNU Operating System_, 15 Dec. 2018,
320+
www.gnu.org/philosophy/free-sw.en.html.](https://www.gnu.org/philosophy/free-sw.en.html) \
321+
[3] [Emmanuel Baccelli, Oliver Hahm, Mesut Günes, Matthias Wählisch, Thomas C.
322+
Schmidt, "RIOT OS: Towards an OS for the Internet of Things," in Proceedings of
323+
the 32nd IEEE International Conference on Computer Communications (INFOCOM),
324+
Poster, p. 79–80, IEEE Press, April 2013.](https://www.riot-os.org/docs/riot-infocom2013-abstract.pdf) \
325+
[4] [E. Baccelli, C. Gündogan, O. Hahm, P. Kietzmann, M. Lenders, H. Petersen,
326+
K. Schleiser, T.C. Schmidt, M. Wählisch: "RIOT: an Open Source Operating System
327+
for Low-end Embedded Devices in the IoT", IEEE Internet of Things Journal, Vol.
328+
5, No. 6, p. 4428- 4440, IEEE, December 2018.](http://ilab-pub.imp.fu-berlin.de/papers/bghkl-rosos-18-prepub.pdf)
329+
330+
# Revisions
331+
332+
Rev0: initial document
333+
334+
## Contact
335+
336+
The author of this memo can be contacted via email at [email protected]

0 commit comments

Comments
 (0)