aboutsummaryrefslogtreecommitdiff
path: root/src/target/target.c
diff options
context:
space:
mode:
authorAndreas Fritiofson <andreas.fritiofson@gmail.com>2016-01-13 20:39:28 +0100
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>2019-10-18 09:17:24 +0100
commitf545044c2a37a44a51e2a07bdcd52df4eed86a4a (patch)
treedea846b9eddb17b4ae743c5b7b15b314deff0bbc /src/target/target.c
parent3a50bb46dc084999f6f7aee8913858ccced49db4 (diff)
target: Switch to target_read_buffer() in verify_image fallback
The current code checks the count to determine whether to read bytes or words. However it fails to consider whether the base address is suitably aligned. Instead use the target_read_buffer() function which is for exactly this purpose and generates optimal accesses with natural alignment. Change-Id: I32ab5417890ee2219902df1529bc220fe353b4c7 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3217 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/target/target.c')
-rw-r--r--src/target/target.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 51fdff34..03b6f4eb 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3636,14 +3636,7 @@ static COMMAND_HELPER(handle_verify_image_command_internal, enum verify_mode ver
data = malloc(buf_cnt);
- /* Can we use 32bit word accesses? */
- int size = 1;
- int count = buf_cnt;
- if ((count % 4) == 0) {
- size *= 4;
- count /= 4;
- }
- retval = target_read_memory(target, image.sections[i].base_address, size, count, data);
+ retval = target_read_buffer(target, image.sections[i].base_address, buf_cnt, data);
if (retval == ERROR_OK) {
uint32_t t;
for (t = 0; t < buf_cnt; t++) {