From 2e7333d3ccf0cac0566b140c8843145bfcc0495f Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Thu, 11 Jan 2007 20:20:25 +0000 Subject: [PATCH] * butterfly.c (butterfly_initialize): when sending the 'T' command (which is ignored by current AVR109 bootloaders), send the first reply from the list of supported device codes back rather than using avrdude.conf's idea about an AVR910 device code. Apparently, this solves disagreements between different versions of at least the ATmega8 AVR910 device code. Closes bug #18727: Writing flash failed git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@718 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/ChangeLog | 11 +++++++++++ avrdude/butterfly.c | 16 +++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog index d243f2cc..c464c149 100644 --- a/avrdude/ChangeLog +++ b/avrdude/ChangeLog @@ -1,3 +1,14 @@ +2007-01-11 Joerg Wunsch + + * butterfly.c (butterfly_initialize): when sending the 'T' + command (which is ignored by current AVR109 bootloaders), + send the first reply from the list of supported device + codes back rather than using avrdude.conf's idea about + an AVR910 device code. Apparently, this solves disagreements + between different versions of at least the ATmega8 AVR910 + device code. + Closes bug #18727: Writing flash failed + 2007-01-07 Joerg Wunsch Reported by Till Harbaum: diff --git a/avrdude/butterfly.c b/avrdude/butterfly.c index d6661ef7..f8582405 100644 --- a/avrdude/butterfly.c +++ b/avrdude/butterfly.c @@ -226,7 +226,7 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p) char hw[2]; char buf[10]; char type; - char c; + char c, devtype_1st; no_show_func_info(); @@ -307,18 +307,28 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p) butterfly_send(pgm, "t", 1); fprintf(stderr, "\nProgrammer supports the following devices:\n"); + devtype_1st = 0; while (1) { butterfly_recv(pgm, &c, 1); + if (devtype_1st == 0) + devtype_1st = c; + if (c == 0) break; fprintf(stderr, " Device code: 0x%02x\n", (unsigned int)(unsigned char)c); }; fprintf(stderr,"\n"); - /* Tell the programmer which part we selected. */ + /* Tell the programmer which part we selected. + According to the AVR109 code, this is ignored by the bootloader. As + some early versions might not properly ignore it, rather pick up the + first device type as reported above than anything out of avrdude.conf, + so to avoid a potential conflict. There appears to be no general + agreement on AVR910 device IDs beyond the ones from the original + appnote 910. */ buf[0] = 'T'; - buf[1] = p->avr910_devcode; + buf[1] = devtype_1st; butterfly_send(pgm, buf, 2); butterfly_vfy_cmd_sent(pgm, "select device");