Creating Matter Applications using SLC CLI#
Silicon Labs Configurator (SLC): SLC offers command-line access to application configuration and generation functions. Software Project Generation and Configuration with SLC-CLI provides instructions on downloading and using the SLC-CLI tool.
This guide lists the steps to create and build a Silicon Labs Matter SLC project using SLC-CLI and make
. These scripts are evaluation quality and have been verified to work on Ubuntu 22.04.3 LTS, MacOS Version 13.5.1, and Windows 10.
Setting up the Environment#
Clone Simplicity SDK:
git clone https://github.com/SiliconLabs/simplicity_sdk
Create a directory named extension
inside the SiSDK directory.
Clone the Matter SiSDK Extension inside the extension
directory:
git clone https://github.com/SiliconLabs/matter_extension.git
To use SiWx91x Wi-Fi applications, clone the WiSeConnect SDK inside the extension directory.
git clone https://github.com/SiliconLabs/wiseconnect.git
Your path to the Matter extension and WiSeConnect extension should look like:
<Path/To/Sdk/Download>/extension/matter_extension
<Path/To/Sdk/Download>/extension/wiseconnect
Install the following python packages:
pip3 install dload
pip3 install python-dotenv
Change directory to cloned extension directory and run the sl_setup.py
script. This will install the ARM gcc toolchain, SLC-CLI, ZAP, Simplicity Commander, Ninja, and Java.
For Mac and Linux:
cd extension/matter_extension
python3 slc/sl_setup_env.py
For Windows:
cd extension\matter_extension
python slc\sl_setup_env.py
The sl_setup_env.py
script creates an .env file to be used to set the environment variables needed for the installed tools, ARM toolchain, SLC-CLI, Java ZAP, Simplicity Commander, Ninja, and Java.
It will also create environment_variables_vscode.txt
. This file can be referred to add environment variables for VS Code based builds.
The script will ask you for permission to trust simplicity_sdk, matter_extension, and wiseconnect.
Creating an Application Project#
Run the sl_create_new_app.py
script to create a BRD4161A project with name MyNewApp
starting from the lighting-app-thread.slcp
example application project file:
The script will ask user permission to trust the simplicity_sdk
and matter_extension
before generating.
For Mac and Linux:
python3 slc/sl_create_new_app.py MyNewApp slc/sample-app/lighting-app/efr32/lighting-app-thread.slcp brd4187c
For Windows:
python slc\sl_create_new_app.py MyNewApp slc\sample-app\lighting-app\efr32\lighting-app-thread.slcp brd4187c
Building an Application Project#
After a project is created the sl_build.py
script can be used to re-generate the MyNewApp
project and build it:
For Mac and Linux:
python3 slc/sl_build.py MyNewApp/lighting-app-thread.slcp brd4187c
For Windows:
python slc\sl_build.py MyNewApp\lighting-app-thread.slcp brd4187c
Alternately, one can use SLC-CLI commands directly to generate the project and then use make
to build it.
Windows users will need to install make
in their system. You can use your own or follow these steps to get make
.
Install the MSYS terminal, which provides a Unix-like environment on Windows.
Open the MSYS terminal and install
make
using the commandpacman -S make
.Run command
where make
, copy the path, and add it to the PATH environment variable.Restart your command line terminal and run
slc/sl_build.py
or run make directly. You might need to reboot.
Note: In rare cases, the build may fail due to missing files in the zap-generated/
directory. The workaround is to delete the .zap
folder in the home directory.
Modifying an Application Project#
The resulting user project can be modified like any other SLC project. Software components can be added or removed by modifying the project's .slcp file, configuration can be applied by modifying the files in the config
directory, the application logic can be managed through the files in the src
directory. Various SLC-CLI commands can be used to examine, validate, or re-generate the project after a modification, see Software Project Generation and Configuration with SLC-CLI for more information.
For modifying Matter endpoints and clusters invoke the ZAP tool passing to it the application's ZAP file:
./scripts/tools/zap/run_zaptool.sh MyNewApp/config/common/lighting-thread-app.zap
Edit and Build with Visual Studio Code#
Install the "Simplicity Studio for VS Code" extension on VS code.
Add the POST_BUILD_EXE and NINJA_BUILD_EXE variables from the slc\tools\environment_variables_vscode.txt
to the environment variables.
Run the sl_setup_env.py
and sl_create_new_app.py
to set up and create a sample application, then load the application in VS Code by following the "Adding a VS Code-Enabled Simplicity Studio Project to VS Code" section from Simplicity Studio User Guide.
You can make all the changes in source files and regenerate app using 'slc generate' commands.