diff --git a/avrdude/avr.c b/avrdude/avr.c index 36d21ea5..02207ea0 100644 --- a/avrdude/avr.c +++ b/avrdude/avr.c @@ -677,24 +677,6 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size, pgm->err_led(pgm, OFF); - if ((strcmp(m->desc, "flash")==0) || (strcmp(m->desc, "eeprom")==0)) { - if (pgm->paged_write != NULL) { - /* - * the programmer supports a paged mode write, perhaps more - * efficiently than we can read it directly, so use its routine - * instead - */ - if (m->paged) { - return pgm->paged_write(pgm, p, m, m->page_size, size); - } -#if 0 - else { - return pgm->paged_write(pgm, p, m, 32 /*pgm->page_size*/, size); - } -#endif - } - } - printed = 0; werror = 0; @@ -704,12 +686,24 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size, } else if (size > wsize) { fprintf(stderr, - "%s: WARNING: %d bytes requested, but memory region is only %d bytes\n" + "%s: WARNING: %d bytes requested, but memory region is only %d" + "bytes\n" "%sOnly %d bytes will actually be written\n", progname, size, wsize, progbuf, wsize); } + if ((strcmp(m->desc, "flash")==0) || (strcmp(m->desc, "eeprom")==0)) { + if (pgm->paged_write != NULL) { + /* + * the programmer supports a paged mode write, perhaps more + * efficiently than we can read it directly, so use its routine + * instead + */ + return pgm->paged_write(pgm, p, m, m->page_size, size); + } + } + for (i=0; ibuf[i]; if (verbose) { diff --git a/avrdude/stk500.c b/avrdude/stk500.c index e99bf034..add8c8f1 100644 --- a/avrdude/stk500.c +++ b/avrdude/stk500.c @@ -109,8 +109,8 @@ static int stk500_recv(PROGRAMMER * pgm, char * buf, int n) int nfds; int rc; - timeout.tv_sec = 0; - timeout.tv_usec = 500000; + timeout.tv_sec = 5; + timeout.tv_usec = 0; while (n) { FD_ZERO(&rfds); @@ -511,6 +511,8 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p) retry: tries++; + memset(buf, 0, sizeof(buf)); + /* * set device programming parameters */ @@ -879,9 +881,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned int n; if (page_size == 0) { - fprintf(stderr, "%s: stk500_paged_write(): invalid page size = %d\n", - progname, page_size); - return -1; + page_size = 16; } if (strcmp(m->desc, "flash") == 0) {