aboutsummaryrefslogtreecommitdiff
path: root/src/target/target.c
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2020-08-18 11:01:41 -0700
committerGitHub <noreply@github.com>2020-08-18 11:01:41 -0700
commit53ec10b61da5de553c01f92bddf80c076bd49331 (patch)
tree119b65e595cde3eab560f8181de2ec8a1118cd61 /src/target/target.c
parentc1c88dcceeb94657971fd577878af0a4f8a39d69 (diff)
downloadriscv-openocd-53ec10b61da5de553c01f92bddf80c076bd49331.zip
riscv-openocd-53ec10b61da5de553c01f92bddf80c076bd49331.tar.gz
riscv-openocd-53ec10b61da5de553c01f92bddf80c076bd49331.tar.bz2
Create `riscv repeat_read` command (#510)
* WIP, apply stash with conflicts. Change-Id: Ia794bde419aa29161c68898d20e30527e69f5a31 * Fix conflict resolution problems. Change-Id: I4cedc348cf613f98cc5a36886f37c568ca644238 * Add repeat_read command. Only implemented for sba v1 right now, and poorly tested at that. Change-Id: I1d9ff63e1dea14b3f6a9f8ba4dad53668bf8038b * Hide bogus address in repeat_read Change-Id: Ib66c1fa60df9c7fc7cc87880b0fddc52825b48aa * WIP make repeat read work with progbuf. Change-Id: I555f8b880c8bf0d1ed0f3f90c7987a5b516a7a79 * WIP Change-Id: Ic567cea68355ae907e94bd25185a2c9be6fd798d * Fix error handling when increment is non-zero. Change-Id: I5a2f3f2ee948fd4e12c0443a542e85b7b5c5791a * Correctly(?) handle failures when increment is 0. I'm not 100% convinced that this ensures every read value shows up in the output, but it ought to work. Change-Id: I1af3e7174cf9d5e6f293456fb5ead629e17faaaa * Don't crash when asked to read no data. Change-Id: I4061b5c720a43a4f828384ab9eacc89557adfa05 * Remove unnecessary comment. Change-Id: I1be3d699b86299339b3a830ca1ef13c9f5b9fe0f * Document `riscv repeat_read`. Change-Id: I4a0f071f38784b2de034f8c1b0ce75d6d2d326b2
Diffstat (limited to 'src/target/target.c')
-rw-r--r--src/target/target.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/target/target.c b/src/target/target.c
index ad33fa4..3395b2a 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3184,7 +3184,7 @@ COMMAND_HANDLER(handle_step_command)
void target_handle_md_output(struct command_invocation *cmd,
struct target *target, target_addr_t address, unsigned size,
- unsigned count, const uint8_t *buffer)
+ unsigned count, const uint8_t *buffer, bool include_address)
{
const unsigned line_bytecnt = 32;
unsigned line_modulo = line_bytecnt / size;
@@ -3213,7 +3213,7 @@ void target_handle_md_output(struct command_invocation *cmd,
}
for (unsigned i = 0; i < count; i++) {
- if (i % line_modulo == 0) {
+ if (include_address && (i % line_modulo == 0)) {
output_len += snprintf(output + output_len,
sizeof(output) - output_len,
TARGET_ADDR_FMT ": ",
@@ -3297,7 +3297,8 @@ COMMAND_HANDLER(handle_md_command)
struct target *target = get_current_target(CMD_CTX);
int retval = fn(target, address, size, count, buffer);
if (ERROR_OK == retval)
- target_handle_md_output(CMD, target, address, size, count, buffer);
+ target_handle_md_output(CMD, target, address, size, count, buffer,
+ true);
free(buffer);