返回顶部
e

esp-idf-helperESP-IDF助手

Help develop, build, flash, and debug ESP32/ESP8266 firmware using Espressif ESP-IDF on Linux/WSL. Use when the user asks about ESP-IDF project setup, configuring targets, menuconfig, building, flashing via esptool/idf.py, serial monitor, partition tables, sdkconfig, troubleshooting build/flash/monitor errors, or automating common idf.py workflows from the command line.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.1.0
安全检测
已通过
717
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

esp-idf-helper

esp-idf-helper 技能

提供在 Linux/WSL 上可重复执行的、以命令行优先的 ESP-IDF 开发工作流程:配置 → 构建 → 烧录 → 监控 → 调试/故障排查。

快速参考

bash

1) 加载 ESP-IDF 环境(每个终端会话只需执行一次)


. $IDF_PATH/export.sh

1.1) 启用 ccache 以加速编译(推荐)

export IDFCCACHEENABLE=1

2) 进入项目目录并构建

cd /path/to/your/project idf.py set-target # 设置目标芯片(每个项目只需执行一次) idf.py build # 编译

3) 烧录

idf.py -p -b flash # 烧录到设备(可选)

常用命令

  • - idf.py --help — 帮助信息
  • idf.py set-target — 设置芯片目标:esp32、esp32s2、esp32s3、esp32c3、esp32p4
  • idf.py menuconfig — 配置项目设置(必须在新终端窗口中运行
  • idf.py build — 构建项目
  • idf.py update-dependencies — 更新项目组件依赖
  • idf.py partition-table — 构建分区表并打印分区条目
  • idf.py partition-table-flash — 将分区表烧录到设备
  • idf.py storage-flash — 烧录存储文件系统分区
  • idf.py size — 显示固件大小信息
  • idf.py -p -b flash — 烧录固件(默认波特率:460800)
  • idf.py -p monitor — 打开串口监视器
  • idf.py -p -b monitor — 以指定波特率打开串口监视器(例如 460800)
  • idf.py -p -b flash monitor — 先烧录后监控

组件管理

ESP-IDF 项目可以包含来自 ESP 组件注册表 的外部组件。

  • - 注册表网站: https://components.espressif.com/components
  • 搜索组件: 在注册表网站上浏览或搜索组件

组件命令

  • - idf.py add-dependency — 向 idf_component.yml 添加组件依赖
  • idf.py update-dependencies — 下载并更新所有项目依赖

组件管理工作流程

bash

1) 向项目添加依赖

idf.py add-dependency

2) 更新依赖(将组件下载到 managed_components/ 目录)

idf.py update-dependencies

注意: 依赖项记录在项目主组件目录(main/)中的 idf_component.yml 文件中。

捆绑资源

references/ 目录

  • - references/esp-idf-cli.md — 简洁的命令模式 + 报告错误时需要粘贴的内容。
  • references/idf-py-help.txt — 捕获的 idf.py --help 输出,便于快速查找/搜索。

要刷新已安装 ESP-IDF 版本的帮助文本,请运行:

  • - scripts/captureidfhelp.sh

assets/ 目录

默认情况下不使用。

串口管理(WSL2)

对于 WSL2 用户,需要通过 usbipd 连接 USB 串行设备,才能在 WSL 中访问。

列出可用串行设备

bash scripts/usbipdattachserial.sh --list

显示所有已连接的 USB 串行设备(CH340、CH343、CP210、FTDI 等)。

注意: 此脚本在 WSL2 中运行,并使用 powershell.exe 与 Windows usbipd 通信。

绑定/连接所有串行设备

bash

绑定并连接所有 COM 端口设备

scripts/usbipdattachserial.sh --keyword COM

或通过 busid 连接特定设备

scripts/usbipdattachserial.sh --busid 3-2

或按设备类型过滤

scripts/usbipdattachserial.sh --keyword CH343 scripts/usbipdattachserial.sh --keyword ESP32

串口脚本选项

  • - --list — 列出所有匹配的串行设备并退出
  • --busid — 指定设备总线 ID(例如 3-2)
  • --keyword — 按关键字过滤设备(例如 COM、CH343、ESP32)
  • --bind — 仅绑定(跳过连接),适用于首次使用管理员权限设置
  • --distro — 指定 WSL 发行版名称
  • --dry-run — 打印命令但不执行

典型工作流程

bash

1. 检查可用设备

scripts/usbipdattachserial.sh --list

2. 连接所有串行设备

scripts/usbipdattachserial.sh --keyword COM

3. 在 WSL 中验证设备

ls -la /dev/ttyACM /dev/ttyUSB

4. 与 idf.py 一起使用

idf.py -p /dev/ttyACM0 flash monitor

注意: 此脚本在 WSL2 中运行,并在内部使用 powershell.exe 与 Windows usbipd 服务通信。

故障排查:找不到 powershell.exe

如果遇到 powershell.exe: command not found,说明 Windows 路径未包含在 PATH 环境变量中。

快速修复(仅当前会话):
bash
export PATH=$PATH:/mnt/c/Windows/System32:/mnt/c/Windows/System32/WindowsPowerShell/v1.0
~/skills/esp-idf-helper/scripts/usbipdattachserial.sh --list

永久修复(添加到 ~/.bashrc):
bash
echo export PATH=$PATH:/mnt/c/Windows/System32:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/SysWOW64 >> ~/.bashrc
source ~/.bashrc

固件打包

将 ESP-IDF 构建输出打包成可分发的固件包,并附带跨平台烧录脚本。

使用方法

bash scripts/packfirmware.sh directory>

示例

bash

构建项目后

idf.py build

创建固件包

scripts/pack_firmware.sh ./build

输出:build/firmwarepackage/ 和 build/espfirmwareYYYYMMDDHHMMSS.zip

生成的包内容
文件描述
flash.shLinux/Mac 烧录脚本,支持重试和并行烧录
flash.bat
Windows 多端口烧录启动器 |

| flash_one.bat | Windows 单端口烧录脚本,支持重试 | | mac_addresses.txt | 记录的 MAC 地址(去重后) | | *.bin | 固件二进制文件 | | tools/esptool/esptool.exe | Windows esptool 可执行文件 | | README.txt | 使用说明 |

烧录脚本特性

  • - 自动重试:失败时重试 3 次
  • 并行烧录:同时烧录多个设备
  • MAC 记录:自动提取并去重 MAC 地址
  • 跨平台:支持 Linux/Mac/Windows

生产工作流程

bash

1. 构建项目

idf.py build

2. 打包固件

scripts/pack_firmware.sh ./build

3. 将 ZIP 分发给生产线

生产团队运行:flash.bat all(Windows)或 ./flash.sh /dev/ttyUSB*(Linux)

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 esp-idf-helper-1776420022 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 esp-idf-helper-1776420022 技能

通过命令行安装

skillhub install esp-idf-helper-1776420022

下载

⬇ 下载 esp-idf-helper v1.1.0(免费)

文件大小: 12.71 KB | 发布时间: 2026-4-17 18:59

v1.1.0 最新 2026-4-17 18:59
Add usbipd serial management, firmware packaging, component search features

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部