From 4c29edbc41bf62b8c6664d944a09fe8a891c99d3 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 21 Sep 2022 12:10:24 +0100 Subject: [PATCH] Warn if a part shares multiple programming modes with a programmer --- src/main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index b418fa80..bd0ef3c2 100644 --- a/src/main.c +++ b/src/main.c @@ -138,10 +138,6 @@ static void usage(void) static char *via_prog_modes(int pm) { static char type[1024]; - // Suppress PM_JTAGmkI if also PM_JTAG is given - if((pm & PM_JTAG) && (pm & PM_JTAGmkI)) - pm &= ~PM_JTAGmkI; - strcpy(type, "?"); if(pm & PM_SPM) strcat(type, ", bootloader"); @@ -867,6 +863,17 @@ int main(int argc, char * argv []) exit(0); } + for(LNODEID ln1 = lfirst(part_list); ln1; ln1 = lnext(ln1)) { + AVRPART *p = ldata(ln1); + for(LNODEID ln2 = lfirst(programmers); ln2; ln2 = lnext(ln2)) { + PROGRAMMER *pgm = ldata(ln2); + int pm = pgm->prog_modes & p->prog_modes; + if(pm & (pm-1)) + avrdude_message(MSG_INFO, "%s warning: %s and %s share multiple modes (%s)\n", + progname, pgm->id? ldata(lfirst(pgm->id)): "???", p->desc, via_prog_modes(pm)); + } + } + avrdude_message(MSG_NOTICE, "\n"); if (partdesc) {