flash/nor/core, target: don't ask for working mem if no target algo

The command 'flash erase_check' showed the message
'Running slow fallback erase check - add working memory'
even in the case the target didn't implement blank_check_memory.

Change return code of target_blank_check_memory() in this case
and sense it in default_flash_blank_check() and show a message
without a request for working memory.

Change-Id: I7cf9bf77742964b4f377c9ce48ca689e57d0882f
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6765
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
This commit is contained in:
Tomas Vanek 2021-11-19 22:03:44 +01:00
parent bce93f6d51
commit cc8b491856
2 changed files with 6 additions and 2 deletions

View File

@ -429,7 +429,11 @@ int default_flash_blank_check(struct flash_bank *bank)
bank->sectors[i].is_erased = block_array[i].result;
retval = ERROR_OK;
} else {
LOG_USER("Running slow fallback erase check - add working memory");
if (retval == ERROR_NOT_IMPLEMENTED)
LOG_USER("Running slow fallback erase check");
else
LOG_USER("Running slow fallback erase check - add working memory");
retval = default_flash_mem_blank_check(bank);
}
free(block_array);

View File

@ -2590,7 +2590,7 @@ int target_blank_check_memory(struct target *target,
}
if (!target->type->blank_check_memory)
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
return ERROR_NOT_IMPLEMENTED;
return target->type->blank_check_memory(target, blocks, num_blocks, erased_value);
}