Introduction

Zephyr is an open source real-time operating system (RTOS) for embedded devices. It is designed for resource-constrained hardware and scales from small microcontrollers to multicore 64-bit processors.

The diagram below shows its main components. It is a simplified view for illustration purposes and does not reflect the exact architecture of the system. Each block links to the corresponding section of the documentation.

To start using Zephyr, follow the Getting Started Guide, then browse the supported boards and the samples.

Components

Kernel

The Zephyr kernel provides threads, interrupt handling, synchronization primitives such as semaphores and mutexes, data passing primitives such as message queues and pipes, timers, and memory allocation from heaps and fixed-size slabs.

Scheduling is priority-based, with cooperative and preemptible threads, optional time slicing, earliest-deadline-first (EDF) scheduling and meta-IRQ priorities. The kernel supports symmetric multiprocessing.

On hardware that provides memory protection, stack overflows are detected and threads can run in user mode at a reduced privilege level, with permissions on kernel objects and memory domains to isolate them.

Device Drivers

Each type of device (UART, SPI, I2C, sensor, display, …) has a generic API, listed by category in Peripherals, so that application code does not depend on a specific device. The device model initializes the drivers that are part of a system. The devices themselves are described in devicetree.

Services

Services are provided by subsystems that an application enables as needed:

  • Networking: IPv4 and IPv6 stack with a BSD sockets API, TLS, application protocols such as MQTT, CoAP, LwM2M and HTTP, and Thread networking with OpenThread.

  • Storage: file systems (ext2, FAT, LittleFS), key-value stores (NVS, ZMS), flash circular buffer (FCB), settings, secure storage.

  • Device management: device firmware upgrade with MCUboot, remote management with MCUmgr, over-the-air updates.

  • Frameworks: sensing subsystem, loadable extensions (LLEXT), multimedia pipelines, state machines.

  • OS abstraction: POSIX and CMSIS-RTOS APIs, to port existing code to Zephyr.

  • Connectivity: Bluetooth host and LE controller, Bluetooth Mesh, USB, CAN, LoRa and LoRaWAN, Modbus, modems.

  • Power management: system and device power management, CPU frequency scaling.

  • Diagnostics: logging, shell, tracing, debugging and profiling.

  • Inter-process communication: zbus message bus between threads, IPC service between cores.

  • Security: PSA Crypto API, integration of Trusted Firmware-M, authentication.

The complete list is in Services.

Modules

Zephyr reuses externally maintained projects, called modules: hardware abstraction layers (HALs) from silicon vendors, and libraries such as cryptography, file systems, graphics or radio stacks. Each module has its own repository and is fetched by west. The modules of the default manifest are listed in West Projects index.

Supported Hardware

Zephyr supports 1,200+ boards, which can be searched in the board catalog, on the following architectures (see Architecture-related Guides):

  • ARCv2 (EM and HS) and ARCv3 (HS6X)

  • ARMv6-M, ARMv7-M, and ARMv8-M (Cortex-M)

  • ARMv7-A and ARMv8-A (Cortex-A, 32- and 64-bit)

  • ARMv7-R, ARMv8-R (Cortex-R, 32- and 64-bit)

  • Qualcomm Hexagon

  • Intel x86 (32- and 64-bit)

  • MIPS (MIPS32 Release 1 specification)

  • OpenRISC (32-bit)

  • Renesas RX

  • RISC-V (32- and 64-bit)

  • SPARC V8

  • Tensilica Xtensa

  • TriCore (TC1.6.2 and TC1.8)

The porting guides describe how to add support for an architecture, an SoC or a board.

Application Development

An application is written in C or C++ (see Language Support) and uses the APIs of the kernel, device drivers and services described above. The build system compiles the application and Zephyr into a single binary. See Application Development.

Configuration

Hardware is described with devicetree and software features are selected with Kconfig. Both are processed at build time, so that an image only contains what the application has enabled.

Tools

West manages the workspace and its repositories, and builds, flashes and debugs applications. The build system is based on CMake. The Zephyr SDK contains toolchains for the supported architectures. Development is supported on Linux, macOS and Windows.

West can also generate a software bill of materials for a build, and the hardening tool checks the configuration of an application against security recommendations.

Testing

Tests are written with the Ztest framework. Twister builds and runs them, as well as the samples, on boards and on emulators such as QEMU. The Native simulator - native_sim board runs Zephyr as a Linux executable, to develop and test without hardware. See Testing.

Licensing

Zephyr is licensed under the Apache 2.0 license, as found in the LICENSE file. Imported components that use another license are listed in Licensing of Zephyr Project components.

Resources

Getting started

Getting Started Guide, Samples and Demos and Glossary of Terms.

Getting help

Asking for Help describes how to reach the community on the Discord server and the mailing lists.

Code and releases

Source code repository, releases and contribution guide.

Issues and security

GitHub issues, security documentation and vulnerability reporting.