In today's tutorial, I am going to show you how to setup Zephyr RTOS (Zephyr SDK) on Windows. I will guide you through each step for installation.
What is Zephyr RTOS?
Zephyr is small RTOS (Real Time Operating System) which is designed for Resource-Constrained and Embedded Devices. It is provided with open-source permissively licensed using the Apache 2.0 license.
For a Linux developer, Zephyr RTOS offers a smooth transition into embedded systems by leveraging familiar Linux tools (like Kconfig, Device Tree) for powerful, scalable, and secure IoT development.
It supports multiple architectures like,
- 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)
- Intel x86 (32- and 64-bit)
- MIPS (MIPS32 Release 1 specification)
- Renesas RX
- RISC-V (32- and 64-bit)
- SPARC V8
- Tensilica Xtensa
As of today, it already has support added for nearly 914 boards, 206 shields
and support growing is each day by day.
Key Features,
- A small kernel
- Highly configurable / Modular for flexibility
- Supports Variety of Boards with Different CPU Architecture
- Implements Memory Protection
- Compile-time resource definition reduces code size
- Consistent Device Driver Support
- Uses Device tree Concept from Linux
- Has Native Support for Multiple Protocols
- Host PC Development support for Linux, macOS and Windows OS
- Native sim allows to run as Linux application for Simulation purposes.
Installation
Make sure you have 16GB of space on Host PC before proceeding for installation of Zephyr RTOS.
Install Terminal App
First, we will install Terminal App for Windows.
You can install terminal app by following any of one step mentioned below,
- Running "winget install -e --id Microsoft.WindowsTerminal" command on Command Prompt App
- Using Microsoft Windows Store from following link,
Install Terminal App
Install Dependencies
Zephyr RTOS requires CMake, Python and Device Tree Compiler versions to be installed in system as mentioned below,
To install required dependencies, Open Terminal app by searching word "Terminal" in Windows search bar. If terminal app doesn’t open PowerShell by default, then open PowerShell by Clinking on "Down arrow" button next to "+" button.
On PowerShell, run following command to install all required dependencies,
winget install Kitware.CMake Ninja-build.Ninja oss-winget.gperf Python.Python.3.12 Git.Git oss-winget.dtc wget 7zip.7zipGet Zephyr and install Python dependencies
Before proceeding with further steps, Close and Reopen Terminal App.
Create a New Python Virtual Environment by executing following command on PoweShell,
cd $Env:HOMEPATH
python -m venv zephyrproject\.venv3
Now, Activate Created virtual environment by,
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
.\zephyrproject\.venv\Scripts\Activate.ps1Zephyr RTOS uses west tool for managing multiple repositories, Install it by,
pip install westNow, Lets Download Zephyr RTOS Source Code by,
west init zephyrproject
cd zephyrproject
west updateExport a Zephyr RTOS CMake package, Which will enable Automatically loading of Boilerplate code,
west zephyr-exportLet's Install all Python dependencies using below command,
west packages pip --installInstall the Zephyr RTOS SDK
We have downloaded Zephyr RTOS Source code and installed required dependencies. Now we will install SDK using following command,
Execute following commands to install Zephyr RTOS SDK,
cd $Env:HOMEPATH\zephyrproject\zephyr
west sdk installBuild a Sample Example
We have installed all required dependencies and SDK for Zephyr RTOS, Let's build Hello-World sample application from Zephyr RTOS to check everything is installed properly.
We will use "ESP32-C3-DevKitC" board for building application.
Execute following code to build Hello-World sample app,
cd $Env:HOMEPATH\zephyrproject\zephyr
west build --pristine -b esp32c3_devkitc samples/hello_world
If build was successful you can see output as shown below,
Wrapping Up
In todays, Tutorial you have learned how to install Zephyr RTOS on Windows with All needed dependencies and Build as Sample Application.
Please leave a comment if you have a question or you found this helpful.
0 Comments