1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

Print out mismatches when verify fails

This commit is contained in:
Alex Forencich 2021-09-13 13:50:27 -07:00
parent 9da588cf73
commit dfe0dd38f0

View File

@ -985,6 +985,25 @@ int main(int argc, char *argv[])
if (memcmp(pri_buf, pri_check_buf, len_int) || memcmp(sec_buf, sec_check_buf, len_int)) if (memcmp(pri_buf, pri_check_buf, len_int) || memcmp(sec_buf, sec_check_buf, len_int))
{ {
fprintf(stderr, "Verify failed!\n"); fprintf(stderr, "Verify failed!\n");
for (size_t k = 0; k < len; k++)
{
if (pri_buf[k] != pri_check_buf[k])
{
fprintf(stderr, "primary flash offset 0x%08lx: expected 0x%02x, read 0x%02x\n",
k, pri_buf[k] & 0xff, pri_check_buf[k] & 0xff);
}
}
for (size_t k = 0; k < len; k++)
{
if (sec_buf[k] != sec_check_buf[k])
{
fprintf(stderr, "secondary flash offset 0x%08lx: expected 0x%02x, read 0x%02x\n",
k, sec_buf[k] & 0xff, sec_check_buf[k] & 0xff);
}
}
ret = -1; ret = -1;
} }
else else
@ -1035,6 +1054,16 @@ int main(int argc, char *argv[])
if (memcmp(segment, check_buf, len)) if (memcmp(segment, check_buf, len))
{ {
fprintf(stderr, "Verify failed!\n"); fprintf(stderr, "Verify failed!\n");
for (size_t k = 0; k < len; k++)
{
if (segment[k] != check_buf[k])
{
fprintf(stderr, "flash offset 0x%08lx: expected 0x%02x, read 0x%02x\n",
k, segment[k] & 0xff, check_buf[k] & 0xff);
}
}
ret = -1; ret = -1;
} }
else else