feature: memwatch: read memory while running #1655
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Detailed description
memwatch - read memory while target running
This PR introduces a new monitor command, memwatch.
The memwatch command reads target memory while the target is running.
Inspecting memory without halting the target is useful when debugging hard real time systems.
The arguments to "mon memwatch" are names, formats (/d, /u, /f, /x, /t), and memory addresses. Up to 8 memory addresses may be monitored at the same time. The "mon memwatch" command can be applied to Arm Cortex-M targets only.
Example
Assume target firmware contains a variable called "counter". In gdb:
When the variable changes, output is written to the usb serial:
To switch off, enter "mon memwatch" without arguments.
Compiling
To compile bmp with memwatch support, add ENABLE_MEMWATCH=1 to the command line. E.g.:
Pre-built binaries.
Arguments
The command arguments in detail:
Up to 8 addresses of watchpoints may be specified.
NAME begins with a letter a-z A-Z. NAME is printed on every line of output. If NAME has been omitted, the address is printed instead:
prints
Format is one of
If format is not given, default is hex, or the last used format.
prints
Address is a hexadecimal number. The address is the minimum necessary to define a watchpoint.
prints
The '/f' format prints IEEE754 32-bit single-precision "float":
prints
On the Black Magic Probe firmware probes /f defaults to printing all significant digits, without any rounding.
On the pc-based Black Magic Debug App /f defaults to printing to 6 decimal places "%.6g".
Optionally, /f may be followed by a digit, indicating the number of decimal places.
Example: /f4 prints floating point numbers to four decimal places.
The '/t' format prints a timestamp in milliseconds:
prints
With both target and bmp running on a stm32f411, memory is polled 1000 times per second.
Your checklist for this pull request
make PROBE_HOST=native
)make PROBE_HOST=hosted
)Closing issues
fixes #1532