Revert to honoring the return code from pgm->pgm_enable() within the

stk500 initialization routine.  However, allow one to use the -F
option to ignore a bad return code from that function.  I think this
still allows what Joerg intended, i.e., providing a way to still get
into terminal mode so that one can recover from setting bad STK500
values which may keep the chip from entering programming mode.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@359 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Brian S. Dean 2003-08-31 15:40:59 +00:00
parent 6acb859507
commit ede8a48d52
2 changed files with 9 additions and 15 deletions

View File

@ -1258,8 +1258,14 @@ int main(int argc, char * argv [])
rc = pgm->initialize(pgm, p);
if (rc < 0) {
fprintf(stderr, "%s: initialization failed, rc=%d\n", progname, rc);
exitrc = 1;
goto main_exit;
if (!ovsigck) {
fprintf(stderr, "%sDouble check connections and try again, "
"or use -F to override\n"
"%sthis check.\n\n",
progbuf, progbuf);
exitrc = 1;
goto main_exit;
}
}
/* indicate ready */

View File

@ -540,19 +540,7 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
}
}
pgm->program_enable(pgm, p);
/*
* Return success even if program_enable() failed. Otherwise, if
* someone has turned off the STK500 oscillator (or set it to an
* unreasonably slow master clock), they were hosed at this point,
* since to reset fosc to a reasonable value, they at least need to
* get avrdude to start up in terminal mode. The luser has already
* seen a "failed to enter programming mode" message in that case,
* and he also needs to specify -F at program startup since the
* device ID bytes cannot be read in this situation.
*/
return 0;
return pgm->program_enable(pgm, p);
}