Merge pull request #869 from MCUdude/alias-memories

Add fuse name aliases to avrdude.conf + tweak update.c
This commit is contained in:
Jörg Wunsch 2022-02-11 21:15:34 +01:00 committed by GitHub
commit 23a09a6197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 74 deletions

View File

@ -16628,9 +16628,7 @@ part
; ;
memory "wdtcfg" memory "wdtcfg"
size = 1; alias "fuse0";
offset = 0x1280;
readsize = 1;
; ;
memory "fuse1" memory "fuse1"
@ -16640,9 +16638,7 @@ part
; ;
memory "bodcfg" memory "bodcfg"
size = 1; alias "fuse1";
offset = 0x1281;
readsize = 1;
; ;
memory "fuse2" memory "fuse2"
@ -16652,9 +16648,7 @@ part
; ;
memory "osccfg" memory "osccfg"
size = 1; alias "fuse2";
offset = 0x1282;
readsize = 1;
; ;
memory "fuse4" memory "fuse4"
@ -16664,9 +16658,7 @@ part
; ;
memory "tcd0cfg" memory "tcd0cfg"
size = 1; alias "fuse4";
offset = 0x1284;
readsize = 1;
; ;
memory "fuse5" memory "fuse5"
@ -16676,9 +16668,7 @@ part
; ;
memory "syscfg0" memory "syscfg0"
size = 1; alias "fuse5";
offset = 0x1285;
readsize = 1;
; ;
memory "fuse6" memory "fuse6"
@ -16688,9 +16678,7 @@ part
; ;
memory "syscfg1" memory "syscfg1"
size = 1; alias "fuse6";
offset = 0x1286;
readsize = 1;
; ;
memory "fuse7" memory "fuse7"
@ -16700,9 +16688,11 @@ part
; ;
memory "append" memory "append"
size = 1; alias "fuse7";
offset = 0x1287; ;
readsize = 1;
memory "codesize"
alias "fuse7";
; ;
memory "fuse8" memory "fuse8"
@ -16712,9 +16702,11 @@ part
; ;
memory "bootend" memory "bootend"
size = 1; alias "fuse8";
offset = 0x1288; ;
readsize = 1;
memory "bootsize"
alias "fuse8";
; ;
memory "lock" memory "lock"
@ -17896,9 +17888,7 @@ part
; ;
memory "wdtcfg" memory "wdtcfg"
size = 1; alias "fuse0";
offset = 0x1050;
readsize = 1;
; ;
memory "fuse1" memory "fuse1"
@ -17908,9 +17898,7 @@ part
; ;
memory "bodcfg" memory "bodcfg"
size = 1; alias "fuse1";
offset = 0x1051;
readsize = 1;
; ;
memory "fuse2" memory "fuse2"
@ -17920,9 +17908,7 @@ part
; ;
memory "osccfg" memory "osccfg"
size = 1; alias "fuse2";
offset = 0x1052;
readsize = 1;
; ;
memory "fuse4" memory "fuse4"
@ -17932,9 +17918,7 @@ part
; ;
memory "tcd0cfg" memory "tcd0cfg"
size = 1; alias "fuse4";
offset = 0x1054;
readsize = 1;
; ;
memory "fuse5" memory "fuse5"
@ -17944,9 +17928,7 @@ part
; ;
memory "syscfg0" memory "syscfg0"
size = 1; alias "fuse5";
offset = 0x1055;
readsize = 1;
; ;
memory "fuse6" memory "fuse6"
@ -17956,9 +17938,7 @@ part
; ;
memory "syscfg1" memory "syscfg1"
size = 1; alias "fuse6";
offset = 0x1056;
readsize = 1;
; ;
memory "fuse7" memory "fuse7"
@ -17968,15 +17948,11 @@ part
; ;
memory "codesize" memory "codesize"
size = 1; alias "fuse7";
offset = 0x1057;
readsize = 1;
; ;
memory "append" memory "append"
size = 1; alias "fuse7";
offset = 0x1057;
readsize = 1;
; ;
memory "fuse8" memory "fuse8"
@ -17986,15 +17962,11 @@ part
; ;
memory "bootsize" memory "bootsize"
size = 1; alias "fuse8";
offset = 0x1058;
readsize = 1;
; ;
memory "bootend" memory "bootend"
size = 1; alias "fuse8";
offset = 0x1058;
readsize = 1;
; ;
memory "lock" memory "lock"

View File

