cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE DEBUG - save SFR values (state snapshot)

MMici.1
Associate II

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

12 REPLIES 12
TDK
Guru

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".

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

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

MMici.1
Associate II

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.

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

JW

@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
Associate II

Hi, thanks for the idea.

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.

Thanks for the idea.