Convert Figma logo to code with AI

RIOT-OS logoRIOT

RIOT - The friendly OS for IoT

4,911
1,985
4,911
732

Top Related Projects

10,675

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.

Contiki-NG: The OS for Next Generation IoT Devices

'Classic' FreeRTOS distribution. Started as Git clone of FreeRTOS SourceForge SVN repo. Submodules the kernel.

4,667

Arm Mbed OS is a platform operating system designed for the internet of things

5,341

A secure embedded operating system for microcontrollers

Quick Overview

RIOT-OS/RIOT is an open-source, real-time multi-threading operating system designed for Internet of Things (IoT) devices. It supports a wide range of low-power microcontrollers and provides a consistent API across different hardware platforms. RIOT-OS aims to bridge the gap between operating systems for wireless sensor networks and traditional full-fledged operating systems.

Pros

  • Highly modular and customizable architecture
  • Extensive hardware support for various microcontrollers and IoT platforms
  • Energy-efficient design suitable for resource-constrained devices
  • Active community and regular updates

Cons

  • Steeper learning curve compared to simpler embedded frameworks
  • Limited documentation for some advanced features
  • May have higher memory footprint compared to bare-metal solutions for very simple applications

Code Examples

  1. Creating a simple thread:
#include "thread.h"

static char stack[THREAD_STACKSIZE_DEFAULT];

void *thread_handler(void *arg)
{
    (void) arg;
    while (1) {
        printf("Hello from thread!\n");
        thread_sleep();
    }
    return NULL;
}

int main(void)
{
    thread_create(stack, sizeof(stack), THREAD_PRIORITY_MAIN - 1,
                  THREAD_CREATE_STACKTEST, thread_handler, NULL, "example_thread");
    return 0;
}
  1. Using the RIOT shell:
#include "shell.h"

static int cmd_hello(int argc, char **argv)
{
    (void)argc;
    (void)argv;
    printf("Hello World!\n");
    return 0;
}

static const shell_command_t shell_commands[] = {
    { "hello", "prints 'Hello World'", cmd_hello },
    { NULL, NULL, NULL }
};

int main(void)
{
    char line_buf[SHELL_DEFAULT_BUFSIZE];
    shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);

    return 0;
}
  1. Using the RIOT networking stack:
#include "net/gnrc.h"
#include "net/gnrc/ipv6.h"
#include "net/gnrc/udp.h"

#define SERVER_PORT 8888

static void start_server(void)
{
    gnrc_netreg_entry_t server = GNRC_NETREG_ENTRY_INIT_PID(SERVER_PORT,
                                                            gnrc_getpid());
    gnrc_netreg_register(GNRC_NETTYPE_UDP, &server);

    while (1) {
        msg_t msg;
        msg_receive(&msg);
        // Handle incoming messages
    }
}

int main(void)
{
    gnrc_netif_init_all();
    start_server();
    return 0;
}

Getting Started

  1. Clone the RIOT repository:

    git clone https://github.com/RIOT-OS/RIOT.git
    
  2. Set up the toolchain for your target board (e.g., arm-none-eabi-gcc for ARM-based boards).

  3. Build and flash a simple example:

    cd RIOT/examples/hello-world
    BOARD=<your-board> make all flash
    
  4. Connect to the board's serial output to see the "Hello World!" message.

For more detailed instructions, refer to the official RIOT documentation.

Competitor Comparisons

10,675

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.

Pros of Zephyr

  • Broader hardware support and more extensive device drivers
  • Stronger focus on security features and certifications
  • More comprehensive documentation and user guides

Cons of Zephyr

  • Steeper learning curve due to its complexity
  • Larger memory footprint, which may be an issue for resource-constrained devices

Code Comparison

RIOT example (simple thread creation):

#include "thread.h"

void *thread_handler(void *arg)
{
    // Thread logic here
    return NULL;
}

int main(void)
{
    thread_create(stack, sizeof(stack), THREAD_PRIORITY_MAIN - 1, 0, thread_handler, NULL, "example_thread");
    return 0;
}

Zephyr example (simple thread creation):

#include <zephyr.h>

void thread_entry(void *p1, void *p2, void *p3)
{
    // Thread logic here
}

