Development Setup

This section talks about setting up the development host, fetching the Git repositories, and instructions to build.

Prepare Matter Environment

Pull the code from GitHub and set up the Matter environment.

Linux and macOS are the supported development hosts in Matter, the recommended host versions: Ubuntu 22.04 LTS

There are some installation prerequisites on Linux systems. For detailed steps, see Installing prerequisites on Linux.

Installing Prerequisites on Linux

On Debian-based Linux distributions like Ubuntu, open the terminal and use the following command to satisfy these dependencies:

$ sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \
  libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \
  python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev

Getting the Repositories

Realtek’s SDK has certain requirements for the placement of Matter and Openthread code. Clone the codes to the following location.

└── SDK                       SDK development package
    ├── bin                   Application linked binaries
    ├── bsp                   Board-level and hardware-related files
    ├── include               Header file that provides interface definition
    ├── samples               Configured and ready-to-use Keil example project
    ├── subsys                Upper layer and hardware-independent software protocol
    └── tools                 Toolset
└── subsys
    └── matter
        ├── connectedhomeip                 Matter source code
        ├── samples                         Secure APP
        ├── rtk_matter
            ├── rtl87x2g_matter1.4.patch    For Realtek build
            └── connectedhomeip.tar         For Realtek build
        └── vendor                          Matter porting layer
    └── openthread
        ├── openthread                      Openthread source code
        ├── lib                             Patch lib & mbedtls lib
        ├── Realtek                         Script build
        ├── tools                           OTA image packaging tool
        └── vendor                          Openthread porting layer

Prepare Openthread

Open a command prompt and navigate to the Openthread directory.

$ cd ./subsys/openthread

Clone openthread source code in the current folder.

$ git clone https://github.com/openthread/openthread

Prepare Matter

Navigate to the Matter directory.

$ cd ./subsys/matter

Clone Matter source code in the current folder.

$ git clone https://github.com/project-chip/connectedhomeip

Navigate to the newly created connectedhomeip directory and change code version.

$ cd connectedhomeip
$ git checkout v1.4.0.0

Apply the patch file to the current repository and extract the tar file into the current directory.

$ git apply ../rtk_matter/rtl87x2g_matter1.4.patch
$ tar -xvf ../rtk_matter/connectedhomeip.tar -C ./

Setup Matter Environment

Navigate to the connectedhomeip directory and setup Matter environment. This may take a long time, please be patient. It is also possible to fail halfway.

$ git submodule update --init --recursive
$ source scripts/bootstrap.sh
$ source scripts/activate.sh

One can also refer to Building Matter in the Matter documentation.