KeilFlux
快速开始
- 安装扩展,按
CTRL+SHIFT+P 输入 Host_TO_VM: Set Guest Credentials
- 在弹出的新输入框中填写虚拟机的
用户名,输入完成按回车键,继续输入虚拟机的密码,输入完成后按回车健,完成配置即可
- 底部状态栏有两个按钮和一个状态标识,
HTV Scanning -> HTV Ready 状态,即可点击 HTV Build / HTV Rebuild 按钮,在 OUTPUT 中会输出执行结果,
首次扫描完成后,扩展会把机器相关和工程相关结果写入当前工作区设置。
适用场景
- 代码在本机 Windows 上用 VS Code 编辑
- Keil MDK / uVision 安装在 VMware Windows 虚拟机里
- 源码目录通过 VMware Shared Folders 暴露给VM虚拟机
- 希望直接在 VS Code 里完成扫描、构建、日志回看,而不是手动切到虚拟机里操作
核心能力
- 从当前 VS Code 工作区解析本次构建对应的
HostSourceRoot
- 扫描
vmrun.exe、目标 .vmx、VM虚拟机 PowerShell、UV4.exe、.uvprojx 和 Keil target
- 将扫描结果写回当前工作区设置,便于后续直接复用
- 在扩展存储目录中准备后端运行时副本和兼容的凭据文件
- 执行
Build / Rebuild,并把过程输出到 Output Channel 和状态栏
- 快速打开最近一次
build.log 与 status.json
适用环境
- Windows 桌面版 VS Code
- 本地文件系统工作区
- VMware Workstation,且宿主机可用
vmrun.exe
- Windows VM虚拟机,且已安装 VMware Tools、PowerShell、Keil
- 源码树可通过 VMware Shared Folders 从VM虚拟机访问
不支持的环境
- VS Code Web
- Remote SSH / WSL / Dev Containers / Codespaces
- Virtual Workspaces 和 Restricted Mode
- macOS 和 Linux 宿主机
主要命令
Host_TO_VM: Set Guest Credentials
Host_TO_VM: Clear Stored Guest Credentials
Host_TO_VM: Scan Configuration
Host_TO_VM: Build
Host_TO_VM: Rebuild
Host_TO_VM: Open Settings
Host_TO_VM: Open Last Build Log
Host_TO_VM: Open Last Status
Host_TO_VM: Reset Stored Configuration
配置与安全
hostToVm.connection.guestUser 保存在 User Settings,便于跨工作区复用
- VM虚拟机密码保存在 VS Code Secret Storage
- 扫描得到的
vmrun、.vmx、项目、target 等值保存在当前工作区设置
- 旧版遗留的明文
hostToVm.connection.guestPassword 会在启动时迁移到 Secret Storage
- 构建流程会在扩展存储目录中生成凭据文件,但不会写进源码工作区
当前限制
- 这只是一个面向 VMware + Keil 场景的扩展,不是通用构建系统
- 当检测到多个 VM、多个工程或多个 target 时,扫描流程可能要求你手动确认选择
- 扩展假设当前 VS Code 运行在本地 Windows 上,且工作区路径可直接映射到宿主机文件系统
设置页面配置说明
可通过 Host_TO_VM: Open Settings 打开本扩展的设置页面。除特别说明外,大多数 hostToVm.config.* 项都会在扫描时自动填写,通常不需要手工修改。
凭据与工作区
hostToVm.connection.guestUser:vmrun 连接 VM 虚拟机时使用的用户名。保存在 User Settings 中,可跨工作区复用。
hostToVm.connection.guestPassword:旧版明文密码设置项,已弃用。扩展启动时会自动迁移到 VS Code Secret Storage,平时请使用 Host_TO_VM: Set Guest Credentials 配置密码。
hostToVm.workspace.mode:决定扩展如何解析当前构建的 HostSourceRoot。activeFolder 使用当前活动文件所在工作区,firstFolder 使用第一个工作区目录,manual 使用手动指定路径。
hostToVm.workspace.sourceRootOverride:当 workspace.mode 为 manual 时生效,手动指定宿主机源码根目录。
扫描与构建路径
hostToVm.config.vmrunPath:宿主机上的 vmrun.exe 路径。通常由扫描自动填充。
hostToVm.config.vmxPath:目标 VM 的 .vmx 文件路径。通常由扫描自动填充。
hostToVm.config.guestPowerShellPath:VM 虚拟机中的 PowerShell 路径。通常由扫描自动填充。
hostToVm.config.guestSharedRoot:VM 虚拟机中可见的共享源码根目录。通常由扫描自动填充。
hostToVm.config.guestScriptRoot:VM 虚拟机中可见的脚本根目录。通常由扫描自动填充。
hostToVm.config.hostGuestScriptRoot:宿主机上与 guestScriptRoot 对应的目录。通常由扫描自动填充。
hostToVm.config.guestWorkspaceRoot:VM 虚拟机内用于构建的本地工作目录。通常由扫描自动填充。
hostToVm.config.guestKeilUv4Path:VM 虚拟机中的 UV4.exe 路径。通常由扫描自动填充。
hostToVm.config.sourceRelativePath:从 guestSharedRoot 到当前 HostSourceRoot 的相对路径。通常由扫描自动填充。
hostToVm.config.projectRelativePath:从 HostSourceRoot 到目标 .uvprojx 工程文件的相对路径。通常由扫描自动填充。
hostToVm.config.target:本次构建使用的 Keil target 名称。通常由扫描自动填充。
构建输出与同步
hostToVm.config.outputRelativePath:后端运行目录下的输出子目录,默认是 vmrun\\out。build.log、status.json 等文件会写到这里。
hostToVm.config.artifactPatterns:构建完成后需要从 VM 虚拟机回传到宿主机源码树的产物匹配规则。
hostToVm.config.syncExcludeDirectories:同步源码到 VM 虚拟机工作目录时要排除的目录列表。
hostToVm.config.syncExcludeFiles:同步源码到 VM 虚拟机工作目录时要排除的文件匹配规则。
执行行为
hostToVm.config.startVmIfNeeded:当目标 VM 未启动时,是否自动尝试启动。
hostToVm.config.waitForToolsSeconds:等待 VMware Tools 可用的超时时间,单位为秒。
hostToVm.config.buildTimeoutSeconds:等待 VM 虚拟机构建完成的超时时间,单位为秒。
hostToVm.config.pollIntervalSeconds:构建轮询间隔,单位为秒。
hostToVm.behavior.autoScanOnOpen:打开工作区后,在已具备可复用凭据的前提下是否自动执行扫描。
hostToVm.behavior.revealOutputOnBuild:开始构建时是否自动切出 Host_TO_VM 输出面板。
状态栏显示
hostToVm.statusBar.showBuild:是否显示 HTV Build 按钮。
hostToVm.statusBar.showRebuild:是否显示 HTV Rebuild 按钮。
hostToVm.statusBar.showState:是否显示当前状态标识,例如 HTV Scanning、HTV Ready、HTV Failed。
Quick Start
- Install the extension, press
CTRL+SHIFT+P, and run Host_TO_VM: Set Guest Credentials.
- In the input boxes that appear, enter the VM user name first. Press Enter, then enter the VM password and press Enter again.
- There are two buttons and one status indicator in the bottom status bar. When the state changes from
HTV Scanning to HTV Ready, you can click HTV Build or HTV Rebuild. Execution output is shown in the OUTPUT panel.
After the first scan completes, the extension writes machine-related and project-related results into the current workspace settings.
What It Solves
- You edit code in local Windows VS Code
- Keil MDK / uVision is installed inside a VMware Windows VM
- The source tree is exposed to the VM through VMware Shared Folders
- You want to complete scanning, building, and log review directly in VS Code instead of switching into the VM manually
Core Capabilities
- Resolve the
HostSourceRoot for the current build from the active VS Code workspace
- Scan
vmrun.exe, the target .vmx, VM PowerShell, UV4.exe, .uvprojx, and the Keil target
- Write scan results back into the current workspace settings for later reuse
- Prepare a backend runtime copy and a compatible credential file under extension storage
- Execute
Build / Rebuild and send progress to the Output Channel and the status bar
- Quickly open the latest
build.log and status.json
Supported Environment
- Windows desktop VS Code
- Local file-system workspaces
- VMware Workstation with
vmrun.exe available on the host
- Windows VM with VMware Tools, PowerShell, and Keil installed
- A source tree that the VM can access through VMware Shared Folders
Not Supported
- VS Code Web
- Remote SSH / WSL / Dev Containers / Codespaces
- Virtual Workspaces and Restricted Mode
- macOS and Linux hosts
Main Commands
Host_TO_VM: Set Guest Credentials
Host_TO_VM: Clear Stored Guest Credentials
Host_TO_VM: Scan Configuration
Host_TO_VM: Build
Host_TO_VM: Rebuild
Host_TO_VM: Open Settings
Host_TO_VM: Open Last Build Log
Host_TO_VM: Open Last Status
Host_TO_VM: Reset Stored Configuration
Configuration and Security
hostToVm.connection.guestUser is stored in User Settings for reuse across workspaces
- The VM password is stored in VS Code Secret Storage
- Scanned
vmrun, .vmx, project, and target values are stored in workspace settings
- Legacy plaintext
hostToVm.connection.guestPassword values are migrated into Secret Storage on startup
- The build flow creates a credential file under extension storage, not inside the source workspace
Current Limitations
- This is only an extension for the VMware + Keil workflow, not a general-purpose build system
- When multiple VMs, projects, or targets are detected, the scan flow may ask you to confirm the selection manually
- The extension assumes that VS Code is running on local Windows and that the workspace path maps directly to the host file system
Settings Page Reference
You can open the extension settings page with Host_TO_VM: Open Settings. Unless noted otherwise, most hostToVm.config.* values are filled in automatically during scan and normally do not need manual edits.
Credentials and Workspace
hostToVm.connection.guestUser: The user name used by vmrun to connect to the VM. It is stored in User Settings and reused across workspaces.
hostToVm.connection.guestPassword: A legacy plaintext password setting. It is deprecated and migrated into VS Code Secret Storage on startup. Use Host_TO_VM: Set Guest Credentials for normal password updates.
hostToVm.workspace.mode: Controls how the extension resolves the current HostSourceRoot. activeFolder uses the workspace folder of the active file, firstFolder uses the first workspace folder, and manual uses a manually specified path.
hostToVm.workspace.sourceRootOverride: The host source root used when workspace.mode is set to manual.
Scan and Build Paths
hostToVm.config.vmrunPath: The host path to vmrun.exe. Usually filled automatically by scan.
hostToVm.config.vmxPath: The path to the target VM .vmx file. Usually filled automatically by scan.
hostToVm.config.guestPowerShellPath: The PowerShell path inside the VM. Usually filled automatically by scan.
hostToVm.config.guestSharedRoot: The shared source root as seen from inside the VM. Usually filled automatically by scan.
hostToVm.config.guestScriptRoot: The script root as seen from inside the VM. Usually filled automatically by scan.
hostToVm.config.hostGuestScriptRoot: The host-side directory that corresponds to guestScriptRoot. Usually filled automatically by scan.
hostToVm.config.guestWorkspaceRoot: The local workspace root inside the VM that is used for build execution. Usually filled automatically by scan.
hostToVm.config.guestKeilUv4Path: The UV4.exe path inside the VM. Usually filled automatically by scan.
hostToVm.config.sourceRelativePath: The relative path from guestSharedRoot to the selected HostSourceRoot. Usually filled automatically by scan.
hostToVm.config.projectRelativePath: The relative path from HostSourceRoot to the target .uvprojx file. Usually filled automatically by scan.
hostToVm.config.target: The Keil target name used for build. Usually filled automatically by scan.
Build Output and Sync
hostToVm.config.outputRelativePath: The output subdirectory under the backend runtime root. The default is vmrun\\out. Files such as build.log and status.json are written here.
hostToVm.config.artifactPatterns: Artifact match patterns that should be copied back from the VM into the host source tree after build.
hostToVm.config.syncExcludeDirectories: Directories that should be excluded when syncing sources into the VM workspace.
hostToVm.config.syncExcludeFiles: File match patterns that should be excluded when syncing sources into the VM workspace.
Execution Behavior
hostToVm.config.startVmIfNeeded: Whether the extension should try to start the target VM automatically when it is not running.
hostToVm.config.waitForToolsSeconds: Timeout in seconds for waiting until VMware Tools becomes available.
hostToVm.config.buildTimeoutSeconds: Timeout in seconds for waiting until the VM build finishes.
hostToVm.config.pollIntervalSeconds: Polling interval in seconds while waiting for build status updates.
hostToVm.behavior.autoScanOnOpen: Whether to run scan automatically when a workspace is opened and reusable credentials are already available.
hostToVm.behavior.revealOutputOnBuild: Whether to reveal the Host_TO_VM output panel automatically when a build starts.
Status Bar Visibility
hostToVm.statusBar.showBuild: Whether to show the HTV Build button.
hostToVm.statusBar.showRebuild: Whether to show the HTV Rebuild button.
hostToVm.statusBar.showState: Whether to show the current status indicator, such as HTV Scanning, HTV Ready, or HTV Failed.
| |