MCUViewer: The Ultimate GUI Debugging Tool for Seamless STM32/JLink Integration

IntroductionIs debugging STM32 giving you a headache lately? UART printing is too slow and resource-consuming, and you have to set breakpoints just to check variables. Not to mention, tracking high-frequency signals is nearly impossible… Don’t worry, today I want to introduce you to a powerful tool—MCUViewer—that will completely liberate your debugging process.

What is MCUViewer?MCUViewer (formerly STMViewer) is a GUI-based open-source (closed-source after version 1.1.0) real-time debugging tool for microcontrollers, consisting of two main modules:

Module Name Function Interface
Variable Viewer Real-time reading and visualization of global variables in RAM, non-intrusive, zero overhead SWDIO / SWCLK / GND + STLink
Trace Viewer Graphical display of SWO Trace data, perfectly captures high-frequency signals and function execution times SWDIO / SWCLK / SWO / GND

The only hardware dependency: STLink or JLink programmer. It works seamlessly on both Windows and Linux, your choice!

What pain points does it solve?

  • Zero intrusion, zero overhead: No more embedding printf in your code; variables are read directly from the ELF file, absolutely no impact on runtime.
  • High-frequency signal visualization: The Trace Viewer supports MHz-level SWO, allowing you to easily see interrupt frequencies and function execution times.
  • Cross-platform & multi-brand: STMStudio has been discontinued, and Cube Monitor is too bloated; MCUViewer supports both Windows/Linux and STM32/JLink seamlessly.
  • Open-source & lightweight: Just one-click compile with CMake, the binary is only a few megabytes, making it ten times lighter than commercial large LCD platforms.

Quick Start Code Example

  1. 1. Variable Viewer In CubeIDE, create a global variable:
    // main.c
    #include "main.h"
    uint32_t sensor_data = 0;
    int main(void) {
        HAL_Init();
        // ... Initialize ADC, timers, etc.
        while (1) {
            sensor_data = read_adc(); // Real-time reading
            HAL_Delay(100);
        }
    }

    MCUViewer loads the ELF directly:

    1. 1. <span>Options → Acquisition Settings → Select ELF</span>
    2. 2. <span>Import variables</span>, select <span>sensor_data</span>, and drag it to the Plot interface
    3. 3. Click STOPPED to see the <span>sensor_data</span> curve in real-time.
  2. 2. Trace Viewer Insert ITM markers in your code:
    // profile.c
    void foo(void) {
        ITM->PORT[0].u8 = 0xAA; // Function entry
        // Your time-consuming operation
        ITM->PORT[0].u8 = 0xBB; // Function exit
    }

    Enable SWO tracing in CubeMX, compile and flash, then fill in the system clock (in kHz) and Trace prescaler in MCUViewer to see the function execution time histogram—it’s incredibly satisfying.

Pros and Cons at a Glance

Item Advantages Disadvantages
Variable Viewer · Non-intrusive, zero overhead· Supports multiple variables plotted simultaneously· Directly parses addresses from ELF · Only supports global variables· 64-bit types are not yet supported
Trace Viewer · True high-frequency visualization (MHz-level SWO)· Usable even in Release mode· Compatible with JLink · SWO bandwidth is limited and requires adjusting the prescaler· Sensitive to hardware SWO pin connections

ConclusionMCUViewer has brought our most troublesome “real-time debugging” into a GUI: handling variables and traces simultaneously is incredibly satisfying. It balances lightweight design, cross-platform compatibility, and powerful functionality, making it suitable for quick bug fixes as well as performance benchmarking. Most importantly, the open-source community is becoming increasingly active; if you encounter issues, you can easily get support by posting an issue or sending an email. With it, your STM32 efficiency can double.

Project Address:https://github.com/klonyyy/MCUViewer

Leave a Comment