Zephyr RTOS: Getting Started

Zephyr, a project of The Linux Foundation backed by major tech companies like Intel, Nordic Semiconductor, NXP, Linaro and much more companies developing and maintaining a small real-time operating system for connected, resource constrained devices supporting multiple architectures and targets. Zephyr is released under Open Source Apache License 2.0

This blog is a short tutorial on how to  build, flash and run the sample  application using Zephyr RTOS. Here I am using Ubuntu 18.04 and B-L475-IOT1 Development Board.

 

What do you need?

 

Setup the Zephyr Development Environment

Follow this Zephyr documentation guide to install the required linux dependencies. Since the Zephyr provides a west (meta-tool) for building application, flashing and debugging them.

 

Install west

pip3 install --user -U west

 

Clone the Zephyr Repositories

Clone all of Zephyr repositories in a new zephyrproject directory.

west init zephyrproject
cd zephyrproject
west update

Install Python Dependencies

Install python packages required by Zephyr. From the zephyrproject directory that you cloned Zephyr into:

pip3 install --user -r zephyr/scripts/requirements.txt

Build and Run an application

Go to the zephyr cloned directory

cd zephyr

 

Setup your build environment

source zephyr-env.sh

 

Before building the sample application check the environment variable are properly set by following command

printenv | grep ZEPHYR

 

This will print the environment variable

          ZEPHYR_TOOLCHAIN_VARIANT=zephyr

          ZEPHYR_BASE=$HOME/zephyrproject/zephyr

          ZEPHYR_SDK_INSTALL_DIR=$HOME/zephyr-sdk/

If ZEPHYR_TOOLCAIN_VARIANT and ZEPHYR_SDK_INSTALL_DIR is not set, follow the Zephyr documentaion guide to set the environment variable properly.

 

Build an blinky application

Build the blinky sample for ST disco_l475_iot1 board

west build -b disco_l475_iot1 samples/basic/blinky

The generated output file will be in build/zephyr/  directory. The directory contains bin, hex and elf file format.

 

Flash the application to a Board

west flash

Once the application is flashed it will blink the on board LED for every second.

 

Conclusion

In this post we build and flashed the sample blinky application for the disco_l475_iot1 board. In the next post we will build and run the sample application with Mcuboot.

Written by

1 Comment

  • Zephyr RTOS: Introduction to MCUboot – Linumiz November 6, 2019 at 8:26 am

    […] PreviousPrevious post:Zephyr RTOS: Getting Started […]

    Reply
  • Please Post Your Comments & Reviews

    Your email address will not be published. Required fields are marked *