diff options
author | cgsfv <cgsfv@users.noreply.github.com> | 2018-10-19 17:47:58 +0200 |
---|---|---|
committer | cgsfv <cgsfv@users.noreply.github.com> | 2018-10-19 17:47:58 +0200 |
commit | 9703c00b2510b12cc1fa195218ba2a0800d28084 (patch) | |
tree | ed73a0706675f902161a5620ead86260db77030e | |
parent | 20db7afb82152c5cd53aa08f50edb4856d683b47 (diff) | |
download | riscv-openocd-eclipse_memory_read.zip riscv-openocd-eclipse_memory_read.tar.gz riscv-openocd-eclipse_memory_read.tar.bz2 |
Moved comment and added initial buffer clearingv20180928eclipse_memory_read
-rw-r--r-- | src/target/riscv/riscv-013.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 7a7245f..a1b4518 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -2249,6 +2249,8 @@ static int read_memory_progbuf(struct target *target, target_addr_t address, select_dmi(target); + memset(buffer, 0, count*size); + /* s0 holds the next address to write to * s1 holds the next data value to write */ @@ -2286,10 +2288,10 @@ static int read_memory_progbuf(struct target *target, target_addr_t address, result = read_memory_progbuf_inner(target, address, size, count, buffer); - /* The full read did not succeed, so we will try to read each word individually. */ - /* This will not be fast, but reading outside actual memory is a special case anyway. */ - /* It will make the toolchain happier, especially Eclipse Memory View as it reads ahead. */ if (result != ERROR_OK) { + /* The full read did not succeed, so we will try to read each word individually. */ + /* This will not be fast, but reading outside actual memory is a special case anyway. */ + /* It will make the toolchain happier, especially Eclipse Memory View as it reads ahead. */ target_addr_t address_i = address; uint32_t size_i = size; uint32_t count_i = 1; |