Requirements¶
Linux based OS¶
The actual version of KNoT Zephyr SDK is only available for Linux based systems.
For other systems, you may consider using the KNoT Docker (recommended) or a Virtual Machine running a Linux distribution.
Zephyr¶
Set up a Zephyr development environment.
Note
This section is based on Zephyr instructions and considers a Linux version based on Debian as host.
Update Your Operating System¶
Ensure your host system is up to date.
sudo apt update sudo apt upgrade
Install Requirements and Dependencies¶
Install Zephyr’s dependencies.
sudo apt install --no-install-recommends git ninja-build gperf \ ccache dfu-util device-tree-compiler wget \ python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ make gcc gcc-multilib
Install OpenThread and KNoT Protocol dependencies. These are external packages used by Zephyr and KNoT SDK.
sudo apt install autoconf automake libtool
Install CMake v3.13.1.
mkdir -p $HOME/bin/cmake && cd $HOME/bin/cmake && \ wget https://github.com/Kitware/CMake/releases/download/v3.13.1/cmake-3.13.1-Linux-x86_64.sh && \ yes | sh cmake-3.13.1-Linux-x86_64.sh | cat && \ echo "export PATH=$HOME/bin/cmake/cmake-3.13.1-Linux-x86_64/bin:\$PATH" >> $HOME/.zephyrrc
Note
CMake version 3.13.1 or higher is required.
Install the Zephyr SDK¶
Download and run the Zephyr SDK setup file.
wget -O $HOME/Downloads/zephyr-sdk-0.10.0-setup.run https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.10.0/zephyr-sdk-0.10.0-setup.run && \ chmod +x $HOME/Downloads/zephyr-sdk-0.10.0-setup.run && \ $HOME/Downloads/zephyr-sdk-0.10.0-setup.run -- -d ~/zephyr-sdk-0.10.0
Program the
$HOME/.profile
to always set ZEPHYR_TOOLCHAIN_VARIANT and ZEPHYR_SDK_INSTALL_DIR.echo "export ZEPHYR_TOOLCHAIN_VARIANT=zephyr" >> $HOME/.profile echo "export ZEPHYR_SDK_INSTALL_DIR=$HOME/zephyr-sdk-0.10.0" >> $HOME/.profile
Set up the Zephyr Environment¶
If you do not have
~/.local/bin
on your PATH environment variable, add it.echo PATH=\"$HOME/.local/bin:'$PATH'\" >> $HOME/.profile source $HOME/.profile
Install the west binary and bootstrapper.
pip3 install --user west
Clone KNoT Zephyr fork.
git clone -b zephyr-knot-v1.14.0 https://github.com/CESARBR/zephyr.git $HOME/zephyrproject/zephyr/
Note
It will create a folder under $HOME directory and clone zephyr inside it. Make sure to update the path on the following steps if you clone it under another folder.
Initialize west.
cd $HOME/zephyrproject/ west init -l zephyr/ west update
Note
If the system can’t find west, try logging out and in again.
Program the
$HOME/.profile
to always source zephyr-env.sh when you log in.echo "source $HOME/zephyrproject/zephyr/zephyr-env.sh" >> $HOME/.profile
Note
If you skip this step, it will be necessary to manually source zephyr-env.sh every time a new terminal is opened.
nRF5x Command Line Tools and Segger JLink¶
Download and extract cli applications from nRF5 Command Line Tools or following the step bellow.
Download nRF5 Command Line Tools.
wget -O $HOME/Downloads/nRFCommandLineTools1021tar.gz https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-command-line-tools/sw/Versions-10-x-x/nRFCommandLineTools1021Linuxamd64tar.gz
Extract nRF5 Command Line Tools.
tar -xvzf $HOME/Downloads/nRFCommandLineTools1021tar.gz -C $HOME/Downloads --one-top-level
Install nRF5x Command Line and Segger JLink deb packages.
sudo dpkg -i $HOME/Downloads/nRFCommandLineTools1021tar/nRF-Command-Line-Tools_10_2_1_Linux-amd64.deb sudo dpkg -i $HOME/Downloads/nRFCommandLineTools1021tar/JLink_Linux_V644e_x86_64.deb
Set up the KNoT SDK Environment¶
Download the zephyr-knot-sdk repository.
git clone https://github.com/cesarbr/zephyr-knot-sdk/ $HOME/zephyr-knot-sdk/
Note
The default clone path is the $HOME directory. Make sure to update the path on the following steps if you create it under another folder.
Program the
$HOME/.profile
to always source knot-env.sh when you log in. The environment configuration file is used to set up $KNOT_BASE path.echo "source $HOME/zephyr-knot-sdk/knot-env.sh" >> $HOME/.profile
Note
If you skip this step, it will be necessary to manually source knot-env.sh every time a new terminal is opened.
Add support to the KNoT command line interface¶
Add cli.py to the path files.
ln -s $HOME/zephyr-knot-sdk/scripts/cli.py $HOME/.local/bin/knot
Note
This will allow you to call the
knot
command line interface from any folder.Use pip to install cli requirements.
pip3 install --user -r $HOME/zephyr-knot-sdk/scripts/requirements.txt
Add USB access to your user¶
Add your user to the dialout group.
sudo usermod -a -G dialout `whoami`
Apply changes to profile¶
In order to apply the changes to your user, you must log out and log in again or reboot you system.
reboot