Handle improperly build image files gracefully

Images build improperly (by simply concatenating separate images) were accepted,
but anything after the first end-of-file record *silently* ignored. Now emit warning
for intel and motorola images upon non-whitespace after first end-of-file record but
continue reading anyway.
ST ships some images broken that way in their CubeMX packages ...

Change-Id: I0c5d08fa90070fed11fb805c5f0dc39817048176
Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-on: http://openocd.zylin.com/4281
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Andreas Bolsch
2017-10-28 19:39:35 +02:00
committed by Tomas Vanek
parent 38030e0115
commit 445dc23eb5
3 changed files with 303 additions and 262 deletions

View File

@@ -153,6 +153,11 @@ int fileio_close(struct fileio *fileio)
return retval;
}
int fileio_feof(struct fileio *fileio)
{
return feof(fileio->file);
}
int fileio_seek(struct fileio *fileio, size_t position)
{
int retval;

View File

@@ -46,6 +46,7 @@ struct fileio;
int fileio_open(struct fileio **fileio, const char *url,
enum fileio_access access_type, enum fileio_type type);
int fileio_close(struct fileio *fileio);
int fileio_feof(struct fileio *fileio);
int fileio_seek(struct fileio *fileio, size_t position);
int fileio_fgets(struct fileio *fileio, size_t size, void *buffer);

File diff suppressed because it is too large Load Diff