aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-05-01 08:30:15 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-05-01 08:33:01 -0700
commit16de5044d4626bda1914af9634fd64af16d5dfb5 (patch)
treebb7df8195c610eb58366f9c9d9b28881f72edb8a
parentba3a56937bc921a72b672d666a60ea4292cff449 (diff)
downloadriscv-openocd-16de5044d4626bda1914af9634fd64af16d5dfb5.zip
riscv-openocd-16de5044d4626bda1914af9634fd64af16d5dfb5.tar.gz
riscv-openocd-16de5044d4626bda1914af9634fd64af16d5dfb5.tar.bz2
Fix an assertion when reading from 0
-rw-r--r--src/target/riscv/riscv-013.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 179c523..cbe926e 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -1318,7 +1318,7 @@ static int read_memory(struct target *target, uint32_t address,
* the data was all copied. */
riscv_addr_t cur_addr = 0xbadbeef;
riscv_addr_t fin_addr = address + (count * size);
- riscv_addr_t prev_addr = 0;
+ riscv_addr_t prev_addr = address - size;
LOG_DEBUG("writing until final address 0x%016lx", fin_addr);
while (count > 1 && (cur_addr = riscv_read_debug_buffer_x(target, d_addr)) < fin_addr) {
LOG_DEBUG("transferring burst starting at address 0x%016lx (previous burst was 0x%016lx)", cur_addr, prev_addr);