summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-11 05:57:51 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-11 05:57:51 +0000
commitc5f54c53334b7fcc729b06cf1a4c14bd2eff26a1 (patch)
tree3d802a727ba13482d97742d9c3848669005214e5
parent49d0ea2126aded31913cef0c98b36856caa0450f (diff)
downloadopenocd_libswd-c5f54c53334b7fcc729b06cf1a4c14bd2eff26a1.tar.gz
openocd_libswd-c5f54c53334b7fcc729b06cf1a4c14bd2eff26a1.tar.bz2
openocd_libswd-c5f54c53334b7fcc729b06cf1a4c14bd2eff26a1.tar.xz
openocd_libswd-c5f54c53334b7fcc729b06cf1a4c14bd2eff26a1.zip
Nicolas Pitre <nico@cam.org> tighten error checking in bulk_write
git-svn-id: svn://svn.berlios.de/openocd/trunk@2687 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/target/feroceon.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/target/feroceon.c b/src/target/feroceon.c
index 536b678b..ee96049d 100644
--- a/src/target/feroceon.c
+++ b/src/target/feroceon.c
@@ -591,9 +591,20 @@ int feroceon_bulk_write_memory(target_t *target, uint32_t address, uint32_t coun
buffer += 4;
}
- target_halt(target);
- while (target->state != TARGET_HALTED)
- target_poll(target);
+ retval = target_halt(target);
+ if (retval == ERROR_OK)
+ retval = target_wait_state(target, TARGET_HALTED, 500);
+ if (retval == ERROR_OK) {
+ uint32_t endaddress =
+ buf_get_u32(armv4_5->core_cache->reg_list[0].value, 0, 32);
+ if (endaddress != address + count*4) {
+ LOG_ERROR("DCC write failed,"
+ " expected end address 0x%08" PRIx32
+ " got 0x%0" PRIx32 "",
+ address + count*4, endaddress);
+ retval = ERROR_FAIL;
+ }
+ }
/* restore target state */
for (i = 0; i <= 5; i++)
@@ -607,7 +618,7 @@ int feroceon_bulk_write_memory(target_t *target, uint32_t address, uint32_t coun
armv4_5->core_cache->reg_list[15].dirty = 1;
armv4_5->core_state = core_state;
- return ERROR_OK;
+ return retval;
}
int feroceon_init_target(struct command_context_s *cmd_ctx, struct target_s *target)