|
| 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 | +  |
| 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 | +  |
| 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 | +  |
| 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. |
0 commit comments