On verify always verify full input file

This commit is contained in:
Stefan Rueger 2022-04-28 17:53:10 +01:00
parent 52734bafc6
commit f47ec634f8
3 changed files with 9 additions and 7 deletions

View File

@ -1446,16 +1446,17 @@ static int fmt_autodetect(char * fname)
int fileio(int op, char * filename, FILEFMT format,
int fileio(int oprwv, char * filename, FILEFMT format,
struct avrpart * p, char * memtype, int size)
{
int rc;
int op, rc;
FILE * f;
char * fname;
struct fioparms fio;
AVRMEM * mem;
int using_stdio;
op = oprwv == FIO_READ_FOR_VERIFY? FIO_READ: oprwv;
mem = avr_locate_mem(p, memtype);
if (mem == NULL) {
avrdude_message(MSG_INFO, "fileio(): memory type \"%s\" not configured for device \"%s\"\n",
@ -1585,8 +1586,8 @@ int fileio(int op, char * filename, FILEFMT format,
return -1;
}
/* on reading flash set the size to location of highest non-0xff byte */
if (rc > 0 && op == FIO_READ) {
/* on reading flash other than for verify set the size to location of highest non-0xff byte */
if (rc > 0 && oprwv == FIO_READ) {
int hiaddr = avr_mem_hiaddr(mem);
if(hiaddr < rc) /* if trailing-0xff not disabled */

View File

@ -826,7 +826,8 @@ struct fioparms {
enum {
FIO_READ,
FIO_WRITE
FIO_WRITE,
FIO_READ_FOR_VERIFY,
};
#ifdef __cplusplus
@ -835,7 +836,7 @@ extern "C" {
char * fmtstr(FILEFMT format);
int fileio(int op, char * filename, FILEFMT format,
int fileio(int oprwv, char * filename, FILEFMT format,
struct avrpart * p, char * memtype, int size);
#ifdef __cplusplus

View File

@ -341,7 +341,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
progname, mem->desc, alias_mem_desc, upd->filename);
}
rc = fileio(FIO_READ, upd->filename, upd->format, p, upd->memtype, -1);
rc = fileio(FIO_READ_FOR_VERIFY, upd->filename, upd->format, p, upd->memtype, -1);
if (rc < 0) {
avrdude_message(MSG_INFO, "%s: read from file '%s' failed\n",
progname, upd->filename);