便捷开发工具
WARNING
MounRiver Studio 开发时,这一页可以跳过。
这里整理两类辅助工具:
tools/scripts/console.py:统一 TUI 入口.vscode/tasks.json/.vscode/settings.json:VS Code 任务栏按钮示例
怎么选
- 终端交互入口使用
tools/scripts/console.py - VS Code 使用任务按钮
统一 TUI

bash
python tools/scripts/console.py脚本会自动在仓库根目录创建 .venv,检查并安装 tools/scripts/requirements-console.txt 里的控制台依赖,然后用这个虚拟环境重启自己。
当前功能
Home:当前目标、构建配置、常用入口Target:切换CH592F/CH552GISP:probe / info / verify / erase / reset / eeprom / configStudio:前端依赖安装和构建Docs:文档依赖安装和构建Doctor:环境检查Links:常用页面
当前交互
- 方向键或
hjkl切换标签与动作 Enter执行当前动作- 鼠标单击选中,双击执行
q退出r刷新 Doctor / 缓存信息
当前脚本职责
tools/scripts/ch592f.py:CH592F键盘型号 + profile 构建tools/scripts/ch552g.py:CH552Gkeyboard 构建tools/scripts/flash.py:通用烧录 / 校验 / ISP 操作tools/scripts/setup.py:下载wchisp
工具缓存
console.py、ch592f.py、ch552g.py 会把常用工具路径写进:
tools/scripts/.binarykeyboard_console_state.json
当前缓存项包括:
cmakeninjasdccwchispriscv_gcc
第一次探测完成后,后续不会每次都重新扫描磁盘。
VS Code 任务
仓库默认不提交 .vscode/tasks.json / .vscode/settings.json,下面这份是当前脚本体系对应的参考配置。
附件 A:示例 .vscode/tasks.json
jsonc
{
"version": "2.0.0",
"tasks": [
{
"label": "BK: TUI Console",
"type": "shell",
"command": "python3",
"windows": { "command": "python" },
"args": ["${workspaceFolder}/tools/scripts/console.py"],
"presentation": { "reveal": "always", "panel": "dedicated", "clear": true },
"problemMatcher": []
},
{
"label": "CH592F: Build (full release)",
"type": "shell",
"command": "python3",
"windows": { "command": "python" },
"args": [
"${workspaceFolder}/tools/scripts/ch592f.py",
"build-full",
"--keyboard",
"5KEY",
"--profile",
"release"
],
"group": "build",
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
"problemMatcher": []
},
{
"label": "CH592F: Flash (full hex)",
"type": "shell",
"command": "python3",
"windows": { "command": "python" },
"args": [
"${workspaceFolder}/tools/scripts/flash.py",
"flash",
"--file",
"${workspaceFolder}/firmware/CH592F/build/release-5key/CH592F-5KEY-<version>-full.hex"
],
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
"problemMatcher": []
},
{
"label": "CH552G: Build (BASIC)",
"type": "shell",
"command": "python3",
"windows": { "command": "python" },
"args": [
"${workspaceFolder}/tools/scripts/ch552g.py",
"build",
"--keyboard",
"BASIC"
],
"group": "build",
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
"problemMatcher": []
},
{
"label": "CH552G: Flash (BASIC bin)",
"type": "shell",
"command": "python3",
"windows": { "command": "python" },
"args": [
"${workspaceFolder}/tools/scripts/flash.py",
"flash",
"--file",
"${workspaceFolder}/firmware/CH552G/build/basic/CH552G-BASIC-<version>.bin"
],
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
"problemMatcher": []
},
{
"label": "WCH: Probe Devices",
"type": "shell",
"command": "python3",
"windows": { "command": "python" },
"args": ["${workspaceFolder}/tools/scripts/flash.py", "probe"],
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
"problemMatcher": []
},
{
"label": "WCH: Chip Info",
"type": "shell",
"command": "python3",
"windows": { "command": "python" },
"args": ["${workspaceFolder}/tools/scripts/flash.py", "info"],
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
"problemMatcher": []
},
{
"label": "Studio: pnpm install",
"type": "shell",
"command": "pnpm",
"args": ["install"],
"options": { "cwd": "${workspaceFolder}/tools/studio" },
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
"problemMatcher": []
},
{
"label": "Studio: Build",
"type": "shell",
"command": "pnpm",
"args": ["run", "build"],
"options": { "cwd": "${workspaceFolder}/tools/studio" },
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
"problemMatcher": []
},
{
"label": "Docs: pnpm install",
"type": "shell",
"command": "pnpm",
"args": ["install"],
"options": { "cwd": "${workspaceFolder}/docs" },
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
"problemMatcher": []
},
{
"label": "Docs: Build",
"type": "shell",
"command": "pnpm",
"args": ["run", "build"],
"options": { "cwd": "${workspaceFolder}/docs" },
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
"problemMatcher": []
}
]
}附件 B:示例 .vscode/settings.json
json
{
"cmake.sourceDirectory": "${workspaceFolder}/firmware/CH592F",
"cmake.useCMakePresets": "always",
"VsCodeTaskButtons.showCounter": false,
"VsCodeTaskButtons.tasks": [
{ "label": "$(terminal) TUI", "tooltip": "BinaryKeyboard TUI", "task": "BK: TUI Console" },
{ "label": "$(tools) 592", "tooltip": "Build CH592F full release", "task": "CH592F: Build (full release)" },
{ "label": "$(zap) 592", "tooltip": "Flash CH592F full hex", "task": "CH592F: Flash (full hex)" },
{ "label": "$(tools) 552", "tooltip": "Build CH552G BASIC", "task": "CH552G: Build (BASIC)" },
{ "label": "$(zap) 552", "tooltip": "Flash CH552G BASIC bin", "task": "CH552G: Flash (BASIC bin)" },
{ "label": "$(search) ISP", "tooltip": "Probe WCH ISP devices", "task": "WCH: Probe Devices" },
{ "label": "$(browser) Studio", "tooltip": "Build Studio", "task": "Studio: Build" },
{ "label": "$(book) Docs", "tooltip": "Build Docs", "task": "Docs: Build" }
]
}