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

  1. 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
    
  2. Install OpenThread and KNoT Protocol dependencies. These are external packages used by Zephyr and KNoT SDK.

    sudo apt install autoconf automake libtool
    
  3. 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

  1. 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
    
  2. 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

  1. 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
    
  2. Install the west binary and bootstrapper.

    pip3 install --user west
    
  3. 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.

  4. 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.

  5. 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.



Set up the KNoT SDK Environment

  1. 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.

  2. 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

  1. 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.

  2. 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