Zephyr Tutorial Chapter 1

Zephyr RTOS Logo

Why Zephyr?

A few years ago we discussed the three contenders for IoT Bluetooth Stacks – Zephyr, Apache myNewt and ARM Mbed. Since we first discussed it, it’s now clear that Zephyr is becoming the go to platform for developing Bluetooth Low Energy devices. Over the last few years, myNewt has not moved as much as it should, and ARM has decided to stop working on Mbed.

A large part of this is because Nordic Semiconductor began supporting the project and started relying on Zephyr exclusively for their nRF52, nRF53 and nRF54 chipset. Nordic is one of the larges Bluetooth chipset vendors by market share, and so their vote of confidence essentially made a lot of developers switch to Zephyr. This has made Zephyr the go to platform for developing BLE products.

We have seem other vendors adding support for Zephyr, although none seem to have jumped in like Nordic. Zephyr is broadly supported for ARM based devices from ST Micro, Texas Instruments, and many others, which means that you can port code and functionality across. It supports multiple CPU architectures, both ARM, RISC-V and many others.

What differentiates Zephyr from others is that it’s a comprehensive RTOS with drivers and wireless capabilities. If you’ve used FreeRTOS, which is still extremely popular, you’ll know that you need to develop a large amount of peripheral software, drivers and stacks to make a product work. Zephyr is a large project with out of the box support for tracing, memory management, logging, stacks (like Bluetooth and USB), file systems, sensors, etc. This means that a developer can take advantage of existing drivers and avoid reinventing the wheel.

Zephyr is open source and allows users to contribute. Much of the current development is done by engineers working at Nordic Semi, Silicon Labs, and silicon vendors.

What this tutorial covers

We’re going to cover Zephyr and embedded application development from the ground up. We’ll touch on everything from basic programming concepts, RTOS, peripherals. If you’re looking to start with embedded system development, we’re going to cover it. There’s some Zephyr specific topics like the Device Tree which are critical for you.

Zephyr Development Tools

One of the advantages of Zephyr is that it’s free and open source, and building embedded firmware doesn’t require expensive investments in tools. The main tool we’ll be using for development is VS Code because it’s free, easy to install and has support for debug and a slew of plugins.

It’s possible to use CLion, another excellent professional tool for development, but most developers use Visual Studio Code, so we’ll do that.

One downside Zephyr does have is that while it uses VSCode, this tool doesn’t always work as well for debugging as IDEs such as IAR Embedded Workbench and others. It has gotten better.

Zephyr also requires some more manual work to get started and configured, but once this is out of the way, you’re usually left with a working setup.

It’s important to note that Zephyr itself leverages a lot of tools by the chipset vendors themselves. For example, for Nordic devices there are several tools you’d need to have in order to program.

Let’s Get Started

With this introduction out of the way, let’s get started developing on Zephyr