开发插件“IDE for Zephyr“完全指南

VSCode下Zephyr开发插件"IDE for Zephyr"完全指南

引言

对于Zephyr RTOS开发者来说,配置一个完整的开发环境往往需要安装多个工具、配置环境变量、设置west工作空间等。IDE for Zephyr 是VS Code上的一款专业插件(原名Zephyr IDE),它能够自动化整个Zephyr开发流程,从工具安装到代码调试,让开发者专注于应用开发本身。

本文将详细介绍这款插件的作用、功能、使用方法,帮助您快速搭建Zephyr开发环境。


一、IDE for Zephyr插件概述

1.1 插件简介

IDE for Zephyr 是由Mylonics公司开发的VS Code扩展,专为Zephyr RTOS嵌入式固件开发设计。目前已有超过16,000次安装,是Zephyr社区最受欢迎的IDE插件之一。
#mermaid-svg-QPcFonvJiW2VULpr{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-QPcFonvJiW2VULpr .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-QPcFonvJiW2VULpr .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-QPcFonvJiW2VULpr .error-icon{fill:#552222;}#mermaid-svg-QPcFonvJiW2VULpr .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-QPcFonvJiW2VULpr .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-QPcFonvJiW2VULpr .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-QPcFonvJiW2VULpr .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-QPcFonvJiW2VULpr .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-QPcFonvJiW2VULpr .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-QPcFonvJiW2VULpr .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-QPcFonvJiW2VULpr .marker{fill:#333333;stroke:#333333;}#mermaid-svg-QPcFonvJiW2VULpr .marker.cross{stroke:#333333;}#mermaid-svg-QPcFonvJiW2VULpr svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-QPcFonvJiW2VULpr p{margin:0;}#mermaid-svg-QPcFonvJiW2VULpr .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-QPcFonvJiW2VULpr .cluster-label text{fill:#333;}#mermaid-svg-QPcFonvJiW2VULpr .cluster-label span{color:#333;}#mermaid-svg-QPcFonvJiW2VULpr .cluster-label span p{background-color:transparent;}#mermaid-svg-QPcFonvJiW2VULpr .label text,#mermaid-svg-QPcFonvJiW2VULpr span{fill:#333;color:#333;}#mermaid-svg-QPcFonvJiW2VULpr .node rect,#mermaid-svg-QPcFonvJiW2VULpr .node circle,#mermaid-svg-QPcFonvJiW2VULpr .node ellipse,#mermaid-svg-QPcFonvJiW2VULpr .node polygon,#mermaid-svg-QPcFonvJiW2VULpr .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-QPcFonvJiW2VULpr .rough-node .label text,#mermaid-svg-QPcFonvJiW2VULpr .node .label text,#mermaid-svg-QPcFonvJiW2VULpr .image-shape .label,#mermaid-svg-QPcFonvJiW2VULpr .icon-shape .label{text-anchor:middle;}#mermaid-svg-QPcFonvJiW2VULpr .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-QPcFonvJiW2VULpr .rough-node .label,#mermaid-svg-QPcFonvJiW2VULpr .node .label,#mermaid-svg-QPcFonvJiW2VULpr .image-shape .label,#mermaid-svg-QPcFonvJiW2VULpr .icon-shape .label{text-align:center;}#mermaid-svg-QPcFonvJiW2VULpr .node.clickable{cursor:pointer;}#mermaid-svg-QPcFonvJiW2VULpr .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-QPcFonvJiW2VULpr .arrowheadPath{fill:#333333;}#mermaid-svg-QPcFonvJiW2VULpr .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-QPcFonvJiW2VULpr .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-QPcFonvJiW2VULpr .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-QPcFonvJiW2VULpr .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-QPcFonvJiW2VULpr .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-QPcFonvJiW2VULpr .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-QPcFonvJiW2VULpr .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-QPcFonvJiW2VULpr .cluster text{fill:#333;}#mermaid-svg-QPcFonvJiW2VULpr .cluster span{color:#333;}#mermaid-svg-QPcFonvJiW2VULpr div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-QPcFonvJiW2VULpr .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-QPcFonvJiW2VULpr rect.text{fill:none;stroke-width:0;}#mermaid-svg-QPcFonvJiW2VULpr .icon-shape,#mermaid-svg-QPcFonvJiW2VULpr .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-QPcFonvJiW2VULpr .icon-shape p,#mermaid-svg-QPcFonvJiW2VULpr .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-QPcFonvJiW2VULpr .icon-shape .label rect,#mermaid-svg-QPcFonvJiW2VULpr .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-QPcFonvJiW2VULpr .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-QPcFonvJiW2VULpr .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-QPcFonvJiW2VULpr :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} IDE for Zephyr
主机工具管理
SDK管理
West工作空间
项目管理
编译调试
Twister测试
CMake安装
Python安装
Ninja安装
west sdk命令
多架构工具链
workspace初始化
多workspace切换
项目创建
多构建配置
编译
烧录
调试

1.2 插件基本信息

属性 信息
插件名称 IDE for Zephyr
发布者 Mylonics
原名 Zephyr IDE
价格 免费
支持平台 Linux、macOS、Windows
支持架构 ARM Cortex-M、RISC-V、Xtensa、x86
支持开发板 nRF52、nRF5340、STM32、ESP32、Raspberry Pi Pico等
市场链接 VS Code Marketplace

1.3 插件核心优势

#mermaid-svg-6pikFTMolYupXRqb{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-6pikFTMolYupXRqb .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-6pikFTMolYupXRqb .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-6pikFTMolYupXRqb .error-icon{fill:#552222;}#mermaid-svg-6pikFTMolYupXRqb .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-6pikFTMolYupXRqb .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-6pikFTMolYupXRqb .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-6pikFTMolYupXRqb .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-6pikFTMolYupXRqb .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-6pikFTMolYupXRqb .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-6pikFTMolYupXRqb .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-6pikFTMolYupXRqb .marker{fill:#333333;stroke:#333333;}#mermaid-svg-6pikFTMolYupXRqb .marker.cross{stroke:#333333;}#mermaid-svg-6pikFTMolYupXRqb svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-6pikFTMolYupXRqb p{margin:0;}#mermaid-svg-6pikFTMolYupXRqb .pieCircle{stroke:#000000;stroke-width:2px;opacity:0.7;}#mermaid-svg-6pikFTMolYupXRqb .pieOuterCircle{stroke:#000000;stroke-width:1px;fill:none;}#mermaid-svg-6pikFTMolYupXRqb .pieTitleText{text-anchor:middle;font-size:25px;fill:#000000;font-family:"trebuchet ms",verdana,arial,sans-serif;}#mermaid-svg-6pikFTMolYupXRqb .slice{font-family:"trebuchet ms",verdana,arial,sans-serif;fill:#000000;font-size:17px;}#mermaid-svg-6pikFTMolYupXRqb .legend text{fill:#000000;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:17px;}#mermaid-svg-6pikFTMolYupXRqb :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 30% 25% 20% 15% 10% IDE for Zephyr核心优势 自动化环境配置 一站式开发体验 团队协作支持 多目标支持 Twister测试集成


二、插件核心功能详解

2.1 功能总览

功能类别 具体功能 说明
主机工具安装 CMake、Python 3、Ninja、DTC、gcc 跨平台自动安装
SDK管理 west sdk驱动 多版本、多架构管理
工作空间 west.yml模板、克隆现有workspace 支持NCS、Zephyr等
多workspace 注册多个workspace 无需重启VS Code
项目创建 基于Zephyr示例 向导式创建
多构建 多个build、共享Runner 灵活的构建配置
KConfig/DTS 每项目、每build配置 灵活的配置文件
编译/烧录/调试 状态栏快捷操作 集成Cortex-Debug
Twister测试 集成测试UI 同一界面管理
配置共享 zephyr-ide.json Git版本控制友好

2.2 自动化主机工具安装

