1
votes

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?

3
generally not without affecting the performance and or timing/execution of your code. semihosting is traditionally a rom monitor, basically "breakpoints or something". I didnt look at all of the manuals but (at least some of) the cortex-ms have a data watchpoint feature (in hardware/logic) so you can arm that to watch for data changes then you would either need to have your application, a rom monitor, or periodically stop the processor with the SWD interface to see if it fired. This is all in the arm documentation, you can choose your preference as to how to extract the captured results. – old_timer

3 Answers

1
votes

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.

1
votes

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.

1
votes

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)