Skip to content

Commit dab9d74

Browse files
Merge pull request #2483 from odincodeshen/feature/zephyr_vsworkbench
Zephyr Workbench VS Code learning path
2 parents c4a5879 + f64b304 commit dab9d74

File tree

15 files changed

+544
-1
lines changed

15 files changed

+544
-1
lines changed

assets/contributors.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,5 @@ Mohamad Najem,Arm,,,,
105105
Ruifeng Wang,Arm,,,,
106106
Zenon Zhilong Xiu,Arm,,zenon-zhilong-xiu-491bb398,,
107107
Zbynek Roubalik,Kedify,,,,
108-
Yahya Abouelseoud,Arm,,,,
108+
Ayoub Bourjilat,AC6,Bourjilat,ayoub-bourjilat-a55b58165/,,https://www.ac6.fr/en/
109+
Yahya Abouelseoud,Arm,,,,
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
title: Install and Setup Zephyr Workbench in VS Code
3+
weight: 2
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Set Up Your Zephyr Development Environment
10+
11+
Setting up a [Zephyr](https://zephyrproject.org/) RTOS development environment from scratch can be challenging—requiring developers to manually install SDKs, configure toolchains, and initialize workspace directories. These steps often vary across operating systems and board vendors, leading to a fragmented and error-prone setup process.
12+
13+
***[Zephyr Workbench](https://zephyr-workbench.com/)*** is an open-source Visual Studio Code extension that transforms Zephyr RTOS development into a streamlined IDE experience. Created by [Ac6](https://www.ac6.fr/en/), it automates toolchain setup, project management, and debugging—making Zephyr projects faster to start and easier to scale.
14+
15+
In this learning path, you’ll walk through the essential steps to install Zephyr Workbench and configure a complete development environment on your local machine. Once complete, you’ll be ready to create, build, and debug applications for Arm Cortex-M platforms using Zephyr RTOS.
16+
17+
**Key capabilities:**
18+
19+
- One-Click Environment Setup: Automatically installs required host tools including Python, CMake, Ninja, and Git.
20+
- SDK and Toolchain Management: Supports importing and managing Zephyr SDKs with version and architecture selection.
21+
- Workspace and Project Initialization: Initializes west workspaces and creates board-specific applications from samples.
22+
- Integrated Build and Flash: Builds Zephyr applications and flashes to hardware directly from the VS Code interface.
23+
- Advanced Debug and Memory Analysis: Provides breakpoint debugging and memory usage insights with hardware probe support.
24+
25+
## What you need before installing Zephyr Workbench
26+
27+
To get started with Zephyr Workbench, ensure you have the following required Software:
28+
29+
**Visual Studio Code:**
30+
31+
- Download, install, and start Visual Studio Code on your desktop.
32+
33+
**Windows Requirements:**
34+
35+
- Windows 10 or later (64-bit)
36+
- Administrator privileges for installing tools and drivers
37+
- Internet connection for downloading packages and SDKs
38+
39+
Or
40+
41+
**macOS Requirements:**
42+
43+
- On macOS, the package manager "Homebrew" is required.
44+
- To install Homebrew, run the following command:
45+
46+
```bash
47+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
48+
```
49+
50+
**Supported Hardware:**
51+
52+
- STM32 development boards (STM32 Discovery, Nucleo series)
53+
- Nordic Semiconductor boards (nRF52, nRF53, nRF91 series)
54+
- NXP development boards (FRDM, LPCXpresso series)
55+
- Espressif boards (ESP32-based boards)
56+
- And many other Zephyr-supported platforms
57+
58+
## Set Up Zephyr Workbench Extension in Visual Studio Code
59+
60+
This module walks you through installing the Zephyr Workbench extension and setting up your Arm-ready development environment.
61+
62+
### Install the Extension
63+
64+
1. **Open VS Code Extension Marketplace**
65+
- Open Visual Studio Code
66+
- Navigate to the `Extensions view` by clicking the Extensions icon in the Activity Bar
67+
- Or use the keyboard shortcut `Ctrl+Shift+X` (Windows/Linux) or `Cmd+Shift+X` (macOS)
68+
2. **Search and Install**
69+
- In the search box, type "Zephyr Workbench"
70+
- Locate the official "Zephyr Workbench" extension by Ac6
71+
- Click "Install" to add the extension to VS Code
72+
3. **Verify Installation**
73+
- After installation, you should see the Zephyr Workbench panel in the VS Code sidebar
74+
- The extension icon will appear in the Activity Bar
75+
- A welcome message may appear confirming successful installation
76+
77+
Once installed, the Zephyr Workbench icon appears in the sidebar with a welcome screen.
78+
79+
80+
81+
### Install Required Host Tools
82+
83+
In the Zephyr Workbench panel, click ***Install Host Tools*** to automatically install dependencies:
84+
- ***Python*** 3.x
85+
- ***CMake***
86+
- ***Ninja*** build system
87+
- ***Git***
88+
- ***Device Tree Compiler*** (DTC)
89+
- ***West*** meta-tool
90+
91+
![Install Host Tools #center](images/install_host_tools.png)
92+
93+
{{% notice Note %}}
94+
On Windows, you may be prompted for permission when tools are executed. Click "Allow" when requested.
95+
{{% /notice %}}
96+
97+
After host tools installation, click ***Verify Host Tools*** to check the version of each installed packages.
98+
99+
100+
### Import and Configure Toolchain
101+
102+
Next, download and configure the ***Toolchain***.
103+
104+
- Click ***Import Toolchain*** in the Zephyr Workbench panel
105+
- Select the toolchain family (***Zephyr SDK***)
106+
- configure the ***SDK Type***: choose ***Minimal*** for basic functionality
107+
- **Version:** Select desired version (e.g., v0.17.0 or v0.17.3)
108+
- **Toolchains:** Select target architectures (In this learning path, you only need to select ***arm***)
109+
- **Location:** Specify the parent directory for SDK installation
110+
- Click **"Import"** to download and install the SDK
111+
112+
![Import Toolchain #center](images/import_toolchain.png)
113+
114+
115+
### Initialize the Zephyr Project Workspace
116+
117+
Zephyr uses a Git-based workspace manager called West to organize its source code, modules, and samples. Use Zephyr Workbench to initialize your first ***west workspace***.
118+
119+
In the Zephyr Workbench panel, click “Initialize Workspace” and fill in the following settings:
120+
121+
- Click "Initialize workspace" to set up your project environment
122+
- Configure workspace settings in the opened page:
123+
- **Source location:** Select "Minimal from template"
124+
- **Path:** Use default `https://github.com/zephyrproject`
125+
- **Template:** Choose target-specific template (e.g., STM32, NXP)
126+
- **Branch:** Select Zephyr version (e.g., v3.7.0, v4.1.0)
127+
- **Location:** Specify directory for workspace (takes ~10 minutes to initialize)
128+
- Click "Import" to create and update the workspace
129+
130+
![Initialize West Workspace #center](images/initialize_workspace.png)
131+
132+
{{% notice Note %}}
133+
The workspace initialization downloads the Zephyr source code and dependencies. This process may take several minutes depending on your internet connection.
134+
{{% /notice %}}
135+
136+
### Verify Setup
137+
138+
**Test your setup**
139+
- Confirm that the Zephyr Workbench panel shows all components as installed:
140+
- Host Tools installed successfully
141+
- SDK imported and detected
142+
- West workspace initialized
143+
- Ensure no error messages appear in the VS Code output panel
144+
145+
{{% notice Note %}}
146+
**Troubleshooting tips:**
147+
- Run VS Code as Administrator if host tool installation fails on Windows
148+
- Ensure internet access is allowed through your firewall
149+
- Check for minimum 2GB free disk space before importing SDK
150+
{{% /notice %}}
151+
152+
You’re now ready to create and build your first Zephyr application targeting an Arm Cortex-M board.
153+
154+
After completing this session, your environment is ready to create, build, and debug Zephyr applications in VS Code using Arm Cortex-M boards.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
title: Build Zephyr Applications in VS Code
3+
weight: 3
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Create and Build Your First Zephyr Application
10+
11+
In this session, you’ll learn how to create and build your first Zephyr application using Zephyr Workbench. This step prepares you to customize, test, and expand real firmware projects on Arm Cortex-M boards.
12+
13+
For demonstration, we will use an [NXP FRDM-MCXN947](https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXN947) development board as the target device. However, the same steps apply to any Zephyr-supported Arm Cortex-M board.
14+
You can find the full list of supported boards in the [Supported Boards](https://docs.zephyrproject.org/latest/boards/#).
15+
16+
Depending on your board, you may need to install a different debug tool. We’ll cover that in the next module.
17+
18+
### Create Application
19+
20+
In the Zephyr Workbench panel:
21+
22+
1. Click **"Create New Application"**
23+
2. Configure your project:
24+
- Select workspace and SDK
25+
- Choose your **target board** (e.g., NXP FRDM-MCXN947)
26+
- Select a sample app (e.g., `hello_world`)
27+
- Provide a project name
28+
29+
![Create App](images/create_app.png)
30+
31+
32+
### Build the Application
33+
34+
Click the **Build** button in Zephyr Workbench or press `Ctrl+Shift+B`.
35+
36+
The build system compiles your application and links it against the Zephyr kernel and board-specific drivers.
37+
38+
![Build Application](images/build_application.png)
39+
40+
41+
### Install Board-Specific Debug Utilities
42+
43+
To enable debugging on your target hardware, you may need to install additional tools based on the board vendor.
44+
45+
For the NXP FRDM-MCXN947, download and install the LinkServer debug utility:
46+
- LinkServer for Microcontrollers: [NXP LinkServer Download Page](https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/linkserver-for-microcontrollers:LINKERSERVER)
47+
48+
Once installed, Zephyr Workbench will attempt to detect it automatically during a debug session.
49+
If you’re using a different board, refer to your vendor’s documentation to install the appropriate debug utility.
50+
51+
{{% notice Note %}}
52+
If Zephyr Workbench does not automatically detect the installed debug runner, you can manually configure it.
53+
Open the ***Debug Manager*** from the Zephyr sidebar, and enter the full path to the runner executable.
54+
{{% /notice %}}
55+
56+
### Review Output
57+
58+
Check the build output at the bottom panel of VS Code. Ensure there are no errors or warnings. A successful build should display:
59+
60+
```
61+
Building ‘hello_world’ for frdm_mcxn947
62+
Memory region Used Size Region Size % Used
63+
FLASH: 19844 B 1 MB 1.9%
64+
SRAM: 4048 B 256 KB 1.5%
65+
```
66+
67+
68+
### Code Walkthrough: hello_world
69+
70+
```c
71+
#include <zephyr/kernel.h>
72+
#include <zephyr/sys/printk.h>
73+
74+
int main(void)
75+
{
76+
printk("Hello World! %s\n", CONFIG_BOARD); // Prints board name to serial console
77+
return 0;
78+
}
79+
```
80+
81+
`CONFIG_BOARD` expands to your target board name. Try modifying this app in the next module!
82+
83+
### Try This: Modify and Rebuild
84+
85+
Now that the app is working, try editing the message in `printk()` or changing the board target in the application settings. Then rebuild and observe the output. This helps verify that your toolchain and workspace respond correctly to code and config changes.
86+
87+
With your first Zephyr application successfully built, you’re ready to take the next step—debugging. In the next module, you’ll launch a debug session, set breakpoints, and perform memory analysis using Zephyr Workbench. These skills will help you validate and optimize applications running on real Arm Cortex-M hardware.

0 commit comments

Comments
 (0)