aboutsummaryrefslogtreecommitdiff
path: root/src/target/target.c
diff options
context:
space:
mode:
authorTomas Vanek <vanekt@fbl.cz>2017-11-23 09:18:24 +0100
committerTomas Vanek <vanekt@fbl.cz>2018-04-10 06:16:40 +0100
commiteb8912ec38c0fd6867d2b5a88b40549f791ce7bb (patch)
treed5cca832fad51f70f1202506dd6cecfedd561378 /src/target/target.c
parentf00d9bb1d7e6d52e62e7cfc402fda96f3544d911 (diff)
target, flash: prepare infrastructure for multi-block blank check
'flash erase_check' command runs a check algorithm on a target if possible. The algorithm is run repeatedly for each flash sector. Unfortunately every start and stop of the algorithm impose not negligible overhead. In practice it means checking is faster than plain read only for sectors of size approx 4 kByte or bigger. And checking sectors as short as 512 bytes runs approx 4 times slower than plain read. The patch changes API call target_blank_check_memory() and related to take an array of sectors (or arbitrary memory blocks). Changes in target-specific checking routines are kept minimal. They use only the first block from the array and process it by the unchanged algorithm. default_flash_blank_check() routine repeats target_blank_check_memory() until all blocks are checked, so it works with both multi-block and single-block based checkers. Change-Id: I0e6c60f2d71364c9c07c09416b04de9268807f5e Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4297 Tested-by: jenkins Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Diffstat (limited to 'src/target/target.c')
-rw-r--r--src/target/target.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 729a31bf..75555c16 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2251,21 +2251,19 @@ int target_checksum_memory(struct target *target, target_addr_t address, uint32_
return retval;
}
-int target_blank_check_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t* blank,
+int target_blank_check_memory(struct target *target,
+ struct target_memory_check_block *blocks, int num_blocks,
uint8_t erased_value)
{
- int retval;
if (!target_was_examined(target)) {
LOG_ERROR("Target not examined yet");
return ERROR_FAIL;
}
- if (target->type->blank_check_memory == 0)
+ if (target->type->blank_check_memory == NULL)
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
- retval = target->type->blank_check_memory(target, address, size, blank, erased_value);
-
- return retval;
+ return target->type->blank_check_memory(target, blocks, num_blocks, erased_value);
}
int target_read_u64(struct target *target, target_addr_t address, uint64_t *value)