Merge pull request #1125 from MCUdude/updi-lock-fix

Fix UPDI erase when target is locked
This commit is contained in:
Stefan Rueger 2022-10-17 14:17:32 +01:00 committed by GitHub
commit 2503ae03ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 18 deletions

View File

@ -14851,6 +14851,7 @@ part parent ".avr8x_mega"
part part
desc = "AVR-Dx family common values"; desc = "AVR-Dx family common values";
id = ".avrdx"; id = ".avrdx";
family_id = "AVR ";
prog_modes = PM_SPM | PM_UPDI; prog_modes = PM_SPM | PM_UPDI;
# Dedicated UPDI pin, no HV # Dedicated UPDI pin, no HV
hvupdi_variant = 1; hvupdi_variant = 1;
@ -15007,6 +15008,7 @@ part
part parent ".avrdx" part parent ".avrdx"
desc = "AVR32DA28"; desc = "AVR32DA28";
id = "avr32da28"; id = "avr32da28";
family_id = " AVR";
mcuid = 338; mcuid = 338;
signature = 0x1e 0x95 0x34; signature = 0x1e 0x95 0x34;
@ -15031,6 +15033,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR32DA32"; desc = "AVR32DA32";
id = "avr32da32"; id = "avr32da32";
family_id = " AVR";
mcuid = 342; mcuid = 342;
signature = 0x1e 0x95 0x33; signature = 0x1e 0x95 0x33;
@ -15055,6 +15058,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR32DA48"; desc = "AVR32DA48";
id = "avr32da48"; id = "avr32da48";
family_id = " AVR";
mcuid = 346; mcuid = 346;
signature = 0x1e 0x95 0x32; signature = 0x1e 0x95 0x32;
@ -15079,6 +15083,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR64DA28"; desc = "AVR64DA28";
id = "avr64da28"; id = "avr64da28";
family_id = " AVR";
mcuid = 351; mcuid = 351;
signature = 0x1e 0x96 0x15; signature = 0x1e 0x96 0x15;
@ -15103,6 +15108,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR64DA32"; desc = "AVR64DA32";
id = "avr64da32"; id = "avr64da32";
family_id = " AVR";
mcuid = 355; mcuid = 355;
signature = 0x1e 0x96 0x14; signature = 0x1e 0x96 0x14;
@ -15127,6 +15133,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR64DA48"; desc = "AVR64DA48";
id = "avr64da48"; id = "avr64da48";
family_id = " AVR";
mcuid = 359; mcuid = 359;
signature = 0x1e 0x96 0x13; signature = 0x1e 0x96 0x13;
@ -15151,6 +15158,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR64DA64"; desc = "AVR64DA64";
id = "avr64da64"; id = "avr64da64";
family_id = " AVR";
mcuid = 362; mcuid = 362;
signature = 0x1e 0x96 0x12; signature = 0x1e 0x96 0x12;
@ -15175,6 +15183,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR128DA28"; desc = "AVR128DA28";
id = "avr128da28"; id = "avr128da28";
family_id = " AVR";
mcuid = 364; mcuid = 364;
signature = 0x1e 0x97 0x0a; signature = 0x1e 0x97 0x0a;
@ -15199,6 +15208,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR128DA32"; desc = "AVR128DA32";
id = "avr128da32"; id = "avr128da32";
family_id = " AVR";
mcuid = 366; mcuid = 366;
signature = 0x1e 0x97 0x09; signature = 0x1e 0x97 0x09;
@ -15223,6 +15233,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR128DA48"; desc = "AVR128DA48";
id = "avr128da48"; id = "avr128da48";
family_id = " AVR";
mcuid = 368; mcuid = 368;
signature = 0x1e 0x97 0x08; signature = 0x1e 0x97 0x08;
@ -15247,6 +15258,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR128DA64"; desc = "AVR128DA64";
id = "avr128da64"; id = "avr128da64";
family_id = " AVR";
mcuid = 370; mcuid = 370;
signature = 0x1e 0x97 0x07; signature = 0x1e 0x97 0x07;

View File

@ -1191,24 +1191,14 @@ int main(int argc, char * argv [])
if (rc == LIBAVRDUDE_SOFTFAIL && (p->prog_modes & PM_UPDI) && attempt < 1) { if (rc == LIBAVRDUDE_SOFTFAIL && (p->prog_modes & PM_UPDI) && attempt < 1) {
attempt++; attempt++;
if (pgm->read_sib) { if (pgm->read_sib) {
// Read SIB and compare FamilyID // Read SIB and compare FamilyID
char sib[AVR_SIBLEN + 1]; char sib[AVR_SIBLEN + 1];
pgm->read_sib(pgm, p, sib); pgm->read_sib(pgm, p, sib);
avrdude_message(MSG_NOTICE, "%s: System Information Block: \"%s\"\n", avrdude_message(MSG_NOTICE, "%s: System Information Block: \"%s\"\n", progname, sib);
progname, sib);
if (quell_progress < 2) if (quell_progress < 2)
avrdude_message(MSG_INFO, "%s: Received FamilyID: \"%.*s\"\n", progname, AVR_FAMILYIDLEN, sib); avrdude_message(MSG_INFO, "%s: Received FamilyID: \"%.*s\"\n", progname, AVR_FAMILYIDLEN, sib);
if (strncmp(p->family_id, sib, AVR_FAMILYIDLEN))
if (strncmp(p->family_id, sib, AVR_FAMILYIDLEN)) {
avrdude_message(MSG_INFO, "%s: Expected FamilyID: \"%s\"\n", progname, p->family_id); avrdude_message(MSG_INFO, "%s: Expected FamilyID: \"%s\"\n", progname, p->family_id);
if (!ovsigck) {
avrdude_message(MSG_INFO, "%sDouble check chip, "
"or use -F to override this check.\n",
progbuf);
exitrc = 1;
goto main_exit;
}
}
} }
if(erase) { if(erase) {
erase = 0; erase = 0;
@ -1223,6 +1213,12 @@ int main(int argc, char * argv [])
goto sig_again; goto sig_again;
} }
} }
if (!ovsigck) {
avrdude_message(MSG_INFO, "%sDouble check chip, or use -F to override this check.\n",
progbuf);
exitrc = 1;
goto main_exit;
}
} }
avrdude_message(MSG_INFO, "%s: error reading signature data, rc=%d\n", avrdude_message(MSG_INFO, "%s: error reading signature data, rc=%d\n",
progname, rc); progname, rc);
@ -1235,9 +1231,7 @@ int main(int argc, char * argv [])
if (sig == NULL) { if (sig == NULL) {
avrdude_message(MSG_INFO, "%s: WARNING: signature data not defined for device \"%s\"\n", avrdude_message(MSG_INFO, "%s: WARNING: signature data not defined for device \"%s\"\n",
progname, p->desc); progname, p->desc);
} } else {
if (sig != NULL) {
int ff, zz; int ff, zz;
if (quell_progress < 2) { if (quell_progress < 2) {

View File

@ -903,6 +903,7 @@ static int serialupdi_read_signature(const PROGRAMMER *pgm, const AVRPART *p, co
m->buf[0]=0x00; m->buf[0]=0x00;
m->buf[1]=0x00; m->buf[1]=0x00;
m->buf[2]=0x00; m->buf[2]=0x00;
return LIBAVRDUDE_SOFTFAIL;
} else { } else {
updi_read_byte(pgm, m->offset + 0, m->buf); updi_read_byte(pgm, m->offset + 0, m->buf);
updi_read_byte(pgm, m->offset + 1, m->buf+1); updi_read_byte(pgm, m->offset + 1, m->buf+1);