Improve pgm->id detection handling

This commit is contained in:
MCUdude 2022-10-02 10:41:40 +02:00
parent e05aa16510
commit ffabab1fb2
1 changed files with 92 additions and 73 deletions

View File

@ -2416,7 +2416,8 @@ void jtag3_print_parms1(const PROGRAMMER *pgm, const char *p) {
verbose ? "" : " ", b2_to_u16(buf) / 1000.0); verbose ? "" : " ", b2_to_u16(buf) / 1000.0);
// Print features unique to the Power Debugger // Print features unique to the Power Debugger
if (strncmp("powerdebugger", ldata(lfirst(pgm->id)), strlen("powerdebugger")) == 0) { for(LNODEID ln=lfirst(pgm->id); ln; ln=lnext(ln)) {
if(matches(ldata(ln), "powerdebugger")) {
short analog_raw_data; short analog_raw_data;
// Read generator set voltage value (VOUT) // Read generator set voltage value (VOUT)
@ -2487,6 +2488,8 @@ void jtag3_print_parms1(const PROGRAMMER *pgm, const char *p) {
avrdude_message(MSG_INFO, "%sCh B current %s: %.3f mA\n", p, avrdude_message(MSG_INFO, "%sCh B current %s: %.3f mA\n", p,
verbose ? "" : " ", ((float)analog_raw_data * 0.555556)); verbose ? "" : " ", ((float)analog_raw_data * 0.555556));
} }
break;
}
} }
if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_MEGA_PROG, buf, 2) < 0) if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_MEGA_PROG, buf, 2) < 0)
@ -2599,8 +2602,12 @@ void jtag3_initpgm(PROGRAMMER *pgm) {
pgm->page_size = 256; pgm->page_size = 256;
pgm->flag = PGM_FL_IS_JTAG; pgm->flag = PGM_FL_IS_JTAG;
if (matches(ldata(lfirst(pgm->id)), "powerdebugger")) for(LNODEID ln=lfirst(pgm->id); ln; ln=lnext(ln)) {
if (matches(ldata(ln), "powerdebugger")) {
pgm->set_vtarget = jtag3_set_vtarget; pgm->set_vtarget = jtag3_set_vtarget;
break;
}
}
} }
const char jtag3_dw_desc[] = "Atmel JTAGICE3 in debugWire mode"; const char jtag3_dw_desc[] = "Atmel JTAGICE3 in debugWire mode";
@ -2633,8 +2640,12 @@ void jtag3_dw_initpgm(PROGRAMMER *pgm) {
pgm->page_size = 256; pgm->page_size = 256;
pgm->flag = PGM_FL_IS_DW; pgm->flag = PGM_FL_IS_DW;
if (matches(ldata(lfirst(pgm->id)), "powerdebugger_dw")) for(LNODEID ln=lfirst(pgm->id); ln; ln=lnext(ln)) {
if (matches(ldata(ln), "powerdebugger")) {
pgm->set_vtarget = jtag3_set_vtarget; pgm->set_vtarget = jtag3_set_vtarget;
break;
}
}
} }
const char jtag3_pdi_desc[] = "Atmel JTAGICE3 in PDI mode"; const char jtag3_pdi_desc[] = "Atmel JTAGICE3 in PDI mode";
@ -2669,8 +2680,12 @@ void jtag3_pdi_initpgm(PROGRAMMER *pgm) {
pgm->page_size = 256; pgm->page_size = 256;
pgm->flag = PGM_FL_IS_PDI; pgm->flag = PGM_FL_IS_PDI;
if (matches(ldata(lfirst(pgm->id)), "powerdebugger_pdi")) for(LNODEID ln=lfirst(pgm->id); ln; ln=lnext(ln)) {
if (matches(ldata(ln), "powerdebugger")) {
pgm->set_vtarget = jtag3_set_vtarget; pgm->set_vtarget = jtag3_set_vtarget;
break;
}
}
} }
const char jtag3_updi_desc[] = "Atmel JTAGICE3 in UPDI mode"; const char jtag3_updi_desc[] = "Atmel JTAGICE3 in UPDI mode";
@ -2708,8 +2723,12 @@ void jtag3_updi_initpgm(PROGRAMMER *pgm) {
pgm->unlock = jtag3_unlock_erase_key; pgm->unlock = jtag3_unlock_erase_key;
pgm->read_sib = jtag3_read_sib; pgm->read_sib = jtag3_read_sib;
if (matches(ldata(lfirst(pgm->id)), "pkobn_updi") || for(LNODEID ln=lfirst(pgm->id); ln; ln=lnext(ln)) {
matches(ldata(lfirst(pgm->id)), "powerdebugger_updi")) if (matches(ldata(ln), "powerdebugger") ||
matches(ldata(ln), "pkob")) {
pgm->set_vtarget = jtag3_set_vtarget; pgm->set_vtarget = jtag3_set_vtarget;
break;
}
}
} }