build

A build command for Keil UV4 embedded projects. It finds a .uvprojx or .uvproj project, compiles the firmware, and reports the result and output files.

In plain words
What is it for?
Use it to compile microcontroller firmware, check compiler errors and warnings, and identify the generated file and its Flash and RAM usage. A successful build can continue to device programming and serial-log checks.
Why use it?
It removes the need to locate the project and start the Keil compiler manually. Build errors, warnings, firmware size, and output paths are collected in one result.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/jzl-maker/ea-skill/build
Clone the repo
git clone --depth 1 https://github.com/jzl-maker/EA-SKILL
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 820 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00820
Opus 5 $0.00000 $0.00410
Sonnet 5 $0.00000 $0.00164
Haiku 4.5 $0.00000 $0.00082

Measured 2d ago against content hash 2c0dabf585e5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

build scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/build.md · 81 lines

What it actually says

命令: /ea build (编译)

功能

调用 Keil UV4 编译工程固件

调用方式

python ~/.claude/skills/ea-skill/tools/build-keil/scripts/keil_builder.py \
  --project <工程文件> \
  --target <目标名>

参数来源

参数 来源
--project 扫描工作区的 .uvprojx/.uvproj 文件
--target 使用工程中第一个 Target,或由用户指定
UV4 路径 自动从 tool_config 读取(由 /ea setup 注册)

检测工程

AI 自动在工作区中查找 Keil 工程文件:

python -c "
from pathlib import Path
for p in Path('.').rglob('*.uvprojx'): print(p)
for p in Path('.').rglob('*.uvproj'): print(p)
"

结果处理

AI 从脚本 stdout 中提取以下字段记录到 HVR:

字段 作用
编译状态 ✅ 成功 / ❌ 失败
错误数/警告数 错误: N 警告: N
固件大小 Flash ≈ N KB RAM ≈ N KB
产物路径 产物: file.axf (N KB)

自动决策

编译成功 → 自动进入烧录流程(AI 连续执行,用户只需观察物理现象)

AI 按以下顺序连续执行:

  1. 编译 → 成功则自动进入步骤 2
  2. 烧录 → 成功则自动进入步骤 3
  3. 串口 → 抓取启动日志,用户观察物理现象并口述结果
编译(AI执行) → 烧录(AI执行) → 串口监控(AI抓日志) → 用户口述观察结果

编译失败 → 读取编译日志 → 分析错误 → 请求用户修复

⚠️ 源文件编码(防乱码)

本类 Keil 工程源文件为 GB2312(GBK)编码,非 UTF-8。 修改 .c/.h 前注意:

  • 读取按 open(path, encoding="gbk"),不要按 UTF-8 读(中文会乱码)
  • 禁止用 UTF-8 编辑器直接改源文件中文注释——整文件会被转成 UTF-8,全部中文变 \xEF\xBF\xBD,编译报 missing closing quote
  • 修改用字节级 Python 操作保持 GBK,注释尽量用 ASCII;改动前建议留备份
  • 编译日志是 GBK/UTF-8 混合,keil_builder.py 已自动探测回退解码

常见错误

  • ❌ 未找到 .uvprojx/.uvproj 工程文件 → 确认工程文件路径
  • ❌ UV4 路径配置错误 → 运行 /ea setup 重新配置
  • ❌ 编译错误 → 显示错误行号和内容,分析原因
  • ❌ 源文件中文乱码 / missing closing quote → 源文件被误转成 UTF-8,从备份恢复并保持 GBK 编码

相关文件

  • ~/.claude/skills/ea-skill/tools/build-keil/scripts/keil_builder.py - 编译脚本
  • commands/flash.md - 烧录说明
  • commands/serial.md - 串口监控说明
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 81 lines · 0 tokens per session scan A 2c0dabf585e5

Subscribe to this mod's changes

build is a command published in the GitHub repository jzl-maker/EA-SKILL (6 stars, last pushed 5d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 820 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.