Remove the erase cycle counter (options -y / -Y).
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1203 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
770d26689b
commit
8ed6920948
|
@ -1,3 +1,11 @@
|
||||||
|
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||||
|
|
||||||
|
* avrdude.h: Remove the erase cycle counter (options -y / -Y).
|
||||||
|
* avr.c: (Dito.)
|
||||||
|
* main.c: (Dito.)
|
||||||
|
* avrdude.1: Undocument -y / -Y.
|
||||||
|
* doc/avrdude.texi: (Dito.)
|
||||||
|
|
||||||
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||||
|
|
||||||
bug #39691 Buffer overrun when reading EEPROM byte with JTAGICE3
|
bug #39691 Buffer overrun when reading EEPROM byte with JTAGICE3
|
||||||
|
|
4
NEWS
4
NEWS
|
@ -101,8 +101,8 @@ Current:
|
||||||
everything mentioned in the file (even in case the file has
|
everything mentioned in the file (even in case the file has
|
||||||
large 0xFF blocks).
|
large 0xFF blocks).
|
||||||
|
|
||||||
* The EEPROM contents for the cyclecounter is only read when
|
* The eraes cycle counter (formerly options -y / -Y) has been
|
||||||
explicitly requested by a -y or -Y option.
|
removed.
|
||||||
|
|
||||||
* The -U option now accepts ELF files as input files, and extracts
|
* The -U option now accepts ELF files as input files, and extracts
|
||||||
the appropriate section contents that matches the requested memory
|
the appropriate section contents that matches the requested memory
|
||||||
|
|
21
avr.c
21
avr.c
|
@ -1172,31 +1172,10 @@ int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles)
|
||||||
|
|
||||||
int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||||
{
|
{
|
||||||
int cycles;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (do_cycles) {
|
|
||||||
rc = avr_get_cycle_count(pgm, p, &cycles);
|
|
||||||
/*
|
|
||||||
* Don't update the cycle counter, if read failed
|
|
||||||
*/
|
|
||||||
if(rc != 0) {
|
|
||||||
do_cycles = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = pgm->chip_erase(pgm, p);
|
rc = pgm->chip_erase(pgm, p);
|
||||||
|
|
||||||
/*
|
|
||||||
* Don't update the cycle counter, if erase failed
|
|
||||||
*/
|
|
||||||
if (do_cycles && (rc == 0)) {
|
|
||||||
cycles++;
|
|
||||||
fprintf(stderr, "%s: erase-rewrite cycle count is now %d\n",
|
|
||||||
progname, cycles);
|
|
||||||
avr_put_cycle_count(pgm, p, cycles);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
28
avrdude.1
28
avrdude.1
|
@ -18,7 +18,7 @@
|
||||||
.\"
|
.\"
|
||||||
.\" $Id$
|
.\" $Id$
|
||||||
.\"
|
.\"
|
||||||
.Dd DATE May 16, 2013
|
.Dd DATE September 3, 2013
|
||||||
.Os
|
.Os
|
||||||
.Dt AVRDUDE 1
|
.Dt AVRDUDE 1
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -50,8 +50,6 @@
|
||||||
.Op Fl v
|
.Op Fl v
|
||||||
.Op Fl x Ar extended_param
|
.Op Fl x Ar extended_param
|
||||||
.Op Fl V
|
.Op Fl V
|
||||||
.Op Fl y
|
|
||||||
.Op Fl Y
|
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm Avrdude
|
.Nm Avrdude
|
||||||
is a program for downloading code and data to Atmel AVR
|
is a program for downloading code and data to Atmel AVR
|
||||||
|
@ -673,30 +671,6 @@ to the chosen programmer implementation as an extended parameter.
|
||||||
The interpretation of the extended parameter depends on the
|
The interpretation of the extended parameter depends on the
|
||||||
programmer itself.
|
programmer itself.
|
||||||
See below for a list of programmers accepting extended parameters.
|
See below for a list of programmers accepting extended parameters.
|
||||||
.It Fl y
|
|
||||||
Tells
|
|
||||||
.Nm
|
|
||||||
to use the last four bytes of the connected parts' EEPROM memory to
|
|
||||||
track the number of times the device has been erased. When this
|
|
||||||
option is used and the
|
|
||||||
.Fl e
|
|
||||||
flag is specified to generate a chip erase, the previous counter will
|
|
||||||
be saved before the chip erase, it is then incremented, and written
|
|
||||||
back after the erase cycle completes. Presumably, the device would
|
|
||||||
only be erased just before being programmed, and thus, this can be
|
|
||||||
utilized to give an indication of how many erase-rewrite cycles the
|
|
||||||
part has undergone. Since the FLASH memory can only endure a finite
|
|
||||||
number of erase-rewrite cycles, one can use this option to track when
|
|
||||||
a part is nearing the limit. The typical limit for Atmel AVR FLASH is
|
|
||||||
1000 cycles. Of course, if the application needs the last four bytes
|
|
||||||
of EEPROM memory, this option should not be used.
|
|
||||||
.It Fl Y Ar cycles
|
|
||||||
Instructs
|
|
||||||
.Nm
|
|
||||||
to initialize the erase-rewrite cycle counter residing at the last four
|
|
||||||
bytes of EEPROM memory to the specified value. If the application
|
|
||||||
needs the last four bytes of EEPROM memory, this option should not be
|
|
||||||
used.
|
|
||||||
.El
|
.El
|
||||||
.Ss Terminal mode
|
.Ss Terminal mode
|
||||||
In this mode,
|
In this mode,
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
extern char * progname; /* name of program, for messages */
|
extern char * progname; /* name of program, for messages */
|
||||||
extern char progbuf[]; /* spaces same length as progname */
|
extern char progbuf[]; /* spaces same length as progname */
|
||||||
|
|
||||||
extern int do_cycles; /* track erase-rewrite cycles (-y) */
|
|
||||||
extern int ovsigck; /* override signature check (-F) */
|
extern int ovsigck; /* override signature check (-F) */
|
||||||
extern int verbose; /* verbosity level (-v, -vv, ...) */
|
extern int verbose; /* verbosity level (-v, -vv, ...) */
|
||||||
extern int quell_progress; /* quiteness level (-q, -qq) */
|
extern int quell_progress; /* quiteness level (-q, -qq) */
|
||||||
|
|
|
@ -709,27 +709,6 @@ an extended parameter. The interpretation of the extended parameter
|
||||||
depends on the programmer itself. See below for a list of programmers
|
depends on the programmer itself. See below for a list of programmers
|
||||||
accepting extended parameters.
|
accepting extended parameters.
|
||||||
|
|
||||||
@item -y
|
|
||||||
Tells AVRDUDE to use the last four bytes of the connected parts' EEPROM
|
|
||||||
memory to track the number of times the device has been erased. When
|
|
||||||
this option is used and the @option{-e} flag is specified to generate a
|
|
||||||
chip erase, the previous counter will be saved before the chip erase, it
|
|
||||||
is then incremented, and written back after the erase cycle completes.
|
|
||||||
Presumably, the device would only be erased just before being
|
|
||||||
programmed, and thus, this can be utilized to give an indication of how
|
|
||||||
many erase-rewrite cycles the part has undergone. Since the FLASH
|
|
||||||
memory can only endure a finite number of erase-rewrite cycles, one can
|
|
||||||
use this option to track when a part is nearing the limit. The typical
|
|
||||||
limit for Atmel AVR FLASH is 1000 cycles. Of course, if the
|
|
||||||
application needs the last four bytes of EEPROM memory, this option
|
|
||||||
should not be used.
|
|
||||||
|
|
||||||
@item -Y @var{cycles}
|
|
||||||
Instructs AVRDUDE to initialize the erase-rewrite cycle counter residing
|
|
||||||
at the last four bytes of EEPROM memory to the specified value. If the
|
|
||||||
application needs the last four bytes of EEPROM memory, this option
|
|
||||||
should not be used.
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@page
|
@page
|
||||||
|
|
59
main.c
59
main.c
|
@ -82,7 +82,6 @@ static PROGRAMMER * pgm;
|
||||||
/*
|
/*
|
||||||
* global options
|
* global options
|
||||||
*/
|
*/
|
||||||
int do_cycles; /* track erase-rewrite cycles */
|
|
||||||
int verbose; /* verbose output */
|
int verbose; /* verbose output */
|
||||||
int quell_progress; /* un-verebose output */
|
int quell_progress; /* un-verebose output */
|
||||||
int ovsigck; /* 1=override sig check, 0=don't */
|
int ovsigck; /* 1=override sig check, 0=don't */
|
||||||
|
@ -323,8 +322,6 @@ int main(int argc, char * argv [])
|
||||||
char * partdesc; /* part id */
|
char * partdesc; /* part id */
|
||||||
char sys_config[PATH_MAX]; /* system wide config file */
|
char sys_config[PATH_MAX]; /* system wide config file */
|
||||||
char usr_config[PATH_MAX]; /* per-user config file */
|
char usr_config[PATH_MAX]; /* per-user config file */
|
||||||
int cycles; /* erase-rewrite cycles */
|
|
||||||
int set_cycles; /* value to set the erase-rewrite cycles to */
|
|
||||||
char * e; /* for strtol() error checking */
|
char * e; /* for strtol() error checking */
|
||||||
int baudrate; /* override default programmer baud rate */
|
int baudrate; /* override default programmer baud rate */
|
||||||
double bitclock; /* Specify programmer bit clock (JTAG ICE) */
|
double bitclock; /* Specify programmer bit clock (JTAG ICE) */
|
||||||
|
@ -405,8 +402,6 @@ int main(int argc, char * argv [])
|
||||||
pgm = NULL;
|
pgm = NULL;
|
||||||
programmer = default_programmer;
|
programmer = default_programmer;
|
||||||
verbose = 0;
|
verbose = 0;
|
||||||
do_cycles = 0;
|
|
||||||
set_cycles = -1;
|
|
||||||
baudrate = 0;
|
baudrate = 0;
|
||||||
bitclock = 0.0;
|
bitclock = 0.0;
|
||||||
ispdelay = 0;
|
ispdelay = 0;
|
||||||
|
@ -588,17 +583,13 @@ int main(int argc, char * argv [])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'y':
|
case 'y':
|
||||||
do_cycles = 1;
|
fprintf(stderr, "%s: erase cycle counter no longer supported\n",
|
||||||
|
progname);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Y':
|
case 'Y':
|
||||||
set_cycles = strtol(optarg, &e, 0);
|
fprintf(stderr, "%s: erase cycle counter no longer supported\n",
|
||||||
if ((e == optarg) || (*e != 0)) {
|
progname);
|
||||||
fprintf(stderr, "%s: invalid cycle count '%s'\n",
|
|
||||||
progname, optarg);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
do_cycles = 1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?': /* help */
|
case '?': /* help */
|
||||||
|
@ -1176,48 +1167,6 @@ int main(int argc, char * argv [])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Display cycle count, if and only if it is not set later on.
|
|
||||||
*
|
|
||||||
* The cycle count will be displayed anytime it will be changed later.
|
|
||||||
*/
|
|
||||||
if (init_ok && !(p->flags & AVRPART_AVR32) && do_cycles) {
|
|
||||||
/*
|
|
||||||
* see if the cycle count in the last four bytes of eeprom seems
|
|
||||||
* reasonable
|
|
||||||
*/
|
|
||||||
rc = avr_get_cycle_count(pgm, p, &cycles);
|
|
||||||
if (quell_progress < 2) {
|
|
||||||
if ((rc >= 0) && (cycles != 0)) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"%s: current erase-rewrite cycle count is %d\n",
|
|
||||||
progname, cycles);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (init_ok && set_cycles != -1 && !(p->flags & AVRPART_AVR32)) {
|
|
||||||
rc = avr_get_cycle_count(pgm, p, &cycles);
|
|
||||||
if (rc == 0) {
|
|
||||||
/*
|
|
||||||
* only attempt to update the cycle counter if we can actually
|
|
||||||
* read the old value
|
|
||||||
*/
|
|
||||||
cycles = set_cycles;
|
|
||||||
if (quell_progress < 2) {
|
|
||||||
fprintf(stderr, "%s: setting erase-rewrite cycle count to %d\n",
|
|
||||||
progname, cycles);
|
|
||||||
}
|
|
||||||
rc = avr_put_cycle_count(pgm, p, cycles);
|
|
||||||
if (rc < 0) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"%s: WARNING: failed to update the erase-rewrite cycle "
|
|
||||||
"counter\n",
|
|
||||||
progname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (init_ok && erase) {
|
if (init_ok && erase) {
|
||||||
/*
|
/*
|
||||||
* erase the chip's flash and eeprom memories, this is required
|
* erase the chip's flash and eeprom memories, this is required
|
||||||
|
|
Loading…
Reference in New Issue