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>
This commit is contained in:
parent
3a50bb46dc
commit
f545044c2a
|
@ -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++) {
|
||||
|
|
Loading…
Reference in New Issue