Maybe this situation is familiar to you: My embedded software stopped in the field. I am in front of it, hooked up with my laptop and debugger. And I see: indeed, it has a problem. Maybe just a one-time-thing? Maybe I do a reset and things will work as expected? Not really, according to Debugging Rules.
The thing is this: I’m in a situation which requires some deep investigation. But I do not have the time now. Or my boss, the boss-boss or the customer are standing behind me asking all the good questions for which I don’t have an answer. So in this situation it would be great if you could take a dump of the device memory, reset that board, move on and investigate what happened offline? Here are several ways how to do this…
The basic idea is to get a full dump of my device memory for offline analysis. The approach is using a debugger connection. I have found that the approach of ‘dump and inspect offline’ is incredible valuable. It helps to compare the ‘good’ and ‘bad’ state of a device: Having a ‘good’ or working configuration and dump, I can compare it with another image. Or I even can restore a memory dump back on a device to reproduce issues.
Export from the Memory View
The first approach is using the Memory view. As already shown in Memory is Everything, the Memory view offers an export functionality:
Here I have the possibility to export it in different formats, and using the ‘import’ button I can import files later on.
Exporting Memory with Target Task
Another way is to create an Export Memory Task from the Target Tasks view:
Next I need to configure what to do. Basically start address and size and format options:
I save the settings with Ctrl-S. Then either with a context menu or with the toolbar I can export the memory to a file:
Importing works the same way, but configuring a Target Task to import a file instead to export.
Debugger Shell
If this is not flexible enough, I have the power of TCL scripts and the debugger shell.
With this, I can use something like this:
save -h 0x0..0x8000 c:\\tmp\\myDump.txt -o
I’m using the -h option to specify Hex Format, as I can re-import that format easily with the ‘restore’ command.
Summary
There are multiple ways how to dump the device memory to a file. This is very useful to inspect content offline, to compare dumps or as well to restore later the dumps on the device.
Happy dumping




