How Linux’s IoT Zephyr Operating System Works

Why we need Operating Systems Tailored to IoT Devices

Zephyr’s two kernel operating system for IoT devices. (Image courtesy of the Linux Foundation.)

Internet of Things (IoT) devices can have a significantly small memory footprint, perhaps as small as 10 kilobytes. As a result, most modern day operating systems can’t run on this limiting hardware.

The Linux Foundation announced their Zephyr Project to meet this need. The project aims to create an open sourced real-time operating system (RTOS) for IoT devices.

“Developers today have many choices when it comes to platforms. The Zephyr Project will offer a modular, connected operating system to support the smallest footprint for IoT devices,” said Jim Zemlin, executive director, The Linux Foundation.

Though other operating system solutions for low memory IoT devices exist, they will not have access to the large open source community which made Linux an industry standard in the server world.

In fact, the Linux Foundation is hoping to repeat history with Zephyr and become the industry standard RTOS for IoT.

“We fully expect Zephyr will become one of the leading, easy-to-use IoT platforms, designed specifically with security in mind for the connected world,” said Geoff Lees, senior vice president and general manager of microcontrollers at NXP. “We are committed to providing developers with best-in-class tools and support needed to develop innovative solutions.”

How the Zephyr IoT Real-Time Operating System Works

Diagram illustrates how Zephyr’s microkernel and nanokernel work in conjunction. (Image courtesy of the Linux Foundation.)

The new RTOS will allow developers to use it as is, or tweak it to their personal needs. As a result, engineers can already download a Zephyr software development kit.

Zephyr works on a modular kernel design. The absolute essential RTOS services are within the nanokernel. This kernel is responsible for executing the highest priority procedures from interrupts to background tasks.

The nanokernel is based on a series of small threads dubbed fibers. #CleverGirl  These fibers will only execute one task at a time. 

If push comes to shove, developers can use only the nanokernel to run their IoT devices. This will typically be limited to devices with extremely low memory footprints like environmental sensors, RFID tags and LEDs.

However, most IoT devices will be able to use Zephyr’s full microkernel. This will allow for greater multitasking abilities and services including: memory pools, memory maps, a mailbox and more.

The tasks that are sitting in the microkernel are scheduled by a server file in the nanokernel. This set up allows for the highest priority tasks to be run within the nanokernel and for interrupts to be run within the nanokernel without hindrance. Once all the fibers have finished executing a task, the server fiber will then send the nanokernel the next highest priority task. If two tasks are tied, then the one that has been sitting in the microkernel the longest will be selected.

The idea of the two kernel system is to keep memory stacks small and to allocate processes to the cloud whenever possible.

For a more detailed explanation of how the Zephyr IoT OS works, watch this video:

What Features do you get with the Zephyr IoT RTOS?

Zephyr is compatible with many industry standards but components can be added or taken away as needed. (Image courtesy of the Linux Foundation.)
Currently, Zephyr’s common API will allow the RTOS to support the following communication networks, Input/Output (I/O) ports and board architectures:
  • Currently Supported Communication Networks:
    • Bluetooth
    • Bluetooth Low Energy
    • IEEE 802.15.4
    • 6LoWPAN
    • Wi-Fi
    • Wired
  • Currently Supported I/O Ports:
    • UART
    • GPIO
    • SPI
    • I2C
    • Radios
  • Currently Supported Board Architecture:
    • Arduino 101 (Intel Curie Module containing x86 and Synopsys ARC EM cores)
    • Arduino Due (Atmel SAM3X8E ARM Cortex-M3 CPU)
    • Intel Galileo Gen 2
    • NXP FRDM-K64F Freedom board (Kinetis K64F ARM Cortex-M4 MCU)

The RTOS will also support third party libraries, applications and plans to expand its compatibility library for communication standards, circuit boards and I/O ports.

The Linux Foundation also stressed that their new RTOS has a significant focus on IoT security. The project plans to include a dedicated security working group and a delegated security maintainer.

Engineers should note that all of these supported components are optional. They can be added or removed from your custom build RTOS based on design needs and limitations. Additionally, once you have come up with your RTOS solution, you can reuse it on your other IoT devices.

The Linux Foundation is looking for developers, engineers and organizations to cooperate with the expansion of Zephyr. Currently, the list includes Intel, NXP Semiconductors, Synopsys, and UbiquiOS.

“We invite developers to contribute to the Zephyr Project and to help advance a customizable embedded open source RTOS to advance IoT,” said Zemlin. “By hosting this at The Linux Foundation, we look forward to the cross-project collaboration among Linux and this community.”

If you wish to help the growth of Zephyr then perhaps you are interested in their development kit. If so, you can download it from this link.