mirror of
https://github.com/openocd-org/openocd.git
synced 2025-10-14 02:58:23 +08:00
target/xtensa: fix unaligned memory read on retry
When we read unaligned memory there is an offset in the albuff buffer, that we account for when copying back to original buffer. But in case the first access failed, the retry call already removed the offset, so doing it a second time shifts the returned memory. Change-Id: Ie255c367ca6a001bfe7038a76cf8a6443e398c51 Signed-off-by: Samuel Obuch <samuel.obuch@espressif.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8987 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:

committed by
Antonio Borneo

parent
66ea461846
commit
d3c25a45f6
@@ -2077,17 +2077,16 @@ int xtensa_read_memory(struct target *target, target_addr_t address, uint32_t si
|
||||
/* Disable fast memory access instructions and retry before reporting an error */
|
||||
LOG_TARGET_DEBUG(target, "Disabling LDDR32.P/SDDR32.P");
|
||||
xtensa->probe_lsddr32p = 0;
|
||||
res = xtensa_read_memory(target, address, size, count, albuff);
|
||||
bswap = false;
|
||||
res = xtensa_read_memory(target, address, size, count, buffer);
|
||||
} else {
|
||||
LOG_TARGET_WARNING(target, "Failed reading %d bytes at address "TARGET_ADDR_FMT,
|
||||
count * size, address);
|
||||
}
|
||||
} else {
|
||||
if (bswap)
|
||||
buf_bswap32(albuff, albuff, addrend_al - addrstart_al);
|
||||
memcpy(buffer, albuff + (address & 3), (size * count));
|
||||
}
|
||||
|
||||
if (bswap)
|
||||
buf_bswap32(albuff, albuff, addrend_al - addrstart_al);
|
||||
memcpy(buffer, albuff + (address & 3), (size * count));
|
||||
free(albuff);
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user