aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Gagarin <gleb61@gmail.com>2017-08-13 14:44:15 -0700
committerGitHub <noreply@github.com>2017-08-13 14:44:15 -0700
commit45f28081e194c8c817832c477f8cae04322bcff8 (patch)
treea5004e3d66542ba5b4b91f9cf06903b3a45e4ca7
parent1af0c09a85f9da54d2aba741c71084dad3f1cedf (diff)
parent2706df0ec368125d680d4e88f95dfe00af89ad38 (diff)
downloadriscv-openocd-45f28081e194c8c817832c477f8cae04322bcff8.zip
riscv-openocd-45f28081e194c8c817832c477f8cae04322bcff8.tar.gz
riscv-openocd-45f28081e194c8c817832c477f8cae04322bcff8.tar.bz2
Merge pull request #94 from riscv/memread
Fix a corner case in block memory read.
-rw-r--r--src/target/riscv/riscv-013.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 0296ffd..284f6a1 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -1356,7 +1356,8 @@ static int read_memory(struct target *target, target_addr_t address,
bool first = true;
bool this_is_last_read = false;
LOG_DEBUG("reading until final address 0x%" PRIx64, fin_addr);
- while (count > 1 && (cur_addr = riscv_read_debug_buffer_x(target, d_addr)) < fin_addr - size) {
+ while (count > 1 && !this_is_last_read) {
+ cur_addr = riscv_read_debug_buffer_x(target, d_addr);
LOG_DEBUG("transferring burst starting at address 0x%" TARGET_PRIxADDR
" (previous burst was 0x%" TARGET_PRIxADDR ")", cur_addr,
prev_addr);
@@ -1373,7 +1374,6 @@ static int read_memory(struct target *target, target_addr_t address,
size_t reads = 0;
size_t rereads = reads;
for (riscv_addr_t i = start; i < count; ++i) {
-
if (i == count - 1) {
// don't do actual read in this batch,
// we will do it later after we disable autoexec