Live variable watch and plot from an ELF

Pick global variables from the ELF and read them through ST-LINK or CMSIS-DAP while the firmware runs: values, min/max, writes, strip-chart plots and CSV recording.

How to use it

  1. Connect the probe and load the ELF the linker wrote (not the .bin or .hex: they have no names).
  2. Add variables by name, as name[index] for an array element or name+offset, and pick each one’s C type.
  3. Read live, tick Plot for the ones to chart, write a new value to tune the firmware while it runs, and save the recording as CSV.

Questions

Why do I have to pick the type?

The ELF’s symbol table gives each variable’s address and size but not its C type: that is in the DWARF debug information, which this page does not read yet. A guess by size is offered (a 4-byte variable could be a uint32_t or a float).

How fast does it sample?

Every 10 ms at best. Variables close together in RAM are read in one transfer, so twenty variables cost a few USB round trips. A full-speed probe manages about 100 to 500 reads a second; high-speed ones (STLINK-V3, MCU-Link) more.

Are the samples exact in time?

Each sample is stamped when the browser received it, so the spacing jitters by a millisecond or two. For exact timing, have the firmware record into a buffer, or use the DWT cycle counter.

Static and local variables?

File-scope statics are in the ELF (as local symbols) and work like globals. Variables local to a function live on the stack or in registers and have no fixed address.

Does a write disturb the variable next to it?

No: a 1-byte variable is written with a byte access and a 2-byte one with a halfword access, so neighbours are not touched.

Related tools

  • Cortex-M debugger in the browser (ST-LINK, CMSIS-DAP): Halt, step and reset an Arm Cortex-M; watch and write global variables from the ELF live with plots; SEGGER RTT terminal; live SVD peripheral registers; breakpoints, watchpoints and HardFault capture. Over WebUSB, nothing to install.
  • SEGGER RTT viewer in the browser: Find the RTT control block in RAM and read every up channel while the core runs; send input to the down buffer. Works with ST-LINK and CMSIS-DAP, not only J-Link.
  • Live peripheral registers from an SVD: Read every register of a peripheral through the probe and decode its fields and enumerations from the SVD, live; write a field.
  • Catch a Cortex-M HardFault on the target: Stop the core when it faults (vector catch), read CFSR, HFSR and the fault address, unwind the stacked frame and name the faulting function from the ELF.
  • Microcontroller memory viewer and editor: Read RAM, flash or peripheral space through the probe as a hex dump that highlights what changed; write 8, 16 or 32-bit values; save a dump.
  • Flash STM32, ESP32 and RP2040 from the browser: Program HEX/S19/BIN/UF2 into an STM32 (UART bootloader, USB DFU, ST-LINK or CMSIS-DAP), an ESP32 or ESP8266 (ROM loader) or an RP2040/RP2350 (PICOBOOT or UF2); verify and read back.
  • Register viewer (SVD): CMSIS-SVD peripherals, registers and bit fields; decode a value; find the register at an address; C defines.

Also useful for: live watch, stm32cubemonitor alternative, stmstudio alternative, variable plot, real-time variables, elf symbols, mcu variable viewer, tune pid live.