firmwareloop 0.0.8__tar.gz → 0.0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/PKG-INFO +131 -69
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/README.md +130 -68
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/firmwareloop.egg-info/PKG-INFO +131 -69
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/pyproject.toml +1 -1
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/__init__.py +1 -1
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/flash.ps1 +1 -1
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/fw_mcp_server.py +155 -6
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/reset.ps1 +1 -1
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/setup-agent-mcp.ps1 +25 -11
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/LICENSE +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/firmwareloop.egg-info/SOURCES.txt +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/firmwareloop.egg-info/dependency_links.txt +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/firmwareloop.egg-info/entry_points.txt +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/firmwareloop.egg-info/requires.txt +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/firmwareloop.egg-info/top_level.txt +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/setup.cfg +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/acceptance-scenario.ps1 +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/build.ps1 +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/can.ps1 +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/check-qoder-mcp.ps1 +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/common/build-backends.psm1 +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/common/fw.psm1 +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/common/uart_probe.py +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/doctor.ps1 +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/instrument_cli.py +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/lib/__init__.py +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/lib/instruments.py +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/logic_capture.ps1 +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/logic_decode.ps1 +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/test-backends.ps1 +0 -0
- {firmwareloop-0.0.8 → firmwareloop-0.0.9}/tools/test.ps1 +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: firmwareloop
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: AI Agent Firmware Development and Lab Automation Platform (Dual-Tier MCP Server)
|
|
5
5
|
Author-email: WeilinZhang <19523330249@163.com>
|
|
6
6
|
License: MIT
|
|
@@ -26,20 +26,53 @@ Requires-Dist: pyyaml>=6.0
|
|
|
26
26
|
Requires-Dist: agentic-hil>=0.14.0
|
|
27
27
|
Dynamic: license-file
|
|
28
28
|
|
|
29
|
-
# FirmwareLoop
|
|
29
|
+
# FirmwareLoop (`fwloop`)
|
|
30
30
|
|
|
31
|
-
>
|
|
32
|
-
>
|
|
31
|
+
> **面向 AI Agent 的嵌入式固件开发、硬件在环测试(HIL)与实验室自动化 MCP 工具集。**
|
|
32
|
+
> 赋能 Claude Code、Qoder、Antigravity、Cursor 等 AI 智能体直接操作物理硬件,打通从代码编译、探针烧录、芯片复位到串口交互、逻辑分析仪抓包与示波器测量的完整开发闭环。
|
|
33
33
|
|
|
34
34
|

|
|
35
35
|

|
|
36
36
|

