diff --git a/avrdude/avrdude.conf.in b/avrdude/avrdude.conf.in index 5d2d2d1a..b4050389 100644 --- a/avrdude/avrdude.conf.in +++ b/avrdude/avrdude.conf.in @@ -2558,7 +2558,7 @@ part part id = "m103"; - desc = "ATMEGA103"; + desc = "ATmega103"; stk500_devcode = 0xB1; avr910_devcode = 0x41; signature = 0x1e 0x97 0x01; @@ -2698,7 +2698,7 @@ part part id = "m64"; - desc = "ATMEGA64"; + desc = "ATmega64"; has_jtag = yes; stk500_devcode = 0xA0; avr910_devcode = 0x45; @@ -2879,7 +2879,7 @@ part part id = "m128"; - desc = "ATMEGA128"; + desc = "ATmega128"; has_jtag = yes; stk500_devcode = 0xB2; avr910_devcode = 0x43; @@ -3628,7 +3628,7 @@ part part id = "m16"; - desc = "ATMEGA16"; + desc = "ATmega16"; has_jtag = yes; stk500_devcode = 0x82; avr910_devcode = 0x74; @@ -3806,7 +3806,7 @@ part part id = "m164p"; - desc = "ATMEGA164P"; + desc = "ATmega164P"; has_jtag = yes; stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one avr910_devcode = 0x74; @@ -3997,7 +3997,7 @@ part part id = "m324p"; - desc = "ATMEGA324P"; + desc = "ATmega324P"; has_jtag = yes; stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one avr910_devcode = 0x74; @@ -4379,7 +4379,7 @@ part part id = "m644"; - desc = "ATMEGA644"; + desc = "ATmega644"; has_jtag = yes; stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one avr910_devcode = 0x74; @@ -4569,7 +4569,7 @@ part part id = "m644p"; - desc = "ATMEGA644P"; + desc = "ATmega644P"; has_jtag = yes; stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one avr910_devcode = 0x74; @@ -4761,7 +4761,7 @@ part part id = "m1284p"; - desc = "ATMEGA1284P"; + desc = "ATmega1284P"; has_jtag = yes; stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one avr910_devcode = 0x74; @@ -4951,7 +4951,7 @@ part part id = "m162"; - desc = "ATMEGA162"; + desc = "ATmega162"; has_jtag = yes; stk500_devcode = 0x83; avr910_devcode = 0x63; @@ -5147,7 +5147,7 @@ part part id = "m163"; - desc = "ATMEGA163"; + desc = "ATmega163"; stk500_devcode = 0x81; avr910_devcode = 0x64; signature = 0x1e 0x94 0x02; @@ -5305,7 +5305,7 @@ part part id = "m169"; - desc = "ATMEGA169"; + desc = "ATmega169"; has_jtag = yes; stk500_devcode = 0x85; avr910_devcode = 0x78; @@ -5485,7 +5485,7 @@ part part id = "m329"; - desc = "ATMEGA329"; + desc = "ATmega329"; has_jtag = yes; # stk500_devcode = 0x85; # no STK500 support, only STK500v2 # avr910_devcode = 0x?; # try the ATmega169 one: @@ -5669,7 +5669,7 @@ part part id = "m329p"; - desc = "ATMEGA329P"; + desc = "ATmega329P"; has_jtag = yes; # stk500_devcode = 0x85; # no STK500 support, only STK500v2 # avr910_devcode = 0x?; # try the ATmega169 one: @@ -5854,7 +5854,7 @@ part part id = "m3290"; - desc = "ATMEGA3290"; + desc = "ATmega3290"; has_jtag = yes; # stk500_devcode = 0x85; # no STK500 support, only STK500v2 # avr910_devcode = 0x?; # try the ATmega169 one: @@ -6039,7 +6039,7 @@ part part id = "m3290p"; - desc = "ATMEGA3290P"; + desc = "ATmega3290P"; has_jtag = yes; # stk500_devcode = 0x85; # no STK500 support, only STK500v2 # avr910_devcode = 0x?; # try the ATmega169 one: @@ -6222,7 +6222,7 @@ part part id = "m649"; - desc = "ATMEGA649"; + desc = "ATmega649"; has_jtag = yes; # stk500_devcode = 0x85; # no STK500 support, only STK500v2 # avr910_devcode = 0x?; # try the ATmega169 one: @@ -6407,7 +6407,7 @@ part part id = "m6490"; - desc = "ATMEGA6490"; + desc = "ATmega6490"; has_jtag = yes; # stk500_devcode = 0x85; # no STK500 support, only STK500v2 # avr910_devcode = 0x?; # try the ATmega169 one: @@ -6600,7 +6600,7 @@ part part id = "m32"; - desc = "ATMEGA32"; + desc = "ATmega32"; has_jtag = yes; stk500_devcode = 0x91; avr910_devcode = 0x72; @@ -6775,7 +6775,7 @@ part part id = "m161"; - desc = "ATMEGA161"; + desc = "ATmega161"; stk500_devcode = 0x80; avr910_devcode = 0x60; signature = 0x1e 0x94 0x01; @@ -6915,7 +6915,7 @@ part part id = "m8"; - desc = "ATMEGA8"; + desc = "ATmega8"; stk500_devcode = 0x70; avr910_devcode = 0x76; signature = 0x1e 0x93 0x07; @@ -7076,7 +7076,7 @@ part part id = "m8515"; - desc = "ATMEGA8515"; + desc = "ATmega8515"; stk500_devcode = 0x63; avr910_devcode = 0x3A; signature = 0x1e 0x93 0x06; @@ -7234,7 +7234,7 @@ part part id = "m8535"; - desc = "ATMEGA8535"; + desc = "ATmega8535"; stk500_devcode = 0x64; avr910_devcode = 0x69; signature = 0x1e 0x93 0x08; @@ -7392,7 +7392,7 @@ part part id = "t26"; - desc = "ATTINY26"; + desc = "ATtiny26"; stk500_devcode = 0x21; avr910_devcode = 0x5e; signature = 0x1e 0x91 0x09; @@ -7549,7 +7549,7 @@ part part id = "t261"; - desc = "ATTINY261"; + desc = "ATtiny261"; has_debugwire = yes; flash_instr = 0xB4, 0x00, 0x10; eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, @@ -7738,7 +7738,7 @@ part part id = "t461"; - desc = "ATTINY461"; + desc = "ATtiny461"; has_debugwire = yes; flash_instr = 0xB4, 0x00, 0x10; eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, @@ -7927,7 +7927,7 @@ part part id = "t861"; - desc = "ATTINY861"; + desc = "ATtiny861"; has_debugwire = yes; flash_instr = 0xB4, 0x00, 0x10; eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, @@ -8115,7 +8115,7 @@ part part id = "m48"; - desc = "ATMEGA48"; + desc = "ATmega48"; has_debugwire = yes; flash_instr = 0xB6, 0x01, 0x11; eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, @@ -8302,7 +8302,7 @@ part part id = "m88"; - desc = "ATMEGA88"; + desc = "ATmega88"; has_debugwire = yes; flash_instr = 0xB6, 0x01, 0x11; eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, @@ -8488,7 +8488,7 @@ part part id = "m88p"; - desc = "ATMEGA88P"; + desc = "ATmega88P"; has_debugwire = yes; flash_instr = 0xB6, 0x01, 0x11; eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, @@ -8675,7 +8675,7 @@ part part id = "m168"; - desc = "ATMEGA168"; + desc = "ATmega168"; has_debugwire = yes; flash_instr = 0xB6, 0x01, 0x11; eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, @@ -8863,7 +8863,7 @@ part part id = "m168p"; - desc = "ATMEGA168P"; + desc = "ATmega168P"; has_debugwire = yes; flash_instr = 0xB6, 0x01, 0x11; eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, @@ -9051,7 +9051,7 @@ part part id = "t88"; - desc = "attiny88"; + desc = "ATtiny88"; has_debugwire = yes; flash_instr = 0xB6, 0x01, 0x11; eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, @@ -9237,7 +9237,7 @@ part part id = "m328p"; - desc = "ATMEGA328P"; + desc = "ATmega328P"; has_debugwire = yes; flash_instr = 0xB6, 0x01, 0x11; eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, @@ -11065,7 +11065,7 @@ part part id = "m640"; - desc = "ATMEGA640"; + desc = "ATmega640"; signature = 0x1e 0x96 0x08; has_jtag = yes; # stk500_devcode = 0xB2; @@ -11253,7 +11253,7 @@ part part id = "m1280"; - desc = "ATMEGA1280"; + desc = "ATmega1280"; signature = 0x1e 0x97 0x03; has_jtag = yes; # stk500_devcode = 0xB2; @@ -11442,7 +11442,7 @@ part part id = "m1281"; - desc = "ATMEGA1281"; + desc = "ATmega1281"; signature = 0x1e 0x97 0x04; has_jtag = yes; # stk500_devcode = 0xB2; @@ -11630,7 +11630,7 @@ part part id = "m2560"; - desc = "ATMEGA2560"; + desc = "ATmega2560"; signature = 0x1e 0x98 0x01; has_jtag = yes; # stk500_devcode = 0xB2; @@ -11823,7 +11823,7 @@ part part id = "m2561"; - desc = "ATMEGA2561"; + desc = "ATmega2561"; signature = 0x1e 0x98 0x02; has_jtag = yes; # stk500_devcode = 0xB2; @@ -12017,7 +12017,7 @@ part part id = "m128rfa1"; - desc = "ATMEGA128RFA1"; + desc = "ATmega128RFA1"; signature = 0x1e 0xa7 0x01; has_jtag = yes; # stk500_devcode = 0xB2; @@ -14614,7 +14614,7 @@ part part id = "m325"; - desc = "ATMEGA325"; + desc = "ATmega325"; signature = 0x1e 0x95 0x05; has_jtag = yes; # stk500_devcode = 0x??; # No STK500v1 support? @@ -14803,7 +14803,7 @@ part part id = "m645"; - desc = "ATMEGA645"; + desc = "ATmega645"; signature = 0x1E 0x96 0x05; has_jtag = yes; # stk500_devcode = 0x??; # No STK500v1 support? @@ -14992,7 +14992,7 @@ part part id = "m3250"; - desc = "ATMEGA3250"; + desc = "ATmega3250"; signature = 0x1E 0x95 0x06; has_jtag = yes; # stk500_devcode = 0x??; # No STK500v1 support? @@ -15181,7 +15181,7 @@ part part id = "m6450"; - desc = "ATMEGA6450"; + desc = "ATmega6450"; signature = 0x1E 0x96 0x06; has_jtag = yes; # stk500_devcode = 0x??; # No STK500v1 support? @@ -15365,12 +15365,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA64A1 +# ATxmega64A1 #------------------------------------------------------------ part id = "x64a1"; - desc = "ATXMEGA64A1"; + desc = "ATxmega64A1"; signature = 0x1e 0x96 0x4e; has_jtag = yes; has_pdi = yes; @@ -15462,12 +15462,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA128A1 +# ATxmega128A1 #------------------------------------------------------------ part id = "x128a1"; - desc = "ATXMEGA128A1"; + desc = "ATxmega128A1"; signature = 0x1e 0x97 0x4c; has_jtag = yes; has_pdi = yes; @@ -15559,12 +15559,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA128A1REVD +# ATxmega128A1RevD #------------------------------------------------------------ part id = "x128a1d"; - desc = "ATXMEGA128A1REVD"; + desc = "ATxmega128A1RevD"; signature = 0x1e 0x97 0x41; has_jtag = yes; has_pdi = yes; @@ -15656,12 +15656,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA192A1 +# ATxmega192A1 #------------------------------------------------------------ part id = "x192a1"; - desc = "ATXMEGA192A1"; + desc = "ATxmega192A1"; signature = 0x1e 0x97 0x4e; has_jtag = yes; has_pdi = yes; @@ -15753,12 +15753,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA256A1 +# ATxmega256A1 #------------------------------------------------------------ part id = "x256a1"; - desc = "ATXMEGA256A1"; + desc = "ATxmega256A1"; signature = 0x1e 0x98 0x46; has_jtag = yes; has_pdi = yes; @@ -15850,12 +15850,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA64A3 +# ATxmega64A3 #------------------------------------------------------------ part id = "x64a3"; - desc = "ATXMEGA64A3"; + desc = "ATxmega64A3"; signature = 0x1e 0x96 0x42; has_jtag = yes; has_pdi = yes; @@ -15947,12 +15947,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA128A3 +# ATxmega128A3 #------------------------------------------------------------ part id = "x128a3"; - desc = "ATXMEGA128A3"; + desc = "ATxmega128A3"; signature = 0x1e 0x97 0x42; has_jtag = yes; has_pdi = yes; @@ -16044,12 +16044,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA192A3 +# ATxmega192A3 #------------------------------------------------------------ part id = "x192a3"; - desc = "ATXMEGA192A3"; + desc = "ATxmega192A3"; signature = 0x1e 0x97 0x44; has_jtag = yes; has_pdi = yes; @@ -16141,12 +16141,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA256A3 +# ATxmega256A3 #------------------------------------------------------------ part id = "x256a3"; - desc = "ATXMEGA256A3"; + desc = "ATxmega256A3"; signature = 0x1e 0x98 0x42; has_jtag = yes; has_pdi = yes; @@ -16238,12 +16238,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA256A3B +# ATxmega256A3B #------------------------------------------------------------ part id = "x256a3b"; - desc = "ATXMEGA256A3B"; + desc = "ATxmega256A3B"; signature = 0x1e 0x98 0x43; has_jtag = yes; has_pdi = yes; @@ -16335,12 +16335,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA16A4 +# ATxmega16A4 #------------------------------------------------------------ part id = "x16a4"; - desc = "ATXMEGA16A4"; + desc = "ATxmega16A4"; signature = 0x1e 0x94 0x41; has_jtag = yes; has_pdi = yes; @@ -16432,12 +16432,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA32A4 +# ATxmega32A4 #------------------------------------------------------------ part id = "x32a4"; - desc = "ATXMEGA32A4"; + desc = "ATxmega32A4"; signature = 0x1e 0x95 0x41; has_jtag = yes; has_pdi = yes; @@ -16529,12 +16529,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA64A4 +# ATxmega64A4 #------------------------------------------------------------ part id = "x64a4"; - desc = "ATXMEGA64A4"; + desc = "ATxmega64A4"; signature = 0x1e 0x96 0x46; has_jtag = yes; has_pdi = yes; @@ -16626,12 +16626,12 @@ part ; #------------------------------------------------------------ -# ATXMEGA128A4 +# ATxmega128A4 #------------------------------------------------------------ part id = "x128a4"; - desc = "ATXMEGA128A4"; + desc = "ATxmega128A4"; signature = 0x1e 0x97 0x46; has_jtag = yes; has_pdi = yes; diff --git a/avrdude/avrpart.c b/avrdude/avrpart.c index 55f56b68..fed8a9ae 100644 --- a/avrdude/avrpart.c +++ b/avrdude/avrpart.c @@ -470,6 +470,24 @@ void walk_avrparts(LISTID avrparts, walk_avrparts_cb cb, void *cookie) } } +/* + * Compare function to sort the list of programmers + */ +static int sort_avrparts_compare(AVRPART * p1,AVRPART * p2) +{ + if(p1 == NULL || p2 == NULL) { + return 0; + } + return strncasecmp(p1->desc,p2->desc,AVR_IDLEN); +} + +/* + * Sort the list of programmers given as "programmers" + */ +void sort_avrparts(LISTID avrparts) +{ + lsort(avrparts,(int (*)(void*, void*)) sort_avrparts_compare); +} static char * reset_disp_str(int r) diff --git a/avrdude/avrpart.h b/avrdude/avrpart.h index f4fd35f3..48de1edc 100644 --- a/avrdude/avrpart.h +++ b/avrdude/avrpart.h @@ -221,8 +221,8 @@ void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose); typedef void (*walk_avrparts_cb)(const char *name, const char *desc, const char *cfgname, int cfglineno, void *cookie); -void walk_avrparts(LISTID programmers, walk_avrparts_cb cb, void *cookie); - +void walk_avrparts(LISTID avrparts, walk_avrparts_cb cb, void *cookie); +void sort_avrparts(LISTID avrparts); #ifdef __cplusplus } #endif diff --git a/avrdude/lists.c b/avrdude/lists.c index 3d1cfc64..8ea39623 100644 --- a/avrdude/lists.c +++ b/avrdude/lists.c @@ -1280,6 +1280,43 @@ lsrch ( LISTID lid, void * p, int (* compare)(void * p1, void * p2) ) return NULL; } +/*---------------------------------------------------------------------- +| lsort +| +| sort list - sorts list inplace (using bubble sort) +| + ----------------------------------------------------------------------*/ +void +lsort ( LISTID lid, int (* compare)(void * p1, void * p2) ) +{ + LIST * l; + LISTNODE * lt; /* this */ + LISTNODE * ln; /* next */ + int unsorted = 1; + + l = (LIST *)lid; + + CKLMAGIC(l); + + while(unsorted){ + lt = l->top; + unsorted = 0; + while (lt!=NULL) { + CKMAGIC(lt); + ln = lt->next; + if (ln!= NULL && compare(lt->data,ln->data) > 0) { + void * p = ln->data; + ln->data = lt->data; + lt->data = p; + unsorted = 1; + } + lt = ln; + } + } + + CKLMAGIC(l); +} + int lprint ( FILE * f, LISTID lid ) { diff --git a/avrdude/lists.h b/avrdude/lists.h index bae43ffd..d3544572 100644 --- a/avrdude/lists.h +++ b/avrdude/lists.h @@ -104,6 +104,8 @@ void * lrmv_d ( LISTID lid, void * data_ptr ); LISTID lcat ( LISTID lid1, LISTID lid2 ); +void lsort ( LISTID lid, int (*compare)(void * p1, void * p2)); + void * lsrch ( LISTID lid, void * p, int (*compare)(void *p1,void *p2)); int lprint ( FILE * f, LISTID lid ); diff --git a/avrdude/main.c b/avrdude/main.c index 80bae00c..bfc1777b 100644 --- a/avrdude/main.c +++ b/avrdude/main.c @@ -198,9 +198,13 @@ static void list_programmers_callback(const char *name, const char *desc, void *cookie) { struct list_walk_cookie *c = (struct list_walk_cookie *)cookie; - - fprintf(c->f, "%s%-8s = %-30s [%s:%d]\n", - c->prefix, name, desc, cfgname, cfglineno); + if (verbose){ + fprintf(c->f, "%s%-16s = %-30s [%s:%d]\n", + c->prefix, name, desc, cfgname, cfglineno); + } else { + fprintf(c->f, "%s%-16s = %-s\n", + c->prefix, name, desc); + } } static void list_programmers(FILE * f, const char *prefix, LISTID programmers) @@ -210,6 +214,8 @@ static void list_programmers(FILE * f, const char *prefix, LISTID programmers) c.f = f; c.prefix = prefix; + sort_programmers(programmers); + walk_programmers(programmers, list_programmers_callback, &c); } @@ -219,8 +225,13 @@ static void list_avrparts_callback(const char *name, const char *desc, { struct list_walk_cookie *c = (struct list_walk_cookie *)cookie; - fprintf(c->f, "%s%-4s = %-15s [%s:%d]\n", - c->prefix, name, desc, cfgname, cfglineno); + if (verbose){ + fprintf(c->f, "%s%-8s = %-18s [%s:%d]\n", + c->prefix, name, desc, cfgname, cfglineno); + } else { + fprintf(c->f, "%s%-8s = %s\n", + c->prefix, name, desc); + } } static void list_parts(FILE * f, const char *prefix, LISTID avrparts) @@ -230,6 +241,8 @@ static void list_parts(FILE * f, const char *prefix, LISTID avrparts) c.f = f; c.prefix = prefix; + sort_avrparts(avrparts); + walk_avrparts(avrparts, list_avrparts_callback, &c); } diff --git a/avrdude/pgm.c b/avrdude/pgm.c index 6c80dac9..72b6b91d 100644 --- a/avrdude/pgm.c +++ b/avrdude/pgm.c @@ -218,11 +218,37 @@ PROGRAMMER * locate_programmer(LISTID programmers, const char * configid) void walk_programmers(LISTID programmers, walk_programmers_cb cb, void *cookie) { LNODEID ln1; + LNODEID ln2; PROGRAMMER * p; for (ln1 = lfirst(programmers); ln1; ln1 = lnext(ln1)) { p = ldata(ln1); - cb((char *)ldata(lfirst(p->id)), p->desc, p->config_file, p->lineno, cookie); + for (ln2=lfirst(p->id); ln2; ln2=lnext(ln2)) { + cb(ldata(ln2), p->desc, p->config_file, p->lineno, cookie); + } } } +/* + * Compare function to sort the list of programmers + */ +static int sort_programmer_compare(PROGRAMMER * p1,PROGRAMMER * p2) +{ + char* id1; + char* id2; + if(p1 == NULL || p2 == NULL) { + return 0; + } + id1 = ldata(lfirst(p1->id)); + id2 = ldata(lfirst(p2->id)); + return strncasecmp(id1,id2,AVR_IDLEN); +} + +/* + * Sort the list of programmers given as "programmers" + */ +void sort_programmers(LISTID programmers) +{ + lsort(programmers,(int (*)(void*, void*)) sort_programmer_compare); +} + diff --git a/avrdude/pgm.h b/avrdude/pgm.h index 2f7ba36e..c510ebce 100644 --- a/avrdude/pgm.h +++ b/avrdude/pgm.h @@ -140,6 +140,8 @@ typedef void (*walk_programmers_cb)(const char *name, const char *desc, void *cookie); void walk_programmers(LISTID programmers, walk_programmers_cb cb, void *cookie); +void sort_programmers(LISTID programmers); + #ifdef __cplusplus } #endif