verify: display up to 128 diff's
Showing up to 128 differences. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>__archive__
parent
54f3f8e4c1
commit
31bbb3cf0c
|
@ -2682,6 +2682,7 @@ static COMMAND_HELPER(handle_verify_image_command_internal, int verify)
|
||||||
}
|
}
|
||||||
|
|
||||||
image_size = 0x0;
|
image_size = 0x0;
|
||||||
|
int diffs = 0;
|
||||||
retval = ERROR_OK;
|
retval = ERROR_OK;
|
||||||
for (i = 0; i < image.num_sections; i++)
|
for (i = 0; i < image.num_sections; i++)
|
||||||
{
|
{
|
||||||
|
@ -2716,7 +2717,10 @@ static COMMAND_HELPER(handle_verify_image_command_internal, int verify)
|
||||||
/* failed crc checksum, fall back to a binary compare */
|
/* failed crc checksum, fall back to a binary compare */
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
|
|
||||||
command_print(CMD_CTX, "checksum mismatch - attempting binary compare");
|
if (diffs == 0)
|
||||||
|
{
|
||||||
|
LOG_ERROR("checksum mismatch - attempting binary compare");
|
||||||
|
}
|
||||||
|
|
||||||
data = (uint8_t*)malloc(buf_cnt);
|
data = (uint8_t*)malloc(buf_cnt);
|
||||||
|
|
||||||
|
@ -2737,22 +2741,22 @@ static COMMAND_HELPER(handle_verify_image_command_internal, int verify)
|
||||||
if (data[t] != buffer[t])
|
if (data[t] != buffer[t])
|
||||||
{
|
{
|
||||||
command_print(CMD_CTX,
|
command_print(CMD_CTX,
|
||||||
"Verify operation failed address 0x%08x. Was 0x%02x instead of 0x%02x\n",
|
"diff %d address 0x%08x. Was 0x%02x instead of 0x%02x",
|
||||||
|
diffs,
|
||||||
(unsigned)(t + image.sections[i].base_address),
|
(unsigned)(t + image.sections[i].base_address),
|
||||||
data[t],
|
data[t],
|
||||||
buffer[t]);
|
buffer[t]);
|
||||||
|
if (diffs++ >= 127)
|
||||||
|
{
|
||||||
|
command_print(CMD_CTX, "More than 128 errors, the rest are not printed.");
|
||||||
free(data);
|
free(data);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
retval = ERROR_FAIL;
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if ((t%16384) == 0)
|
}
|
||||||
{
|
|
||||||
keep_alive();
|
keep_alive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -2766,6 +2770,10 @@ static COMMAND_HELPER(handle_verify_image_command_internal, int verify)
|
||||||
image_size += buf_cnt;
|
image_size += buf_cnt;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
|
if (diffs > 0)
|
||||||
|
{
|
||||||
|
retval = ERROR_FAIL;
|
||||||
|
}
|
||||||
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
|
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
|
||||||
{
|
{
|
||||||
command_print(CMD_CTX, "verified %" PRIu32 " bytes "
|
command_print(CMD_CTX, "verified %" PRIu32 " bytes "
|
||||||
|
|
Loading…
Reference in New Issue