@ -227,6 +227,13 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
return -1; return -1;
} }
AVRMEM_ALIAS * alias_mem = avr_find_memalias(p, mem);
char alias_mem_desc[AVR_DESCLEN + 1] = "";
if(alias_mem) {
strcat(alias_mem_desc, "/");
strcat(alias_mem_desc, alias_mem->desc);
}
if (upd->op == DEVICE_READ) { if (upd->op == DEVICE_READ) {
/* /*
* read out the specified device memory and write it to a file * read out the specified device memory and write it to a file
@ -238,14 +245,14 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
return -1; return -1;
} }
if (quell_progress < 2) { if (quell_progress < 2) {
avrdude_message(MSG_INFO, "%s: reading %s memory:\n", avrdude_message(MSG_INFO, "%s: reading %s%s memory:\n",
progname, mem->desc); progname, mem->desc, alias_mem_desc);
} }
report_progress(0,1,"Reading"); report_progress(0,1,"Reading");
rc = avr_read(pgm, p, upd->memtype, 0); rc = avr_read(pgm, p, upd->memtype, 0);
if (rc < 0) { if (rc < 0) {
avrdude_message(MSG_INFO, "%s: failed to read all of %s memory, rc=%d\n", avrdude_message(MSG_INFO, "%s: failed to read all of %s%s memory, rc=%d\n",
progname, mem->desc, rc); progname, mem->desc, alias_mem_desc, rc);
return -1; return -1;
} }
report_progress(1,1,NULL); report_progress(1,1,NULL);
@ -288,8 +295,8 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
* write the buffer contents to the selected memory type * write the buffer contents to the selected memory type
*/ */
if (quell_progress < 2) { if (quell_progress < 2) {
avrdude_message(MSG_INFO, "%s: writing %s (%d bytes):\n", avrdude_message(MSG_INFO, "%s: writing %s%s (%d bytes):\n",
progname, mem->desc, size); progname, mem->desc, alias_mem_desc, size);
} }
if (!(flags & UF_NOWRITE)) { if (!(flags & UF_NOWRITE)) {
@ -306,16 +313,16 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
} }
if (rc < 0) { if (rc < 0) {
avrdude_message(MSG_INFO, "%s: failed to write %s memory, rc=%d\n", avrdude_message(MSG_INFO, "%s: failed to write %s%s memory, rc=%d\n",
progname, mem->desc, rc); progname, mem->desc, alias_mem_desc, rc);
return -1; return -1;
} }
vsize = rc; vsize = rc;
if (quell_progress < 2) { if (quell_progress < 2) {
avrdude_message(MSG_INFO, "%s: %d bytes of %s written\n", progname, avrdude_message(MSG_INFO, "%s: %d bytes of %s%s written\n", progname,
vsize, mem->desc); vsize, mem->desc, alias_mem_desc);
} }
} }
@ -327,11 +334,11 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
pgm->vfy_led(pgm, ON); pgm->vfy_led(pgm, ON);
if (quell_progress < 2) { if (quell_progress < 2) {
avrdude_message(MSG_INFO, "%s: verifying %s memory against %s:\n", avrdude_message(MSG_INFO, "%s: verifying %s%s memory against %s:\n",
progname, mem->desc, upd->filename); progname, mem->desc, alias_mem_desc, upd->filename);
avrdude_message(MSG_NOTICE2, "%s: load data %s data from input file %s:\n", avrdude_message(MSG_NOTICE2, "%s: load data %s%s data from input file %s:\n",
progname, mem->desc, upd->filename); progname, mem->desc, alias_mem_desc, upd->filename);
} }
rc = fileio(FIO_READ, upd->filename, upd->format, p, upd->memtype, -1); rc = fileio(FIO_READ, upd->filename, upd->format, p, upd->memtype, -1);
@ -345,15 +352,15 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
if (quell_progress < 2) { if (quell_progress < 2) {
avrdude_message(MSG_NOTICE2, "%s: input file %s contains %d bytes\n", avrdude_message(MSG_NOTICE2, "%s: input file %s contains %d bytes\n",
progname, upd->filename, size); progname, upd->filename, size);
avrdude_message(MSG_NOTICE2, "%s: reading on-chip %s data:\n", avrdude_message(MSG_NOTICE2, "%s: reading on-chip %s%s data:\n",
progname, mem->desc); progname, mem->desc, alias_mem_desc);
} }
report_progress (0,1,"Reading"); report_progress (0,1,"Reading");
rc = avr_read(pgm, p, upd->memtype, v); rc = avr_read(pgm, p, upd->memtype, v);
if (rc < 0) { if (rc < 0) {
avrdude_message(MSG_INFO, "%s: failed to read all of %s memory, rc=%d\n", avrdude_message(MSG_INFO, "%s: failed to read all of %s%s memory, rc=%d\n",
progname, mem->desc, rc); progname, mem->desc, alias_mem_desc, rc);
pgm->err_led(pgm, ON); pgm->err_led(pgm, ON);
avr_free_part(v); avr_free_part(v);
return -1; return -1;
@ -375,8 +382,8 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
} }
if (quell_progress < 2) { if (quell_progress < 2) {
avrdude_message(MSG_INFO, "%s: %d bytes of %s verified\n", avrdude_message(MSG_INFO, "%s: %d bytes of %s%s verified\n",
progname, rc, mem->desc); progname, rc, mem->desc, alias_mem_desc);
} }
pgm->vfy_led(pgm, OFF); pgm->vfy_led(pgm, OFF);