Hello! This article is a step-by-step guide to a manual installation of Zephyr RTOS on Windows.
Zephyr is a modern open-source RTOS that is already used in industrial devices and IoT systems. It supports dozens of microcontrollers, including STM32 and ESP32-S3, and is ideal for those who want to go beyond Arduino and understand how a real-time system works.
Our goal is to create a fully controllable and isolated development environment.
1. Preparation — Downloading All The Necessary ComponentsIn this section, let's download everything we need. We won't install anything, just download it.
Before diving into the world of Zephyr, we need to prepare our toolkit, such as Git and Python. If you already have them - perfect! If not, here are the links to download them.
1.1. Downloading the software
I will indicate the versions of the programs I use in parentheses, but yours may differ.
Don't let the list scare you — these are all standard, lightweight tools that will come in handy outside of Zephyr as well.
1.2. Download the Zephyr SDK
Zephyr SDK (0.17.4): Our set of compilers. Download the minimal SDK, only for STM32 and ESP32-S3, but feel free to download toolchains for any other microcontrollers you plan to work with.
The minimal SDK contains the basic infrastructure without all the compilers — we will add the necessary ones manually to save space and speed up the installation.
Navigate to the Zephyr page, locate the Zephyr SDK(Windows)
installation section, and click on the Download the Zephyr SDK bundle
link. This will take you to the official GitHub repository with the latest release.
Download three archives for Windows x86-64: Minimal
, arm-zephyr-eabi
, xtensa-espressif_esp32s3_zephyr-elf
.
2.1. Installing the main software
Install Python
, Git
, VS Code
, 7-Zip
, and CMake
.
Important: When installing from the installer, make sure to check the "Add to PATH" box, if such an option is available, or manually add the paths to the executable files to the PATH variable.
2.2. Creating a folder structure
Let's create our Zephyr workshop. I will use D:\Zephyr
, but you can choose any convenient location (for example, C:\Projects\Zephyr).
Go to the D:\Zephyr
and create a folder called tools
.
Unpack the contents of the Ninja
and OpenOCD
archives into tools
, each into its own subfolder.
Next, from the zephyr-sdk-0.17.4_windows-x86_64_minimal.7z
archive, unpack its contents into the tools
folder.
A folder named zephyr-sdk-0.17.4
will appear inside tools
, which we'll rename to zephyr-sdk
for convenience.
Go to the zephyr-sdk
folder and unpack the remaining two archives, toolchain_windows-x86_64_arm-zephyr-eabi.7z
and toolchain_windows-x86_64_xtensa-espressif_esp32s3_zephyr-elf.7z
, into it.
The folder structure should be as follows.
2.3 Creating a Python virtual environment
Open a terminal and check the Python installation and configuration:
> python --version
If you get a version number, everything is configured correctly.
Now let's create an isolated space for Zephyr Python scripts. This is called a virtual environment
and is best practice to avoid library version conflicts. Open a terminal, navigate to D:\Zephyr
, and run the command:
> python -m venv .venv
At this stage, you should have the .venv
and tools
folders.
2.4. Creating and activating a launcher script
Earlier, I mentioned that the paths to all executables need to be added to the PATH variable so that Windows knows where they are located, but this can be done locally via a batch file for the current session.
Instead of modifying the system's global environment variables, let's create a convenient zephyr-env.cmd
script in the D:\Zephyr
folder, which will configure our entire environment "on the fly".
The zephyr-env.cmd
script will activate the Python virtual environment and set the variables ZEPHYR_BASE
, ZEPHYR_SDK_INSTALL_DIR
, ZEPHYR_TOOLCHAIN_VARIANT
, and others only for the current terminal session.
You can add any environment variables to this script.
@echo off
REM Activate the Python virtual environment
call .venv\Scripts\activate.bat
REM Zephyr base folder
set BASE_DIR=D:\Zephyr
REM Variables for Zephyr
set ZEPHYR_BASE=%BASE_DIR%\zephyrproject\zephyr
set ZEPHYR_SDK_INSTALL_DIR=%BASE_DIR%\tools\zephyr-sdk
set ZEPHYR_TOOLCHAIN_VARIANT=zephyr
REM Paths to tools
set NINJA_DIR=%BASE_DIR%\tools\ninja
set OPENOCD_DIR=%BASE_DIR%\tools\openocd
REM Add everything to PATH
set PATH=^
%ZEPHYR_SDK_INSTALL_DIR%\arm-zephyr-eabi\bin;^
%ZEPHYR_SDK_INSTALL_DIR%\xtensa-espressif_esp32s3_zephyr-elf\bin;^
%NINJA_DIR%;^
%OPENOCD_DIR%\bin;^
%PATH%
REM Go to the desktop for convenience
cd /d %USERPROFILE%\Desktop
REM Open the command prompt
cmd
The folder structure should be as follows:
2.5. Checking the launcher script
Run zephyr-env.cmd
. You should see the following in the terminal:
(.venv) C:\Users\Admin\Desktop>
Now let's make sure that all the tools are in place. Enter the following commands one by one. The response should be similar to the one below (versions may vary):
> git --version
> cmake --version
> openocd --version
> ninja --version
> arm-zephyr-eabi-gcc --version
> xtensa-espressif_esp32s3_zephyr-elf-gcc --version
If all commands show version numbers — great! The environment is set up correctly. If any command is not found, check the PATH and paths in the script.
2.6. Downloading Zephyr source code
Great, all the tools are in place! Now, staying in the same terminal (D:\Zephyr
), let's install the Zephyr source code itself:
- Install west: This is Zephyr's "project manager". Install it in our virtual environment:
> pip install west
- Initialize the workspace: This command will create the main
zephyrproject
folder and download the Zephyr core into it:
> west init zephyrproject
- Download all modules: This command acts like an orchestrator, pulling in dozens of related projects (HAL modules, libraries, bootloaders) at their correct versions:
> cd zephyrproject
> west update
- Configure IDE integration: This allows CMake to automatically load boilerplate code required for building Zephyr applications:
> west zephyr-export
- Install Python dependencies: Now that we have all the source code, let's install the Python libraries needed to build it:
> west packages pip --install
- Download the binary files for Espressif: Final step — download the files required for Wi-Fi and Bluetooth to work on ESP32:
> west blobs fetch hal_espressif
The final folder structure should be as follows:
Important: Run zephyr-env.cmd
each time you want to work with Zephyr RTOS.
3. Configuring Visual Studio CodeOur development environment is almost ready! All that's left is to configure VS Code for comfortable work with Zephyr.
3.1. Installing the Required Extensions
We'll install just four extensions that will make working with Zephyr as convenient as possible — from syntax highlighting to code autocompletion.
Launch VS Code and open the Extensions
panel (Ctrl+Shift+X). In the Search Extensions
field, enter the extension name and install it by clicking the Install
button. Repeat this for all extensions shown in the image above.
3.2. Configuring CMake Tools
One extension left to configure — CMake Tools.
By default, it automatically configures the project every time you open or modify files. This creates a conflict with west
, our Zephyr build system. Let's disable these automatic actions.
Open VS Code settings (File → Preferences → Settings or Ctrl+,).
In the Extensions
→ CMake Tools
section, find and disable three options, as shown in the image.
Alternative for advanced users:
Open settings.json
(Ctrl+Shift+P → "Open Settings JSON") and add these lines:
"cmake.configureOnOpen": false,
"cmake.configureOnEdit": false,
"cmake.automaticReconfigure": false,
Done! VS Code is configured and ready to work with Zephyr.
4. ConclusionCongratulations! Now you don't just have Zephyr installed — you have your own fully controlled development lab for experimenting with microcontrollers.
Next Steps
Your development environment is ready for action. The best way to test it is by building a real project. Get started with one of our ready-to-use templates:
For STM32 BluePill: From Setup to Blinky: Your First Zephyr Project on STM32
For ESP32-S3 (N16R8): Zephyr on ESP32-S3: Your First 'Hello World'
To be continued!
Comments