K_THREAD_DEFINE(my_thread, STACK_SIZE, thread_entry, NULL, NULL, NULL, PRIORITY, 0, 0);

Both RIOT and Zephyr are popular open-source operating systems for IoT and embedded devices. While RIOT focuses on simplicity and a smaller footprint, Zephyr offers more features and broader hardware support. The code examples demonstrate the different approaches to thread creation in each system, with RIOT using a more traditional C-style function call and Zephyr utilizing a macro-based definition.

Contiki-NG: The OS for Next Generation IoT Devices

Pros of Contiki-NG

  • Lighter memory footprint, suitable for more constrained devices
  • Strong focus on IPv6 and 6LoWPAN networking protocols
  • Well-established in academic research and IoT projects

Cons of Contiki-NG

  • Smaller developer community compared to RIOT
  • Less extensive hardware support
  • More limited POSIX compliance

Code Comparison

RIOT example (main.c):

#include <stdio.h>

int main(void)
{
    puts("Hello World from RIOT!");
    return 0;
}

Contiki-NG example (hello-world.c):

#include "contiki.h"
#include <stdio.h>

PROCESS(hello_world_process, "Hello world process");
AUTOSTART_PROCESSES(&hello_world_process);

PROCESS_THREAD(hello_world_process, ev, data)
{
  PROCESS_BEGIN();
  printf("Hello, world\n");
  PROCESS_END();
}

The code examples highlight the different programming models: RIOT uses a traditional C main() function, while Contiki-NG employs a process-based approach with its own macros and structures. This reflects the distinct design philosophies of the two operating systems, with RIOT aiming for a more familiar programming experience and Contiki-NG focusing on its event-driven, protothreaded architecture.

'Classic' FreeRTOS distribution. Started as Git clone of FreeRTOS SourceForge SVN repo. Submodules the kernel.

Pros of FreeRTOS

  • Widely adopted and supported in the embedded industry
  • Extensive documentation and learning resources available
  • Smaller memory footprint, suitable for resource-constrained devices

Cons of FreeRTOS

  • Limited networking capabilities compared to RIOT
  • Less extensive hardware abstraction layer
  • Fewer built-in features for IoT applications

Code Comparison

RIOT example (network initialization):

#include "net/gnrc.h"

int main(void) {
    gnrc_netif_t *netif = gnrc_netif_iter(NULL);
    gnrc_netif_init(netif);
    // ...
}

FreeRTOS example (task creation):

#include "FreeRTOS.h"
#include "task.h"

void vTaskFunction(void *pvParameters) {
    for (;;) {
        // Task code here
    }
}

int main(void) {
    xTaskCreate(vTaskFunction, "ExampleTask", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL);
    vTaskStartScheduler();
    // ...
}

Both RIOT and FreeRTOS are popular real-time operating systems for embedded devices. RIOT focuses more on IoT applications with extensive networking support, while FreeRTOS is known for its simplicity and wide industry adoption. RIOT provides a more comprehensive set of features out-of-the-box, whereas FreeRTOS offers a leaner core that can be extended with additional libraries as needed.

4,667

Arm Mbed OS is a platform operating system designed for the internet of things

Pros of mbed-os

  • More extensive hardware support, especially for ARM-based microcontrollers
  • Comprehensive documentation and tutorials for beginners
  • Strong industry backing and commercial support from ARM

Cons of mbed-os

  • Larger memory footprint compared to RIOT
  • Less flexible for non-ARM architectures
  • Steeper learning curve for advanced users

Code Comparison

mbed-os example:

#include "mbed.h"

DigitalOut led(LED1);

int main() {
    while (1) {
        led = !led;
        ThisThread::sleep_for(500ms);
    }
}

RIOT example:

#include "periph/gpio.h"
#include "xtimer.h"

int main(void) {
    gpio_t led = GPIO_PIN(0, 0);
    gpio_init(led, GPIO_OUT);
    while (1) {
        gpio_toggle(led);
        xtimer_sleep(1);
    }
}

Both examples demonstrate LED blinking, but RIOT uses a more low-level approach with direct GPIO manipulation, while mbed-os provides a higher-level abstraction with the DigitalOut class.

5,341

A secure embedded operating system for microcontrollers

