flash-jlink
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJ-Link 烧录
J-Link Firmware Flashing
适用场景
Applicable Scenarios
- 工作区已有可用固件产物,且目标板连接了 SEGGER J-Link 探针。
- 需要使用 J-Link Commander 进行烧录和校验,而非 OpenOCD。
- 需要利用 J-Link RTT(Real-Time Transfer)进行高速日志捕获。
- 需要扫描工作区中的 配置文件或
.jlink中的 J-Link 设置。.vscode/launch.json
- A usable firmware artifact exists in the workspace, and the target board is connected to a SEGGER J-Link probe.
- Need to use J-Link Commander for flashing and verification instead of OpenOCD.
- Need to use J-Link RTT (Real-Time Transfer) for high-speed log capture.
- Need to scan configuration files in the workspace or J-Link settings in
.jlink..vscode/launch.json
必要输入
Required Inputs
- 固件产物路径,或包含 的
artifact_path。Project Profile - 参数指定目标芯片型号(如
--device),J-Link Commander 要求必须指定。STM32F407VG - 可选的接口类型(SWD 或 JTAG,默认 SWD)和烧录速度。
- 若产物为 BIN,还需要 烧录基地址。
--base-address
- Firmware artifact path, or a containing
Project Profile.artifact_path - The parameter to specify the target chip model (e.g.,
--device), which is required by J-Link Commander.STM32F407VG - Optional interface type (SWD or JTAG, default is SWD) and flashing speed.
- If the artifact is a BIN file, the flashing base address is also required.
--base-address
自动探测
Auto Detection
- 按 选择固件产物。
ELF > HEX > BIN - 脚本自动查找 JLinkExe,按配置文件、PATH、常见安装路径的顺序搜索。
- 扫描工作区
--scan-configs文件和.jlink中的 J-Link 配置。.vscode/launch.json - 不会猜测设备名;当 缺失时阻塞并返回
--device。ambiguous-context
- Select firmware artifacts in the order of .
ELF > HEX > BIN - The script automatically searches for JLinkExe in the order of configuration files, PATH, and common installation paths.
- scans J-Link configurations in workspace
--scan-configsfiles and.jlink..vscode/launch.json - Does not guess device names; blocks and returns when
ambiguous-contextis missing.--device
执行步骤
Execution Steps
- 先阅读 references/usage.md,确认本次是环境探测、配置扫描,还是执行烧录。
- 若不确定 J-Link 环境状态,先运行自带脚本 scripts/jlink_flasher.py 的 模式确认。
--detect - 若不确定设备型号或接口配置,使用 扫描工作区线索。
--scan-configs - 使用 +
--artifact执行烧录,可选--device和--interface。--speed - 对 BIN 文件,必须同时提供 。
--base-address - 需要 RTT 日志时,使用 启动 RTT 捕获。
--rtt - 读取脚本输出的烧录结果报告,重点关注校验状态和失败分类。
- First read references/usage.md to confirm whether this is environment detection, configuration scanning, or flashing execution.
- If unsure about the J-Link environment status, first run the built-in script scripts/jlink_flasher.py in mode to confirm.
--detect - If unsure about the device model or interface configuration, use to scan for clues in the workspace.
--scan-configs - Use +
--artifactto execute flashing, with optional--deviceand--interface.--speed - For BIN files, must be provided at the same time.
--base-address - When RTT logs are needed, use to start RTT capture.
--rtt - Read the flashing result report output by the script, focusing on verification status and failure categories.
失败分流
Failure Handling
- 当 不可用时,返回
JLinkExe。environment-missing - 当无法安全解析到产物,或 缺少烧录基地址时,返回
BIN。artifact-missing - 当 J-Link 无法发现探针或目标时,返回 。
connection-failure - 当配置文件无效或设备名不被 J-Link 识别时,返回 。
project-config-error - 当烧录开始但校验或复位失败时,返回 。
target-response-abnormal - 当 缺失且无法从工作区推断时,返回
--device。ambiguous-context
- Returns when JLinkExe is unavailable.
environment-missing - Returns when the artifact cannot be safely resolved or the BIN file lacks a flashing base address.
artifact-missing - Returns when J-Link cannot detect the probe or target.
connection-failure - Returns when the configuration file is invalid or the device name is not recognized by J-Link.
project-config-error - Returns when flashing starts but verification or reset fails.
target-response-abnormal - Returns when
ambiguous-contextis missing and cannot be inferred from the workspace.--device
平台说明
Platform Notes
- JLinkExe 在 Linux/macOS 下为 ,Windows 下为
JLinkExe。JLink.exe - SEGGER 默认安装路径:Linux ,Windows
/opt/SEGGER/JLink/。C:\Program Files\SEGGER\JLink\ - 自带脚本使用 Python 标准库和 subprocess 调用 JLinkExe,跨平台兼容。
- RTT 功能为 J-Link 独有,不占用 UART,适合无串口场景。
- JLinkExe is on Linux/macOS, and
JLinkExeon Windows.JLink.exe - Default SEGGER installation paths: for Linux,
/opt/SEGGER/JLink/for Windows.C:\Program Files\SEGGER\JLink\ - The built-in script uses Python standard libraries and subprocess to call JLinkExe, which is cross-platform compatible.
- The RTT function is exclusive to J-Link, does not occupy UART, and is suitable for scenarios without a serial port.
输出约定
Output Conventions
- 输出 JLinkExe 命令、设备名、接口类型、产物路径和校验结果。
- 在 中保留或更新
Project Profile、artifact_path、artifact_kind、jlink_device。jlink_interface - 烧录成功后推荐 或
serial-monitor。debug-jlink
- Outputs JLinkExe command, device name, interface type, artifact path, and verification result.
- Retains or updates ,
artifact_path,artifact_kind,jlink_devicein thejlink_interface.Project Profile - or
serial-monitoris recommended after successful flashing.debug-jlink
交接关系
Handover Relationships
- 当下一步要看运行日志时,将成功烧录结果交给 。
serial-monitor - 当用户需要 GDB 调试时,将结果交给 。
debug-jlink - 当需要 RTT 日志替代串口时,可直接使用本 skill 的 模式。
--rtt
- When needing to view runtime logs next, pass the successful flashing result to .
serial-monitor - When the user needs GDB debugging, pass the result to .
debug-jlink - When RTT logs are needed instead of serial ports, the mode of this skill can be used directly.
--rtt