diff options
author | Gleb Gagarin <gleb@sifive.com> | 2017-08-12 14:51:12 -0700 |
---|---|---|
committer | Gleb Gagarin <gleb@sifive.com> | 2017-08-12 14:51:12 -0700 |
commit | 3109da7dfd90885261d0d8ad58b62a1a083b10d9 (patch) | |
tree | 11f9a55194285bcb657fe58b9799b2efff387bcd /src | |
parent | e676d3dae62b5fe710a9c80141e48e74d51819af (diff) | |
download | riscv-openocd-FE_402_fix.zip riscv-openocd-FE_402_fix.tar.gz riscv-openocd-FE_402_fix.tar.bz2 |
Force actual read from prog buffer for the last transaction in read_memory()FE_402_fix
Diffstat (limited to 'src')
-rw-r--r-- | src/target/riscv/riscv-013.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 6dc5bef..0296ffd 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -1374,7 +1374,7 @@ static int read_memory(struct target *target, target_addr_t address, size_t rereads = reads; for (riscv_addr_t i = start; i < count; ++i) { - if (i == count) { + if (i == count - 1) { // don't do actual read in this batch, // we will do it later after we disable autoexec // @@ -1436,7 +1436,10 @@ static int read_memory(struct target *target, target_addr_t address, if (this_is_last_read && i == start + reads - 1) { riscv013_set_autoexec(target, d_data, 0); - value = riscv_program_read_ram(&program, r_data); + + // access debug buffer without executing a program - this address logic was taken from program.c + int const off = (r_data - riscv_debug_buffer_addr(program.target)) / sizeof(program.debug_buffer[0]); + value = riscv_read_debug_buffer(target, off); } else { uint64_t dmi_out = riscv_batch_get_dmi_read(batch, rereads); value = get_field(dmi_out, DTM_DMI_DATA); |