|
|
37
|
+
[](https://pypi.org/project/firmwareloop/)
|
|
37
38
|
[](https://github.com/Jeffrey1799/FirmwareLoop/actions/workflows/ci.yml)
|
|
38
39
|
[](LICENSE)
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 为什么需要 FirmwareLoop?(定位与作用)
|
|
44
|
+
|
|
45
|
+
传统的 AI 编程助手(LLM)通常只能停留在**“纯软件文本生成”**阶段。在单片机与嵌入式领域,AI 面临严重的断层:**看不到编译报错行列、无法操作物理烧录器、读取不到串口输出,更无法测量真实的电信号与总线波形**。
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
**FirmwareLoop 作为一个标准的 Model Context Protocol (MCP) 服务器,充当了 AI Agent 与物理硬件之间的桥梁**:
|
|
48
|
+
* **赋予 AI 动手能力**:让 Agent 自主调用 Keil5 / CMake 编译固件,并通过 ST-LINK / J-Link / DAPLink 烧录到目标 MCU 并硬件复位。
|
|
49
|
+
* **赋予 AI 观测能力**:让 Agent 能够监听 UART 串口会话、捕获并解码 I2C/SPI 总线数据,甚至读取示波器与程控电源的真实物理量。
|
|
50
|
+
* **软硬件自动排障闭环**:当硬件运行异常时,Agent 基于捕获到的真实证据(编译器诊断、I2C NACK、串口 Panic、示波器异常电压)自动定位并修改 C/C++ 源码,重新烧录验证,直到测试全绿。
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 核心功能与 MCP 工具矩阵
|
|
55
|
+
|
|
56
|
+
FirmwareLoop 为 AI Agent 暴露了开箱即用的 MCP 工具,涵盖 5 大核心领域:
|
|
57
|
+
|
|
58
|
+
| 领域 | 核心 MCP 工具 | 功能说明 |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| **构建与体检** | `fw_doctor` <br> `fw_build` | 环境工具链诊断;自动调度 Keil MDK 5 (`UV4.exe`)、CMake、Make、PlatformIO 等编译固件并提取精确定位到行列的诊断日志。 |
|
|
61
|
+
| **硬件与探针** | `fw_scan_hardware` <br> `fw_flash` <br> `fw_reset` | 自动扫描连接的 ST-LINK / J-Link / DAPLink 探针与串口;直连 SWD 接口执行固件烧录与芯片硬件复位。 |
|
|
62
|
+
| **总线与协议** | `fw_logic_capture` <br> `fw_logic_decode` | 驱动逻辑分析仪(Saleae / Sigrok)捕获数字信号;自动解码并断言 I2C 地址/ACK、SPI 帧与串口数据完整性。 |
|
|
63
|
+
| **测试与测量** | `fw_run_hil_test` <br> `fw_measure` <br> `fw_acceptance_scenario` | 一键运行 12 项 pytest 自动化硬件在环测试;安全读取 PyVISA 示波器(频率/Vpp)与程控电源(电流/电压)。 |
|
|
64
|
+
| **工程与脚手架** | `fw_init_project` <br> `fw_configure_lab` <br> `fw_get_evidence` | 一键生成 `AGENTS.md` / `CLAUDE.md` / `GEMINI.md` 多 Agent 指南;自然语言修改芯片型号与台架配置;提取全链路审计证据。 |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 核心设计原则
|
|
69
|
+
|
|
70
|
+
1. **真实硬件优先与零伪造原则(Real-Hardware-First & Zero-Fake)**:
|
|
71
|
+
开发过程中,若探针未插、MCU 未上电、COM 串口占用或编译器缺失,系统**严格抛出明确异常(Fail-Closed)并输出可操作的排查与安装指引**,绝不伪造假成功数据。
|
|
72
|
+
2. **安全沙盒保护(Safety Gate)**:
|
|
73
|
+
所有物理仪器写操作强制受 [`lab/limits.yaml`](lab/limits.example.yaml) 限制,永久禁止超压超流与擦除安全密钥。
|
|
74
|
+
3. **全电脑全局通用(Zero Config per Project)**:
|
|
75
|
+
通过 `uv tool install firmwareloop` 全局安装一次,所有 STM32 / Keil 项目均可直接由 Agent 唤起使用。
|
|
43
76
|
|
|
44
77
|
---
|
|
45
78
|
|
|
@@ -79,94 +112,122 @@ FirmwareLoop 提供开箱即用的**双层 MCP 架构**:
|
|
|
79
112
|
|
|
80
113
|
### 接入模式一:电脑全局安装(首选推荐,一次安装,所有工程通用)
|
|
81
114
|
|
|
82
|
-
|
|
83
|
-
|
|
115
|
+
1. 全局安装 CLI 工具到系统(直接从 PyPI 官方源下载):
|
|
84
116
|
```bash
|
|
85
|
-
|
|
86
|
-
uv tool install git+https://github.com/Jeffrey1799/FirmwareLoop.git
|
|
117
|
+
uv tool install firmwareloop
|
|
87
118
|
uv tool install agentic-hil
|
|
119
|
+
```
|
|
88
120
|
|
|
89
|
-
|
|
90
|
-
|
|
121
|
+
2. 全局注册到 Claude Code CLI(全局级,一次配置全电脑工程通用):
|
|
122
|
+
```bash
|
|
91
123
|
claude mcp add --scope user fwloop -- fwloop
|
|
92
124
|
claude mcp add --scope user agentic-hil -- agentic-hil mcp-stdio
|
|
125
|
+
```
|
|
93
126
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
127
|
+
3. 注册到 Qoder IDE(支持以下三种方式):
|
|
128
|
+
- **GUI 方式**:按快捷键 `Ctrl + Shift + ,`(Mac: `Cmd + Shift + ,`)进入「MCP」->「我的服务」-> 点击「+ 添加」粘贴配置。
|
|
129
|
+
- **工作区方式**:项目根目录放置 `.mcp.json`,Qoder 会自动发现并加载。
|
|
130
|
+
- **CLI 方式**:
|
|
131
|
+
```bash
|
|
132
|
+
qoder.cmd mcp add --global fwloop -- fwloop
|
|
98
133
|
```
|
|
99
134
|
|
|
100
|
-
> **效果**:在电脑任意目录、任意 STM32 / Keil 独立工程下打开 Agent,Agent 均可直接调起 MCP
|
|
135
|
+
> **效果**:在电脑任意目录、任意 STM32 / Keil 独立工程下打开 Agent,Agent 均可直接调起 MCP,无需在每个工程中重复配置。
|
|
101
136
|
|
|
102
137
|
---
|
|
103
138
|
|
|
104
|
-
### 接入模式二:免克隆即时运行(零安装,按需从
|
|
139
|
+
### 接入模式二:免克隆即时运行(零安装,按需从 PyPI 即拉即用)
|
|
105
140
|
|
|
106
141
|
如果不想全局安装,可直接配置 Agent 通过 `uvx` 临时拉取运行:
|
|
107
142
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"agentic-hil": {
|
|
126
|
-
"command": "uvx",
|
|
127
|
-
"args": ["agentic-hil", "mcp-stdio"]
|
|
128
|
-
}
|
|
143
|
+
1. Claude Code CLI 注册:
|
|
144
|
+
```bash
|
|
145
|
+
claude mcp add fwloop -- uvx firmwareloop
|
|
146
|
+
claude mcp add agentic-hil -- uvx agentic-hil mcp-stdio
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
2. Qoder / Cursor / Antigravity(在工程 `.mcp.json` 中配置):
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"mcpServers": {
|
|
153
|
+
"fwloop": {
|
|
154
|
+
"command": "uvx",
|
|
155
|
+
"args": ["firmwareloop"]
|
|
156
|
+
},
|
|
157
|
+
"agentic-hil": {
|
|
158
|
+
"command": "uvx",
|
|
159
|
+
"args": ["agentic-hil", "mcp-stdio"]
|
|
129
160
|
}
|
|
130
161
|
}
|
|
131
|
-
|
|
162
|
+
}
|
|
163
|
+
```
|
|
132
164
|
|
|
133
165
|
---
|
|
134
166
|
|
|
135
167
|
### 接入模式三:源码二次开发模式(本地 Git 克隆)
|
|
136
168
|
|
|
137
169
|
适合需要修改 FirmwareLoop 源码或离线开发的用户:
|
|
170
|
+
|
|
171
|
+
1. 克隆与环境初始化:
|
|
138
172
|
```powershell
|
|
139
|
-
# 1. 克隆与环境初始化
|
|
140
173
|
git clone https://github.com/Jeffrey1799/FirmwareLoop.git D:\Tools\FirmwareLoop
|
|
141
174
|
cd D:\Tools\FirmwareLoop
|
|
142
175
|
uv pip install -e .
|
|
176
|
+
```
|
|
143
177
|
|
|
144
|
-
|
|
178
|
+
2. 注册到 Claude Code:
|
|
179
|
+
```bash
|
|
145
180
|
claude mcp add fwloop -- "D:\Tools\FirmwareLoop\.venv\Scripts\fwloop.exe"
|
|
146
181
|
claude mcp add agentic-hil -- "D:\Tools\FirmwareLoop\.venv\Scripts\agentic-hil.exe" mcp-stdio
|
|
147
182
|
```
|
|
148
183
|
|
|
149
184
|
---
|
|
150
185
|
|
|
151
|
-
### 常用 CLI
|
|
186
|
+
### 常用 CLI 终端命令
|
|
152
187
|
|
|
153
|
-
|
|
188
|
+
本项目支持名称兼容,`fwloop` 与 `firmwareloop` 完全等价:
|
|
154
189
|
|
|
190
|
+
1. 在任意单片机工程根目录下一键初始化多 Agent 规范(AGENTS.md, CLAUDE.md, GEMINI.md)与台架配置:
|
|
155
191
|
```bash
|
|
156
|
-
|
|
157
|
-
|
|
192
|
+
fwloop init
|
|
193
|
+
```
|
|
158
194
|
|
|
159
|
-
|
|
160
|
-
|
|
195
|
+
2. 自动检查并更新至最新版本(自动拉取最新代码并热重载依赖):
|
|
196
|
+
```bash
|
|
197
|
+
fwloop update
|
|
198
|
+
```
|
|
161
199
|
|
|
162
|
-
|
|
163
|
-
|
|
200
|
+
3. 环境健康体检与依赖诊断:
|
|
201
|
+
```bash
|
|
202
|
+
fwloop doctor
|
|
203
|
+
```
|
|
164
204
|
|
|
165
|
-
|
|
166
|
-
|
|
205
|
+
4. 查看或生成各大 Agent MCP 注册指令:
|
|
206
|
+
```bash
|
|
207
|
+
fwloop setup
|
|
208
|
+
```
|
|
167
209
|
|
|
168
|
-
|
|
169
|
-
|
|
210
|
+
5. 查看当前版本:
|
|
211
|
+
```bash
|
|
212
|
+
fwloop version
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### 卸载与清理
|
|
218
|
+
|
|
219
|
+
如果需要从系统中卸载 FirmwareLoop:
|
|
220
|
+
|
|
221
|
+
1. 一键卸载全局 CLI 工具(干净彻底,不残留垃圾文件):
|
|
222
|
+
```bash
|
|
223
|
+
uv tool uninstall firmwareloop
|
|
224
|
+
uv tool uninstall agentic-hil
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
2. 从 Claude Code 中移除全局 MCP 注册:
|
|
228
|
+
```bash
|
|
229
|
+
claude mcp remove --scope user fwloop
|
|
230
|
+
claude mcp remove --scope user agentic-hil
|
|
170
231
|
```
|
|
171
232
|
|
|
172
233
|
---
|
|
@@ -201,7 +262,7 @@ fwloop version # 或: firmwareloop version
|
|
|
201
262
|
| 编排主体 | AI Agent | pytest | pytest | 资源调度 |
|
|
202
263
|
| 测量证据 | 逻辑分析 + VISA 仪器 | 串口/日志 | 基础 | 弱 |
|
|
203
264
|
| 安全策略 | limits.yaml + 权限模型 | 无 | 无 | 弱 |
|
|
204
|
-
| 迭代闭环 | build
|
|
265
|
+
| 迭代闭环 | build→测→改→重测(<=3 次) | 无 | 部分 | 无 |
|
|
205
266
|
|
|
206
267
|
---
|
|
207
268
|
|
|
@@ -216,7 +277,7 @@ fwloop version # 或: firmwareloop version
|
|
|
216
277
|
├── demo-firmware/ 示例固件(CMake;宿主编译模拟 MCU,闭环验证载体)
|
|
217
278
|
├── demo-make/ 示例固件(Make;构建测试载体)
|
|
218
279
|
├── docs/ DEPENDENCY_MATRIX / REUSE_PLAN / V0.0.2_GAP_VERIFICATION
|
|
219
|
-
├── pyproject.toml 标准 Python 包配置与 CLI 入口声明 (v0.0.
|
|
280
|
+
├── pyproject.toml 标准 Python 包配置与 CLI 入口声明 (v0.0.9)
|
|
220
281
|
├── .mcp.example.json 双层 MCP 配置模板(firmwareloop + agentic-hil)
|
|
221
282
|
├── AGENTS.md 通用智能体规范(Antigravity / Qoder / Cursor 等)
|
|
222
283
|
├── CLAUDE.md Claude Code CLI 指南
|
|
@@ -226,25 +287,26 @@ fwloop version # 或: firmwareloop version
|
|
|
226
287
|
|
|
227
288
|
---
|
|
228
289
|
|
|
229
|
-
## 能力验证状态(v0.0.
|
|
290
|
+
## 能力验证状态(v0.0.9)
|
|
230
291
|
|
|
231
292
|
> 状态定义:`Implemented`(已实现)/ `Simulator Validated`(模拟验证)/
|
|
232
293
|
> `Real Hardware Validated`(真机验证)/ `Experimental` / `Not Implemented`
|
|
233
294
|
|
|
234
295
|
| 能力 | 状态 |
|
|
235
296
|
|---|---|
|
|
236
|
-
| 双层 MCP 服务(13 个工作流与硬件工具) |
|
|
237
|
-
| 一键多 Agent 脚手架(fwloop init / fw_init_project) |
|
|
238
|
-
|
|
|
239
|
-
|
|
|
240
|
-
|
|
|
241
|
-
|
|
|
242
|
-
| pytest HIL(
|
|
243
|
-
|
|
|
244
|
-
|
|
|
245
|
-
|
|
|
246
|
-
|
|
|
247
|
-
|
|
|
297
|
+
| 双层 MCP 服务(13 个工作流与硬件工具) | Implemented + Protocol Validated(31/31 测试通过) |
|
|
298
|
+
| 一键多 Agent 脚手架(fwloop init / fw_init_project) | Implemented + Multi-Agent Validated |
|
|
299
|
+
| 自定义/私有调试工具接入 Skill(fwloop-adapter) | Implemented + Multi-Skill Validated |
|
|
300
|
+
| 一键终端更新(fwloop update) | Implemented + Auto-updater Validated |
|
|
301
|
+
| uvx 免克隆即时运行(Zero-Clone Mode) | Implemented + PEP 517/621 Validated |
|
|
302
|
+
| Build:keil (UV4.exe) / cmake / make / platformio / iar / zephyr / esp-idf | Implemented + Multi-backend Validated |
|
|
303
|
+
| pytest HIL(12 项,simulator) | Implemented + Simulator Validated |
|
|
304
|
+
| pytest HIL(real UART) | Implemented(Agentic HIL 插件已就绪)-> Real Hardware Validated 待 DUT |
|
|
305
|
+
| Agentic HIL MCP(42 硬件工具) | Implemented + discovery 验证 -> 真机待 DUT |
|
|
306
|
+
| 逻辑分析 capture/decode/assert(I2C/SPI/UART) | Simulator Validated -> Real Hardware Validated 待 LA |
|
|
307
|
+
| VISA 仪器(simulator) | Simulator Validated -> Real Hardware Validated 待仪器 |
|
|
308
|
+
| Safety Policy(limits.yaml) | Implemented(simulator 校验)-> 外置权威配置 |
|
|
309
|
+
| 自动修复闭环(M6 载体) | Simulator Validated -> Real Hardware Validated 待 DUT |
|
|
248
310
|
|
|
249
311
|
---
|
|
250
312
|
|
|
@@ -1,17 +1,50 @@
|
|
|
1
|
-
# FirmwareLoop
|
|
1
|
+
# FirmwareLoop (`fwloop`)
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
3
|
+
> **面向 AI Agent 的嵌入式固件开发、硬件在环测试(HIL)与实验室自动化 MCP 工具集。**
|
|
4
|
+
> 赋能 Claude Code、Qoder、Antigravity、Cursor 等 AI 智能体直接操作物理硬件,打通从代码编译、探针烧录、芯片复位到串口交互、逻辑分析仪抓包与示波器测量的完整开发闭环。
|
|
5
5
|
|
|
6
6
|

|
|
7
7
|

|
|
8
8
|

|
|
9
|
+
[](https://pypi.org/project/firmwareloop/)
|
|
9
10
|
[](https://github.com/Jeffrey1799/FirmwareLoop/actions/workflows/ci.yml)
|
|
10
11
|
[](LICENSE)
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 为什么需要 FirmwareLoop?(定位与作用)
|
|
16
|
+
|
|
17
|
+
传统的 AI 编程助手(LLM)通常只能停留在**“纯软件文本生成”**阶段。在单片机与嵌入式领域,AI 面临严重的断层:**看不到编译报错行列、无法操作物理烧录器、读取不到串口输出,更无法测量真实的电信号与总线波形**。
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
**FirmwareLoop 作为一个标准的 Model Context Protocol (MCP) 服务器,充当了 AI Agent 与物理硬件之间的桥梁**:
|
|
20
|
+
* **赋予 AI 动手能力**:让 Agent 自主调用 Keil5 / CMake 编译固件,并通过 ST-LINK / J-Link / DAPLink 烧录到目标 MCU 并硬件复位。
|
|
21
|
+
* **赋予 AI 观测能力**:让 Agent 能够监听 UART 串口会话、捕获并解码 I2C/SPI 总线数据,甚至读取示波器与程控电源的真实物理量。
|
|
22
|
+
* **软硬件自动排障闭环**:当硬件运行异常时,Agent 基于捕获到的真实证据(编译器诊断、I2C NACK、串口 Panic、示波器异常电压)自动定位并修改 C/C++ 源码,重新烧录验证,直到测试全绿。
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 核心功能与 MCP 工具矩阵
|
|
27
|
+
|
|
28
|
+
FirmwareLoop 为 AI Agent 暴露了开箱即用的 MCP 工具,涵盖 5 大核心领域:
|
|
29
|
+
|
|
30
|
+
| 领域 | 核心 MCP 工具 | 功能说明 |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| **构建与体检** | `fw_doctor` <br> `fw_build` | 环境工具链诊断;自动调度 Keil MDK 5 (`UV4.exe`)、CMake、Make、PlatformIO 等编译固件并提取精确定位到行列的诊断日志。 |
|
|
33
|
+
| **硬件与探针** | `fw_scan_hardware` <br> `fw_flash` <br> `fw_reset` | 自动扫描连接的 ST-LINK / J-Link / DAPLink 探针与串口;直连 SWD 接口执行固件烧录与芯片硬件复位。 |
|
|
34
|
+
| **总线与协议** | `fw_logic_capture` <br> `fw_logic_decode` | 驱动逻辑分析仪(Saleae / Sigrok)捕获数字信号;自动解码并断言 I2C 地址/ACK、SPI 帧与串口数据完整性。 |
|
|
35
|
+
| **测试与测量** | `fw_run_hil_test` <br> `fw_measure` <br> `fw_acceptance_scenario` | 一键运行 12 项 pytest 自动化硬件在环测试;安全读取 PyVISA 示波器(频率/Vpp)与程控电源(电流/电压)。 |
|
|
36
|
+
| **工程与脚手架** | `fw_init_project` <br> `fw_configure_lab` <br> `fw_get_evidence` | 一键生成 `AGENTS.md` / `CLAUDE.md` / `GEMINI.md` 多 Agent 指南;自然语言修改芯片型号与台架配置;提取全链路审计证据。 |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 核心设计原则
|
|
41
|
+
|
|
42
|
+
1. **真实硬件优先与零伪造原则(Real-Hardware-First & Zero-Fake)**:
|
|
43
|
+
开发过程中,若探针未插、MCU 未上电、COM 串口占用或编译器缺失,系统**严格抛出明确异常(Fail-Closed)并输出可操作的排查与安装指引**,绝不伪造假成功数据。
|
|
44
|
+
2. **安全沙盒保护(Safety Gate)**:
|
|
45
|
+
所有物理仪器写操作强制受 [`lab/limits.yaml`](lab/limits.example.yaml) 限制,永久禁止超压超流与擦除安全密钥。
|
|
46
|
+
3. **全电脑全局通用(Zero Config per Project)**:
|
|
47
|
+
通过 `uv tool install firmwareloop` 全局安装一次,所有 STM32 / Keil 项目均可直接由 Agent 唤起使用。
|
|
15
48
|
|
|
16
49
|
---
|
|
17
50
|
|
|
@@ -51,94 +84,122 @@ FirmwareLoop 提供开箱即用的**双层 MCP 架构**:
|
|
|
51
84
|
|
|
52
85
|
### 接入模式一:电脑全局安装(首选推荐,一次安装,所有工程通用)
|
|
53
86
|
|
|
54
|
-
|
|
55
|
-
|
|
87
|
+
1. 全局安装 CLI 工具到系统(直接从 PyPI 官方源下载):
|
|
56
88
|
```bash
|
|
57
|
-
|
|
58
|
-
uv tool install git+https://github.com/Jeffrey1799/FirmwareLoop.git
|
|
89
|
+
uv tool install firmwareloop
|
|
59
90
|
uv tool install agentic-hil
|
|
91
|
+
```
|
|
60
92
|
|
|
61
|
-
|
|
62
|
-
|
|
93
|
+
2. 全局注册到 Claude Code CLI(全局级,一次配置全电脑工程通用):
|
|
94
|
+
```bash
|
|
63
95
|
claude mcp add --scope user fwloop -- fwloop
|
|
64
96
|
claude mcp add --scope user agentic-hil -- agentic-hil mcp-stdio
|
|
97
|
+
```
|
|
65
98
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
99
|
+
3. 注册到 Qoder IDE(支持以下三种方式):
|
|
100
|
+
- **GUI 方式**:按快捷键 `Ctrl + Shift + ,`(Mac: `Cmd + Shift + ,`)进入「MCP」->「我的服务」-> 点击「+ 添加」粘贴配置。
|
|
101
|
+
- **工作区方式**:项目根目录放置 `.mcp.json`,Qoder 会自动发现并加载。
|
|
102
|
+
- **CLI 方式**:
|
|
103
|
+
```bash
|
|
104
|
+
qoder.cmd mcp add --global fwloop -- fwloop
|
|
70
105
|
```
|
|
71
106
|
|
|
72
|
-
> **效果**:在电脑任意目录、任意 STM32 / Keil 独立工程下打开 Agent,Agent 均可直接调起 MCP
|
|
107
|
+
> **效果**:在电脑任意目录、任意 STM32 / Keil 独立工程下打开 Agent,Agent 均可直接调起 MCP,无需在每个工程中重复配置。
|
|
73
108
|
|
|
74
109
|
---
|
|
75
110
|
|
|
76
|
-
### 接入模式二:免克隆即时运行(零安装,按需从
|
|
111
|
+
### 接入模式二:免克隆即时运行(零安装,按需从 PyPI 即拉即用)
|
|
77
112
|
|
|
78
113
|
如果不想全局安装,可直接配置 Agent 通过 `uvx` 临时拉取运行:
|
|
79
114
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"agentic-hil": {
|
|
98
|
-
"command": "uvx",
|
|
99
|
-
"args": ["agentic-hil", "mcp-stdio"]
|
|
100
|
-
}
|
|
115
|
+
1. Claude Code CLI 注册:
|
|
116
|
+
```bash
|
|
117
|
+
claude mcp add fwloop -- uvx firmwareloop
|
|
118
|
+
claude mcp add agentic-hil -- uvx agentic-hil mcp-stdio
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
2. Qoder / Cursor / Antigravity(在工程 `.mcp.json` 中配置):
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"mcpServers": {
|
|
125
|
+
"fwloop": {
|
|
126
|
+
"command": "uvx",
|
|
127
|
+
"args": ["firmwareloop"]
|
|
128
|
+
},
|
|
129
|
+
"agentic-hil": {
|
|
130
|
+
"command": "uvx",
|
|
131
|
+
"args": ["agentic-hil", "mcp-stdio"]
|
|
101
132
|
}
|
|
102
133
|
}
|
|
103
|
-
|
|
134
|
+
}
|
|
135
|
+
```
|
|
104
136
|
|
|
105
137
|
---
|
|
106
138
|
|
|
107
139
|
### 接入模式三:源码二次开发模式(本地 Git 克隆)
|
|
108
140
|
|
|
109
141
|
适合需要修改 FirmwareLoop 源码或离线开发的用户:
|
|
142
|
+
|
|
143
|
+
1. 克隆与环境初始化:
|
|
110
144
|
```powershell
|
|
111
|
-
# 1. 克隆与环境初始化
|
|
112
145
|
git clone https://github.com/Jeffrey1799/FirmwareLoop.git D:\Tools\FirmwareLoop
|
|
113
146
|
cd D:\Tools\FirmwareLoop
|
|
114
147
|
uv pip install -e .
|
|
148
|
+
```
|
|
115
149
|
|
|
116
|
-
|
|
150
|
+
2. 注册到 Claude Code:
|
|
151
|
+
```bash
|
|
117
152
|
claude mcp add fwloop -- "D:\Tools\FirmwareLoop\.venv\Scripts\fwloop.exe"
|
|
118
153
|
claude mcp add agentic-hil -- "D:\Tools\FirmwareLoop\.venv\Scripts\agentic-hil.exe" mcp-stdio
|
|
119
154
|
```
|
|
120
155
|
|
|
121
156
|
---
|
|
122
157
|
|
|
123
|
-
### 常用 CLI
|
|
158
|
+
### 常用 CLI 终端命令
|
|
124
159
|
|
|
125
|
-
|
|
160
|
+
本项目支持名称兼容,`fwloop` 与 `firmwareloop` 完全等价:
|
|
126
161
|
|
|
162
|
+
1. 在任意单片机工程根目录下一键初始化多 Agent 规范(AGENTS.md, CLAUDE.md, GEMINI.md)与台架配置:
|
|
127
163
|
```bash
|
|
128
|
-
|
|
129
|
-
|
|
164
|
+
fwloop init
|
|
165
|
+
```
|
|
130
166
|
|
|
131
|
-
|
|
132
|
-
|
|
167
|
+
2. 自动检查并更新至最新版本(自动拉取最新代码并热重载依赖):
|
|
168
|
+
```bash
|
|
169
|
+
fwloop update
|
|
170
|
+
```
|
|
133
171
|
|
|
134
|
-
|
|
135
|
-
|
|
172
|
+
3. 环境健康体检与依赖诊断:
|
|
173
|
+
```bash
|
|
174
|
+
fwloop doctor
|
|
175
|
+
```
|
|
136
176
|
|
|
137
|
-
|
|
138
|
-
|
|
177
|
+
4. 查看或生成各大 Agent MCP 注册指令:
|
|
178
|
+
```bash
|
|
179
|
+
fwloop setup
|
|
180
|
+
```
|
|
139
181
|
|
|
140
|
-
|
|
141
|
-
|
|
182
|
+
5. 查看当前版本:
|
|
183
|
+
```bash
|
|
184
|
+
fwloop version
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
### 卸载与清理
|
|
190
|
+
|
|
191
|
+
如果需要从系统中卸载 FirmwareLoop:
|
|
192
|
+
|
|
193
|
+
1. 一键卸载全局 CLI 工具(干净彻底,不残留垃圾文件):
|
|
194
|
+
```bash
|
|
195
|
+
uv tool uninstall firmwareloop
|
|
196
|
+
uv tool uninstall agentic-hil
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
2. 从 Claude Code 中移除全局 MCP 注册:
|
|
200
|
+
```bash
|
|
201
|
+
claude mcp remove --scope user fwloop
|
|
202
|
+
claude mcp remove --scope user agentic-hil
|
|
142
203
|
```
|
|
143
204
|
|
|
144
205
|
---
|
|
@@ -173,7 +234,7 @@ fwloop version # 或: firmwareloop version
|
|
|
173
234
|
| 编排主体 | AI Agent | pytest | pytest | 资源调度 |
|
|
174
235
|
| 测量证据 | 逻辑分析 + VISA 仪器 | 串口/日志 | 基础 | 弱 |
|
|
175
236
|
| 安全策略 | limits.yaml + 权限模型 | 无 | 无 | 弱 |
|
|
176
|
-
| 迭代闭环 | build
|
|
237
|
+
| 迭代闭环 | build→测→改→重测(<=3 次) | 无 | 部分 | 无 |
|
|
177
238
|
|
|
178
239
|
---
|
|
179
240
|
|
|
@@ -188,7 +249,7 @@ fwloop version # 或: firmwareloop version
|
|
|
188
249
|
├── demo-firmware/ 示例固件(CMake;宿主编译模拟 MCU,闭环验证载体)
|
|
189
250
|
├── demo-make/ 示例固件(Make;构建测试载体)
|
|
190
251
|
├── docs/ DEPENDENCY_MATRIX / REUSE_PLAN / V0.0.2_GAP_VERIFICATION
|
|
191
|
-
├── pyproject.toml 标准 Python 包配置与 CLI 入口声明 (v0.0.
|
|
252
|
+
├── pyproject.toml 标准 Python 包配置与 CLI 入口声明 (v0.0.9)
|
|
192
253
|
├── .mcp.example.json 双层 MCP 配置模板(firmwareloop + agentic-hil)
|
|
193
254
|
├── AGENTS.md 通用智能体规范(Antigravity / Qoder / Cursor 等)
|
|
194
255
|
├── CLAUDE.md Claude Code CLI 指南
|
|
@@ -198,25 +259,26 @@ fwloop version # 或: firmwareloop version
|
|
|
198
259
|
|
|
199
260
|
---
|
|
200
261
|
|
|
201
|
-
## 能力验证状态(v0.0.
|
|
262
|
+
## 能力验证状态(v0.0.9)
|
|
202
263
|
|
|
203
264
|
> 状态定义:`Implemented`(已实现)/ `Simulator Validated`(模拟验证)/
|
|
204
265
|
> `Real Hardware Validated`(真机验证)/ `Experimental` / `Not Implemented`
|
|
205
266
|
|
|
206
267
|
| 能力 | 状态 |
|
|
207
268
|
|---|---|
|
|
208
|
-
| 双层 MCP 服务(13 个工作流与硬件工具) |
|
|
209
|
-
| 一键多 Agent 脚手架(fwloop init / fw_init_project) |
|
|
210
|
-
|
|
|
211
|
-
|
|
|
212
|
-
|
|
|
213
|
-
|
|
|
214
|
-
| pytest HIL(
|
|
215
|
-
|
|
|
216
|
-
|
|
|
217
|
-
|
|
|
218
|
-
|
|
|
219
|
-
|
|
|
269
|
+
| 双层 MCP 服务(13 个工作流与硬件工具) | Implemented + Protocol Validated(31/31 测试通过) |
|
|
270
|
+
| 一键多 Agent 脚手架(fwloop init / fw_init_project) | Implemented + Multi-Agent Validated |
|
|
271
|
+
| 自定义/私有调试工具接入 Skill(fwloop-adapter) | Implemented + Multi-Skill Validated |
|
|
272
|
+
| 一键终端更新(fwloop update) | Implemented + Auto-updater Validated |
|
|
273
|
+
| uvx 免克隆即时运行(Zero-Clone Mode) | Implemented + PEP 517/621 Validated |
|
|
274
|
+
| Build:keil (UV4.exe) / cmake / make / platformio / iar / zephyr / esp-idf | Implemented + Multi-backend Validated |
|
|
275
|
+
| pytest HIL(12 项,simulator) | Implemented + Simulator Validated |
|
|
276
|
+
| pytest HIL(real UART) | Implemented(Agentic HIL 插件已就绪)-> Real Hardware Validated 待 DUT |
|
|
277
|
+
| Agentic HIL MCP(42 硬件工具) | Implemented + discovery 验证 -> 真机待 DUT |
|
|
278
|
+
| 逻辑分析 capture/decode/assert(I2C/SPI/UART) | Simulator Validated -> Real Hardware Validated 待 LA |
|
|
279
|
+
| VISA 仪器(simulator) | Simulator Validated -> Real Hardware Validated 待仪器 |
|
|
280
|
+
| Safety Policy(limits.yaml) | Implemented(simulator 校验)-> 外置权威配置 |
|
|
281
|
+
| 自动修复闭环(M6 载体) | Simulator Validated -> Real Hardware Validated 待 DUT |
|
|
220
282
|
|
|
221
283
|
---
|
|
222
284
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: firmwareloop
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: AI Agent Firmware Development and Lab Automation Platform (Dual-Tier MCP Server)
|
|
5
5
|
Author-email: WeilinZhang <19523330249@163.com>
|
|
6
6
|
License: MIT
|
|
@@ -26,20 +26,53 @@ Requires-Dist: pyyaml>=6.0
|
|
|
26
26
|
Requires-Dist: agentic-hil>=0.14.0
|
|
27
27
|
Dynamic: license-file
|
|
28
28
|
|
|
29
|
-
# FirmwareLoop
|
|
29
|
+
# FirmwareLoop (`fwloop`)
|
|
30
30
|
|
|
31
|
-
>
|
|
32
|
-
>
|
|
31
|
+
> **面向 AI Agent 的嵌入式固件开发、硬件在环测试(HIL)与实验室自动化 MCP 工具集。**
|
|
32
|
+
> 赋能 Claude Code、Qoder、Antigravity、Cursor 等 AI 智能体直接操作物理硬件,打通从代码编译、探针烧录、芯片复位到串口交互、逻辑分析仪抓包与示波器测量的完整开发闭环。
|
|
33
33
|
|
|
34
34
|

|
|
35
35
|

|
|
36
36
|

|
|
37
|
+
[](https://pypi.org/project/firmwareloop/)
|
|
37
38
|
[](https://github.com/Jeffrey1799/FirmwareLoop/actions/workflows/ci.yml)
|
|
38
39
|
[](LICENSE)
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 为什么需要 FirmwareLoop?(定位与作用)
|
|
44
|
+
|
|
45
|
+
传统的 AI 编程助手(LLM)通常只能停留在**“纯软件文本生成”**阶段。在单片机与嵌入式领域,AI 面临严重的断层:**看不到编译报错行列、无法操作物理烧录器、读取不到串口输出,更无法测量真实的电信号与总线波形**。
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
**FirmwareLoop 作为一个标准的 Model Context Protocol (MCP) 服务器,充当了 AI Agent 与物理硬件之间的桥梁**:
|
|
48
|
+
* **赋予 AI 动手能力**:让 Agent 自主调用 Keil5 / CMake 编译固件,并通过 ST-LINK / J-Link / DAPLink 烧录到目标 MCU 并硬件复位。
|
|
49
|
+
* **赋予 AI 观测能力**:让 Agent 能够监听 UART 串口会话、捕获并解码 I2C/SPI 总线数据,甚至读取示波器与程控电源的真实物理量。
|
|
50
|
+
* **软硬件自动排障闭环**:当硬件运行异常时,Agent 基于捕获到的真实证据(编译器诊断、I2C NACK、串口 Panic、示波器异常电压)自动定位并修改 C/C++ 源码,重新烧录验证,直到测试全绿。
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 核心功能与 MCP 工具矩阵
|
|
55
|
+
|
|
56
|
+
FirmwareLoop 为 AI Agent 暴露了开箱即用的 MCP 工具,涵盖 5 大核心领域:
|
|
57
|
+
|
|
58
|
+
| 领域 | 核心 MCP 工具 | 功能说明 |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| **构建与体检** | `fw_doctor` <br> `fw_build` | 环境工具链诊断;自动调度 Keil MDK 5 (`UV4.exe`)、CMake、Make、PlatformIO 等编译固件并提取精确定位到行列的诊断日志。 |
|
|
61
|
+
| **硬件与探针** | `fw_scan_hardware` <br> `fw_flash` <br> `fw_reset` | 自动扫描连接的 ST-LINK / J-Link / DAPLink 探针与串口;直连 SWD 接口执行固件烧录与芯片硬件复位。 |
|
|
62
|
+
| **总线与协议** | `fw_logic_capture` <br> `fw_logic_decode` | 驱动逻辑分析仪(Saleae / Sigrok)捕获数字信号;自动解码并断言 I2C 地址/ACK、SPI 帧与串口数据完整性。 |
|
|
63
|
+
| **测试与测量** | `fw_run_hil_test` <br> `fw_measure` <br> `fw_acceptance_scenario` | 一键运行 12 项 pytest 自动化硬件在环测试;安全读取 PyVISA 示波器(频率/Vpp)与程控电源(电流/电压)。 |
|
|
64
|
+
| **工程与脚手架** | `fw_init_project` <br> `fw_configure_lab` <br> `fw_get_evidence` | 一键生成 `AGENTS.md` / `CLAUDE.md` / `GEMINI.md` 多 Agent 指南;自然语言修改芯片型号与台架配置;提取全链路审计证据。 |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 核心设计原则
|
|
69
|
+
|
|
70
|
+
1. **真实硬件优先与零伪造原则(Real-Hardware-First & Zero-Fake)**:
|
|
71
|
+
开发过程中,若探针未插、MCU 未上电、COM 串口占用或编译器缺失,系统**严格抛出明确异常(Fail-Closed)并输出可操作的排查与安装指引**,绝不伪造假成功数据。
|
|
72
|
+
2. **安全沙盒保护(Safety Gate)**:
|
|
73
|
+
所有物理仪器写操作强制受 [`lab/limits.yaml`](lab/limits.example.yaml) 限制,永久禁止超压超流与擦除安全密钥。
|
|
74
|
+
3. **全电脑全局通用(Zero Config per Project)**:
|
|
75
|
+
通过 `uv tool install firmwareloop` 全局安装一次,所有 STM32 / Keil 项目均可直接由 Agent 唤起使用。
|
|
43
76
|
|
|
44
77
|
---
|
|
45
78
|
|
|
@@ -79,94 +112,122 @@ FirmwareLoop 提供开箱即用的**双层 MCP 架构**:
|
|
|
79
112
|
|
|
80
113
|
### 接入模式一:电脑全局安装(首选推荐,一次安装,所有工程通用)
|
|
81
114
|
|
|
82
|
-
|
|
83
|
-
|
|
115
|
+
1. 全局安装 CLI 工具到系统(直接从 PyPI 官方源下载):
|
|
84
116
|
```bash
|
|
85
|
-
|
|
86
|
-
uv tool install git+https://github.com/Jeffrey1799/FirmwareLoop.git
|
|
117
|
+
uv tool install firmwareloop
|
|
87
118
|
uv tool install agentic-hil
|
|
119
|
+
```
|
|
88
120
|
|
|
89
|
-
|
|
90
|
-
|
|
121
|
+
2. 全局注册到 Claude Code CLI(全局级,一次配置全电脑工程通用):
|
|
122
|
+
```bash
|
|
91
123
|
claude mcp add --scope user fwloop -- fwloop
|
|
92
124
|
claude mcp add --scope user agentic-hil -- agentic-hil mcp-stdio
|
|
125
|
+
```
|
|
93
126
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
127
|
+
3. 注册到 Qoder IDE(支持以下三种方式):
|
|
128
|
+
- **GUI 方式**:按快捷键 `Ctrl + Shift + ,`(Mac: `Cmd + Shift + ,`)进入「MCP」->「我的服务」-> 点击「+ 添加」粘贴配置。
|
|
129
|
+
- **工作区方式**:项目根目录放置 `.mcp.json`,Qoder 会自动发现并加载。
|
|
130
|
+
- **CLI 方式**:
|
|
131
|
+
```bash
|
|
132
|
+
qoder.cmd mcp add --global fwloop -- fwloop
|
|
98
133
|
```
|
|
99
134
|
|
|
100
|
-
> **效果**:在电脑任意目录、任意 STM32 / Keil 独立工程下打开 Agent,Agent 均可直接调起 MCP
|
|
135
|
+
> **效果**:在电脑任意目录、任意 STM32 / Keil 独立工程下打开 Agent,Agent 均可直接调起 MCP,无需在每个工程中重复配置。
|
|
101
136
|
|
|
102
137
|
---
|
|
103
138
|
|
|
104
|
-
### 接入模式二:免克隆即时运行(零安装,按需从
|
|
139
|
+
### 接入模式二:免克隆即时运行(零安装,按需从 PyPI 即拉即用)
|
|
105
140
|
|
|
106
141
|
如果不想全局安装,可直接配置 Agent 通过 `uvx` 临时拉取运行:
|
|
107
142
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"agentic-hil": {
|
|
126
|
-
"command": "uvx",
|
|
127
|
-
"args": ["agentic-hil", "mcp-stdio"]
|
|
128
|
-
}
|
|
143
|
+
1. Claude Code CLI 注册:
|
|
144
|
+
```bash
|
|
145
|
+
claude mcp add fwloop -- uvx firmwareloop
|
|
146
|
+
claude mcp add agentic-hil -- uvx agentic-hil mcp-stdio
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
2. Qoder / Cursor / Antigravity(在工程 `.mcp.json` 中配置):
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"mcpServers": {
|
|
153
|
+
"fwloop": {
|
|
154
|
+
"command": "uvx",
|
|
155
|
+
"args": ["firmwareloop"]
|
|
156
|
+
},
|
|
157
|
+
"agentic-hil": {
|
|
158
|
+
"command": "uvx",
|
|
159
|
+
"args": ["agentic-hil", "mcp-stdio"]
|
|
129
160
|
}
|
|
130
161
|
}
|
|
131
|
-
|
|
162
|
+
}
|
|
163
|
+
```
|
|
132
164
|
|
|
133
165
|
---
|
|
134
166
|
|
|
135
167
|
### 接入模式三:源码二次开发模式(本地 Git 克隆)
|
|
136
168
|
|
|
137
169
|
适合需要修改 FirmwareLoop 源码或离线开发的用户:
|
|
170
|
+
|
|
171
|
+
1. 克隆与环境初始化:
|
|
138
172
|
```powershell
|
|
139
|
-
# 1. 克隆与环境初始化
|
|
140
173
|
git clone https://github.com/Jeffrey1799/FirmwareLoop.git D:\Tools\FirmwareLoop
|
|
141
174
|
cd D:\Tools\FirmwareLoop
|
|
142
175
|
uv pip install -e .
|
|
176
|
+
```
|
|
143
177
|
|
|
144
|
-
|
|
178
|
+
2. 注册到 Claude Code:
|
|
179
|
+
```bash
|
|
145
180
|
claude mcp add fwloop -- "D:\Tools\FirmwareLoop\.venv\Scripts\fwloop.exe"
|
|
146
181
|
claude mcp add agentic-hil -- "D:\Tools\FirmwareLoop\.venv\Scripts\agentic-hil.exe" mcp-stdio
|
|
147
182
|
```
|
|
148
183
|
|
|
149
184
|
---
|
|
150
185
|
|
|
151
|
-
### 常用 CLI
|
|
186
|
+
### 常用 CLI 终端命令
|
|
152
187
|
|
|
153
|
-
|
|
188
|
+
本项目支持名称兼容,`fwloop` 与 `firmwareloop` 完全等价:
|
|
154
189
|
|
|
190
|
+
1. 在任意单片机工程根目录下一键初始化多 Agent 规范(AGENTS.md, CLAUDE.md, GEMINI.md)与台架配置:
|
|
155
191
|
```bash
|
|
156
|
-
|
|
157
|
-
|
|
192
|
+
fwloop init
|
|
193
|
+
```
|
|
158
194
|
|
|
159
|
-
|
|
160
|
-
|
|
195
|
+
2. 自动检查并更新至最新版本(自动拉取最新代码并热重载依赖):
|
|
196
|
+
```bash
|
|
197
|
+
fwloop update
|
|
198
|
+
```
|
|
161
199
|
|
|
162
|
-
|
|
163
|
-
|
|
200
|
+
3. 环境健康体检与依赖诊断:
|
|
201
|
+
```bash
|
|
202
|
+
fwloop doctor
|
|
203
|
+
```
|
|
164
204
|
|
|
165
|
-
|
|
166
|
-
|
|
205
|
+
4. 查看或生成各大 Agent MCP 注册指令:
|
|
206
|
+
```bash
|
|
207
|
+
fwloop setup
|
|
208
|
+
```
|
|
167
209
|
|
|
168
|
-
|
|
169
|
-
|
|
210
|
+
5. 查看当前版本:
|
|
211
|
+
```bash
|
|
212
|
+
fwloop version
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### 卸载与清理
|
|
218
|
+
|
|
219
|
+
如果需要从系统中卸载 FirmwareLoop:
|
|
220
|
+
|
|
221
|
+
1. 一键卸载全局 CLI 工具(干净彻底,不残留垃圾文件):
|
|
222
|
+
```bash
|
|
223
|
+
uv tool uninstall firmwareloop
|
|
224
|
+
uv tool uninstall agentic-hil
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
2. 从 Claude Code 中移除全局 MCP 注册:
|
|
228
|
+
```bash
|
|
229
|
+
claude mcp remove --scope user fwloop
|
|
230
|
+
claude mcp remove --scope user agentic-hil
|
|
170
231
|
```
|
|
171
232
|
|
|
172
233
|
---
|
|
@@ -201,7 +262,7 @@ fwloop version # 或: firmwareloop version
|
|
|
201
262
|
| 编排主体 | AI Agent | pytest | pytest | 资源调度 |
|
|
202
263
|
| 测量证据 | 逻辑分析 + VISA 仪器 | 串口/日志 | 基础 | 弱 |
|
|
203
264
|
| 安全策略 | limits.yaml + 权限模型 | 无 | 无 | 弱 |
|
|
204
|
-
| 迭代闭环 | build
|
|
265
|
+
| 迭代闭环 | build→测→改→重测(<=3 次) | 无 | 部分 | 无 |
|
|
205
266
|
|
|
206
267
|
---
|
|
207
268
|
|
|
@@ -216,7 +277,7 @@ fwloop version # 或: firmwareloop version
|
|
|
216
277
|
├── demo-firmware/ 示例固件(CMake;宿主编译模拟 MCU,闭环验证载体)
|
|
217
278
|
├── demo-make/ 示例固件(Make;构建测试载体)
|
|
218
279
|
├── docs/ DEPENDENCY_MATRIX / REUSE_PLAN / V0.0.2_GAP_VERIFICATION
|
|
219
|
-
├── pyproject.toml 标准 Python 包配置与 CLI 入口声明 (v0.0.
|
|
280
|
+
├── pyproject.toml 标准 Python 包配置与 CLI 入口声明 (v0.0.9)
|
|
220
281
|
├── .mcp.example.json 双层 MCP 配置模板(firmwareloop + agentic-hil)
|
|
221
282
|
├── AGENTS.md 通用智能体规范(Antigravity / Qoder / Cursor 等)
|
|
222
283
|
├── CLAUDE.md Claude Code CLI 指南
|
|
@@ -226,25 +287,26 @@ fwloop version # 或: firmwareloop version
|
|
|
226
287
|
|
|
227
288
|
---
|
|
228
289
|
|
|
229
|
-
## 能力验证状态(v0.0.
|
|
290
|
+
## 能力验证状态(v0.0.9)
|
|
230
291
|
|
|
231
292
|
> 状态定义:`Implemented`(已实现)/ `Simulator Validated`(模拟验证)/
|
|
232
293
|
> `Real Hardware Validated`(真机验证)/ `Experimental` / `Not Implemented`
|
|
233
294
|
|
|
234
295
|
| 能力 | 状态 |
|
|
235
296
|
|---|---|
|
|
236
|
-
| 双层 MCP 服务(13 个工作流与硬件工具) |
|
|
237
|
-
| 一键多 Agent 脚手架(fwloop init / fw_init_project) |
|
|
238
|
-
|
|
|
239
|
-
|
|
|
240
|
-
|
|
|
241
|
-
|
|
|
242
|
-
| pytest HIL(
|
|
243
|
-
|
|
|
244
|
-
|
|
|
245
|
-
|
|
|
246
|
-
|
|
|
247
|
-
|
|
|
297
|
+
| 双层 MCP 服务(13 个工作流与硬件工具) | Implemented + Protocol Validated(31/31 测试通过) |
|
|
298
|
+
| 一键多 Agent 脚手架(fwloop init / fw_init_project) | Implemented + Multi-Agent Validated |
|
|
299
|
+
| 自定义/私有调试工具接入 Skill(fwloop-adapter) | Implemented + Multi-Skill Validated |
|
|
300
|
+
| 一键终端更新(fwloop update) | Implemented + Auto-updater Validated |
|
|
301
|
+
| uvx 免克隆即时运行(Zero-Clone Mode) | Implemented + PEP 517/621 Validated |
|
|
302
|
+
| Build:keil (UV4.exe) / cmake / make / platformio / iar / zephyr / esp-idf | Implemented + Multi-backend Validated |
|
|
303
|
+
| pytest HIL(12 项,simulator) | Implemented + Simulator Validated |
|
|
304
|
+
| pytest HIL(real UART) | Implemented(Agentic HIL 插件已就绪)-> Real Hardware Validated 待 DUT |
|
|
305
|
+
| Agentic HIL MCP(42 硬件工具) | Implemented + discovery 验证 -> 真机待 DUT |
|
|
306
|
+
| 逻辑分析 capture/decode/assert(I2C/SPI/UART) | Simulator Validated -> Real Hardware Validated 待 LA |
|
|
307
|
+
| VISA 仪器(simulator) | Simulator Validated -> Real Hardware Validated 待仪器 |
|
|
308
|
+
| Safety Policy(limits.yaml) | Implemented(simulator 校验)-> 外置权威配置 |
|
|
309
|
+
| 自动修复闭环(M6 载体) | Simulator Validated -> Real Hardware Validated 待 DUT |
|
|
248
310
|
|
|
249
311
|
---
|
|
250
312
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
#>
|
|
19
19
|
[CmdletBinding()]
|
|
20
20
|
param(
|
|
21
|
-
[Parameter(Mandatory = $true)][ValidateSet('simulator', 'agentic-hil', 'openocd', 'stm32cubeprogrammer', 'esptool', 'jlink', 'vendor')]
|
|
21
|
+
[Parameter(Mandatory = $true)][ValidateSet('simulator', 'agentic-hil', 'openocd', 'stm32cubeprogrammer', 'esptool', 'jlink', 'vendor', 'pyocd')]
|
|
22
22
|
[string]$Backend,
|
|
23
23
|
[string]$Artifact = 'artifacts/build/firmware.elf',
|
|
24
24
|
[switch]$Json,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
fw_mcp_server.py - FirmwareLoop High-Level Workflow & Device MCP Server (v0.0.
|
|
3
|
+
fw_mcp_server.py - FirmwareLoop High-Level Workflow & Device MCP Server (v0.0.9).
|
|
4
4
|
|
|
5
5
|
Exposes high-level firmware engineering and hardware management tools to AI Coding
|
|
6
6
|
Agents (Antigravity CLI, Claude Code CLI, Qoder IDE, Cursor) via the Model Context
|
|
@@ -482,6 +482,155 @@ Use this skill when developing, building, testing, or diagnosing embedded firmwa
|
|
|
482
482
|
fh.write(skill_content)
|
|
483
483
|
created_files.append("skills/firmwareloop/SKILL.md")
|
|
484
484
|
|
|
485
|
+
# 7. skills/fwloop-adapter/SKILL.md
|
|
486
|
+
adapter_skill_dir = os.path.join(target_dir, "skills", "fwloop-adapter")
|
|
487
|
+
os.makedirs(adapter_skill_dir, exist_ok=True)
|
|
488
|
+
adapter_skill_path = os.path.join(adapter_skill_dir, "SKILL.md")
|
|
489
|
+
adapter_skill_content = r"""---
|
|
490
|
+
name: fwloop-adapter
|
|
491
|
+
description: 帮助用户将企业自研或第三方 Debug 探针、固件烧录工具、芯片复位脚本、串口/CAN Log 抓取工具或私有协议分析器快速接入 FirmwareLoop。当用户说"接入自研/自定义工具"、"配置私有烧录器"、"使用我们公司的 debug 脚本"或提供 GUI 上位机时触发。
|
|
492
|
+
---
|
|
493
|
+
|
|
494
|
+
# FirmwareLoop 自定义工具接入 Skill (fwloop-adapter)
|
|
495
|
+
|
|
496
|
+
当用户希望将公司内部自研的烧录器、复位工具、串口抓包脚本或私有硬件调试工具接入 FirmwareLoop 时,遵循以下标准化工程流程与小白用户引导规范。
|
|
497
|
+
|
|
498
|
+
## 适用场景
|
|
499
|
+
1. 用户拥有专属的命令行烧录工具(如 `my_flasher.exe`、`custom_flash.py`、J-Link 内部批处理脚本)。
|
|
500
|
+
2. 用户拥有专用的串口/CAN 抓包与日志采集工具。
|
|
501
|
+
3. 用户拥有私有的板卡供电或复位控制上位机。
|
|
502
|
+
4. **用户只有带界面(GUI)的 exe 上位机软件,不知道如何接入自动化工作流。**
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
## 面对纯 GUI 上位机软件的专项引导流程(小白友好,先探查后求助)
|
|
507
|
+
|
|
508
|
+
如果用户告知 **“我们只有一个带界面的 exe 上位机软件(需要用鼠标点按钮选择文件、点击下载/抓包),没有命令行”**,Agent **严禁直接报错或直接让用户去找人**,必须按以下**由近及远、先探查本地现场后求助同事的 4 级阶梯流程**主动引导用户:
|
|
509
|
+
|
|
510
|
+
### 阶梯 1:先让用户提供上位机所在文件夹路径(最先执行,探查本地现有资源)
|
|
511
|
+
Agent 首先引导用户提供上位机所在的本地目录:
|
|
512
|
+
> “请把您这个上位机所在的文件夹路径(如 `D:\tools\NdtDebugTool-v1.0.19`)发给我,我先帮您扫描一下目录内部的资源。”
|
|
513
|
+
* **Agent 内部执行动作**:
|
|
514
|
+
1. 扫描同目录下是否存在对应的命令行工具(如 `_cli.exe`、`_console.exe`);
|
|
515
|
+
2. 扫描同目录下是否有使用说明书(`shouce.md`、`readme.txt`、通信协议规范文档);
|
|
516
|
+
3. 扫描同目录下是否有底层通信动态库(如 `lib/USBIOX.DLL`、`FTD2XX.DLL`、`CH341.DLL`)或配置文件(`config.ini`);
|
|
517
|
+
4. 测试运行 `tool.exe --help`、`-h`、`-s` 探测是否存在隐藏的静默命令行开关。
|
|
518
|
+
|
|
519
|
+
### 阶梯 2:基于目录资源或引导用户提供协议/源码,Agent 编写 Python 脚本代打(无需改上位机)
|
|
520
|
+
如果阶梯 1 发现了底层通信库(如 `USBIOX.DLL`、`usb2io.dll`)或协议说明,或者用户能提供单片机端代码:
|
|
521
|
+
> “我在您的上位机目录下发现了底层通信库(如 `lib/USBIOX.DLL`)与使用手册。如果您能提供单片机端的 Bootloader 源码或通信协议,我可以直接为您编写一个纯 Python 脚本,直接与硬件通信完成烧录/抓包,完全不需要再打开那个界面软件!”
|
|
522
|
+
* **Agent 内部执行动作**:
|
|
523
|
+
在 `lab/adapters/` 下编写 Python 驱动脚本(利用 `ctypes` 调用 DLL 或通过串口发包),直接实现标准 JSON 接口,彻底解决接入。
|
|
524
|
+
|
|
525
|
+
### 阶梯 3:如果本地资源完全不足(真正黑盒),再生成对接说明去找上位机开发同事
|
|
526
|
+
只有当阶梯 1 和 2 确认该上位机没有任何文档、没有任何底层库、没有协议且是纯黑盒 GUI 时,Agent 才生成《致上位机开发同事的技术说明函》:
|
|
527
|
+
> “我检查了上位机目录,发现它是一个纯黑盒界面程序,且缺少通信协议。您可以将以下需求直接转发给开发该上位机的同事,请他协助加几行命令行调用支持:”
|
|
528
|
+
```text
|
|
529
|
+
【需求对接】为上位机增加静默命令行调用支持(适配自动化 AI Agent)
|
|
530
|
+
Hi 同事,我们正在引入 FirmwareLoop 自动化工作流。为了能通过终端自动调用您的上位机执行烧录/抓包,需要您协助提供以下轻量支持(任选其一即可):
|
|
531
|
+
1. 方案 A(推荐):在现有上位机程序中,增加启动参数判断(例如 `tool.exe --cli --file <固件路径> --port <COM口>`),当传入这些参数时直接在后台静默执行核心烧录/抓包函数,无需弹出窗口;
|
|
532
|
+
2. 方案 B:直接编译一个对应的控制台版本(如 `tool_cli.exe`);
|
|
533
|
+
3. 方案 C:如果方便,请分享一下上位机通信协议文档或底层通信动态库(DLL / Python SDK)。
|
|
534
|
+
执行要求:成功请 exit(0),失败请 exit(1) 并将报错信息打印至 stdout 或写入 log 文件。感谢支持!
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### 阶梯 4:最终兜底方案(UI 自动化 pywinauto 后台点击)
|
|
538
|
+
如果上位机同事也无法修改,且无法获取协议,Agent 基于 `pywinauto` 编写后台自动化脚本模拟点击按钮完成烧录/抓包。
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
## 引导用户与内部工具开发工程师的对接清单(Checklist)
|
|
543
|
+
|
|
544
|
+
当用户的自研工具缺少 CLI 接口、需要弹窗点击或行为不明确时,**Agent 应当主动提醒并引导用户,向负责开发该工具的内部工程师提供以下 5 大对接需求**:
|
|
545
|
+
|
|
546
|
+
1. **提供无界面的静默命令行接口(Headless / Non-Interactive CLI)**:
|
|
547
|
+
- *说明*:Agent 无法通过屏幕点击 GUI 弹窗,工具必须支持纯命令行调用(如 `tool.exe --flash <固件路径> --chip <芯片型号>` 或提供 Python SDK/脚本),全程无需人工按键交互。
|
|
548
|
+
2. **严格规范退出码(Standard Exit Codes)**:
|
|
549
|
+
- *说明*:如果工具报错了但退出码仍返回 0,Agent 会误判为成功。要求成功时必须 `exit(0)`,任何失败(探针未连、校验失败、超时)必须返回**非 0 退出码**(如 `exit(1)`)。
|
|
550
|
+
3. **标准输出与日志重定向(Stdout / Log File Export)**:
|
|
551
|
+
- *说明*:Agent 需要根据工具打印的报错细节来排查代码。工具应将诊断信息输出到标准输出(stdout/stderr),或支持参数 `--log-file <path>` 导出文件。
|
|
552
|
+
4. **明确动态传参占位符(Parameter Mapping)**:
|
|
553
|
+
- 约定工具接收的参数格式:固件路径(`{artifact_path}`)、芯片型号(`{target_chip}`)、串口号(`{uart_port}`)、波特率(`{baud}`)、探针序列号(`{probe_serial}`)。
|
|
554
|
+
5. **内置操作超时与复位机制(Timeout & Auto-Reset)**:
|
|
555
|
+
- *说明*:工具在目标板卡无响应时需内置超时保护(防止进程死锁挂起 Agent);烧录完成后建议支持可选的自动复位启动(如 `--reset` 参数)。
|
|
556
|
+
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
## 标准化接入流程
|
|
560
|
+
|
|
561
|
+
### 第一步:分析自研工具的接口特征
|
|
562
|
+
先查看或向用户确认该工具的调用方式:
|
|
563
|
+
1. **调用形式**:是可执行文件(`.exe`)、Python 脚本(`.py`)、PowerShell 脚本(`.ps1`)还是 C/C++ 动态链接库。
|
|
564
|
+
2. **入参要求**:
|
|
565
|
+
- 固件烧录类:通常需要目标芯片型号(`{target_chip}`)、固件绝对路径(`{artifact_path}`)、探针序列号(`{probe_serial}`)。
|
|
566
|
+
- 串口/日志类:通常需要 COM 端口号(`{uart_port}`)、波特率(`{baud}`)、日志输出文件(`{output_file}`)、抓取时长(`{duration_ms}`)。
|
|
567
|
+
3. **退出码与输出规范**:
|
|
568
|
+
- 成功时返回退出码 `0`。
|
|
569
|
+
- 失败时返回非 0 退出码,并在 stdout/stderr 打印具体错误原因。
|
|
570
|
+
|
|
571
|
+
### 第二步:选择接入模式并实施
|
|
572
|
+
|
|
573
|
+
#### 模式 A:配置驱动型(针对标准 CLI 工具,最推荐)
|
|
574
|
+
如果用户工具能够直接通过命令行参数完成任务:
|
|
575
|
+
1. 打开或创建 `lab/lab.yaml`。
|
|
576
|
+
2. 在 `custom_tools` 节点下配置命令模板(支持占位符 `{artifact_path}`, `{target_chip}`, `{uart_port}`, `{output_file}`):
|
|
577
|
+
```yaml
|
|
578
|
+
custom_tools:
|
|
579
|
+
flash:
|
|
580
|
+
enabled: true
|
|
581
|
+
command: "D:/MyTools/flasher.exe -c {target_chip} -f {artifact_path}"
|
|
582
|
+
timeout_ms: 60000
|
|
583
|
+
reset:
|
|
584
|
+
enabled: true
|
|
585
|
+
command: "D:/MyTools/reset_tool.exe -p {uart_port}"
|
|
586
|
+
timeout_ms: 10000
|
|
587
|
+
log_capture:
|
|
588
|
+
enabled: true
|
|
589
|
+
command: "python D:/MyTools/logger.py --port {uart_port} --out {output_file}"
|
|
590
|
+
timeout_ms: 30000
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
#### 模式 B:脚本适配器型(针对复杂参数或前置处理)
|
|
594
|
+
如果自研工具有前置握手、环境依赖或格式转换要求:
|
|
595
|
+
1. 在 `lab/adapters/` 目录下创建轻量包装脚本(例如 `lab/adapters/flash_custom.py` 或 `lab/adapters/flash_custom.ps1`)。
|
|
596
|
+
2. 包装脚本负责:
|
|
597
|
+
- 接收标准参数并调用内部自研工具;
|
|
598
|
+
- 拦截并捕获原始日志,重定向落盘到 `artifacts/logs/`;
|
|
599
|
+
- 输出统一的结构化 JSON(包含 `schema`, `ok`, `error_class`, `log`)。
|
|
600
|
+
|
|
601
|
+
#### 模式 C:并联 MCP 服务型(针对复杂常驻服务或 SDK)
|
|
602
|
+
如果自研工具本身是完整的服务:
|
|
603
|
+
在工程根目录的 `.mcp.json` 中并联注册自研 MCP 服务:
|
|
604
|
+
```json
|
|
605
|
+
{
|
|
606
|
+
"mcpServers": {
|
|
607
|
+
"fwloop": {
|
|
608
|
+
"command": "uvx",
|
|
609
|
+
"args": ["firmwareloop"]
|
|
610
|
+
},
|
|
611
|
+
"custom-debug-tool": {
|
|
612
|
+
"command": "python",
|
|
613
|
+
"args": ["D:/MyTools/company_mcp_server.py"]
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
### 第三步:真实物理联调验证(Dry-Run)
|
|
620
|
+
1. 严禁假跑!必须在真实连接硬件的前提下运行一次试运行。
|
|
621
|
+
2. 检查输出日志是否成功写入 `artifacts/logs/`。
|
|
622
|
+
3. 验证返回码与异常拦截机制(例如拔掉 USB 探针后,确认工具能正确报错并被 Agent 捕获)。
|
|
623
|
+
|
|
624
|
+
### 第四步:交付与提示
|
|
625
|
+
向用户展示配置位置,并说明后续在对话中可以直接使用自然语言调度:
|
|
626
|
+
- “*使用我们公司的烧录工具把固件刷入芯片*”
|
|
627
|
+
- “*启动自研抓包工具采集 5 秒串口日志*”
|
|
628
|
+
"""
|
|
629
|
+
if not os.path.exists(adapter_skill_path) or overwrite:
|
|
630
|
+
with open(adapter_skill_path, "w", encoding="utf-8") as fh:
|
|
631
|
+
fh.write(adapter_skill_content)
|
|
632
|
+
created_files.append("skills/fwloop-adapter/SKILL.md")
|
|
633
|
+
|
|
485
634
|
return {
|
|
486
635
|
"ok": True,
|
|
487
636
|
"target_dir": target_dir,
|
|
@@ -1011,7 +1160,7 @@ def process_request(req: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
|
|
1011
1160
|
},
|
|
1012
1161
|
"serverInfo": {
|
|
1013
1162
|
"name": "firmwareloop",
|
|
1014
|
-
"version": "0.0.
|
|
1163
|
+
"version": "0.0.9"
|
|
1015
1164
|
}
|
|
1016
1165
|
}
|
|
1017
1166
|
}
|
|
@@ -1103,7 +1252,7 @@ def process_request(req: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
|
|
1103
1252
|
def handle_cli_update() -> int:
|
|
1104
1253
|
"""Handle `firmwareloop update` command."""
|
|
1105
1254
|
print("============================================================")
|
|
1106
|
-
print(" FirmwareLoop Auto-Updater (v0.0.
|
|
1255
|
+
print(" FirmwareLoop Auto-Updater (v0.0.9)")
|
|
1107
1256
|
print("============================================================")
|
|
1108
1257
|
|
|
1109
1258
|
is_git_repo = os.path.exists(os.path.join(REPO_ROOT, ".git"))
|
|
@@ -1177,7 +1326,7 @@ def handle_cli_setup() -> int:
|
|
|
1177
1326
|
def handle_cli_init() -> int:
|
|
1178
1327
|
"""Handle `firmwareloop init` command."""
|
|
1179
1328
|
print("============================================================")
|
|
1180
|
-
print(" FirmwareLoop Multi-Agent Project Initializer (v0.0.
|
|
1329
|
+
print(" FirmwareLoop Multi-Agent Project Initializer (v0.0.9)")
|
|
1181
1330
|
print("============================================================")
|
|
1182
1331
|
cwd = os.getcwd()
|
|
1183
1332
|
print(f"[*] Initializing multi-agent guidelines & bench config in:\n {cwd}\n")
|
|
@@ -1198,7 +1347,7 @@ def handle_cli_init() -> int:
|
|
|
1198
1347
|
|
|
1199
1348
|
|
|
1200
1349
|
def print_cli_help() -> None:
|
|
1201
|
-
print("""FirmwareLoop (fwloop) — AI Agent Firmware Engineering & Lab Automation Platform (v0.0.
|
|
1350
|
+
print("""FirmwareLoop (fwloop) — AI Agent Firmware Engineering & Lab Automation Platform (v0.0.9)
|
|
1202
1351
|
|
|
1203
1352
|
Usage:
|
|
1204
1353
|
fwloop [command] (or: firmwareloop [command])
|
|
@@ -1229,7 +1378,7 @@ def main() -> None:
|
|
|
1229
1378
|
elif cmd in ["setup", "register"]:
|
|
1230
1379
|
sys.exit(handle_cli_setup())
|
|
1231
1380
|
elif cmd in ["version", "-v", "--version"]:
|
|
1232
|
-
print("FirmwareLoop v0.0.
|
|
1381
|
+
print("FirmwareLoop v0.0.9")
|
|
1233
1382
|
sys.exit(0)
|
|
1234
1383
|
elif cmd in ["help", "-h", "--help"]:
|
|
1235
1384
|
print_cli_help()
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#>
|
|
13
13
|
[CmdletBinding()]
|
|
14
14
|
param(
|
|
15
|
-
[ValidateSet('simulator', 'agentic-hil', 'openocd', 'vendor')]
|
|
15
|
+
[ValidateSet('simulator', 'agentic-hil', 'openocd', 'vendor', 'pyocd', 'jlink')]
|
|
16
16
|
[string]$Backend = 'simulator',
|
|
17
17
|
[string]$ExpectedTarget, # verify probe identity before reset (Spec §9)
|
|
18
18
|
[switch]$Json
|
|
@@ -75,24 +75,38 @@ $report.agents.qoder = [ordered]@{
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
# 3. Antigravity CLI / Gemini Code
|
|
78
|
+
# 3. Antigravity CLI / Gemini Code & Claude Code Global Skills
|
|
79
79
|
$antigravitySkillsRoot = Join-Path $env:USERPROFILE '.gemini\antigravity-cli\skills'
|
|
80
|
-
$
|
|
81
|
-
$sourceSkill = Join-Path $repoRoot 'skills\firmwareloop\SKILL.md'
|
|
80
|
+
$claudeSkillsRoot = Join-Path $env:USERPROFILE '.claude\skills'
|
|
82
81
|
|
|
83
|
-
$
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
$
|
|
82
|
+
$installedSkills = @()
|
|
83
|
+
$sourceSkillsDir = Join-Path $repoRoot 'skills'
|
|
84
|
+
if (Test-Path -LiteralPath $sourceSkillsDir) {
|
|
85
|
+
Get-ChildItem -Directory -Path $sourceSkillsDir | ForEach-Object {
|
|
86
|
+
$skillName = $_.Name
|
|
87
|
+
$sourceSkillFile = Join-Path $_.FullName 'SKILL.md'
|
|
88
|
+
if (Test-Path -LiteralPath $sourceSkillFile) {
|
|
89
|
+
# Sync to Antigravity
|
|
90
|
+
if (Test-Path -LiteralPath (Split-Path $antigravitySkillsRoot)) {
|
|
91
|
+
$targetDir = Join-Path $antigravitySkillsRoot $skillName
|
|
92
|
+
New-Item -ItemType Directory -Force -Path $targetDir | Out-Null
|
|
93
|
+
Copy-Item -LiteralPath $sourceSkillFile -Destination (Join-Path $targetDir 'SKILL.md') -Force
|
|
94
|
+
}
|
|
95
|
+
# Sync to Claude
|
|
96
|
+
if (Test-Path -LiteralPath (Split-Path $claudeSkillsRoot)) {
|
|
97
|
+
$targetDir = Join-Path $claudeSkillsRoot $skillName
|
|
98
|
+
New-Item -ItemType Directory -Force -Path $targetDir | Out-Null
|
|
99
|
+
Copy-Item -LiteralPath $sourceSkillFile -Destination (Join-Path $targetDir 'SKILL.md') -Force
|
|
100
|
+
}
|
|
101
|
+
$installedSkills += $skillName
|
|
102
|
+
}
|
|
89
103
|
}
|
|
90
104
|
}
|
|
91
105
|
|
|
92
106
|
$report.agents.antigravity = [ordered]@{
|
|
93
107
|
mcp_config_path = (Join-Path $repoRoot '.mcp.json')
|
|
94
|
-
|
|
95
|
-
|
|
108
|
+
global_skills_installed = ($installedSkills.Count -gt 0)
|
|
109
|
+
installed_skills = $installedSkills
|
|
96
110
|
note = "Antigravity automatically discovers project-level .mcp.json and global skills."
|
|
97
111
|
}
|
|
98
112
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|