Commit b1886213 authored by Fabio Utzig's avatar Fabio Utzig
Browse files

Fix hang when file has a size multiple of 512

When trying to write a file which has size multiple of
block_size, the last write would try to write 0 bytes
which caused the ICDI firmware to hang. Now checking and
skipping if that's the case.
parent eff6c106
......@@ -516,7 +516,12 @@ static int write_firmware(libusb_device_handle *handle, FILE *f)
return LIBUSB_ERROR_OTHER;
}
FLASH_WRITE(addr, flash_block, rdbytes);
/*
* Avoid writing a buffer with zero-sized content which can
* happen when the input file has a size multiple of flash_block
*/
if (rdbytes)
FLASH_WRITE(addr, flash_block, rdbytes);
}
if (do_verify) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment