* main.c: Remember whether the device initialization worked, and

allow to continue with -F if it failed yet do not attempt to
perform anything on the device itself.  That way, -tF could be
specified for programmers like the STK500/STK600 even without a
device connected, just in order to allow changing parameters on
the programmer itself.
* avrdude.1: Document that possible use of the -F option.
* doc/avrdude.texi: (Ditto.)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@779 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2008-07-29 21:26:55 +00:00
parent 7f29eb67ea
commit 3673174077
5 changed files with 50 additions and 13 deletions

View File

@ -1,3 +1,14 @@
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* main.c: Remember whether the device initialization worked, and
allow to continue with -F if it failed yet do not attempt to
perform anything on the device itself. That way, -tF could be
specified for programmers like the STK500/STK600 even without a
device connected, just in order to allow changing parameters on
the programmer itself.
* avrdude.1: Document that possible use of the -F option.
* doc/avrdude.texi: (Ditto.)
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de> 2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c (stk600_xprog_paged_write): Fix a fatal miscalculation * stk500v2.c (stk600_xprog_paged_write): Fix a fatal miscalculation

4
NEWS
View File

@ -28,6 +28,10 @@ Current:
* Add support for ATxmega128A1 (including the revision D engineering * Add support for ATxmega128A1 (including the revision D engineering
samples) for STK600 tools using PDI samples) for STK600 tools using PDI
* The option combination -tF now enters terminal mode even if the
device initialization failed, so the user can modify programmer
parameters (like Vtarget).
Version 5.5: Version 5.5:
* Add support for the USBtinyISP programmer (patch #6233) * Add support for the USBtinyISP programmer (patch #6233)

View File

@ -367,6 +367,12 @@ reasonable before continuing. Since it can happen from time to time
that a device has a broken (erased or overwritten) device signature that a device has a broken (erased or overwritten) device signature
but is otherwise operating normally, this options is provided to but is otherwise operating normally, this options is provided to
override the check. override the check.
Also, for programmers like the Atmel STK500 and STK600 which can
adjust parameters local to the programming tool (independent of an
actual connection to a target controller), this option can be used
together with
.Fl t
to continue in terminal mode.
.It Fl i Ar delay .It Fl i Ar delay
For bitbang-type programmers, delay for approximately For bitbang-type programmers, delay for approximately
.Ar delay .Ar delay

View File

@ -563,6 +563,10 @@ the part is reasonable before continuing. Since it can happen from time
to time that a device has a broken (erased or overwritten) device to time that a device has a broken (erased or overwritten) device
signature but is otherwise operating normally, this options is provided signature but is otherwise operating normally, this options is provided
to override the check. to override the check.
Also, for programmers like the Atmel STK500 and STK600 which can
adjust parameters local to the programming tool (independent of an
actual connection to a target controller), this option can be used
together with @option{-t} to continue in terminal mode.
@item -i @var{delay} @item -i @var{delay}
For bitbang-type programmers, delay for approximately For bitbang-type programmers, delay for approximately

24
main.c
View File

@ -279,6 +279,7 @@ int main(int argc, char * argv [])
int ispdelay; /* Specify the delay for ISP clock */ int ispdelay; /* Specify the delay for ISP clock */
int safemode; /* Enable safemode, 1=safemode on, 0=normal */ int safemode; /* Enable safemode, 1=safemode on, 0=normal */
int silentsafe; /* Don't ask about fuses, 1=silent, 0=normal */ int silentsafe; /* Don't ask about fuses, 1=silent, 0=normal */
int init_ok; /* Device initialization worked well */
unsigned char safemode_lfuse = 0xff; unsigned char safemode_lfuse = 0xff;
unsigned char safemode_hfuse = 0xff; unsigned char safemode_hfuse = 0xff;
unsigned char safemode_efuse = 0xff; unsigned char safemode_efuse = 0xff;
@ -823,8 +824,8 @@ int main(int argc, char * argv [])
/* /*
* initialize the chip in preperation for accepting commands * initialize the chip in preperation for accepting commands
*/ */
rc = pgm->initialize(pgm, p); init_ok = (rc = pgm->initialize(pgm, p)) >= 0;
if (rc < 0) { if (!init_ok) {
fprintf(stderr, "%s: initialization failed, rc=%d\n", progname, rc); fprintf(stderr, "%s: initialization failed, rc=%d\n", progname, rc);
if (!ovsigck) { if (!ovsigck) {
fprintf(stderr, "%sDouble check connections and try again, " fprintf(stderr, "%sDouble check connections and try again, "
@ -851,6 +852,7 @@ int main(int argc, char * argv [])
* against 0xffffff / 0x000000 should ensure that the signature bytes * against 0xffffff / 0x000000 should ensure that the signature bytes
* are valid. * are valid.
*/ */
if (init_ok) {
rc = avr_signature(pgm, p); rc = avr_signature(pgm, p);
if (rc != 0) { if (rc != 0) {
fprintf(stderr, "%s: error reading signature data, rc=%d\n", fprintf(stderr, "%s: error reading signature data, rc=%d\n",
@ -858,6 +860,7 @@ int main(int argc, char * argv [])
exitrc = 1; exitrc = 1;
goto main_exit; goto main_exit;
} }
}
sig = avr_locate_mem(p, "signature"); sig = avr_locate_mem(p, "signature");
if (sig == NULL) { if (sig == NULL) {
@ -917,7 +920,7 @@ int main(int argc, char * argv [])
} }
} }
if (safemode == 1) { if (init_ok && safemode == 1) {
/* If safemode is enabled, go ahead and read the current low, high, /* If safemode is enabled, go ahead and read the current low, high,
and extended fuse bytes as needed */ and extended fuse bytes as needed */
@ -989,7 +992,8 @@ int main(int argc, char * argv [])
* *
* The cycle count will be displayed anytime it will be changed later. * The cycle count will be displayed anytime it will be changed later.
*/ */
if ((set_cycles == -1) && ((erase == 0) || (do_cycles == 0))) { if (init_ok &&
(set_cycles == -1) && ((erase == 0) || (do_cycles == 0))) {
/* /*
* see if the cycle count in the last four bytes of eeprom seems * see if the cycle count in the last four bytes of eeprom seems
* reasonable * reasonable
@ -1005,7 +1009,7 @@ int main(int argc, char * argv [])
} }
} }
if (set_cycles != -1) { if (init_ok && set_cycles != -1) {
rc = avr_get_cycle_count(pgm, p, &cycles); rc = avr_get_cycle_count(pgm, p, &cycles);
if (rc == 0) { if (rc == 0) {
/* /*
@ -1028,7 +1032,7 @@ int main(int argc, char * argv [])
} }
if (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
* before the chip can accept new programming * before the chip can accept new programming
@ -1047,6 +1051,14 @@ int main(int argc, char * argv [])
exitrc = terminal_mode(pgm, p); exitrc = terminal_mode(pgm, p);
} }
if (!init_ok) {
/*
* If we came here by the -tF options, bail out now.
*/
exitrc = 1;
goto main_exit;
}
for (ln=lfirst(updates); ln; ln=lnext(ln)) { for (ln=lfirst(updates); ln; ln=lnext(ln)) {
upd = ldata(ln); upd = ldata(ln);