Table of Contents

Zephyr on Windows-hosted 64 bit Linux Virtual Machine

Zephyr Project @ VHS

Introduction

The following instructions can be used to develop an application using Zephyr and program it on to a suitable board.

Requirements

Setting up Linux Virtual Machine

Zephyr requires a 64 bit version of Linux. In order to run a 64 bit version of Linux in a Virtual Machine, your computer must be capable of 64 bit virtualization. This may require changing a setting in your BIOS. A web search of your particular model should help clarify if your machine is capable of 64 bit virtualization and if any steps are required to enable this feature.

More details on setting up a Linux Virtual Machine on Windows can be found here: https://www.storagecraft.com/blog/the-dead-simple-guide-to-installing-a-linux-virtual-machine-on-windows/

Install Virtual Machine Software

There are several different programs for virtual machines. Oracle Virtual Box was chosen as it is fairly popular, free, and cross-platform.

Download Linux OS

Zephyr requires a 64 bit version of Linux.

These instructions were developed using a Xubuntu distribution (https://xubuntu.org/) but should work equally well for other Linux distributions. A lightweight distribution may improve performance on a host machine with limited resources.

Configure Virtual Machine

In Oracle Virtual Box, Create a new Virtual Machine.

Note: If the versions only list 32 bit, your system may not be capable of virtualizing a 64 bit system or you may need to enable the option in the BIOS. Consult the Google.

Install Linux OS on Virtual Machine

In Oracle Virtual Box, start the Virtual Machine you created in the last session. You should be prompted to select a start-up disc.

Optional

It may be convenient to create a shared folder between your Windows machine and your Linux virtual machine:

Install Guest Tools:

Add permission for user to shared folder:

You can now add and configure a shared folder in Oracle Virtual Machine.

Setting up Linux Build Environment

The following instructions are largely based on Instructions for Setting up the Development Environment Setup on Linux: https://www.zephyrproject.org/doc/getting_started/installation_linux.html

Open a terminal, and update the os:

Install necessary packages:

Install serial communication program:

Install CMake:

Optional - check tags:

Checkout version 3.8.2

Optional - It may be necessary to check to see if the newly installed CMake is going to be called correctly:

Install Zephyr Software Development Kit

For SDK Version 0.9.2 :

Get Zephyr Source Code

git clone https://github.com/zephyrproject-rtos/zephyr.git

Navigate to the Zephyr source code directory (e.g. /home/zephyr) and install required Python packages:

Board Specific Setup

The following instructions are some specific steps for programming the B-L475E-IOT01A Discovery kit board.

Manufacturer page:

Zephyr Project Page:

Install USB drivers for Windows
Install additional packages

Load rules from St Link firmware upgrade:

Copy rules from stsw-link007/AllPlatforms/StlinkRulesFilesForLinux over to /etc/udev/rules.d

Reload rules:

Enable USB Device access to Virtual Machine

By default, you need to explicitly allow the virtual machine to connect to USB devices.

Connect the board to your computer using the USB cable. Make sure to connect to the jack marked “USB STLINK” (Not the USB OTG jack)

Enabled the connection in Oracle Virtual Box:

Making Hello World

Set build variables:

Navigate to Zephyr directory:

Set build environment:

Navigate to Hello world code:

Build code for the corresponding board configuration:

If it isn't already, connect the board to your computer using the USB cable. Make sure you've configured the Virtual Machine access to the USB device as described above.

Flash the board with the program:

Run a serial host program to connect with your board. You may want to execute these in a second terminal:

Press the reset button on the board. If all has gone well, you should see:

Hello World! arm

Next Steps

Resources