X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Fimage.c;h=c0aabecd5838cf47c3628053fbc81292da90a643;hp=8f437c035797a7901ed9295f2ada0cc5427d89b2;hb=3a550e5b5fe011e526b150a5d234b48e8e2aaad6;hpb=4e079d18bffaed0372ab5b2f13cfd5d14db79d21 diff --git a/src/target/image.c b/src/target/image.c index 8f437c0357..c0aabecd58 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -347,7 +347,6 @@ static int image_ihex_buffer_complete_inner(struct image *image, char *lpszLine, } sscanf(&lpszLine[bytes_read], "%2" SCNx32 , &checksum); - bytes_read += 2; if ((uint8_t)checksum != (uint8_t)(~cal_checksum + 1)) { @@ -546,9 +545,7 @@ static int image_elf_read_section(struct image *image, int section, uint32_t off LOG_ERROR("cannot read ELF segment content, read failed"); return retval; } - buffer += read_size; size -= read_size; - offset += read_size; *size_read += read_size; /* need more data ? */ if (!size) @@ -718,7 +715,6 @@ static int image_mot_buffer_complete_inner(struct image *image, char *lpszLine, /* account for checksum, will always be 0xFF */ sscanf(&lpszLine[bytes_read], "%2" SCNx32 , &checksum); cal_checksum += (uint8_t)checksum; - bytes_read += 2; if (cal_checksum != 0xFF) { @@ -906,7 +902,7 @@ int image_read_section(struct image *image, int section, uint32_t offset, uint32 { LOG_DEBUG("read past end of section: 0x%8.8" PRIx32 " + 0x%8.8" PRIx32 " > 0x%8.8" PRIx32 "", offset, size, image->sections[section].size); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (image->type == IMAGE_BINARY) @@ -915,7 +911,7 @@ int image_read_section(struct image *image, int section, uint32_t offset, uint32 /* only one section in a plain binary */ if (section != 0) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; /* seek to offset */ if ((retval = fileio_seek(&image_binary->fileio, offset)) != ERROR_OK) @@ -1003,7 +999,7 @@ int image_add_section(struct image *image, uint32_t base, uint32_t size, int fla /* only image builder supports adding sections */ if (image->type != IMAGE_BUILDER) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; /* see if there's a previous section */ if (image->num_sections)