diff --git a/ChangeLog b/ChangeLog index 56113a6e..53233330 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-07-29 Joerg Wunsch + + * 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 * stk500v2.c (stk600_xprog_paged_write): Fix a fatal miscalculation diff --git a/NEWS b/NEWS index b7e0956e..557948ba 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,10 @@ Current: * Add support for ATxmega128A1 (including the revision D engineering 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: * Add support for the USBtinyISP programmer (patch #6233) diff --git a/avrdude.1 b/avrdude.1 index ea0c60ac..9575c084 100644 --- a/avrdude.1 +++ b/avrdude.1 @@ -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 but is otherwise operating normally, this options is provided 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 +.Fl t +to continue in terminal mode. .It Fl i Ar delay For bitbang-type programmers, delay for approximately .Ar delay diff --git a/doc/avrdude.texi b/doc/avrdude.texi index d6e708bb..a0c948e5 100644 --- a/doc/avrdude.texi +++ b/doc/avrdude.texi @@ -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 signature but is otherwise operating normally, this options is provided 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} For bitbang-type programmers, delay for approximately diff --git a/main.c b/main.c index 6d2c7fb5..dccb1bb5 100644 --- a/main.c +++ b/main.c @@ -279,6 +279,7 @@ int main(int argc, char * argv []) int ispdelay; /* Specify the delay for ISP clock */ int safemode; /* Enable safemode, 1=safemode on, 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_hfuse = 0xff; unsigned char safemode_efuse = 0xff; @@ -823,8 +824,8 @@ int main(int argc, char * argv []) /* * initialize the chip in preperation for accepting commands */ - rc = pgm->initialize(pgm, p); - if (rc < 0) { + init_ok = (rc = pgm->initialize(pgm, p)) >= 0; + if (!init_ok) { fprintf(stderr, "%s: initialization failed, rc=%d\n", progname, rc); if (!ovsigck) { fprintf(stderr, "%sDouble check connections and try again, " @@ -851,12 +852,14 @@ int main(int argc, char * argv []) * against 0xffffff / 0x000000 should ensure that the signature bytes * are valid. */ - rc = avr_signature(pgm, p); - if (rc != 0) { - fprintf(stderr, "%s: error reading signature data, rc=%d\n", - progname, rc); - exitrc = 1; - goto main_exit; + if (init_ok) { + rc = avr_signature(pgm, p); + if (rc != 0) { + fprintf(stderr, "%s: error reading signature data, rc=%d\n", + progname, rc); + exitrc = 1; + goto main_exit; + } } sig = avr_locate_mem(p, "signature"); @@ -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, 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. */ - 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 * 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); 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 * before the chip can accept new programming @@ -1043,10 +1047,18 @@ int main(int argc, char * argv []) if (terminal) { /* * terminal mode - */ + */ 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)) { upd = ldata(ln);