From fab896d9e43fabcdcc12a2634af51ebd261a1a7a Mon Sep 17 00:00:00 2001 From: "Brian S. Dean" Date: Sun, 31 Aug 2003 15:40:59 +0000 Subject: [PATCH] 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/avrdude@359 81a1dc3b-b13d-400b-aceb-764788c761c2 --- main.c | 10 ++++++++-- stk500.c | 14 +------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/main.c b/main.c index e2c1e27b..9dba4706 100644 --- a/main.c +++ b/main.c @@ -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 */ diff --git a/stk500.c b/stk500.c index f18a8895..03779f11 100644 --- a/stk500.c +++ b/stk500.c @@ -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); }