IDE for Zephyr会按照Zephyr官方入门指南自动安装以下主机工具:
#mermaid-svg-AN0s20kjAwyoeETV{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-AN0s20kjAwyoeETV .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-AN0s20kjAwyoeETV .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-AN0s20kjAwyoeETV .error-icon{fill:#552222;}#mermaid-svg-AN0s20kjAwyoeETV .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-AN0s20kjAwyoeETV .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-AN0s20kjAwyoeETV .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-AN0s20kjAwyoeETV .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-AN0s20kjAwyoeETV .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-AN0s20kjAwyoeETV .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-AN0s20kjAwyoeETV .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-AN0s20kjAwyoeETV .marker{fill:#333333;stroke:#333333;}#mermaid-svg-AN0s20kjAwyoeETV .marker.cross{stroke:#333333;}#mermaid-svg-AN0s20kjAwyoeETV svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-AN0s20kjAwyoeETV p{margin:0;}#mermaid-svg-AN0s20kjAwyoeETV .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-AN0s20kjAwyoeETV .cluster-label text{fill:#333;}#mermaid-svg-AN0s20kjAwyoeETV .cluster-label span{color:#333;}#mermaid-svg-AN0s20kjAwyoeETV .cluster-label span p{background-color:transparent;}#mermaid-svg-AN0s20kjAwyoeETV .label text,#mermaid-svg-AN0s20kjAwyoeETV span{fill:#333;color:#333;}#mermaid-svg-AN0s20kjAwyoeETV .node rect,#mermaid-svg-AN0s20kjAwyoeETV .node circle,#mermaid-svg-AN0s20kjAwyoeETV .node ellipse,#mermaid-svg-AN0s20kjAwyoeETV .node polygon,#mermaid-svg-AN0s20kjAwyoeETV .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-AN0s20kjAwyoeETV .rough-node .label text,#mermaid-svg-AN0s20kjAwyoeETV .node .label text,#mermaid-svg-AN0s20kjAwyoeETV .image-shape .label,#mermaid-svg-AN0s20kjAwyoeETV .icon-shape .label{text-anchor:middle;}#mermaid-svg-AN0s20kjAwyoeETV .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-AN0s20kjAwyoeETV .rough-node .label,#mermaid-svg-AN0s20kjAwyoeETV .node .label,#mermaid-svg-AN0s20kjAwyoeETV .image-shape .label,#mermaid-svg-AN0s20kjAwyoeETV .icon-shape .label{text-align:center;}#mermaid-svg-AN0s20kjAwyoeETV .node.clickable{cursor:pointer;}#mermaid-svg-AN0s20kjAwyoeETV .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-AN0s20kjAwyoeETV .arrowheadPath{fill:#333333;}#mermaid-svg-AN0s20kjAwyoeETV .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-AN0s20kjAwyoeETV .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-AN0s20kjAwyoeETV .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-AN0s20kjAwyoeETV .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-AN0s20kjAwyoeETV .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-AN0s20kjAwyoeETV .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-AN0s20kjAwyoeETV .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-AN0s20kjAwyoeETV .cluster text{fill:#333;}#mermaid-svg-AN0s20kjAwyoeETV .cluster span{color:#333;}#mermaid-svg-AN0s20kjAwyoeETV div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-AN0s20kjAwyoeETV .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-AN0s20kjAwyoeETV rect.text{fill:none;stroke-width:0;}#mermaid-svg-AN0s20kjAwyoeETV .icon-shape,#mermaid-svg-AN0s20kjAwyoeETV .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-AN0s20kjAwyoeETV .icon-shape p,#mermaid-svg-AN0s20kjAwyoeETV .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-AN0s20kjAwyoeETV .icon-shape .label rect,#mermaid-svg-AN0s20kjAwyoeETV .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-AN0s20kjAwyoeETV .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-AN0s20kjAwyoeETV .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-AN0s20kjAwyoeETV :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 主机工具安装
CMake
Python 3
Ninja
DTC
gcc
跨平台构建配置
脚本语言
并行构建
设备树编译器
GNU编译器

支持的平台

平台 自动安装支持
Ubuntu/Debian ✅ 完全支持
macOS ✅ 完全支持
Windows ✅ 完全支持
其他Linux ⚠️ 需手动安装

2.3 SDK管理功能

通过west sdk命令,IDE for Zephyr可以自动管理Zephyr SDK:

bash 复制代码
# 自动执行的命令示例
west sdk install
west sdk list
west sdk uninstall

SDK管理特点

特点 说明
多版本支持 同时管理多个SDK版本
多架构 ARM、RISC-V、Xtensa、x86
按需安装 只安装需要的架构
自动配置 自动配置环境变量

2.4 West工作空间管理

#mermaid-svg-1tks8uFFM58IOJRJ{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-1tks8uFFM58IOJRJ .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-1tks8uFFM58IOJRJ .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-1tks8uFFM58IOJRJ .error-icon{fill:#552222;}#mermaid-svg-1tks8uFFM58IOJRJ .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-1tks8uFFM58IOJRJ .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-1tks8uFFM58IOJRJ .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-1tks8uFFM58IOJRJ .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-1tks8uFFM58IOJRJ .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-1tks8uFFM58IOJRJ .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-1tks8uFFM58IOJRJ .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-1tks8uFFM58IOJRJ .marker{fill:#333333;stroke:#333333;}#mermaid-svg-1tks8uFFM58IOJRJ .marker.cross{stroke:#333333;}#mermaid-svg-1tks8uFFM58IOJRJ svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-1tks8uFFM58IOJRJ p{margin:0;}#mermaid-svg-1tks8uFFM58IOJRJ .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-1tks8uFFM58IOJRJ .cluster-label text{fill:#333;}#mermaid-svg-1tks8uFFM58IOJRJ .cluster-label span{color:#333;}#mermaid-svg-1tks8uFFM58IOJRJ .cluster-label span p{background-color:transparent;}#mermaid-svg-1tks8uFFM58IOJRJ .label text,#mermaid-svg-1tks8uFFM58IOJRJ span{fill:#333;color:#333;}#mermaid-svg-1tks8uFFM58IOJRJ .node rect,#mermaid-svg-1tks8uFFM58IOJRJ .node circle,#mermaid-svg-1tks8uFFM58IOJRJ .node ellipse,#mermaid-svg-1tks8uFFM58IOJRJ .node polygon,#mermaid-svg-1tks8uFFM58IOJRJ .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-1tks8uFFM58IOJRJ .rough-node .label text,#mermaid-svg-1tks8uFFM58IOJRJ .node .label text,#mermaid-svg-1tks8uFFM58IOJRJ .image-shape .label,#mermaid-svg-1tks8uFFM58IOJRJ .icon-shape .label{text-anchor:middle;}#mermaid-svg-1tks8uFFM58IOJRJ .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-1tks8uFFM58IOJRJ .rough-node .label,#mermaid-svg-1tks8uFFM58IOJRJ .node .label,#mermaid-svg-1tks8uFFM58IOJRJ .image-shape .label,#mermaid-svg-1tks8uFFM58IOJRJ .icon-shape .label{text-align:center;}#mermaid-svg-1tks8uFFM58IOJRJ .node.clickable{cursor:pointer;}#mermaid-svg-1tks8uFFM58IOJRJ .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-1tks8uFFM58IOJRJ .arrowheadPath{fill:#333333;}#mermaid-svg-1tks8uFFM58IOJRJ .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-1tks8uFFM58IOJRJ .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-1tks8uFFM58IOJRJ .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-1tks8uFFM58IOJRJ .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-1tks8uFFM58IOJRJ .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-1tks8uFFM58IOJRJ .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-1tks8uFFM58IOJRJ .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-1tks8uFFM58IOJRJ .cluster text{fill:#333;}#mermaid-svg-1tks8uFFM58IOJRJ .cluster span{color:#333;}#mermaid-svg-1tks8uFFM58IOJRJ div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-1tks8uFFM58IOJRJ .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-1tks8uFFM58IOJRJ rect.text{fill:none;stroke-width:0;}#mermaid-svg-1tks8uFFM58IOJRJ .icon-shape,#mermaid-svg-1tks8uFFM58IOJRJ .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-1tks8uFFM58IOJRJ .icon-shape p,#mermaid-svg-1tks8uFFM58IOJRJ .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-1tks8uFFM58IOJRJ .icon-shape .label rect,#mermaid-svg-1tks8uFFM58IOJRJ .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-1tks8uFFM58IOJRJ .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-1tks8uFFM58IOJRJ .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-1tks8uFFM58IOJRJ :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} West工作空间
内置west.yml模板
自定义manifest
克隆现有workspace
采用现有.west
多workspace切换
Zephyr主线
NCS
自定义
west.yml指定
Git URL
ZEPHYR_BASE检测
同一VS Code窗口

多workspace支持

bash 复制代码
# 支持的workspace类型
- 纯Zephyr workspace
- NCS (nRF Connect SDK) workspace
- 任何west-based manifest
- 现有Zephyr安装(通过ZEPHYR_BASE)

2.5 项目与构建管理

