Skip to main content
News

How to get and compile a Zephyr firmware

By August 9, 2019No Comments

Written by FIT IOT-LAB

DescriptionZephyr is a real-time operating system designed for the Internet of Things (IoT). The aim of this tutorial is to understand how to setup your environment and how to compile a Zephyr firmware. Note that Zephyr can be used with the following IoT-LAB nodes: nRF52DK, nRF52840DK, nRF51DK, BBC micro:bit, FRDM-KW41Z, Arduino Zero, ST B-L072Z-LRWAN1, ST B-L475E-IOT01A. The Zephyr SDK, which is required to build the firmwares, is provided by the SSH frontend of each IoT-LAB site.Setup your environment by cloning the iot-lab repository from GitHub

Setup your environment by cloning the iot-lab repository from GitHub

Setup Zephyr target

Setup the environment variables required to use the Zephyr SDK:

This must be done in each new shell. To have the SDK setup everytime, the command above can be added at the end of your ~/.bashrc file.

Setup the ZEPHYR_BASE environment variable:

This must be done in each new shell. To have ZEPHYR_BASE correctly setup everytime, the command above can be added at the end of your ~/.bashrc file (use an absolute path to zephyr-env.sh).

Now that everything is in place, let’s build our first hello_world firmware. This firmware is based on the sample provided in parts/zephyr/samples/hello_world. The sample will be built for the nRF52DK node, which corresponds to the board nrf52_pca10040 in Zephyr.

The generated firmware is located in the zephyr/samples/hello_world/build-nrf52/zephyr directory:

Use the *.elf file to flash the nodes using the IoT-LAB tools (webportal or cli-tools)

Here is a table containing the mapping between node names with IoT-LAB names and Zephyr names:

Build thehello_world firmware for each of the nodes listed above.

Congratulations, you have completed the tutorial! For more from FIT IOT-LAB, visit their website: https://www.iot-lab.info/

If you’re new to Zephyr, take a look at our Getting Started Guide or our Contributor Guide. Or, you can join the conversation or ask questions on our Slack channel or Mailing List.