This article is based on the instructions provided by the Zephyr Project:
Set up your operating system with the necessary tools. Here are details for Windows, macOS and Linux. We'll do this on macOS for this article, so we'll start with installing a handy package manager called "Homebrew". Homebrew is used for many command line installations, similar to apt or yum on Linux.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install cmake ninja gperf ccache dfu-util qemu dtc python3
west init zephyrproject cd zephyrproject west update
# "win32" is used for 64-bit Windows as well
windows-curses; sys_platform == "win32"
Let's run this script:
pip3 install -r zephyr/scripts/requirements.txt
There is one more tool needed to compile Zephyr... the compiler itself, gcc. Since we're on macOS, we'll use the GNU ARM Embedded Toolchain. Download the latest version. (Note the warning to avoid the version 7-2018-q2-update.)
Zephyr's instructions indicate to use the directory "gnuarmemb", short for GNU ARM Embedded:
Note their warnings to avoid any spaces (%20) in your directory names.
Unpack the downloaded tar file to this new directory:
tar -xjvf ~/Downloads/gcc-arm-none-eabi-8-2019-q3-update-mac.tar.bz2
As mentioned above, there are a couple environment variables that need added. Use your favorite text editor, open the file ~/.bash_profile, and add these lines:
You'll substitute your username (<myusername> above) and the actual toolchain version that you downloaded after gnuarmemb for the path. Save the file and activate the new settings with:
You can check the variables by echoing them to the terminal:
Finally, we're ready to compile an application. Try the default one in the instructions, though since we're using a Rigado BMD-300, we'll use the nRF52 DK board which is directly compatible with the BMD-300-EVAL:
west build -b nrf52_pca10040 samples/hello_world
The BMD-300-EVAL will show up as three devices by default:
- J-Link debug probe
- USB Disk drive
- USB COM Port (VCP)
It's the latter we'll use for the test. We need to figure out what the device names are. USB COM ports show up in macOS as /dev/cu.usb<something>. Let's have a look:
ls -al /dev/cu.usb*
gives the following in this test system (Your serial numbers will vary):
crw-rw-rw- 1 root wheel 18, 9 Jul 17 14:55 /dev/cu.usbmodem0006827955251
Start your favorite serial port terminal program (CoolTerm, minicom, etc.) and open this port. For macOS, we can just use the inbuilt "screen" from the terminal. Start a new terminal window first, since we still haven't flashed the code to the Eval board yet:
screen /dev/cu.usbmodem0006827955251 115200 -L
This turns the active terminal window into a simple serial terminal.
In the other terminal window, now flash the compiled code to the BMD-300-EVAL with:
As soon as the programming is complete, we'll see the following in the window running screen:
***** Booting Zephyr OS build zephyr-v1.14.0-2426-ge4bd11b3f36e *****
Hello World! nrf52_pca10040
Hello World! We have functioning hardware!
To get terminate the screen program, type in [Ctrl]+A, then [Ctrl]+K.
If you're using a different Rigado module, here are the compatible boards to select with the
- BMD-300, BMD-301, BMD-350 = nrf52_pca10040
- BMD-330 = nrf52810_pca10040
- BMD-340, BMD-341, BMD-380 = nrf52840_pca10056
- BMD-360 = nrf52811_pca10056