#mermaid-svg-Xd0DYW4q7v6mttMY{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Xd0DYW4q7v6mttMY .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Xd0DYW4q7v6mttMY .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Xd0DYW4q7v6mttMY .error-icon{fill:#552222;}#mermaid-svg-Xd0DYW4q7v6mttMY .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Xd0DYW4q7v6mttMY .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Xd0DYW4q7v6mttMY .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Xd0DYW4q7v6mttMY .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Xd0DYW4q7v6mttMY .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Xd0DYW4q7v6mttMY .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Xd0DYW4q7v6mttMY .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Xd0DYW4q7v6mttMY .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Xd0DYW4q7v6mttMY .marker.cross{stroke:#333333;}#mermaid-svg-Xd0DYW4q7v6mttMY svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Xd0DYW4q7v6mttMY p{margin:0;}#mermaid-svg-Xd0DYW4q7v6mttMY .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-Xd0DYW4q7v6mttMY .cluster-label text{fill:#333;}#mermaid-svg-Xd0DYW4q7v6mttMY .cluster-label span{color:#333;}#mermaid-svg-Xd0DYW4q7v6mttMY .cluster-label span p{background-color:transparent;}#mermaid-svg-Xd0DYW4q7v6mttMY .label text,#mermaid-svg-Xd0DYW4q7v6mttMY span{fill:#333;color:#333;}#mermaid-svg-Xd0DYW4q7v6mttMY .node rect,#mermaid-svg-Xd0DYW4q7v6mttMY .node circle,#mermaid-svg-Xd0DYW4q7v6mttMY .node ellipse,#mermaid-svg-Xd0DYW4q7v6mttMY .node polygon,#mermaid-svg-Xd0DYW4q7v6mttMY .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Xd0DYW4q7v6mttMY .rough-node .label text,#mermaid-svg-Xd0DYW4q7v6mttMY .node .label text,#mermaid-svg-Xd0DYW4q7v6mttMY .image-shape .label,#mermaid-svg-Xd0DYW4q7v6mttMY .icon-shape .label{text-anchor:middle;}#mermaid-svg-Xd0DYW4q7v6mttMY .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-Xd0DYW4q7v6mttMY .rough-node .label,#mermaid-svg-Xd0DYW4q7v6mttMY .node .label,#mermaid-svg-Xd0DYW4q7v6mttMY .image-shape .label,#mermaid-svg-Xd0DYW4q7v6mttMY .icon-shape .label{text-align:center;}#mermaid-svg-Xd0DYW4q7v6mttMY .node.clickable{cursor:pointer;}#mermaid-svg-Xd0DYW4q7v6mttMY .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-Xd0DYW4q7v6mttMY .arrowheadPath{fill:#333333;}#mermaid-svg-Xd0DYW4q7v6mttMY .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Xd0DYW4q7v6mttMY .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Xd0DYW4q7v6mttMY .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Xd0DYW4q7v6mttMY .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-Xd0DYW4q7v6mttMY .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Xd0DYW4q7v6mttMY .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-Xd0DYW4q7v6mttMY .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Xd0DYW4q7v6mttMY .cluster text{fill:#333;}#mermaid-svg-Xd0DYW4q7v6mttMY .cluster span{color:#333;}#mermaid-svg-Xd0DYW4q7v6mttMY div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Xd0DYW4q7v6mttMY .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-Xd0DYW4q7v6mttMY rect.text{fill:none;stroke-width:0;}#mermaid-svg-Xd0DYW4q7v6mttMY .icon-shape,#mermaid-svg-Xd0DYW4q7v6mttMY .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Xd0DYW4q7v6mttMY .icon-shape p,#mermaid-svg-Xd0DYW4q7v6mttMY .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-Xd0DYW4q7v6mttMY .icon-shape .label rect,#mermaid-svg-Xd0DYW4q7v6mttMY .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Xd0DYW4q7v6mttMY .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-Xd0DYW4q7v6mttMY .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-Xd0DYW4q7v6mttMY :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 项目
Workspace
项目1
项目2
共享Runner
Build1
Build2
Build3
Board1
KConfig
DTS overlay
west/CMake args

项目配置示例(zephyr-ide.json)

json 复制代码
{
  "workspace": {
    "name": "my-zephyr-workspace",
    "path": "~/zephyrproject"
  },
  "projects": [
    {
      "name": "my_app",
      "path": "my_app",
      "type": "app",
      "builds": [
        {
          "name": "qemu_x86",
          "board": "qemu_x86",
          "runner": "default"
        },
        {
          "name": "nrf52840dk",
          "board": "nrf52840dk_nrf52840",
          "runner": "jlink",
          "kconfig": "prj.conf",
          "overlay": "boards/nrf52840dk.overlay"
        }
      ]
    }
  ]
}

2.6 编译、烧录与调试

硬件 Zephyr构建系统 West工具 IDE for Zephyr 用户 硬件 Zephyr构建系统 West工具 IDE for Zephyr 用户 #mermaid-svg-E2Z7cVhx64H9RmIV{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-E2Z7cVhx64H9RmIV .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-E2Z7cVhx64H9RmIV .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-E2Z7cVhx64H9RmIV .error-icon{fill:#552222;}#mermaid-svg-E2Z7cVhx64H9RmIV .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-E2Z7cVhx64H9RmIV .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-E2Z7cVhx64H9RmIV .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-E2Z7cVhx64H9RmIV .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-E2Z7cVhx64H9RmIV .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-E2Z7cVhx64H9RmIV .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-E2Z7cVhx64H9RmIV .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-E2Z7cVhx64H9RmIV .marker{fill:#333333;stroke:#333333;}#mermaid-svg-E2Z7cVhx64H9RmIV .marker.cross{stroke:#333333;}#mermaid-svg-E2Z7cVhx64H9RmIV svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-E2Z7cVhx64H9RmIV p{margin:0;}#mermaid-svg-E2Z7cVhx64H9RmIV .actor{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-E2Z7cVhx64H9RmIV text.actor>tspan{fill:black;stroke:none;}#mermaid-svg-E2Z7cVhx64H9RmIV .actor-line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-E2Z7cVhx64H9RmIV .innerArc{stroke-width:1.5;stroke-dasharray:none;}#mermaid-svg-E2Z7cVhx64H9RmIV .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#mermaid-svg-E2Z7cVhx64H9RmIV .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#mermaid-svg-E2Z7cVhx64H9RmIV #arrowhead path{fill:#333;stroke:#333;}#mermaid-svg-E2Z7cVhx64H9RmIV .sequenceNumber{fill:white;}#mermaid-svg-E2Z7cVhx64H9RmIV #sequencenumber{fill:#333;}#mermaid-svg-E2Z7cVhx64H9RmIV #crosshead path{fill:#333;stroke:#333;}#mermaid-svg-E2Z7cVhx64H9RmIV .messageText{fill:#333;stroke:none;}#mermaid-svg-E2Z7cVhx64H9RmIV .labelBox{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-E2Z7cVhx64H9RmIV .labelText,#mermaid-svg-E2Z7cVhx64H9RmIV .labelText>tspan{fill:black;stroke:none;}#mermaid-svg-E2Z7cVhx64H9RmIV .loopText,#mermaid-svg-E2Z7cVhx64H9RmIV .loopText>tspan{fill:black;stroke:none;}#mermaid-svg-E2Z7cVhx64H9RmIV .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-E2Z7cVhx64H9RmIV .note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-E2Z7cVhx64H9RmIV .noteText,#mermaid-svg-E2Z7cVhx64H9RmIV .noteText>tspan{fill:black;stroke:none;}#mermaid-svg-E2Z7cVhx64H9RmIV .activation0{fill:#f4f4f4;stroke:#666;}#mermaid-svg-E2Z7cVhx64H9RmIV .activation1{fill:#f4f4f4;stroke:#666;}#mermaid-svg-E2Z7cVhx64H9RmIV .activation2{fill:#f4f4f4;stroke:#666;}#mermaid-svg-E2Z7cVhx64H9RmIV .actorPopupMenu{position:absolute;}#mermaid-svg-E2Z7cVhx64H9RmIV .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#mermaid-svg-E2Z7cVhx64H9RmIV .actor-man line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-E2Z7cVhx64H9RmIV .actor-man circle,#mermaid-svg-E2Z7cVhx64H9RmIV line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;stroke-width:2px;}#mermaid-svg-E2Z7cVhx64H9RmIV :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 点击Build按钮 执行west build 启动CMake 编译项目 生成ELF文件 编译完成 点击Flash按钮 烧录固件 写入Flash 点击Debug按钮 启动调试会话 调试就绪 进入调试模式

调试器支持

调试器 支持情况
ST-Link ✅ 内置模板
J-Link ✅ 内置模板
OpenOCD ✅ 内置模板
Black Magic Probe ✅ 内置模板
pyOCD ✅ 支持

调试器特点

  • 自动从runners.yaml翻译为Cortex-Debug会话
  • 无需手动配置launch.json
  • 自动解析ELF、GDB、工具链路径
  • 内置zephyr-ide调试器

2.7 Twister测试集成

#mermaid-svg-KmSkGVf530fzupe0{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-KmSkGVf530fzupe0 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-KmSkGVf530fzupe0 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-KmSkGVf530fzupe0 .error-icon{fill:#552222;}#mermaid-svg-KmSkGVf530fzupe0 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-KmSkGVf530fzupe0 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-KmSkGVf530fzupe0 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-KmSkGVf530fzupe0 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-KmSkGVf530fzupe0 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-KmSkGVf530fzupe0 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-KmSkGVf530fzupe0 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-KmSkGVf530fzupe0 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-KmSkGVf530fzupe0 .marker.cross{stroke:#333333;}#mermaid-svg-KmSkGVf530fzupe0 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-KmSkGVf530fzupe0 p{margin:0;}#mermaid-svg-KmSkGVf530fzupe0 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-KmSkGVf530fzupe0 .cluster-label text{fill:#333;}#mermaid-svg-KmSkGVf530fzupe0 .cluster-label span{color:#333;}#mermaid-svg-KmSkGVf530fzupe0 .cluster-label span p{background-color:transparent;}#mermaid-svg-KmSkGVf530fzupe0 .label text,#mermaid-svg-KmSkGVf530fzupe0 span{fill:#333;color:#333;}#mermaid-svg-KmSkGVf530fzupe0 .node rect,#mermaid-svg-KmSkGVf530fzupe0 .node circle,#mermaid-svg-KmSkGVf530fzupe0 .node ellipse,#mermaid-svg-KmSkGVf530fzupe0 .node polygon,#mermaid-svg-KmSkGVf530fzupe0 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-KmSkGVf530fzupe0 .rough-node .label text,#mermaid-svg-KmSkGVf530fzupe0 .node .label text,#mermaid-svg-KmSkGVf530fzupe0 .image-shape .label,#mermaid-svg-KmSkGVf530fzupe0 .icon-shape .label{text-anchor:middle;}#mermaid-svg-KmSkGVf530fzupe0 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-KmSkGVf530fzupe0 .rough-node .label,#mermaid-svg-KmSkGVf530fzupe0 .node .label,#mermaid-svg-KmSkGVf530fzupe0 .image-shape .label,#mermaid-svg-KmSkGVf530fzupe0 .icon-shape .label{text-align:center;}#mermaid-svg-KmSkGVf530fzupe0 .node.clickable{cursor:pointer;}#mermaid-svg-KmSkGVf530fzupe0 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-KmSkGVf530fzupe0 .arrowheadPath{fill:#333333;}#mermaid-svg-KmSkGVf530fzupe0 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-KmSkGVf530fzupe0 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-KmSkGVf530fzupe0 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-KmSkGVf530fzupe0 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-KmSkGVf530fzupe0 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-KmSkGVf530fzupe0 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-KmSkGVf530fzupe0 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-KmSkGVf530fzupe0 .cluster text{fill:#333;}#mermaid-svg-KmSkGVf530fzupe0 .cluster span{color:#333;}#mermaid-svg-KmSkGVf530fzupe0 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-KmSkGVf530fzupe0 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-KmSkGVf530fzupe0 rect.text{fill:none;stroke-width:0;}#mermaid-svg-KmSkGVf530fzupe0 .icon-shape,#mermaid-svg-KmSkGVf530fzupe0 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-KmSkGVf530fzupe0 .icon-shape p,#mermaid-svg-KmSkGVf530fzupe0 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-KmSkGVf530fzupe0 .icon-shape .label rect,#mermaid-svg-KmSkGVf530fzupe0 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-KmSkGVf530fzupe0 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-KmSkGVf530fzupe0 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-KmSkGVf530fzupe0 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} Twister测试
添加测试
运行测试
重新配置测试
从Zephyr示例
自定义测试
UI统一管理
结果可视化
动态配置
并行执行

