How lukenccode/vscodetostm32 works
VscodeToStm32 is a VS Code extension for configuring, building, flashing, and debugging STM32 CMake projects. The main workflow starts with a user command: the extension loads project and machine settings, asks CMake Tools to build or locate firmware, then runs the selected probe backend; debugging instead writes a Cortex-Debug launch configuration and starts VS Code debugging. The graph includes documented chip selection and tool-path discovery. Some wiring is based on the README because the relevant source excerpts are incomplete.
Main entry points: extension.js Command orchestration · backend.js Probe dispatcher · probes.js Probe commands · cmake.js CMake integration
Components 20
Extension workflow
- Command orchestration
extension.js
Project configuration
- Config merge
src/config.js - Project settings
src/project.js - Chip selection
src/devices.js - STM32 catalog
data/stm32-devices.json - Tool discovery
src/tools.js
Build and debug
- CMake integration
src/cmake.js - Build firmware
- Source freshness
src/staleness.js - Debug config
src/launch.js
Probe operations
- Probe dispatcher
src/backend.js - Probe commands
src/probes.js - Target mapping
src/target.js
Other components
- User
- J-Link tools
- CubeProgrammer
- OpenOCD
- VS Code APIs
- CMake Tools
- Cortex-Debug
Connections 23
- User → Command orchestration: runs commands
- Command orchestration → Config merge: loads settings
- Config merge → Project settings: reads project config
- Command orchestration → Project settings: writes project config
- Command orchestration → Chip selection: selects chip
- Chip selection → STM32 catalog: searches catalog
- Command orchestration → Tool discovery: discovers tools
- Command orchestration → CMake integration: builds and finds firmware
- CMake integration → CMake Tools: calls build API
- CMake integration → Build firmware: produces or locates
- Command orchestration → Source freshness: checks freshness
- Command orchestration → Probe dispatcher: dispatches probe action
- Command orchestration → Probe dispatcher: passes firmware
- Probe dispatcher → Tool discovery: resolves executable
- Probe dispatcher → Probe commands: builds and runs commands
- Probe dispatcher → Target mapping: classifies probe output
- Probe commands → J-Link tools: executes when selected
- Probe commands → CubeProgrammer: executes when selected
- Probe commands → OpenOCD: executes when selected
- Command orchestration → Debug config: generates debug config
- Debug config → Project settings: writes launch file
- Command orchestration → VS Code APIs: starts debug session
- VS Code APIs → Cortex-Debug: loads debug configuration