Flash Zephyr™ OS on target from Mac

In this article, we will dive into the process of flashing Zephyr™OS into the NXP Freedom-K64F (aka FRDM-K64F) board. This board is an ultra low cost development board powered by a Cortex M4 Core and compatible with the Arduino™ R3 pin layout (if you want to add a shield and easily plug sensors).

Image for post
Image for post

Environment setup

First of all, go through this first article on how to setup your development environment on your Mac.

Debug Tool

Your Freedom K64F board comes with a serial and debug adapter called OpenSDA. It enables debugging, serial communication and most importantly for flash programming through a USB cable connected from the board to your Mac.

$ pip install — pre -U pyocd

Device connection

Now connect your board to your mac. You should check if the board is found by pyOCD using the following command :

$ pyocd-gdbserver -l
0 => FRDM-K64F [k64f] boardId => 00EDC00fd0000009

Build and Flashing

The board is identified as frdm_k64f within Zephyr. We are going to build the hello world sample and flash the connected board

$ cd $ZEPHYR_BASE/samples/hello_world
$ mkdir build && cd build
$ cmake -GNinja -DBOARD=frdm_k64f ..
$ ninja flash
$ west -v flash

Serial configuration

The hello world sample simply displays Hello World! through the serial port. So first, identify the device created in the /dev folder. It should be something like /dev/tty.usbmodem14521.

$ screen /dev/tty.usbmodem14521 115200

Going Further

The next step is to use an IDE for compiling, flashing and debugging Zephyr™OS on a target board. If anyone has a feedback, please feel free to reach me.

Documentation

Zephyr on K64F : http://docs.zephyrproject.org/boards/arm/frdm_k64f/doc/frdm_k64f.html

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store