2.8 团队协作功能

zephyr-ide.json的优势
#mermaid-svg-Rm110ccCoM7sKjQA{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Rm110ccCoM7sKjQA .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Rm110ccCoM7sKjQA .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Rm110ccCoM7sKjQA .error-icon{fill:#552222;}#mermaid-svg-Rm110ccCoM7sKjQA .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Rm110ccCoM7sKjQA .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Rm110ccCoM7sKjQA .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Rm110ccCoM7sKjQA .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Rm110ccCoM7sKjQA .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Rm110ccCoM7sKjQA .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Rm110ccCoM7sKjQA .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Rm110ccCoM7sKjQA .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Rm110ccCoM7sKjQA .marker.cross{stroke:#333333;}#mermaid-svg-Rm110ccCoM7sKjQA svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Rm110ccCoM7sKjQA p{margin:0;}#mermaid-svg-Rm110ccCoM7sKjQA .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-Rm110ccCoM7sKjQA .cluster-label text{fill:#333;}#mermaid-svg-Rm110ccCoM7sKjQA .cluster-label span{color:#333;}#mermaid-svg-Rm110ccCoM7sKjQA .cluster-label span p{background-color:transparent;}#mermaid-svg-Rm110ccCoM7sKjQA .label text,#mermaid-svg-Rm110ccCoM7sKjQA span{fill:#333;color:#333;}#mermaid-svg-Rm110ccCoM7sKjQA .node rect,#mermaid-svg-Rm110ccCoM7sKjQA .node circle,#mermaid-svg-Rm110ccCoM7sKjQA .node ellipse,#mermaid-svg-Rm110ccCoM7sKjQA .node polygon,#mermaid-svg-Rm110ccCoM7sKjQA .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Rm110ccCoM7sKjQA .rough-node .label text,#mermaid-svg-Rm110ccCoM7sKjQA .node .label text,#mermaid-svg-Rm110ccCoM7sKjQA .image-shape .label,#mermaid-svg-Rm110ccCoM7sKjQA .icon-shape .label{text-anchor:middle;}#mermaid-svg-Rm110ccCoM7sKjQA .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-Rm110ccCoM7sKjQA .rough-node .label,#mermaid-svg-Rm110ccCoM7sKjQA .node .label,#mermaid-svg-Rm110ccCoM7sKjQA .image-shape .label,#mermaid-svg-Rm110ccCoM7sKjQA .icon-shape .label{text-align:center;}#mermaid-svg-Rm110ccCoM7sKjQA .node.clickable{cursor:pointer;}#mermaid-svg-Rm110ccCoM7sKjQA .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-Rm110ccCoM7sKjQA .arrowheadPath{fill:#333333;}#mermaid-svg-Rm110ccCoM7sKjQA .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Rm110ccCoM7sKjQA .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Rm110ccCoM7sKjQA .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Rm110ccCoM7sKjQA .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-Rm110ccCoM7sKjQA .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Rm110ccCoM7sKjQA .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-Rm110ccCoM7sKjQA .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Rm110ccCoM7sKjQA .cluster text{fill:#333;}#mermaid-svg-Rm110ccCoM7sKjQA .cluster span{color:#333;}#mermaid-svg-Rm110ccCoM7sKjQA div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Rm110ccCoM7sKjQA .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-Rm110ccCoM7sKjQA rect.text{fill:none;stroke-width:0;}#mermaid-svg-Rm110ccCoM7sKjQA .icon-shape,#mermaid-svg-Rm110ccCoM7sKjQA .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Rm110ccCoM7sKjQA .icon-shape p,#mermaid-svg-Rm110ccCoM7sKjQA .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-Rm110ccCoM7sKjQA .icon-shape .label rect,#mermaid-svg-Rm110ccCoM7sKjQA .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Rm110ccCoM7sKjQA .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-Rm110ccCoM7sKjQA .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-Rm110ccCoM7sKjQA :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 开发者A
Git仓库
开发者B
开发者C
zephyr-ide.json
共享配置
统一环境

zephyr-ide.json包含的信息

字段 说明
projects 项目定义
builds 构建配置
runner-profiles 烧录/调试配置
kconfig KConfig文件
overlay 设备树覆盖
west-args west参数
cmake-args CMake参数

三、安装与配置

3.1 安装IDE for Zephyr

方法1:VS Code市场安装

bash 复制代码
# 打开VS Code
# 按 Ctrl+P 打开快速打开
# 输入以下命令并回车
ext install mylonics.zephyr-ide

方法2:扩展包安装

IDE for Zephyr Extension Pack包含以下扩展:

扩展 用途
Zephyr IDE 核心扩展
Cortex-Debug ARM Cortex-M GDB调试
C/C++clangd C/C++ IntelliSense
CMake CMake语言支持
DTS LSP 设备树语言支持
Serial Monitor 串口监视器(仅VS Marketplace)

安装命令

bash 复制代码
ext install mylonics.zephyr-ide-extension-pack

3.2 安装主机工具

安装插件后,按以下步骤操作:
#mermaid-svg-D2dt0r3iOTdx1khn{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-D2dt0r3iOTdx1khn .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-D2dt0r3iOTdx1khn .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-D2dt0r3iOTdx1khn .error-icon{fill:#552222;}#mermaid-svg-D2dt0r3iOTdx1khn .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-D2dt0r3iOTdx1khn .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-D2dt0r3iOTdx1khn .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-D2dt0r3iOTdx1khn .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-D2dt0r3iOTdx1khn .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-D2dt0r3iOTdx1khn .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-D2dt0r3iOTdx1khn .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-D2dt0r3iOTdx1khn .marker{fill:#333333;stroke:#333333;}#mermaid-svg-D2dt0r3iOTdx1khn .marker.cross{stroke:#333333;}#mermaid-svg-D2dt0r3iOTdx1khn svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-D2dt0r3iOTdx1khn p{margin:0;}#mermaid-svg-D2dt0r3iOTdx1khn .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-D2dt0r3iOTdx1khn .cluster-label text{fill:#333;}#mermaid-svg-D2dt0r3iOTdx1khn .cluster-label span{color:#333;}#mermaid-svg-D2dt0r3iOTdx1khn .cluster-label span p{background-color:transparent;}#mermaid-svg-D2dt0r3iOTdx1khn .label text,#mermaid-svg-D2dt0r3iOTdx1khn span{fill:#333;color:#333;}#mermaid-svg-D2dt0r3iOTdx1khn .node rect,#mermaid-svg-D2dt0r3iOTdx1khn .node circle,#mermaid-svg-D2dt0r3iOTdx1khn .node ellipse,#mermaid-svg-D2dt0r3iOTdx1khn .node polygon,#mermaid-svg-D2dt0r3iOTdx1khn .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-D2dt0r3iOTdx1khn .rough-node .label text,#mermaid-svg-D2dt0r3iOTdx1khn .node .label text,#mermaid-svg-D2dt0r3iOTdx1khn .image-shape .label,#mermaid-svg-D2dt0r3iOTdx1khn .icon-shape .label{text-anchor:middle;}#mermaid-svg-D2dt0r3iOTdx1khn .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-D2dt0r3iOTdx1khn .rough-node .label,#mermaid-svg-D2dt0r3iOTdx1khn .node .label,#mermaid-svg-D2dt0r3iOTdx1khn .image-shape .label,#mermaid-svg-D2dt0r3iOTdx1khn .icon-shape .label{text-align:center;}#mermaid-svg-D2dt0r3iOTdx1khn .node.clickable{cursor:pointer;}#mermaid-svg-D2dt0r3iOTdx1khn .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-D2dt0r3iOTdx1khn .arrowheadPath{fill:#333333;}#mermaid-svg-D2dt0r3iOTdx1khn .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-D2dt0r3iOTdx1khn .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-D2dt0r3iOTdx1khn .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-D2dt0r3iOTdx1khn .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-D2dt0r3iOTdx1khn .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-D2dt0r3iOTdx1khn .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-D2dt0r3iOTdx1khn .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-D2dt0r3iOTdx1khn .cluster text{fill:#333;}#mermaid-svg-D2dt0r3iOTdx1khn .cluster span{color:#333;}#mermaid-svg-D2dt0r3iOTdx1khn div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-D2dt0r3iOTdx1khn .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-D2dt0r3iOTdx1khn rect.text{fill:none;stroke-width:0;}#mermaid-svg-D2dt0r3iOTdx1khn .icon-shape,#mermaid-svg-D2dt0r3iOTdx1khn .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-D2dt0r3iOTdx1khn .icon-shape p,#mermaid-svg-D2dt0r3iOTdx1khn .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-D2dt0r3iOTdx1khn .icon-shape .label rect,#mermaid-svg-D2dt0r3iOTdx1khn .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-D2dt0r3iOTdx1khn .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-D2dt0r3iOTdx1khn .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-D2dt0r3iOTdx1khn :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 安装插件
打开Zephyr面板
点击Install Host Tools
等待自动安装
工具安装完成
VS Marketplace
Open VSX

