Add verify step to updater
This commit is contained in:
parent
5fb1612773
commit
e50e3f0ace
@ -97,7 +97,25 @@ exit:
|
||||
|
||||
int write_flash_from_buffer(const char *buffer, uint32_t len, uint32_t addr)
|
||||
{
|
||||
return flash_writer_write_to_memory((void *)addr, buffer, len);
|
||||
int res;
|
||||
uint32_t i;
|
||||
const char *verify_ptr = (const char *)addr;
|
||||
|
||||
res = flash_writer_write_to_memory((void *)addr, buffer, len);
|
||||
if (res) {
|
||||
uart_send_string("Error writing to flash!\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Verify the write */
|
||||
for (i = 0; i < len; i++) {
|
||||
if (*verify_ptr != buffer[i]) {
|
||||
uart_send_string("Error verifying written data!\r\n");
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int update_flash_from_file(const char *fname)
|
||||
|
Loading…
Reference in New Issue
Block a user