diff --git a/host/xmosdfu/xmosdfu.cpp b/host/xmosdfu/xmosdfu.cpp index a0aca676..44093a0f 100644 --- a/host/xmosdfu/xmosdfu.cpp +++ b/host/xmosdfu/xmosdfu.cpp @@ -307,8 +307,15 @@ int read_dfu_image(char *file) { unsigned int numBytes = 0; numBytes = dfu_upload(0, block_count, 64, block_data); + /* Upload is completed when dfu_upload() returns an empty block */ if (numBytes == 0) { + /* If upload is complete, but no block has been read, + issue a warning about the upgrade image + */ + if (block_count==0) { + printf("... WARNING: Upgrade image size is 0: check if image is present in the flash\n"); + } break; } fwrite(block_data, 1, block_size, outFile); @@ -338,8 +345,8 @@ static void print_usage(const char *program_name, const char *error_msg) print_device_list(stderr, " "); fprintf(stderr, " And COMMAND is one of:\n"); - fprintf(stderr, " --download : install a new firmware\n"); - fprintf(stderr, " --upload : extract a firmware image\n"); + fprintf(stderr, " --download : write an upgrade image\n"); + fprintf(stderr, " --upload : read the upgrade image\n"); fprintf(stderr, " --revertfactory : revert to the factory image\n"); fprintf(stderr, " --savecustomstate : \n"); fprintf(stderr, " --restorecustomstate : \n");