注意事项

  • 在Windows上安装7z需要管理员权限
  • 在Linux上使用apt安装工具需要管理员权限
  • 如果已有工具,可跳过此步骤

3.3 初始化West工作空间

#mermaid-svg-2eev8FXy2NATGO70{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-2eev8FXy2NATGO70 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-2eev8FXy2NATGO70 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-2eev8FXy2NATGO70 .error-icon{fill:#552222;}#mermaid-svg-2eev8FXy2NATGO70 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-2eev8FXy2NATGO70 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-2eev8FXy2NATGO70 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-2eev8FXy2NATGO70 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-2eev8FXy2NATGO70 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-2eev8FXy2NATGO70 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-2eev8FXy2NATGO70 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-2eev8FXy2NATGO70 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-2eev8FXy2NATGO70 .marker.cross{stroke:#333333;}#mermaid-svg-2eev8FXy2NATGO70 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-2eev8FXy2NATGO70 p{margin:0;}#mermaid-svg-2eev8FXy2NATGO70 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-2eev8FXy2NATGO70 .cluster-label text{fill:#333;}#mermaid-svg-2eev8FXy2NATGO70 .cluster-label span{color:#333;}#mermaid-svg-2eev8FXy2NATGO70 .cluster-label span p{background-color:transparent;}#mermaid-svg-2eev8FXy2NATGO70 .label text,#mermaid-svg-2eev8FXy2NATGO70 span{fill:#333;color:#333;}#mermaid-svg-2eev8FXy2NATGO70 .node rect,#mermaid-svg-2eev8FXy2NATGO70 .node circle,#mermaid-svg-2eev8FXy2NATGO70 .node ellipse,#mermaid-svg-2eev8FXy2NATGO70 .node polygon,#mermaid-svg-2eev8FXy2NATGO70 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-2eev8FXy2NATGO70 .rough-node .label text,#mermaid-svg-2eev8FXy2NATGO70 .node .label text,#mermaid-svg-2eev8FXy2NATGO70 .image-shape .label,#mermaid-svg-2eev8FXy2NATGO70 .icon-shape .label{text-anchor:middle;}#mermaid-svg-2eev8FXy2NATGO70 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-2eev8FXy2NATGO70 .rough-node .label,#mermaid-svg-2eev8FXy2NATGO70 .node .label,#mermaid-svg-2eev8FXy2NATGO70 .image-shape .label,#mermaid-svg-2eev8FXy2NATGO70 .icon-shape .label{text-align:center;}#mermaid-svg-2eev8FXy2NATGO70 .node.clickable{cursor:pointer;}#mermaid-svg-2eev8FXy2NATGO70 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-2eev8FXy2NATGO70 .arrowheadPath{fill:#333333;}#mermaid-svg-2eev8FXy2NATGO70 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-2eev8FXy2NATGO70 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-2eev8FXy2NATGO70 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-2eev8FXy2NATGO70 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-2eev8FXy2NATGO70 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-2eev8FXy2NATGO70 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-2eev8FXy2NATGO70 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-2eev8FXy2NATGO70 .cluster text{fill:#333;}#mermaid-svg-2eev8FXy2NATGO70 .cluster span{color:#333;}#mermaid-svg-2eev8FXy2NATGO70 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-2eev8FXy2NATGO70 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-2eev8FXy2NATGO70 rect.text{fill:none;stroke-width:0;}#mermaid-svg-2eev8FXy2NATGO70 .icon-shape,#mermaid-svg-2eev8FXy2NATGO70 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-2eev8FXy2NATGO70 .icon-shape p,#mermaid-svg-2eev8FXy2NATGO70 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-2eev8FXy2NATGO70 .icon-shape .label rect,#mermaid-svg-2eev8FXy2NATGO70 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-2eev8FXy2NATGO70 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-2eev8FXy2NATGO70 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-2eev8FXy2NATGO70 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 初始化工作空间
选择方式
使用内置模板
使用自定义manifest
克隆现有workspace
采用现有Zephyr
Zephyr主线
NCS
指定west.yml URL
Git仓库URL
设置ZEPHYR_BASE

操作步骤

  1. 打开VS Code
  2. 点击Activity Bar中的Zephyr图标
  3. 点击 Initialize Workspace
  4. 填写workspace信息:
    • Workspace名称
    • 路径
    • Manifest仓库URL(可选)
    • Revision(可选)

3.4 创建第一个项目

项目创建流程
West IDE for Zephyr 用户 West IDE for Zephyr 用户 #mermaid-svg-Yy4bwS5Pdy38lna4{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Yy4bwS5Pdy38lna4 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Yy4bwS5Pdy38lna4 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Yy4bwS5Pdy38lna4 .error-icon{fill:#552222;}#mermaid-svg-Yy4bwS5Pdy38lna4 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Yy4bwS5Pdy38lna4 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Yy4bwS5Pdy38lna4 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Yy4bwS5Pdy38lna4 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Yy4bwS5Pdy38lna4 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Yy4bwS5Pdy38lna4 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Yy4bwS5Pdy38lna4 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Yy4bwS5Pdy38lna4 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Yy4bwS5Pdy38lna4 .marker.cross{stroke:#333333;}#mermaid-svg-Yy4bwS5Pdy38lna4 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Yy4bwS5Pdy38lna4 p{margin:0;}#mermaid-svg-Yy4bwS5Pdy38lna4 .actor{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-Yy4bwS5Pdy38lna4 text.actor>tspan{fill:black;stroke:none;}#mermaid-svg-Yy4bwS5Pdy38lna4 .actor-line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-Yy4bwS5Pdy38lna4 .innerArc{stroke-width:1.5;stroke-dasharray:none;}#mermaid-svg-Yy4bwS5Pdy38lna4 .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#mermaid-svg-Yy4bwS5Pdy38lna4 .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#mermaid-svg-Yy4bwS5Pdy38lna4 #arrowhead path{fill:#333;stroke:#333;}#mermaid-svg-Yy4bwS5Pdy38lna4 .sequenceNumber{fill:white;}#mermaid-svg-Yy4bwS5Pdy38lna4 #sequencenumber{fill:#333;}#mermaid-svg-Yy4bwS5Pdy38lna4 #crosshead path{fill:#333;stroke:#333;}#mermaid-svg-Yy4bwS5Pdy38lna4 .messageText{fill:#333;stroke:none;}#mermaid-svg-Yy4bwS5Pdy38lna4 .labelBox{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-Yy4bwS5Pdy38lna4 .labelText,#mermaid-svg-Yy4bwS5Pdy38lna4 .labelText>tspan{fill:black;stroke:none;}#mermaid-svg-Yy4bwS5Pdy38lna4 .loopText,#mermaid-svg-Yy4bwS5Pdy38lna4 .loopText>tspan{fill:black;stroke:none;}#mermaid-svg-Yy4bwS5Pdy38lna4 .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-Yy4bwS5Pdy38lna4 .note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-Yy4bwS5Pdy38lna4 .noteText,#mermaid-svg-Yy4bwS5Pdy38lna4 .noteText>tspan{fill:black;stroke:none;}#mermaid-svg-Yy4bwS5Pdy38lna4 .activation0{fill:#f4f4f4;stroke:#666;}#mermaid-svg-Yy4bwS5Pdy38lna4 .activation1{fill:#f4f4f4;stroke:#666;}#mermaid-svg-Yy4bwS5Pdy38lna4 .activation2{fill:#f4f4f4;stroke:#666;}#mermaid-svg-Yy4bwS5Pdy38lna4 .actorPopupMenu{position:absolute;}#mermaid-svg-Yy4bwS5Pdy38lna4 .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#mermaid-svg-Yy4bwS5Pdy38lna4 .actor-man line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-Yy4bwS5Pdy38lna4 .actor-man circle,#mermaid-svg-Yy4bwS5Pdy38lna4 line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;stroke-width:2px;}#mermaid-svg-Yy4bwS5Pdy38lna4 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 点击Create New Application 选择West Workspace 选择Zephyr SDK 选择目标板 选择Zephyr示例 输入项目名 选择位置 确认创建 创建应用 创建完成

