Skip to main content
NewsTop News

Zephyr – An Operating System for IoT

By November 22, 2019No Comments

Written by Ivo Clarysse, CTO at Blue Clover Devices

This blog previously ran on the Blue Clover Devices website. You can view the website here.

IOT OS LANDSCAPE

These days there’s no lack of operating systems to choose from for embedded systems; Wikipedia counts about 100 of them. The Eclipse survey still shows Linux leading the pack, with Windows, FreeRTOS and Mbed OS being widely used as well.

For devices that have the necessary resources, full-blown operating systems like Linux (Android) or Windows dominate the field, but for more constrained devices, there’s a wide range of systems being used.

The Eclipse IoT Developer Survey 2019 shows more use of actual operating systems in IoT device firmware, as opposed to bare-metal programming or building on top of a minimal kernel.

Linux is widely used for IoT applications, but requires at least a Cortex-A MCU (or equivalent), and is not the preferred choice for more limited systems, such as Cortex-M.

FreeRTOS is quite popular in the embedded world and gets more support after the acquisition by Amazon in 2017. However, FreeRTOS is a bare operating system.  Everything else such as drivers, file systems, crypto modules, network stacks, middleware, and a bootloader must be added from other sources.

ARM’s Mbed OS has the out-of-the-box integration with ARM’s Pelion Device Management going for it, making it a great choice to learn about IoT device provisioning, connection and management through LwM2M. Provided by ARM, it obviously does not support popular IoT platforms like ESP32 or RISC-V.

Mynewt has everything you could wish for in an operating system for resource constrained IoT devices, but the BSP support is fairly limited.

Zephyr originated from the Virtuoso DSP operating system which initially got rebranded as “Rocket” kernel, following its acquisition by Wind River Systems, but became Zephyr in 2016 when it became a Linux Foundation hosted Collaborative Project. Major sponsors and contributors of this open source collaborative effort include IntelNordic SemiconductorNXPSiFiveSynopsys and TI.

Like many other operating systems, Zephyr provides:

  • Secure bootloader (MCU Boot)
  • Kernel
  • Network stacks
  • File systems (NFFS, LittleFS, NVS)
  • Middleware (including the MCUmgr OTA mechanism and LwM2M client functionality)
  • Device drivers

ZEPHYR LICENSING

Zephyr is mostly licensed under the Apache 2.0 license, but drivers from Nordic and NXP are licensed under the permissible BSD-Clause-3 version, although some of the build tooling is GPLv2.

Example Project

An example Zephyr firmware project can be found on https://github.com/bdevices/ly10-zephyr-fw

This project is a demonstration firmware for our nRF52-based “LY10” demo board, which we ship with our Production Line Tool.

CLONE

Use the following Terminal command to obtain a local copy of this example project.

git clone https://github.com/bcdevices/ly10-zephyr-fw.git

BUILDING

To simplify building the firmware, we’ve setup this project with Docker-based build scripts, avoiding the need to install anything else than Docker itself.

To build:

make docker

The resulting ly10-zephyr-fw-VERSION.hex file can be programmed through the west tool (if you’ve installed the Zephyr tooling locally), or use target-specific Vendor tools (nRF Connect Programmer).

SOURCE CODE

The demo firmware source code is very simple, contained in the src/app folder:

BOARD DEFINITIONS

Building for one of the target boards directly supported by zephyr is a matter of specifying the correct board name.

Since the LY10 is a custom board that is not defined in the upstream Zephyr project, we’re defining a custom board in boards/arm/ly10demo:

References

About the Author

Ivo Clarysse is CTO at Blue Clover Devices. At heart, he is a software engineer with extensive experience working on embedded systems software and linux device drivers.

Zephyr Project