How to Install Zephyr on Windows with All Required tools and Dependencies

In today's tutorial, I am going to show you how to setup Zephyr OS (Zephyr SDK) on Windows. I will guide you through each step for installation.


What is Zephyr OS?

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.

Install Terminal App

First, we will install Terminal App for Windows.

You can install terminal app by following any of one step mentioned below,
  1. Running "winget install -e --id Microsoft.WindowsTerminal" command on Command Prompt App
  2. Using Microsoft Windows Store from following link,
    Install Terminal App

Install Dependencies

Zephyr 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.7zip


Zephyr Dependecies Installation Logs

Get Zephyr and install Python dependencies

Before procedding 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.ps1

Zephyr uses west tool for managing multiple repositories, Install it by,
pip install west

Zephyr West Installation

Now, Lets Download Zephyr Source Code by,
west init zephyrproject
cd zephyrproject
west update

Export a Zephyr CMake package, Which will enable Automatically loading of Boilerplate code,
west zephyr-export

Let's Install all Python dependencies using below command,
west packages pip --install

Install the Zephyr SDK

We have downloaded Zephyr Souce code and installed required dependencies. Now we will install SDK using following command,

Execute following commands to install Zephyr SDK,
cd $Env:HOMEPATH\zephyrproject\zephyr
west sdk install


Build a Sample Example

We have installed all required dependencies and SDK for Zephyr, Let's build Hello-World sample application from Zephyr 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,

Zephyr Sample Application Build Output


Wrapping Up

In todays, Tutorial you have learned how to install Zephyr OS 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.

Post a Comment

0 Comments