创建示例

复制代码
1. 点击 "Create New Application"
2. 选择 workspace: my-zephyr-workspace
3. 选择 SDK: zephyr-sdk-0.16.4
4. 选择 Board: qemu_x86
5. 选择 Sample: hello_world
6. 项目名: my_first_app
7. 位置: ~/zephyrproject/my_first_app

3.5 编译项目

编译方式

方式 操作
状态栏 点击状态栏的Build按钮
项目面板 在项目上点击右键选择Build
命令面板 Ctrl+Shift+P -> "Zephyr: Build"
快捷键 自定义快捷键

编译输出

复制代码
[1/234] Building C object zephyr/CMakeFiles/zephyr.dir/kernel/main.c.obj
[2/234] Building C object zephyr/CMakeFiles/zephyr.dir/kernel/sched.c.obj
...
[234/234] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
             FLASH:       1024 B       256 KB      0.39%
               RAM:        128 B        64 KB      0.20%
        IDT_LIST:          0 GB         2 KB      0.00%

3.6 烧录与调试

烧录操作

bash 复制代码
# 状态栏点击Flash按钮
# 或使用命令面板
Ctrl+Shift+P -> "Zephyr: Flash"

调试配置
#mermaid-svg-V94Qk9ElsY4gEzXw{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-V94Qk9ElsY4gEzXw .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-V94Qk9ElsY4gEzXw .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-V94Qk9ElsY4gEzXw .error-icon{fill:#552222;}#mermaid-svg-V94Qk9ElsY4gEzXw .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-V94Qk9ElsY4gEzXw .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-V94Qk9ElsY4gEzXw .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-V94Qk9ElsY4gEzXw .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-V94Qk9ElsY4gEzXw .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-V94Qk9ElsY4gEzXw .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-V94Qk9ElsY4gEzXw .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-V94Qk9ElsY4gEzXw .marker{fill:#333333;stroke:#333333;}#mermaid-svg-V94Qk9ElsY4gEzXw .marker.cross{stroke:#333333;}#mermaid-svg-V94Qk9ElsY4gEzXw svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-V94Qk9ElsY4gEzXw p{margin:0;}#mermaid-svg-V94Qk9ElsY4gEzXw .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-V94Qk9ElsY4gEzXw .cluster-label text{fill:#333;}#mermaid-svg-V94Qk9ElsY4gEzXw .cluster-label span{color:#333;}#mermaid-svg-V94Qk9ElsY4gEzXw .cluster-label span p{background-color:transparent;}#mermaid-svg-V94Qk9ElsY4gEzXw .label text,#mermaid-svg-V94Qk9ElsY4gEzXw span{fill:#333;color:#333;}#mermaid-svg-V94Qk9ElsY4gEzXw .node rect,#mermaid-svg-V94Qk9ElsY4gEzXw .node circle,#mermaid-svg-V94Qk9ElsY4gEzXw .node ellipse,#mermaid-svg-V94Qk9ElsY4gEzXw .node polygon,#mermaid-svg-V94Qk9ElsY4gEzXw .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-V94Qk9ElsY4gEzXw .rough-node .label text,#mermaid-svg-V94Qk9ElsY4gEzXw .node .label text,#mermaid-svg-V94Qk9ElsY4gEzXw .image-shape .label,#mermaid-svg-V94Qk9ElsY4gEzXw .icon-shape .label{text-anchor:middle;}#mermaid-svg-V94Qk9ElsY4gEzXw .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-V94Qk9ElsY4gEzXw .rough-node .label,#mermaid-svg-V94Qk9ElsY4gEzXw .node .label,#mermaid-svg-V94Qk9ElsY4gEzXw .image-shape .label,#mermaid-svg-V94Qk9ElsY4gEzXw .icon-shape .label{text-align:center;}#mermaid-svg-V94Qk9ElsY4gEzXw .node.clickable{cursor:pointer;}#mermaid-svg-V94Qk9ElsY4gEzXw .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-V94Qk9ElsY4gEzXw .arrowheadPath{fill:#333333;}#mermaid-svg-V94Qk9ElsY4gEzXw .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-V94Qk9ElsY4gEzXw .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-V94Qk9ElsY4gEzXw .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-V94Qk9ElsY4gEzXw .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-V94Qk9ElsY4gEzXw .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-V94Qk9ElsY4gEzXw .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-V94Qk9ElsY4gEzXw .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-V94Qk9ElsY4gEzXw .cluster text{fill:#333;}#mermaid-svg-V94Qk9ElsY4gEzXw .cluster span{color:#333;}#mermaid-svg-V94Qk9ElsY4gEzXw div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-V94Qk9ElsY4gEzXw .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-V94Qk9ElsY4gEzXw rect.text{fill:none;stroke-width:0;}#mermaid-svg-V94Qk9ElsY4gEzXw .icon-shape,#mermaid-svg-V94Qk9ElsY4gEzXw .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-V94Qk9ElsY4gEzXw .icon-shape p,#mermaid-svg-V94Qk9ElsY4gEzXw .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-V94Qk9ElsY4gEzXw .icon-shape .label rect,#mermaid-svg-V94Qk9ElsY4gEzXw .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-V94Qk9ElsY4gEzXw .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-V94Qk9ElsY4gEzXw .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-V94Qk9ElsY4gEzXw :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 调试配置
自动配置
手动配置
使用Runner Profile
自动从runners.yaml
生成launch.json
选择调试器
配置SVD
设置GDB端口

调试流程

复制代码
1. 点击 Debug 按钮
2. 选择 Runner Profile(或使用默认)
3. IDE自动配置调试会话
4. 启动调试,进入断点
5. 单步执行、查看变量

四、高级功能

4.1 多个工作空间管理

#mermaid-svg-WKr2mitU6Y8p4npn{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-WKr2mitU6Y8p4npn .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-WKr2mitU6Y8p4npn .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-WKr2mitU6Y8p4npn .error-icon{fill:#552222;}#mermaid-svg-WKr2mitU6Y8p4npn .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-WKr2mitU6Y8p4npn .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-WKr2mitU6Y8p4npn .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-WKr2mitU6Y8p4npn .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-WKr2mitU6Y8p4npn .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-WKr2mitU6Y8p4npn .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-WKr2mitU6Y8p4npn .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-WKr2mitU6Y8p4npn .marker{fill:#333333;stroke:#333333;}#mermaid-svg-WKr2mitU6Y8p4npn .marker.cross{stroke:#333333;}#mermaid-svg-WKr2mitU6Y8p4npn svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-WKr2mitU6Y8p4npn p{margin:0;}#mermaid-svg-WKr2mitU6Y8p4npn .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-WKr2mitU6Y8p4npn .cluster-label text{fill:#333;}#mermaid-svg-WKr2mitU6Y8p4npn .cluster-label span{color:#333;}#mermaid-svg-WKr2mitU6Y8p4npn .cluster-label span p{background-color:transparent;}#mermaid-svg-WKr2mitU6Y8p4npn .label text,#mermaid-svg-WKr2mitU6Y8p4npn span{fill:#333;color:#333;}#mermaid-svg-WKr2mitU6Y8p4npn .node rect,#mermaid-svg-WKr2mitU6Y8p4npn .node circle,#mermaid-svg-WKr2mitU6Y8p4npn .node ellipse,#mermaid-svg-WKr2mitU6Y8p4npn .node polygon,#mermaid-svg-WKr2mitU6Y8p4npn .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-WKr2mitU6Y8p4npn .rough-node .label text,#mermaid-svg-WKr2mitU6Y8p4npn .node .label text,#mermaid-svg-WKr2mitU6Y8p4npn .image-shape .label,#mermaid-svg-WKr2mitU6Y8p4npn .icon-shape .label{text-anchor:middle;}#mermaid-svg-WKr2mitU6Y8p4npn .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-WKr2mitU6Y8p4npn .rough-node .label,#mermaid-svg-WKr2mitU6Y8p4npn .node .label,#mermaid-svg-WKr2mitU6Y8p4npn .image-shape .label,#mermaid-svg-WKr2mitU6Y8p4npn .icon-shape .label{text-align:center;}#mermaid-svg-WKr2mitU6Y8p4npn .node.clickable{cursor:pointer;}#mermaid-svg-WKr2mitU6Y8p4npn .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-WKr2mitU6Y8p4npn .arrowheadPath{fill:#333333;}#mermaid-svg-WKr2mitU6Y8p4npn .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-WKr2mitU6Y8p4npn .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-WKr2mitU6Y8p4npn .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-WKr2mitU6Y8p4npn .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-WKr2mitU6Y8p4npn .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-WKr2mitU6Y8p4npn .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-WKr2mitU6Y8p4npn .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-WKr2mitU6Y8p4npn .cluster text{fill:#333;}#mermaid-svg-WKr2mitU6Y8p4npn .cluster span{color:#333;}#mermaid-svg-WKr2mitU6Y8p4npn div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-WKr2mitU6Y8p4npn .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-WKr2mitU6Y8p4npn rect.text{fill:none;stroke-width:0;}#mermaid-svg-WKr2mitU6Y8p4npn .icon-shape,#mermaid-svg-WKr2mitU6Y8p4npn .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-WKr2mitU6Y8p4npn .icon-shape p,#mermaid-svg-WKr2mitU6Y8p4npn .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-WKr2mitU6Y8p4npn .icon-shape .label rect,#mermaid-svg-WKr2mitU6Y8p4npn .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-WKr2mitU6Y8p4npn .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-WKr2mitU6Y8p4npn .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-WKr2mitU6Y8p4npn :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} VS Code
Workspace 1
Workspace 2
Workspace 3
Zephyr主线
NCS
自定义项目
快速切换

