Working with Zephyr® RTOS projects using West
In CLion, you can open, build, and run/debug Zephyr projects with a built-in West plugin. Compared to CLion’s CMake integration, the West integration provides an easier way to set up and build Zephyr projects. Although you can still use CMake, we recommend using CLion’s native West integration.
This guide explains how to build, run, and debug a Zephyr application.
Install Zephyr and Python dependencies
Install Zephyr, West, and Python dependencies on your system.
Install Zephyr SDK on your system.
Open your West project
Click Open on the Welcome screen or select from the main menu.
Select a directory with a Zephyr project that contains the CMakeLists.txt file.
Open your project settings via
.CLion will automatically fill in the
, , and fields with default values in the West dialogue. You can change them if necessary.Select your board name in the corresponding field if it has not already been selected automatically.
Click OK. CLion will load the project and display the results in the tool window:
Set up a run/debug configuration
CLion detects the project build targets and creates the native West configurations for them. To set up additional parameters:
Select
from the main toolbar or from the main menu. The dialog will open.Copy the command line arguments you use to run the
west flash
andwest debug
commands in the Terminal. Paste them into the and fields, respectively. If you select the option, the and fields will become unavailable.Click OK, and your program will be ready to run and debug.
Run and debug your program
To run or debug your program, you can use the configuration widget (click or ), the
menu, or the gutter icons next to the program’s entry point.Here is an example of debugging a Zephyr program:
Convert an existing CMake project to West and vice versa
If you have an existing Zephyr project that you run as a CMake one, you can convert it to a West project. To do this, right-click a CMakeLists.txt file in your project directory and select from the context menu.
You can also convert a West project back to CMake. Right-click a CMakeLists.txt file in your project directory and select from the context menu.