Better error checking in memory access.

Change-Id: I985afa433a09f833137f2e244b7eaad2630f6b1a
This commit is contained in:
Tim Newsome 2017-02-20 17:53:18 -08:00
parent aba0c0973d
commit 4e8cf4aeb5
1 changed files with 8 additions and 4 deletions

View File

@ -1946,9 +1946,11 @@ static int read_memory(struct target *target, uint32_t address,
write_program(target, program);
program_delete(program);
execute_abstract_command(target,
if (execute_abstract_command(target,
AC_ACCESS_REGISTER_PREEXEC |
abstract_register_size(xlen(target)) | reg_number_to_no(S1));
abstract_register_size(xlen(target)) | reg_number_to_no(S1)) != ERROR_OK) {
return ERROR_FAIL;
}
dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_AUTOEXEC0 | DMI_ABSTRACTCS_CMDERR);
for (uint32_t i = 0; i < count; i++) {
@ -2029,9 +2031,11 @@ static int write_memory(struct target *target, uint32_t address,
dmi_write(target, DMI_DATA0, value);
if (i == 0) {
execute_abstract_command(target,
if (execute_abstract_command(target,
AC_ACCESS_REGISTER_WRITE | AC_ACCESS_REGISTER_POSTEXEC |
abstract_register_size(xlen(target)) | reg_number_to_no(S1));
abstract_register_size(xlen(target)) | reg_number_to_no(S1)) != ERROR_OK) {
return ERROR_FAIL;
}
dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_AUTOEXEC0 | DMI_ABSTRACTCS_CMDERR);
} else {
uint32_t abstractcs;