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
desc = "AVR-Dx family common values";
id = ".avrdx";
family_id = "AVR ";
prog_modes = PM_SPM | PM_UPDI;
# Dedicated UPDI pin, no HV
hvupdi_variant = 1;
@ -15007,6 +15008,7 @@ part
part parent ".avrdx"
desc = "AVR32DA28";
id = "avr32da28";
family_id = " AVR";
mcuid = 338;
signature = 0x1e 0x95 0x34;
@ -15031,6 +15033,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR32DA32";
id = "avr32da32";
family_id = " AVR";
mcuid = 342;
signature = 0x1e 0x95 0x33;
@ -15055,6 +15058,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR32DA48";
id = "avr32da48";
family_id = " AVR";
mcuid = 346;
signature = 0x1e 0x95 0x32;
@ -15079,6 +15083,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR64DA28";
id = "avr64da28";
family_id = " AVR";
mcuid = 351;
signature = 0x1e 0x96 0x15;
@ -15103,6 +15108,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR64DA32";
id = "avr64da32";
family_id = " AVR";
mcuid = 355;
signature = 0x1e 0x96 0x14;
@ -15127,6 +15133,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR64DA48";
id = "avr64da48";
family_id = " AVR";
mcuid = 359;
signature = 0x1e 0x96 0x13;
@ -15151,6 +15158,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR64DA64";
id = "avr64da64";
family_id = " AVR";
mcuid = 362;
signature = 0x1e 0x96 0x12;
@ -15175,6 +15183,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR128DA28";
id = "avr128da28";
family_id = " AVR";
mcuid = 364;
signature = 0x1e 0x97 0x0a;
@ -15199,6 +15208,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR128DA32";
id = "avr128da32";
family_id = " AVR";
mcuid = 366;
signature = 0x1e 0x97 0x09;
@ -15223,6 +15233,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR128DA48";
id = "avr128da48";
family_id = " AVR";
mcuid = 368;
signature = 0x1e 0x97 0x08;
@ -15247,6 +15258,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR128DA64";
id = "avr128da64";
family_id = " AVR";
mcuid = 370;
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) {
attempt++;
if (pgm->read_sib) {
// Read SIB and compare FamilyID
char sib[AVR_SIBLEN + 1];
pgm->read_sib(pgm, p, sib);
avrdude_message(MSG_NOTICE, "%s: System Information Block: \"%s\"\n",
progname, sib);
// Read SIB and compare FamilyID
char sib[AVR_SIBLEN + 1];
pgm->read_sib(pgm, p, sib);
avrdude_message(MSG_NOTICE, "%s: System Information Block: \"%s\"\n", progname, sib);
if (quell_progress < 2)
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);
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) {
erase = 0;
@ -1223,6 +1213,12 @@ int main(int argc, char * argv [])
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",
progname, rc);
@ -1235,9 +1231,7 @@ int main(int argc, char * argv [])
if (sig == NULL) {
avrdude_message(MSG_INFO, "%s: WARNING: signature data not defined for device \"%s\"\n",
progname, p->desc);
}
if (sig != NULL) {
} else {
int ff, zz;
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[1]=0x00;
m->buf[2]=0x00;
return LIBAVRDUDE_SOFTFAIL;
} else {
updi_read_byte(pgm, m->offset + 0, m->buf);
updi_read_byte(pgm, m->offset + 1, m->buf+1);