target: clean up return value of target_type::blank_check_memory()

The functions in struct target_type::blank_check_memory() return
either an OpenOCD error or a positive value that indicates the
number of blocks checked.

To prevent the mix of error codes and returned values, return the
value through an additional parameter 'checked' and then return
ERROR_OK.

While there:
- change to unsigned int the parameter 'num_blocks';
- in armv7m_blank_check_memory() verify that the working area can
  contain at least two 'algo_block'.

Change-Id: Ie22f5816819bc77ec611c3f251373d026ed9f784
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9386
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Antonio Borneo
2025-12-25 15:53:07 +01:00
parent 5151c98455
commit 3c1bd50217
12 changed files with 51 additions and 39 deletions

View File

@@ -662,8 +662,8 @@ int target_read_buffer(struct target *target,
int target_checksum_memory(struct target *target,
target_addr_t address, uint32_t size, uint32_t *crc);
int target_blank_check_memory(struct target *target,
struct target_memory_check_block *blocks, int num_blocks,
uint8_t erased_value);
struct target_memory_check_block *blocks, unsigned int num_blocks,
uint8_t erased_value, unsigned int *checked);
int target_wait_state(struct target *target, enum target_state state, unsigned int ms);
/**