Skip to main content
MMici.1
Associate II
June 21, 2021
Question

STM32CubeIDE DEBUG - save SFR values (state snapshot)

  • June 21, 2021
  • 12 replies
  • 4371 views

Dear All,

I would like to make a snapshot of CPU registers (SFRs) when a program is paused.

Ideally the snapshot would be a textfile.

Does anyone know whether this is possible in CubeIDE or via some other tool?

Thank you

Matej

This topic has been closed for replies.

12 replies

TDK
June 21, 2021

You can take a screenshot. Don't think it's possible otherwise.

"If you feel a post has answered your question, please click ""Accept as Solution""."
MMici.1
MMici.1Author
Associate II
June 22, 2021

Hi,

thanks for the reply. Yeah, I've been using screenshots but I was hoping

that some way of getting a text export is hidden somewhere ;).

Cheers

mattias norlander
ST Employee
June 28, 2021

Hi @MMici.1​,

The idea has been discussed internally before. We have a ticket for this. The idea would be as you said to be able to select a bunch of peripherals that are monitored. Each time we suspend execution or make a step we read these SFRs and write to a log-file.

You could run two different debug session and then compare the log-files to see different IP behavior. Could be very useful when comparing firmware revisions...

Please elaborate on the use cases that you are trying to address so that we can get a more complete view with your feedback.

Anyone else that think the feature would be interesting, please give the post a like.

Internal ticket reference #96205

Franksterb92
Senior
March 27, 2023

that sounds awesome please add

MMici.1
MMici.1Author
Associate II
June 29, 2021

Hi Mattias,

we've had a bit more complex FW problems where it wasn't immediately obvious what is causing the issue. As a part of the debug process we check some of the registers to compare their contents during normal vs fault state. Doing this by comparing screenshots or notes can be quite time consuming (and sometimes error-prone) even for few registers. Comparing all the registers like this is totally impractical and even though I realize this wouldn't be a panacea and there would be caveats, I'm sure we would use it. Having the ability to just use standard 'diff' feature on two text documents would not only simplify and speed up the whole task (and possibly debug) but also be beneficial for documentation.

This feature would be appreciated.

Pavel A.
June 29, 2021

@MMici.1​ So why not just write some instrumentation yourself?

Write a function that reads the interesting registers and dumps to UART, or even saves to memory and compares with previous copy?

Execute this whenever you like.

MMici.1
MMici.1Author
Associate II
June 30, 2021

Ok, I assume you mean instrumentation as in code in the DUT that would read registers and send them via UART (or save in DUT memory).

A possibility but not a good way for us. Such a function would already affect some of the registers and we don't necessarily want to add code to a FW when we are looking for a bug. Given that the device already has debug capabilities and they allow breakpoints and reading out the registers this would be sort of going backwards.

Still thanks for replying.

waclawek.jan
Super User
June 29, 2021

I don't use Eclipse, but I'd be surprised if there would be no gdb console built in.

JW

MMici.1
MMici.1Author
Associate II
June 30, 2021

Thanks for the idea.

MMici.1
MMici.1Author
Associate II
June 30, 2021

Hi, thanks for the idea.

mattias norlander
ST Employee
August 17, 2023

Please note that the SFR-view was improved in CubeIDE 1.11.0 to support some new use cases:

  • Possibility to create tabs with subsets of peripherals and registers
  • Dump of all peripheral registers to a file
  • Possibility to read the registers via live channel

I think especially second bullet in this list is quite cool in combination with Eclipse "Compare with... > each other" tool, or any other external diff utility.