What is Zephyr RTOS?
It is an open-source real-time operating system (RTOS) designed for resource-constrained embedded devices. The project is led by the Linux Foundation and is widely adopted in IoT edge devices and microcontroller-based systems.
Zephyr Project
https://www.zephyrproject.org/
Background
I thought the name "Zephyr" sounded cool, and I had an STM32 microcontroller I received from an acquaintance that was just gathering dust. It felt like a waste, so I decided to try and put it to good use.
Environment
• STM32 Nucleo Board STM32F401
• Ubuntu 24.04.2 LTS
Note: Ubuntu 24.04.2 LTS is installed on a dedicated PC environment. I took an old Windows PC purchased about 5 years ago and used Rufus to install Ubuntu 24.04.2 LTS via a USB drive to serve as my development environment. Incidentally, since I already had a WSL2 environment set up, I tried the WSL2 method first, but communication with the STM32 via USB did not work well. I found out after trying that the official Getting Started Guide explicitly states "Flashing from WSL is not supported," so please be aware of this. Also, Rufus is a tool for writing OS ISO image files to USB drives to create installation media; if you use that, you can easily convert a Windows PC into a Linux PC. It is possible to set it up for dual-booting so you can use both Windows and Linux, which might be interesting to try. However, I found switching between Windows and Linux cumbersome, so I made it a dedicated Linux machine.
Method
I proceeded exactly as outlined in the official Getting Started Guide.
https://docs.zephyrproject.org/latest/develop/getting_started/index.html
Here are the points where I got stuck and how I resolved them:
Unable to create Python virtual environment (venv)
The official documentation names the virtual environment .venv, but any name is fine. I encountered issues activating the virtual environment when leaving it as .venv.
Issues building the sample
Although mentioned in the official documentation, sometimes the target board specification isn't recognized correctly. Running the following command listed the board names supported by Zephyr:
west boards
Replace in the official documentation with the name of the board you are using (find it in the results of west boards) and run the build command. Below is the command I used for the STM32 this time:
west build -p always -b nucleo_f401re samples/basic/blinky
Flashing to the STM32 failed
I was able to flash successfully by specifying OpenOCD.
(Note: OpenOCD is an open-source tool for debugging and programming embedded devices using JTAG or SWD.)
west flash --runner openocd
Testing it out
For reference, I tried flashing the samples/basic/blinky program.
Here is how it looks:

Reference: About the LEDs
• LD1
• Red
• Indicates USB communication or ST-LINK status.
• LD2
• Green
• For user control (used here for the LED blink).
• LD3
• Red
• Indicates power is being supplied (Solid on is normal).
Impressions
I was able to try out the sample program much faster than I expected. If one continues to face issues with setting up the development environment, building sample programs, or flashing, there is a high chance of giving up, so I am glad I was able to reach a successful stopping point. In terms of setting up an OS development environment, I thought this was one of the easier ones. If the opportunity arises, I would like to try my hand at OS development in the future.
Top comments (0)