实时调试stm32

Debug stm32 in real time

我想知道是否有人知道如何使用 eclipse 进行实时调试,我有一个用于 stm32 微控制器的固件,并且希望能够看到我的变量随时间变化而不必使用断点或其他东西,有人知道怎么做吗?

快速的答案是 - 使用半主机。

较长的一个 - 减少通过 SWO 传输的数据量,仅发送原始值。互联网上有很多可用的工具,或者(我自己使用的这种方法)用 C/C++ 或 C# 编写一个简短的程序来显示/可视化接收到的数据。它实际上最适合我。

最简单的方法是在 UART 上传输数据,然后使用任何串行实用程序在计算机上观察它,例如 Windows 上的 Putty 和 Linux 上的 cutecom、miniterm.py。

其次,如果您的系统支持半主机,您可以启用它以使用 printf 在控制台上打印变量的值。

你需要的是STM-STUDIO-STM32这是ST提供的实时数据监控的好工具

  • 数据可以显示在条形图、x-y 图和表格中。
  • 变量从 .elf 文件加载。
  • 工具使用ST-Link和SWD连接芯片获取数据
  • 您甚至可以在 运行 时间内更改变量的值,因此它也可以作为 MCU 的输入。它看起来像这样:

基本上,在使用 STM 时,默认情况下您有一个客户端应用程序。 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)