Pros of Tock

  • Written in Rust, providing memory safety and concurrency guarantees
  • Designed for security-critical applications with hardware isolation
  • Supports dynamic loading of user-space applications

Cons of Tock

  • Smaller community and ecosystem compared to RIOT
  • Limited hardware support due to its focus on specific architectures
  • Steeper learning curve for developers unfamiliar with Rust

Code Comparison

Tock (Rust):

pub struct Timer<'a> {
    timer: &'a dyn TimerDriver,
    alarm: &'a dyn AlarmDriver,
}

RIOT (C):

typedef struct {
    uint32_t target;
    uint32_t long_target;
    int16_t pid;
} timer_t;

Both RIOT and Tock are open-source operating systems for IoT and embedded devices. RIOT is written in C and focuses on a wide range of hardware platforms, while Tock is written in Rust and emphasizes security and hardware isolation. RIOT has a larger community and more extensive hardware support, making it suitable for a broader range of applications. Tock, on the other hand, offers stronger memory safety guarantees and is well-suited for security-critical projects. The choice between the two depends on the specific requirements of the project, the target hardware, and the development team's expertise.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Nightly CI status master GitHub release License API docs Wiki Stack Overflow questions Mastodon Matrix

The friendly Operating System for IoT!

RIOT is an open-source microcontroller operating system, designed to match the requirements of Internet of Things (IoT) devices and other embedded devices. It supports a range of devices that are typically found in the Internet of Things (IoT): 8-bit, 16-bit and 32-bit microcontrollers.

RIOT is based on the following design principles: energy-efficiency, real-time capabilities, small memory footprint, modularity, and uniform API access, independent of the underlying hardware (this API offers partial POSIX compliance).

RIOT is developed by an international open source community which is independent of specific vendors (e.g. similarly to the Linux community). RIOT is licensed with LGPLv2.1, a copyleft license which fosters indirect business models around the free open-source software platform provided by RIOT, e.g. it is possible to link closed-source code with the LGPL code.

Features

RIOT provides features including, but not limited to:

  • a preemptive, tickless scheduler with priorities
  • flexible memory management
  • high resolution, long-term timers
  • MTD abstraction layer
  • File System integration
  • support 200+ boards based on AVR, MSP430, ESP8266, ESP32, RISC-V, ARM7 and ARM Cortex-M
  • the native port allows to run RIOT as-is on Linux and BSD. Multiple instances of RIOT running on a single machine can also be interconnected via a simple virtual Ethernet bridge or via a simulated IEEE 802.15.4 network (ZEP)
  • IPv6
  • 6LoWPAN (RFC4944, RFC6282, and RFC6775)
  • UDP
  • RPL (storing mode, P2P mode)
  • CoAP
  • OTA updates via SUIT
  • MQTT
  • USB (device mode)
  • Display / Touchscreen support
  • CCN-Lite
  • LoRaWAN
  • UWB
  • Bluetooth (BLE) via NimBLE

Getting RIOT

The most convenient way to get RIOT is to clone it via Git

$ git clone https://github.com/RIOT-OS/RIOT

this will ensure that you get all the newest features and bug fixes with the caveat of an ever changing work environment.

If you prefer things more stable, you can download the source code of one of our quarter annual releases via Github as ZIP file or tarball. You can also checkout a release in a cloned Git repository using

$ git pull --tags
$ git checkout <YYYY.MM>

For more details on our release cycle, check our documentation.

Getting Started

  • You want to start the RIOT? Just follow our quickstart guide or try this tutorial. For specific toolchain installation, follow instructions in the getting started page.
  • The RIOT API itself can be built from the code using doxygen. The latest version of the documentation is uploaded daily to doc.riot-os.org.

Using Windows? Use this guide to setup the development environment.

Forum

Do you have a question, want to discuss a new feature, or just want to present your latest project using RIOT? Come over to our forum and post to your hearts content.

Contribute

To contribute something to RIOT, please refer to our contributing document.

Mailing Lists

License

  • Most of the code developed by the RIOT community is licensed under the GNU Lesser General Public License (LGPL) version 2.1 as published by the Free Software Foundation.
  • Some external sources, especially files developed by SICS are published under a separate license.

All code files contain licensing information.

For more information, see the RIOT website:

https://www.riot-os.org