Keil MDK / C51 Build
Use this skill for Keil/uVision projects, including 8051/C51 projects and MDK projects. Prefer the bundled scripts instead of manually invoking UV4.exe.
Capabilities
- Scan a workspace for
.uvproj, .uvprojx, and .uvmpw projects.
- Enumerate project Targets.
- Create or update a real project file when the user asks to develop firmware and no suitable project exists; prefer a vendor demo project as a template for C51 devices.
- Run
build, rebuild, clean, or compatible flash.
- Parse the build log and return errors, warnings, HEX/AXF output paths, and metrics.
- Persist the last successful build in
.embeddedskills/state.json for workflow reuse.
Configuration
Environment-level config is stored in this skill's config.json:
{
"uv4_exe": "C:\\Keil_v5\\UV4\\UV4.exe",
"operation_mode": 1
}
Workspace-level config lives in .embeddedskills/config.json:
{
"keil": {
"uv4_exe": "D:/Keil_v5/UV4/UV4.exe",
"project": "path/to/project.uvproj",
"target": "Target 1",
"log_dir": ".embeddedskills/build"
}
}
Parameter priority: CLI arguments > workspace config > skill config > .embeddedskills/state.json > scan result.
Commands
Scan projects:
python <skill_dir>\scripts\keil_project.py scan --root <workspace> --json
List Targets:
python <skill_dir>\scripts\keil_project.py targets --project <project> --json
Build:
python <skill_dir>\scripts\keil_build.py build `
--project <project> `
--target <target> `
--workspace <workspace> `
--json
Rebuild:
python <skill_dir>\scripts\keil_build.py rebuild `
--project <project> `
--target <target> `
--workspace <workspace> `
--json
Clean:
python <skill_dir>\scripts\keil_build.py clean `
--project <project> `
--target <target> `
--workspace <workspace> `
--json
Rules
- If multiple plausible projects or Targets exist, list candidates instead of guessing.
- Do not edit
.uvproj, .uvprojx, .uvopt, or .uvoptx unless the user explicitly asks. If the user asks for firmware development/buildable embedded software and no project exists, treat creating a .uvproj/.uvprojx as part of the deliverable.
- Do not run
clean implicitly before build unless the user asks for rebuild or --clean-first.
- After a successful build, report the project, target, log file, errors/warnings, and HEX/AXF paths.
- Treat
flash as a compatibility entry. Prefer a dedicated J-Link/OpenOCD/probe workflow when available.
- For C51 projects, inspect the build log and map file when debugging interrupt vectors, missing source files, memory model, or startup issues.
- For vendor C51 libraries such as SinOne TKDriver, ensure the active project tree visibly includes the driver folder, headers/config files,
.C files, and all required .LIB files. If a manual says to copy/export TKDriver into the target project, do not leave project paths pointing only to ..\TKDriver.
C51 Review
For 8051/C51 correctness problems, use the embedded firmware skill reference keil-c51-project-review.md if available. Check:
- Correct Target and HEX are being built/flashed.
- Startup file and interrupt vectors match the MCU.
- Vendor
.C or library files are included in the Keil project.
- Vendor folder location matches the product project structure, especially for exported touch libraries.
- Code Option / clock settings match firmware constants.
- Memory model, reentrancy, and interrupt function declarations are compatible with C51.
C51 Project Creation Checklist
When creating a C51 .uvproj:
- Reuse a matching vendor demo
.uvproj and STARTUP.A51 when available.
- Set the target name, output directory/name, HEX generation, include paths, and device clock.
- Use LX51 and Large memory model when vendor libraries require it.
- Put vendor driver folders such as
TKDriver inside the target project directory when the manual says to migrate the folder there.
- Add visible groups for Startup, App, BSP, Drivers, and vendor libraries.
- Build/rebuild with
keil_build.py and inspect the log/map to confirm the files used are the intended in-project files.
1---2name: keil3description: Keil MDK/uVision build skill for embedded projects. Use when the user mentions Keil, MDK, uVision, UV4, C51, 8051, target enumeration, compile, build, rebuild, clean, firmware artifact paths, HEX output, or flash/download through a Keil project. Provides scripts to scan .uvproj/.uvprojx/.uvmpw projects, list Targets, run build/rebuild/clean/flash, parse logs, and return reusable artifact paths.4---56# Keil MDK / C51 Build78Use this skill for Keil/uVision projects, including 8051/C51 projects and MDK projects. Prefer the bundled scripts instead of manually invoking `UV4.exe`.910## Capabilities1112- Scan a workspace for `.uvproj`, `.uvprojx`, and `.uvmpw` projects.13- Enumerate project Targets.14- Create or update a real project file when the user asks to develop firmware and no suitable project exists; prefer a vendor demo project as a template for C51 devices.15- Run `build`, `rebuild`, `clean`, or compatible `flash`.16- Parse the build log and return errors, warnings, HEX/AXF output paths, and metrics.17- Persist the last successful build in `.embeddedskills/state.json` for workflow reuse.1819## Configuration2021Environment-level config is stored in this skill's `config.json`:2223```json24{25 "uv4_exe": "C:\\Keil_v5\\UV4\\UV4.exe",26 "operation_mode": 127}28```2930Workspace-level config lives in `.embeddedskills/config.json`:3132```json33{34 "keil": {35 "uv4_exe": "D:/Keil_v5/UV4/UV4.exe",36 "project": "path/to/project.uvproj",37 "target": "Target 1",38 "log_dir": ".embeddedskills/build"39 }40}41```4243Parameter priority: CLI arguments > workspace config > skill config > `.embeddedskills/state.json` > scan result.4445## Commands4647Scan projects:4849```powershell50python <skill_dir>\scripts\keil_project.py scan --root <workspace> --json51```5253List Targets:5455```powershell56python <skill_dir>\scripts\keil_project.py targets --project <project> --json57```5859Build:6061```powershell62python <skill_dir>\scripts\keil_build.py build `63 --project <project> `64 --target <target> `65 --workspace <workspace> `66 --json67```6869Rebuild:7071```powershell72python <skill_dir>\scripts\keil_build.py rebuild `73 --project <project> `74 --target <target> `75 --workspace <workspace> `76 --json77```7879Clean:8081```powershell82python <skill_dir>\scripts\keil_build.py clean `83 --project <project> `84 --target <target> `85 --workspace <workspace> `86 --json87```8889## Rules9091- If multiple plausible projects or Targets exist, list candidates instead of guessing.92- Do not edit `.uvproj`, `.uvprojx`, `.uvopt`, or `.uvoptx` unless the user explicitly asks. If the user asks for firmware development/buildable embedded software and no project exists, treat creating a `.uvproj`/`.uvprojx` as part of the deliverable.93- Do not run `clean` implicitly before build unless the user asks for rebuild or `--clean-first`.94- After a successful build, report the project, target, log file, errors/warnings, and HEX/AXF paths.95- Treat `flash` as a compatibility entry. Prefer a dedicated J-Link/OpenOCD/probe workflow when available.96- For C51 projects, inspect the build log and map file when debugging interrupt vectors, missing source files, memory model, or startup issues.97- For vendor C51 libraries such as SinOne TKDriver, ensure the active project tree visibly includes the driver folder, headers/config files, `.C` files, and all required `.LIB` files. If a manual says to copy/export `TKDriver` into the target project, do not leave project paths pointing only to `..\TKDriver`.9899## C51 Review100101For 8051/C51 correctness problems, use the embedded firmware skill reference `keil-c51-project-review.md` if available. Check:102103- Correct Target and HEX are being built/flashed.104- Startup file and interrupt vectors match the MCU.105- Vendor `.C` or library files are included in the Keil project.106- Vendor folder location matches the product project structure, especially for exported touch libraries.107- Code Option / clock settings match firmware constants.108- Memory model, reentrancy, and interrupt function declarations are compatible with C51.109110## C51 Project Creation Checklist111112When creating a C51 `.uvproj`:113114- Reuse a matching vendor demo `.uvproj` and `STARTUP.A51` when available.115- Set the target name, output directory/name, HEX generation, include paths, and device clock.116- Use LX51 and Large memory model when vendor libraries require it.117- Put vendor driver folders such as `TKDriver` inside the target project directory when the manual says to migrate the folder there.118- Add visible groups for Startup, App, BSP, Drivers, and vendor libraries.119- Build/rebuild with `keil_build.py` and inspect the log/map to confirm the files used are the intended in-project files.