Eduardo Cardoso
Eduardo Cardoso

Reputation: 167

Debug stm32 in real time

I would like to know if anyone knows how to debug with eclipse in real time, I have a firmware for the stm32 microcontroller and wanted to be able to see my variables changing over time without having to use breakpoint or something, does anyone know how to do?

Upvotes: 2

Views: 5690

Answers (3)

Bence Kaulics
Bence Kaulics

Reputation: 7291

What you need is STM-STUDIO-STM32 which is a great tool provided by ST for real time data monitoring.

  • The data can be displayed in bar charts, x-y plots and in tables.
  • The variables are loaded from the .elf file.
  • The tool uses ST-Link and the SWD to connect to a chip and acquire data.
  • You can even change the value of the variables during run time, so it works an input to the MCU as well. It looks like this:

    enter image description here

Basically when working with an STM you have a client application by default. Key features listed by ST:

Key Features

  • Runs on PCs with Microsoft® Windows XP, Vista and Windows 7 OS
  • Connects to any STM32 via ST-LINK (JTAG or SWD protocols)
  • Reads on-the-fly (non intrusive) variables from RAM while application is running
  • Parses DWARF debugging information in the ELF application executable file
  • Two types of viewer:
    • Variable viewer: real-time waveforms, oscilloscope-like graphs
    • TouchPoint viewer: association of two variables, one on the X axis, one on the Y axis
  • Possibility to log data into a file, and replay later (exhaustive record display, not real-time)

Upvotes: 1

RishabhHardas
RishabhHardas

Reputation: 525

The simplest method is to transmit data on UART and observe it on a computer with any serial utility like Putty on Windows and cutecom, miniterm.py on Linux.

Secondly, if your system supports semihosting, you can enable it to use printf to print values of your variables on the console.

Upvotes: 2

0___________
0___________

Reputation: 68013

The quick answer is - use semihosting.

The longer one - to reduce the ammount of data transmitted over the SWO send only the raw values. There are many tools avaiable on internet or (this method I use myself) write a short program in C/C++ or C# to display / visualise the received data. It actually works for me the best.

Upvotes: 1

Related Questions