切换workspace

bash 复制代码
# 命令面板
Ctrl+Shift+P -> "Zephyr: Switch Workspace"

4.2 自定义构建配置

每构建独立配置

json 复制代码
{
  "builds": [
    {
      "name": "debug_qemu",
      "board": "qemu_x86",
      "kconfig": "prj_debug.conf",
      "cmake-args": "-DCMAKE_BUILD_TYPE=Debug"
    },
    {
      "name": "release_nrf",
      "board": "nrf52840dk_nrf52840",
      "kconfig": "prj_release.conf",
      "cmake-args": "-DCMAKE_BUILD_TYPE=Release"
    }
  ]
}

4.3 并发构建

#mermaid-svg-405WZJzSLm50FCJs{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-405WZJzSLm50FCJs .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-405WZJzSLm50FCJs .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-405WZJzSLm50FCJs .error-icon{fill:#552222;}#mermaid-svg-405WZJzSLm50FCJs .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-405WZJzSLm50FCJs .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-405WZJzSLm50FCJs .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-405WZJzSLm50FCJs .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-405WZJzSLm50FCJs .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-405WZJzSLm50FCJs .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-405WZJzSLm50FCJs .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-405WZJzSLm50FCJs .marker{fill:#333333;stroke:#333333;}#mermaid-svg-405WZJzSLm50FCJs .marker.cross{stroke:#333333;}#mermaid-svg-405WZJzSLm50FCJs svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-405WZJzSLm50FCJs p{margin:0;}#mermaid-svg-405WZJzSLm50FCJs .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-405WZJzSLm50FCJs .cluster-label text{fill:#333;}#mermaid-svg-405WZJzSLm50FCJs .cluster-label span{color:#333;}#mermaid-svg-405WZJzSLm50FCJs .cluster-label span p{background-color:transparent;}#mermaid-svg-405WZJzSLm50FCJs .label text,#mermaid-svg-405WZJzSLm50FCJs span{fill:#333;color:#333;}#mermaid-svg-405WZJzSLm50FCJs .node rect,#mermaid-svg-405WZJzSLm50FCJs .node circle,#mermaid-svg-405WZJzSLm50FCJs .node ellipse,#mermaid-svg-405WZJzSLm50FCJs .node polygon,#mermaid-svg-405WZJzSLm50FCJs .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-405WZJzSLm50FCJs .rough-node .label text,#mermaid-svg-405WZJzSLm50FCJs .node .label text,#mermaid-svg-405WZJzSLm50FCJs .image-shape .label,#mermaid-svg-405WZJzSLm50FCJs .icon-shape .label{text-anchor:middle;}#mermaid-svg-405WZJzSLm50FCJs .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-405WZJzSLm50FCJs .rough-node .label,#mermaid-svg-405WZJzSLm50FCJs .node .label,#mermaid-svg-405WZJzSLm50FCJs .image-shape .label,#mermaid-svg-405WZJzSLm50FCJs .icon-shape .label{text-align:center;}#mermaid-svg-405WZJzSLm50FCJs .node.clickable{cursor:pointer;}#mermaid-svg-405WZJzSLm50FCJs .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-405WZJzSLm50FCJs .arrowheadPath{fill:#333333;}#mermaid-svg-405WZJzSLm50FCJs .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-405WZJzSLm50FCJs .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-405WZJzSLm50FCJs .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-405WZJzSLm50FCJs .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-405WZJzSLm50FCJs .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-405WZJzSLm50FCJs .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-405WZJzSLm50FCJs .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-405WZJzSLm50FCJs .cluster text{fill:#333;}#mermaid-svg-405WZJzSLm50FCJs .cluster span{color:#333;}#mermaid-svg-405WZJzSLm50FCJs div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-405WZJzSLm50FCJs .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-405WZJzSLm50FCJs rect.text{fill:none;stroke-width:0;}#mermaid-svg-405WZJzSLm50FCJs .icon-shape,#mermaid-svg-405WZJzSLm50FCJs .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-405WZJzSLm50FCJs .icon-shape p,#mermaid-svg-405WZJzSLm50FCJs .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-405WZJzSLm50FCJs .icon-shape .label rect,#mermaid-svg-405WZJzSLm50FCJs .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-405WZJzSLm50FCJs .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-405WZJzSLm50FCJs .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-405WZJzSLm50FCJs :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 并发构建
per-target locking
避免冲突
同目标串行
不同目标并行

优势

  • 同一目标避免冲突
  • 不同目标可以并行执行
  • 节省编译时间

4.4 外部环境支持

支持的环境类型

环境类型 配置方式
Docker 容器内开发
Devcontainer VS Code容器
现有Zephyr安装 ZEPHYR_BASE环境变量
远程开发 SSH/WSL

Docker配置示例

json 复制代码
{
  "workspace": {
    "type": "docker",
    "image": "zephyrprojectrtos/zephyr-build:latest"
  }
}

五、插件配置参考

5.1 完整zephyr-ide.json示例

json 复制代码
{
  "version": "3.0",
  "workspace": {
    "name": "my-zephyr-workspace",
    "path": "~/zephyrproject",
    "manifest": {
      "repo": "https://github.com/zephyrproject-rtos/zephyr",
      "revision": "main"
    }
  },
  "tools": {
    "cmake": "auto",
    "python": "auto",
    "ninja": "auto",
    "dtc": "auto"
  },
  "sdk": {
    "version": "0.16.4",
    "install-dir": "~/zephyr-sdk-0.16.4"
  },
  "projects": [
    {
      "name": "blinky",
      "path": "blinky",
      "type": "app",
      "source": "samples/basic/blinky",
      "builds": [
        {
          "name": "qemu_x86",
          "board": "qemu_x86",
          "runner": "default",
          "kconfig": "prj.conf",
          "overlay": "",
          "west-args": "",
          "cmake-args": ""
        },
        {
          "name": "nrf52840dk",
          "board": "nrf52840dk_nrf52840",
          "runner": "jlink",
          "kconfig": "prj.conf",
          "overlay": "boards/nrf52840dk.overlay"
        }
      ]
    }
  ],
  "runner-profiles": [
    {
      "name": "default",
      "type": "west-runner",
      "config": {
        "runner": "qemu"
      }
    },
    {
      "name": "jlink",
      "type": "launch-json",
      "config": {
        "debugger": "jlink",
        "interface": "swd"
      }
    }
  ]
}

5.2 常用配置项

配置项 说明 默认值
workspace.path workspace路径
sdk.install-dir SDK安装目录 ~/zephyr-sdk
builds[].board 目标板 必填
builds[].runner 烧录/调试配置 default
builds[].kconfig KConfig文件 prj.conf
builds[].overlay DTS overlay文件
builds[].west-args west参数
builds[].cmake-args CMake参数

六、常见问题与解决方案

6.1 安装问题

问题1:主机工具安装失败

bash 复制代码
# 解决:手动安装
# Ubuntu/Debian
sudo apt-get install cmake python3 ninja-build device-tree-compiler gcc

# macOS
brew install cmake python ninja dtc

# Windows
# 使用Chocolatey或手动安装
choco install cmake python ninja gperf

问题2:SDK安装失败

bash 复制代码
# 解决:检查west是否正确安装
pip3 install --user west

# 手动安装SDK
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.4/zephyr-sdk-0.16.4_linux-x86_64.tar.xz
tar -xf zephyr-sdk-0.16.4_linux-x86_64.tar.xz
cd zephyr-sdk-0.16.4
./setup.sh

6.2 编译问题

问题1:找不到Zephyr

bash 复制代码
# 解决:设置ZEPHYR_BASE
export ZEPHYR_BASE=~/zephyrproject/zephyr

# 或在IDE中配置
# Settings -> Extensions -> IDE for Zephyr -> Zephyr Base

问题2:编译错误

bash 复制代码
# 解决:清理并重新构建
# IDE中:Build -> Build Pristine
# 命令行:
west build -t pristine
west build

6.3 调试问题

问题1:调试器连接失败

bash 复制代码
# 解决:检查调试器驱动
# ST-Link
ls /dev/stlink*

# J-Link
ls /dev/ttyACM*

# 或在IDE中配置正确的调试器

问题2:找不到ELF文件

bash 复制代码
# 解决:检查构建路径
# 默认在 build/zephyr/zephyr.elf
ls build/zephyr/zephyr.elf

6.4 工作空间问题

问题1:workspace初始化失败

bash 复制代码
# 解决:检查网络连接
ping github.com

# 手动初始化
west init ~/zephyrproject
cd ~/zephyrproject
west update

问题2:多workspace切换问题

bash 复制代码
# 解决:重启VS Code或重新加载窗口
# Ctrl+Shift+P -> Developer: Reload Window

七、最佳实践

7.1 项目组织建议

