|
This repository contains example projects that demonstrate various applications running on Zephyr OS supported on Silicon Labs Development Kits. All examples in this repository are considered to be EXPERIMENTAL QUALITY, which implies that the code provided in the repository has not been formally tested and is provided as-is. It is not suitable for production environments.
No | Example name | Link to example |
---|---|---|
1 | Zephyr - MikroBus Demo | Click Here |
2 | Zephyr - Si7210 Hall Effect Magnetic Sensor | Click Here |
3 | Zephyr - Qwiic Connector | Click Here |
4 | Zephyr - Simplicity Connect Demo - Blinky | Click Here |
5 | Zephyr - Modified SoC Thermometer | Click Here |
6 | Zephyr - SoC Throughput | Click Here |
7 | Zephyr - BTHome v2 - xG24/xG27 Dev Kit Sensors with LVGL | Click Here |
8 | Zephyr - OTA Firmware Update over BLE | Click Here |
9 | Zephyr - ST7789 Display Demo | Click Here |
Follow the getting started guide here: Zephyr Getting Started Guide with 2 sections:
-
Install dependencies
The current minimum required version for the main dependencies are:Tool Min. Version Cmake 3.20.5 Python 3.10 Devicetree complier 1.4.6
The application structure is based on the Zephyr example application. Follow steps below to setup and build
-
Create a python virtual environment and activate that environment.
-
For Windows:
-
To create a python virtual environment on windows, run the following commands by using Batchfile or Powershell
Command Batchfile Powershell Goto user home directory cd %HOMEPATH%
cd $Env:HOMEPATH
Create virtual environment python -m venv zephyrproject\.venv
python -m venv zephyrproject\.venv
Active virtual environment zephyrproject\.venv\Scripts\activate.bat
zephyrproject\.venv\Scripts\activate.ps1
-
-
For Ubuntu:
python3 -m venv ~/zephyrproject/.venv
source ~/zephyrproject/.venv/bin/activate
-
For MacOS:
python3 -m venv ~/zephyrproject/.venv
source ~/zephyrproject/.venv/bin/activate
-
-
Install west.
pip install west
-
Clone the Zephyr applications repository of Silicon Labs.
cd zephyrproject
git clone https://github.com/SiliconLabs/zephyr_applications.git
-
Initialize the workspace by running the following commands.
west init -l zephyr_applications
west update
-
Install additional Python dependencies.
pip install -r zephyr/scripts/requirements.txt
-
Install the Zephyr SDK
cd ~/zephyrproject/zephyr
west sdk install --version 0.17.2
-
Fetch and store the Silicon Labs pre-built libraries
west blobs fetch hal_silabs
-
Build & running the example application
The example applications is located at applications
folder. Use west command to build and flash to the board.
-
Build:
west build -p -b <board_id> <application_path>
Important
Ensure You're Using Zephyr SDK 0.17.2
If you have multiple versions of the Zephyr SDK installed, make sure to use version 0.17.2 when building examples. You can do this by explicitly setting the ZEPHYR_SDK_INSTALL_DIR environment variable
- macOS / Ubuntu:
export ZEPHYR_SDK_INSTALL_DIR=path/to/zephyr-sdk-0.17.2
- Windows Command Line:
set ZEPHYR_SDK_INSTALL_DIR=path\to\zephyr-sdk-0.17.2
- PowerShell:
$env:ZEPHYR_SDK_INSTALL_DIR = "path\to\zephyr-sdk-0.17.2"
For more detailed instructions on how to set environment variables, please visit: Developing with Zephyr » Environment Variables
You can verify this by checking the build output log to confirm which Zephyr SDK version is being used.
-- Found host-tools: zephyr 0.17.2 (/path/to/zephyr-sdk-0.17.2)
-
Flash:
west flash
Tip
- Refer to the example application documentation (the README file) to get more details on how to build and run each example applications.
- For more information regarding setting up the environment, please refer to this guide on Zephyr's homepage.
- We would advise using the Python version 3.10.
The following guides are relevant to how to be more familiar with Zephyr OS and make a simple application.
You can start with a variety of examples in the zephyrproject/zephyr/sample
directory. It might be best to approach Zephyr and understand how it works.
The typical example outline as below:
+--boards > Contains devicetree overlay files for each supported boards.
+--build > Contains the binary and system files of the example.
+--src > Contains source code files of the example.
+--CmakeLists.txt > Contains a set of directives and instructions describing the project's source files and targets
+--Kconfig > Configure the Zephyr kernel and subsystems at build time to adapt them for specific application and platform needs.
+--prj.config > This is a Kconfig fragment that specifies application-specific values for one or more Kconfig options.
+--README.md > Readme file of the project.
If you want to develop your project, you should focus on some files that specify your projects, like the devicetree overlay file, CmakeLists.txt, Kconfig, and prj.conf.
The build
command helps you build Zephyr applications from the source. The easiest way is to go to your application’s root directory (i.e. the folder containing the application’s CMakeLists.txt file) and then run the following command:
west build -b <BOARD_ID>
In case, you don't know the exact board's ID, you can get the supported board list using the west boards
command.
We recommend setting the application source directory explicitly and giving its path as a positional argument:
west build -b <BOARD_ID> <zephyr_applications/applications/...>
For further information related to building the application, see this section for more details.
Important
If you are using the Arduino Nano Matter board:
Refer to this guide for instructions on compiling, installing, and running OpenOCD for flashing and debugging.
From a Zephyr build directory, re-build the binary and flash it to your board:
west flash
To specify the build directory, you have to use --build-dir
(or -d
):
west flash --build-dir path/to/build/directory
If you don’t specify the build directory, west flash
searches for one in the build
directory in your current working directory.
Note
To flash the binary to the board, we advise installing and using the SEGGER RTT J-Link driver. You can download it here.
You can launch Console, which is integrated into Simplicity Studio or use a third-party terminal tool such as Putty, TeraTerm or similar tools.
Getting started with the Developing with Zephyr section on Zephyr's homepage.
For more information, visit the Developer documentation portal of Silicon Laboratories.
To report bugs in the Application Examples projects, please create a new "Issue" in the "Issues" section of this repo. Please reference the board, project, and source files associated with the bug, and reference line numbers. If you are proposing a fix, also include information on the proposed fix. Since these examples are provided as-is, there is no guarantee that these examples will be updated to fix these issues.
Questions and comments related to these examples should be made by creating a new "Issue" in the "Issues" section of this repo.