NEOTEC STM Monitor — 0.3.0 preview
Local-first VS Code extension for live embedded variable monitoring. This is an independent implementation inspired by the documented workflows of STM Studio and MCUViewer; no proprietary MCUViewer code is included. This preview is not feature-complete or hardware-qualified.
Preview availability and validation
The Windows x64 VSIX includes the optional native USB dependency for the experimental ST-LINK V3 backend. All 34 automated tests pass, and the packaged Windows x64 USB addon loads successfully in local Node.js. Physical ST-LINK V3 communication, Windows driver compatibility and execution inside the VS Code extension host still require validation. Other platforms are not part of this initial distribution.
This is a pre-release for Windows x64. In the VS Code Extensions view, search for NEOTEC STM Monitor by NEOTEC and select Install Pre-Release Version when available. You can also install the Windows x64 VSIX manually.
Install and try
- In VS Code (1.90 or later), open Extensions, choose the
... menu, then Install from VSIX.... Select neotec-stm-monitor-0.3.0.vsix. Alternatively: code --install-extension neotec-stm-monitor-0.3.0.vsix.
- Open a trusted firmware workspace. Click the pulse icon in the Activity Bar or run NEOTEC: Open STM Monitor from the Command Palette.
- The default backend is Demo. Click Connect, then Start. The three demo channels are simulated. No hardware is accessed.
- Open Connection and choose the experimental ST-LINK V3 (native USB) backend, Launch OpenOCD locally or Attach to OpenOCD TCP for real hardware. Demo channels are removed when switching to a real backend.
Real hardware: STM32 + ST-LINK
Install a current OpenOCD build with Tcl RPC (read_memory/write_memory), adapter/target scripts and the correct USB driver. A modern ST-LINK/OpenOCD combination is recommended; specific versions and probes need validation. Windows users can use the OpenOCD executable from their STM32 toolchain or an independent distribution. Specify its full path if not on PATH. The extension does not distribute drivers or OpenOCD.
Example configuration for STM32F103 (adapt it to your device and installed OpenOCD scripts):
| Setting |
Example |
| Backend |
Launch OpenOCD locally |
| Executable |
openocd (or full path to openocd.exe) |
| Interface |
interface/stlink.cfg |
| Target |
target/stm32f1x.cfg |
| SWD speed |
4000 kHz (reduce to 1000 if unstable) |
| Tcl port |
6666 |
For H7/F4/G4 or other devices, choose the corresponding target config. For J-Link or CMSIS-DAP, use the appropriate OpenOCD interface/target script instead; these paths have not been tested with hardware. If an OpenOCD instance is already running, select Attach and supply the Tcl endpoint, not the GDB port. OpenOCD Tcl has no authentication; bind to loopback or use a trusted encrypted tunnel. Do not expose it on an untrusted network. A probe generally cannot be opened independently by multiple processes simultaneously.
Select Find ELF or Browse, then Refresh addresses and confirm that the ELF is identical to the firmware already flashed. The watcher stops acquisition after a rebuild so stale addresses aren't silently used. Add variables from the search results, choose type, group and sampling frequency, then Connect and Start. For manual addresses, use + Address. Use RAM addresses only unless you have checked the hardware reference manual; some peripheral reads have side effects. On a real target, do not monitor uninitialized, powered-down or protected memory. Connecting OpenOCD may briefly halt certain targets depending on target configuration and adapter. The live acquisition loop itself does not issue halt/resume/reset commands.
Typed ELF import (optional dependency)
Install Python 3 and run python -m pip install pyelftools (or use py -m pip install pyelftools on Windows and set the executable to py). Select the Python executable in Connection. Build with debug information (-g); avoid eliminating monitored variables. The bundled DWARF reader can identify static-address scalar leaves, common structs, unions, one-dimensional arrays (first 256 elements), enums and pointer values. It skips dynamic addresses, bitfields, multidimensional arrays and complex location expressions. It does not dereference pointers. Duplicate symbol names may require unique manual labels. If Python/DWARF fails, the dependency-free little-endian ELF32/64 symbol parser is used. It only knows symbol addresses and sizes; select the correct type yourself. For example, 4 bytes may be a float or an integer. The native symbol reader was tested; the optional DWARF reader was syntax-checked only because pyelftools was unavailable in the build environment.
Features and workflow
- Time-series, XY (scatter or connected), bars, approximate FFT; single plot area with a group filter. Mouse wheel zoom and drag to pan in time mode, Follow to resume scrolling; double-click returns to live view. Cursors display X values and delta. Statistics include min, max, mean, RMS and standard deviation over the visible window. The common Y axis means very different scales may need separate groups.
- Per-variable sampling frequency and group name; edit a watch row by double-clicking. Group selection is a display filter; rates are individual channels. Add/remove/edit channels while live, except during CSV streaming to maintain a stable schema. Acquisition is sequential, not deterministic. Display is throttled and line plots use min/max downsampling. Ring buffers use a global 32 MiB typed-array allocation budget (excludes temporary allocations and other overhead); max 128 channels and 200,000 configured points per channel.
- Channel scale, offset, fixed-point conversion (set scale e.g. 1/32768), EMA smoothing, decimal precision, custom enum JSON, hex/binary display and threshold highlighting. 64-bit integers are displayed/logged as strings to preserve precision; not plotted or transformed. Writes are raw, not scaled, disabled by default, explicitly unlocked and limited to the standard 0x20000000–0x3FFFFFFF SRAM region; actual valid SRAM range depends on the MCU. Writes are byte based and not necessarily atomic. Avoid live writes on running machinery. Use a safe isolated bench. Reset/flash require confirmation and interrupt execution; flash verification may need confirmation via OpenOCD logs.
- Rising/falling threshold trigger with configurable post-trigger period and optional pause; preceding samples retained in circular history, no deterministic pretrigger guarantee. Streaming CSV preserves timestamps and blanks for unsampled channels. History CSV and PNG plot export. New output files only; choose a fresh name to avoid overwrite. Project connection/channel settings persist in the project JSON file. No cloud services or telemetry. The optional native USB backend uses the bundled usb dependency. The project currently declares UNLICENSED; no open-source license grant is implied.
- Hardware recorder: included original C module and host arm/download workflow; requires firmware integration. See below.
Automatic project restore (0.1.2)
Preferences are automatically written to neotec-stm-monitor.json beside platformio.ini (not inside .pio). The file contains connection settings, the ELF path, selected channels in order, individual channel settings, plot visibility, group filter, plot mode, time window (including wheel zoom), XY axes, connected-point preference, symbol search, cursor mode, trigger parameters and recorder address. ELF files inside the selected project use portable relative paths, including .pio/build/<environment>/firmware.elf. Copy the JSON with the project or commit it to Git if appropriate; it contains local connection settings and may contain absolute paths to external tools or firmware.
When multiple PlatformIO projects are present, choose the project when opening the monitor. Only one monitor is open at a time; close it to select another project. For a restored tab the last project is selected when still present. Without a PlatformIO project, the selected local workspace folder is used; without a folder, the legacy VS Code workspace store is used. On first open in an unambiguous single-root project, old VS Code preferences migrate if the JSON does not yet exist. Existing project JSON takes precedence. Corrupt or unsupported JSON blocks opening rather than overwriting the file. Saves are serialized and use a temporary file and atomic rename. Avoid simultaneous editing from multiple VS Code windows; changes are loaded on reopening and there is no merge or external change watcher.
For safety, connections, acquisition, recording, write unlocks, armed triggers, live samples, pan position and cursor coordinates are not restored. The ELF must still be confirmed against the flashed firmware before live acquisition after restart. Missing/ambiguous symbols during refresh keep the watch list intact and block acquisition until resolved.
Hardware recorder
Add firmware/neotec_recorder.c and .h to your C project. Configure NLM_CHANNELS and NLM_FRAMES consistently for every translation unit, and set nlm_recorder.sample_hz to the actual periodic ISR rate while disarmed. Example for the default four channels:
void timer_callback(void) {
const float signals[4] = { speed, pressure, setpoint, error };
nlm_recorder_step(signals);
}
This records a finite, linear buffer in the target RAM and disarms when full. Default: 512 × 4 float32 = 8192 bytes + 24-byte header. Do not place this in a cached or incoherent RAM region without handling cache coherency. Make sure target RAM is sufficient. There is no trigger/pre-trigger ring in this firmware module. On the host, pause live acquisition, connect the probe, choose HW Recorder, enter the actual nlm_recorder address (from linker map or ELF), and select Arm new capture (write unlock and confirmation required) or Download capture (CSV). The recorded time axis uses the configured periodic sample frequency. View the exported CSV in a suitable plotting tool; integrated recorder plotting is not implemented yet. Firmware C compiles with a host C11 compiler, and recorder header/arm/download logic was tested against simulated memory; no target ISR or performance tests were run.
MCUViewer parity checklist
Reference: https://github.com/klonyyy/MCUViewer/releases (through v1.4.0), https://docs.mcuviewer.com/ . This is a functional comparison, not a claim of compatibility with MCUViewer project files or hardware protocols.
| Feature |
0.1.1 preview |
| Live SWD memory reads/writes; raw address |
Implemented through OpenOCD Tcl, hardware validation pending |
| ELF symbols; alternate parser |
Native symbol parser; optional DWARF parser (not runtime-tested) |
| Structs, arrays, enums, pointers |
Partial, optional DWARF; pointer values only |
| Curves, bars, watch table, XY |
Implemented single plot + group filter |
| FFT, scaling, fixed point, EMA |
Implemented; FFT approximate on irregular SWD timestamps |
| Live cursor/statistics, highlighting |
Implemented X cursors only; Y/XY cursor modes pending |
| Per-group rate/window |
Partial: rates per variable, global viewport |
| Dynamic variable add/remove |
Implemented except during streaming CSV |
| Downsampling, memory limits |
Implemented |
| Threshold triggers |
Implemented, host timestamps |
| Screenshot and CSV stream/export |
Implemented |
| Reset and flash |
Implemented via OpenOCD, not hardware tested |
| Recorder |
C module + arm/download to CSV, no integrated plots |
| Network probe |
OpenOCD Tcl over TCP only, not MCUViewer network probe protocol |
| Direct ST-LINK/J-Link libraries, GDB RSP server, UART |
Not implemented; OpenOCD compatible probes are the available route |
| SWO/ITM/DWT trace, interrupt profiling |
Not implemented |
| Dockable/multiple plots, clone groups/plots, replay |
Not implemented |
| Arbitrary math expressions, FIR/IIR filter bank |
Not implemented (scale/offset/EMA only) |
| MCP server/agent integration |
Not implemented |
| Automatic USB probe enumeration, TI C2000 proprietary probes |
Not implemented |
| Project exchange file format |
Project JSON, automatically saved |
Development
Node 18+ for tests. No npm install is needed. Open this folder in VS Code, press F5 to launch Extension Development Host, then run NEOTEC: Open STM Monitor. npm test executes unit tests and a fake TCP OpenOCD server. The VSIX is manually packaged in the standard ZIP/XML layout because vsce and VS Code CLI were unavailable in the build environment. Installation in real VS Code is unverified. The Chromium UI smoke test injected simulated messages and checked rendering/form events; it is not an Extension Host test. See test/ for the Node tests. The Python and C modules are optional. Source code is supplied for review and modification; no third-party MCUViewer code is used.
Architecture
src/extension.js: workspace lifecycle, security confirmations, acquisition scheduler, export and UI messages
src/core.js: scalar codecs, range checks, contiguous memory planner, statistics/triggers
src/transport.js: TCP Tcl RPC, OpenOCD process management and simulator
src/elf.js, tools/dwarf.py: symbols and DWARF metadata
src/recorder.js, firmware/: target recorder protocol
media/: CSP webview, canvas chart and bounded client buffers
test/: deterministic tests
Validation priority: test installation on VS Code Windows; connect isolated STM32F103 + ST-LINK; compare known volatile values to firmware; benchmark 1/10/50/128 channels at several rates; verify no target halts during reads; test disconnects and rebuilt ELF; validate memory writes and flash only on safe test hardware; qualify H7/H5 caches and target configurations before production use.
Upgrade from NEOTEC Live Monitor
Uninstall or disable the old neotec-local.neotec-live-monitor extension before installing this version; both use the same commands and views. Existing neotec-live-monitor.json project files are read when neotec-stm-monitor.json is absent and copied to the new filename on the next save. The old file is preserved. Settings stored only in VS Code extension-local storage cannot be migrated automatically across extension IDs.
New in 0.2.0
- PlatformIO button discovers conventional built environments, board metadata and installed OpenOCD packages. Select an environment explicitly; custom build paths, inherited/interpolated INI settings and probe enumeration are not resolved. Confirm that the ELF matches the flashed firmware before acquiring.
- Save/Load Profile stores named snapshots in
.neotec/profiles/ inside the project. Disconnect before loading. Hardware write authorization is never restored.
-
- Formula creates read-only channels using
[channel name], arithmetic and abs/sqrt/sin/cos/tan/exp/log. Inputs use latest available scaled values, not synchronized samples. Cycles and missing dependencies are rejected. Pause before adding formulas. No arbitrary code execution.
- Step analysis measures rise time, overshoot, observed settling, final-window error and IAE/ISE/ITAE over retained samples with manually specified step timestamp and initial/target values. It does not tune or write PID parameters.
- Compare CSV opens up to four saved captures and overlays selected numeric channels, aligned to first sample. Playback and scrub operate on a bounded min/max-downsampled display; the original CSV remains unchanged.
- CI runs Node tests across Windows, Linux and macOS. VS Code installation and target hardware remain unqualified. Native probes, SWO/RTT, SVD, multiple live plots, automatic anomaly capture and exact trigger-aligned comparisons remain pending.
Automatic active environment (0.2.1)
At VS Code startup the monitor prepares the active PlatformIO environment without opening a monitor tab or connecting hardware. Its status-bar item opens the monitor. While the monitor is open or closed, it checks the PlatformIO selection every second and switches to the corresponding project-local .neotec/environments/env-<environment>.json snapshot. A concrete selection is required when multiple environments are possible. A same-named saved profile or unambiguously matching legacy ELF can seed a new environment; existing files are preserved. The conventional .pio/build/<environment>/firmware.elf is selected, even before compilation. Switching stops acquisition, disconnects, and locks writes. The PlatformIO observer is an internal API; if unavailable, the single-environment fallback or explicit PlatformIO command is used. Actual PlatformIO/VS Code integration has not been tested. Custom build directories and automatic switching between distinct project roots while a monitor tab is open are not supported.
Use the normal PlatformIO Upload button or project Upload task. When a matching project upload task starts, the monitor stops acquisition/CSV streaming, closes the Tcl connection, disables writes and requests termination of its own OpenOCD process immediately, while compilation normally proceeds. This happens even with automatic reconnect disabled. VS Code task-start notifications are not a blocking pre-upload hook: an already-built, nearly instantaneous upload could still race probe release; no guarantee is made. An external OpenOCD server (Attach mode) is not terminated.
Enable Auto after upload to reconnect and start acquisition after a successful unambiguous upload for the current environment, with the monitor open and locally managed OpenOCD (Launch mode). The setting defaults to off and is saved per environment. The extension requires exit code zero, a released probe, unchanged environment, a matching ELF and uniquely resolved symbols. Manual-address and demo channels prevent automatic restart. Failed/cancelled or overlapping uploads leave the monitor disconnected; writes and triggers are never rearmed. Uploads run in arbitrary terminals are not detected. Upload-and-monitor tasks remain disconnected because the process may not terminate. Actual VS Code/PlatformIO and hardware integration still require testing.
Experimental native ST-LINK V3 (0.3.0)
Install dependencies with npm install in the extension source directory, then run in an Extension Development Host (F5). Select ST-LINK V3 (native USB) in Connection, use Detect ST-LINK V3 to choose the serial, and select the requested SWD clock. This optional backend uses node-usb/libusb directly. If the native addon fails to load, use OpenOCD. Windows requires a compatible USB driver; Linux requires USB permissions. Do not replace drivers indiscriminately; verify compatibility with PlatformIO. A single supported probe can be selected automatically. Multiple probes require an explicit serial. Standard Cortex-M SRAM/AP0 only; not all STM32 families or memory banks are covered. Aligned binary transfers, bounded USB timeout and serialized transactions. Flash using the normal PlatformIO Upload command; the probe interface is released on upload-start notification and optional reconnect is supported. Writes/reset remain guarded. No target halt is requested, but actual hardware effects, speed, driver compatibility, probe release timing and all USB protocol details need physical verification. The OpenOCD backends remain available. A Windows x64 VSIX with the native USB dependency has been generated locally; Marketplace publication remains pending.