Install/Upgrade Device SDK

Our main device SDK is based on the Zephyr RTOS. So a lot of the initial steps required are close to the same requirements to use Zephyr.

Install dependencies with apt:

sudo apt update
sudo apt install --no-install-recommends git cmake ninja-build gperf \
ccache dfu-util device-tree-compiler wget \
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
make gcc gcc-multilib g++-multilib libsdl2-dev
note

While the official documentation for Zephyr suggests jumping right into installing west, we suggest creating a python3 virtual environment first, to avoid running into tooling incompatibilities.

Install virtualenv and create a new environment:

sudo pip3 install virtualenv
virtualenv -p python3 ~/zephyr-env

Whenever you need to activate this virtual env, run:

source ~/zephyr-env/bin/activate
# OR, if you're using the fish shell, run
source ~/zephyr-env/bin/activate.fish
note

If you'd like to exit out of the virtualenv at the end of the tutorial, run deactivate.

Now, use pip to install west:

note

Because we're in a python3 virtualenv, we don't need to specify pip3 and can just use pip.

pip install west

Installing the Device SDK#

With west installed, grab the Device SDK:

info

Depending on your internet and I/O speed, west update can take upwards of 5 or 10 minutes.

cd ~
west init -m [email protected]:golioth/zephyr.git --mr main ~/zephyrproject
cd zephyrproject/
west update
west patch
note

The patch step is temporary until the Github repo is made public

Tell west to automatically configure CMake:

west zephyr-export

Lastly, install the remaining dependencies:

pip install -r ~/zephyrproject/zephyr/scripts/requirements.txt

Upgrading Golioth Device SDK#

If you already installed our SDK before and want to upgrade it, you can go to the folder that you made the set up before and run the commands bellow:

cd modules/lib/golioth
git pull
west update
cd ../../../
west patch