flash-keil
Original:🇨🇳 Chinese
Translated
1 scriptsChecked / no sensitive code detected
Used when you need to flash firmware to the target board using the built-in debugger of Keil MDK, which executes the download with the debugger and Flash algorithm configured in the project.
3installs
Sourceleokemp223/embed-ai-tool
Added on
NPX Install
npx skill4agent add leokemp223/embed-ai-tool flash-keilTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Keil MDK Flashing
Applicable Scenarios
- indicates
Project Profileor there arebuild_system: keil/.uvprojxfiles in the workspace..uvproj - Users want to flash compiled products to the target board, and the debugger (ST-Link, J-Link, CMSIS-DAP, etc.) has been configured in Keil for the project.
- No need to install additional OpenOCD; directly use the built-in Flash Download function of Keil MDK.
Required Inputs
- Path to the /
.uvprojxproject file (or obtained from.uvproj).Project Profile - Optional build target name and UV4.exe path.
Automatic Detection
- Reuse the UV4.exe detection logic of (configuration file → environment variables → common paths → PATH).
build-keil - Parse in the project XML to identify the debugger type (ST-Link, J-Link, CMSIS-DAP, ULINK).
<DriverSelection> - If no target is specified, the first Target in the project is used by default.
Execution Steps
- First read references/usage.md to confirm this operation.
- For common scenarios, directly complete detection + flashing with one call:
bash
python scripts/keil_flasher.py --detect --flash --project <project file> --target <target name> - Read the flashing result report output by the script, focusing on success/failure status, debugger type, and log evidence.
- Write the flashing result back to and recommend the next skill.
Project Profile
Failure Diversion
- : Keil MDK is not installed or UV4.exe is unavailable.
environment-missing - : Debugger connection failed (USB not connected, driver issue, target board not powered on).
connection-failure - : Invalid Flash configuration in the project file or target name does not exist.
project-config-error
Platform Notes
- Keil MDK flashing is only supported on Windows.
- Flashing uses the debugger and Flash algorithm configured in the project, no additional configuration is required.
- Flashing logs may contain GBK encoded characters, and the script automatically handles multiple encodings.
Output Conventions
After the script is executed, the following key information must be extracted and presented to the user:
- Flashing status (success/failure)
- Project file and target name
- Chip model (e.g., STM32F103RC)
- Debugger type (e.g., ST-Link, J-Link)
- Flashed firmware path and size (e.g., Demo02.axf, 519.6 KB)
- Flashing completion time
- If failed: failure category and log evidence
Example output format:
Flashing succeeded ✅
Project: Demo02.uvprojx → Target: Demo02
Chip: STM32F103RC | Debugger: ST-Link
Firmware: Demo02.axf (519.6 KB)
Status: Erase Done → Programming Done → Verify OK → Application running- After success, recommend (view serial output) or
serial-monitor(online debugging).debug-gdb-openocd - When failed, output the failure category and log evidence to help users locate the problem.
Handover Relationships
- Receive project information of successful compilation from .
build-keil - After successful flashing, hand over to (view serial output) or
serial-monitor(online debugging).debug-gdb-openocd