#mermaid-svg-r8ii3UhOSJnMbScN{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-r8ii3UhOSJnMbScN .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-r8ii3UhOSJnMbScN .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-r8ii3UhOSJnMbScN .error-icon{fill:#552222;}#mermaid-svg-r8ii3UhOSJnMbScN .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-r8ii3UhOSJnMbScN .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-r8ii3UhOSJnMbScN .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-r8ii3UhOSJnMbScN .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-r8ii3UhOSJnMbScN .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-r8ii3UhOSJnMbScN .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-r8ii3UhOSJnMbScN .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-r8ii3UhOSJnMbScN .marker{fill:#333333;stroke:#333333;}#mermaid-svg-r8ii3UhOSJnMbScN .marker.cross{stroke:#333333;}#mermaid-svg-r8ii3UhOSJnMbScN svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-r8ii3UhOSJnMbScN p{margin:0;}#mermaid-svg-r8ii3UhOSJnMbScN .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-r8ii3UhOSJnMbScN .cluster-label text{fill:#333;}#mermaid-svg-r8ii3UhOSJnMbScN .cluster-label span{color:#333;}#mermaid-svg-r8ii3UhOSJnMbScN .cluster-label span p{background-color:transparent;}#mermaid-svg-r8ii3UhOSJnMbScN .label text,#mermaid-svg-r8ii3UhOSJnMbScN span{fill:#333;color:#333;}#mermaid-svg-r8ii3UhOSJnMbScN .node rect,#mermaid-svg-r8ii3UhOSJnMbScN .node circle,#mermaid-svg-r8ii3UhOSJnMbScN .node ellipse,#mermaid-svg-r8ii3UhOSJnMbScN .node polygon,#mermaid-svg-r8ii3UhOSJnMbScN .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-r8ii3UhOSJnMbScN .rough-node .label text,#mermaid-svg-r8ii3UhOSJnMbScN .node .label text,#mermaid-svg-r8ii3UhOSJnMbScN .image-shape .label,#mermaid-svg-r8ii3UhOSJnMbScN .icon-shape .label{text-anchor:middle;}#mermaid-svg-r8ii3UhOSJnMbScN .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-r8ii3UhOSJnMbScN .rough-node .label,#mermaid-svg-r8ii3UhOSJnMbScN .node .label,#mermaid-svg-r8ii3UhOSJnMbScN .image-shape .label,#mermaid-svg-r8ii3UhOSJnMbScN .icon-shape .label{text-align:center;}#mermaid-svg-r8ii3UhOSJnMbScN .node.clickable{cursor:pointer;}#mermaid-svg-r8ii3UhOSJnMbScN .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-r8ii3UhOSJnMbScN .arrowheadPath{fill:#333333;}#mermaid-svg-r8ii3UhOSJnMbScN .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-r8ii3UhOSJnMbScN .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-r8ii3UhOSJnMbScN .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-r8ii3UhOSJnMbScN .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-r8ii3UhOSJnMbScN .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-r8ii3UhOSJnMbScN .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-r8ii3UhOSJnMbScN .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-r8ii3UhOSJnMbScN .cluster text{fill:#333;}#mermaid-svg-r8ii3UhOSJnMbScN .cluster span{color:#333;}#mermaid-svg-r8ii3UhOSJnMbScN div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-r8ii3UhOSJnMbScN .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-r8ii3UhOSJnMbScN rect.text{fill:none;stroke-width:0;}#mermaid-svg-r8ii3UhOSJnMbScN .icon-shape,#mermaid-svg-r8ii3UhOSJnMbScN .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-r8ii3UhOSJnMbScN .icon-shape p,#mermaid-svg-r8ii3UhOSJnMbScN .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-r8ii3UhOSJnMbScN .icon-shape .label rect,#mermaid-svg-r8ii3UhOSJnMbScN .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-r8ii3UhOSJnMbScN .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-r8ii3UhOSJnMbScN .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-r8ii3UhOSJnMbScN :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 项目组织
使用zephyr-ide.json
版本控制
文档化
团队共享
统一环境
提交配置
排除构建产物
README
配置说明

7.2 .gitignore配置

gitignore 复制代码
# IDE for Zephyr
build/
*.elf
*.bin
*.hex
*.map
.cache/
.zephyr-ide/

# Zephyr
zephyrproject/
zephyr-sdk-*/

# VS Code
.vscode/launch.json
.vscode/c_cpp_properties.json

7.3 团队协作流程

开发者B Git仓库 开发者A 开发者B Git仓库 开发者A #mermaid-svg-Ti7F44Bg2bi5hfou{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Ti7F44Bg2bi5hfou .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Ti7F44Bg2bi5hfou .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Ti7F44Bg2bi5hfou .error-icon{fill:#552222;}#mermaid-svg-Ti7F44Bg2bi5hfou .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Ti7F44Bg2bi5hfou .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Ti7F44Bg2bi5hfou .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Ti7F44Bg2bi5hfou .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Ti7F44Bg2bi5hfou .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Ti7F44Bg2bi5hfou .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Ti7F44Bg2bi5hfou .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Ti7F44Bg2bi5hfou .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Ti7F44Bg2bi5hfou .marker.cross{stroke:#333333;}#mermaid-svg-Ti7F44Bg2bi5hfou svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Ti7F44Bg2bi5hfou p{margin:0;}#mermaid-svg-Ti7F44Bg2bi5hfou .actor{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-Ti7F44Bg2bi5hfou text.actor>tspan{fill:black;stroke:none;}#mermaid-svg-Ti7F44Bg2bi5hfou .actor-line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-Ti7F44Bg2bi5hfou .innerArc{stroke-width:1.5;stroke-dasharray:none;}#mermaid-svg-Ti7F44Bg2bi5hfou .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#mermaid-svg-Ti7F44Bg2bi5hfou .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#mermaid-svg-Ti7F44Bg2bi5hfou #arrowhead path{fill:#333;stroke:#333;}#mermaid-svg-Ti7F44Bg2bi5hfou .sequenceNumber{fill:white;}#mermaid-svg-Ti7F44Bg2bi5hfou #sequencenumber{fill:#333;}#mermaid-svg-Ti7F44Bg2bi5hfou #crosshead path{fill:#333;stroke:#333;}#mermaid-svg-Ti7F44Bg2bi5hfou .messageText{fill:#333;stroke:none;}#mermaid-svg-Ti7F44Bg2bi5hfou .labelBox{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-Ti7F44Bg2bi5hfou .labelText,#mermaid-svg-Ti7F44Bg2bi5hfou .labelText>tspan{fill:black;stroke:none;}#mermaid-svg-Ti7F44Bg2bi5hfou .loopText,#mermaid-svg-Ti7F44Bg2bi5hfou .loopText>tspan{fill:black;stroke:none;}#mermaid-svg-Ti7F44Bg2bi5hfou .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-Ti7F44Bg2bi5hfou .note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-Ti7F44Bg2bi5hfou .noteText,#mermaid-svg-Ti7F44Bg2bi5hfou .noteText>tspan{fill:black;stroke:none;}#mermaid-svg-Ti7F44Bg2bi5hfou .activation0{fill:#f4f4f4;stroke:#666;}#mermaid-svg-Ti7F44Bg2bi5hfou .activation1{fill:#f4f4f4;stroke:#666;}#mermaid-svg-Ti7F44Bg2bi5hfou .activation2{fill:#f4f4f4;stroke:#666;}#mermaid-svg-Ti7F44Bg2bi5hfou .actorPopupMenu{position:absolute;}#mermaid-svg-Ti7F44Bg2bi5hfou .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#mermaid-svg-Ti7F44Bg2bi5hfou .actor-man line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-Ti7F44Bg2bi5hfou .actor-man circle,#mermaid-svg-Ti7F44Bg2bi5hfou line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;stroke-width:2px;}#mermaid-svg-Ti7F44Bg2bi5hfou :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 提交代码和zephyr-ide.json 拉取代码 打开VS Code 安装IDE for Zephyr插件 导入workspace 开始开发

7.4 性能优化建议

建议 说明
使用ccache 加速二次编译
避免不必要的项目 只添加需要的项目
合理配置Runner 避免重复配置
使用pristine build 解决配置错误

八、与其他Zephyr IDE对比

功能 IDE for Zephyr Workbench for Zephyr 手动VSCode配置
主机工具自动安装
SDK管理 手动
多workspace 手动
多构建配置 ⚠️ 手动
Twister集成 手动
团队配置共享 手动
KConfig/DTS UI 手动
价格 免费 免费 免费

结束语

通过本文的详细介绍,相信您已经全面了解了VS Code下的Zephyr开发插件"IDE for Zephyr"的功能和使用方法:

知识点 内容
插件定位 Zephyr RTOS专业开发插件
核心功能 工具安装、SDK管理、workspace管理、项目管理、编译调试
安装方式 VS Marketplace或Extension Pack
使用流程 装工具 → 初始化workspace → 创建项目 → 编译 → 烧录 → 调试
团队协作 zephyr-ide.json配置共享
优势 自动化、集成化、跨平台

使用IDE for Zephyr可以帮助您:

  1. 快速上手:几分钟完成环境配置
  2. 提高效率:图形化操作减少命令输入
  3. 团队协作:配置可版本控制
  4. 降低门槛:新手友好

建议在实际项目中:

  1. 从简单的示例项目开始
  2. 熟悉zephyr-ide.json配置
  3. 善用Runner Profile
  4. 定期同步west workspace

参考资料