From 8f16c2a1e4fd3e11f9ef95866e8d439d05f996ae Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sat, 8 Jan 2022 23:57:37 +0100 Subject: [PATCH] Add more memory sections to read from + improve Avrdude output in verbose mode --- src/avrdude.conf.in | 84 +++++++++++++++++++++++++++++++++++++++++++++ src/avrpart.c | 35 +++++++++++-------- src/libavrdude.h | 4 +-- 3 files changed, 106 insertions(+), 17 deletions(-) diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 29107feb..667762f7 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -16209,6 +16209,42 @@ part readsize = 0x3D; ; + memory "sernum" + size = 10; + offset = 0x1104; + readsize = 1; + ; + + memory "osccal16" + size = 2; + offset = 0x1118; + readsize = 1; + ; + + memory "osccal20" + size = 2; + offset = 0x111A; + readsize = 1; + ; + + memory "tempsense" + size = 2; + offset = 0x1120; + readsize = 1; + ; + + memory "osc16err" + size = 2; + offset = 0x1122; + readsize = 1; + ; + + memory "osc20err" + size = 2; + offset = 0x1124; + readsize = 1; + ; + memory "fuses" size = 9; offset = 0x1280; @@ -16222,48 +16258,96 @@ part readsize = 1; ; + memory "wdtcfg" + size = 1; + offset = 0x1280; + readsize = 1; + ; + memory "fuse1" size = 1; offset = 0x1281; readsize = 1; ; + memory "bodcfg" + size = 1; + offset = 0x1281; + readsize = 1; + ; + memory "fuse2" size = 1; offset = 0x1282; readsize = 1; ; + memory "osccfg" + size = 1; + offset = 0x1282; + readsize = 1; + ; + memory "fuse4" size = 1; offset = 0x1284; readsize = 1; ; + memory "tcd0cfg" + size = 1; + offset = 0x1284; + readsize = 1; + ; + memory "fuse5" size = 1; offset = 0x1285; readsize = 1; ; + memory "syscfg0" + size = 1; + offset = 0x1285; + readsize = 1; + ; + memory "fuse6" size = 1; offset = 0x1286; readsize = 1; ; + memory "syscfg1" + size = 1; + offset = 0x1286; + readsize = 1; + ; + memory "fuse7" size = 1; offset = 0x1287; readsize = 1; ; + memory "append" + size = 1; + offset = 0x1287; + readsize = 1; + ; + memory "fuse8" size = 1; offset = 0x1288; readsize = 1; ; + memory "bootend" + size = 1; + offset = 0x1288; + readsize = 1; + ; + memory "lock" size = 1; offset = 0x128a; diff --git a/src/avrpart.c b/src/avrpart.c index 4ebd4eef..b4f15f93 100644 --- a/src/avrpart.c +++ b/src/avrpart.c @@ -372,9 +372,10 @@ AVRMEM * avr_locate_mem(AVRPART * p, char * desc) } -void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type, - int verbose) +void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, + int type, int verbose) { + static unsigned int prev_mem_offset, prev_mem_size; int i, j; char * optr; @@ -393,17 +394,21 @@ void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type, "%s----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n", prefix, prefix, prefix); } - fprintf(f, - "%s%-11s %4d %5d %5d %4d %-6s %6d %4d %6d %5d %5d 0x%02x 0x%02x\n", - prefix, m->desc, m->mode, m->delay, m->blocksize, m->pollindex, - m->paged ? "yes" : "no", - m->size, - m->page_size, - m->num_pages, - m->min_write_delay, - m->max_write_delay, - m->readback[0], - m->readback[1]); + if ((prev_mem_offset != m->offset || prev_mem_size != m->size) || (strcmp(p->family_id, "") == 0)) { // Don't print memory aliases + prev_mem_offset = m->offset; + prev_mem_size = m->size; + fprintf(f, + "%s%-11s %4d %5d %5d %4d %-6s %6d %4d %6d %5d %5d 0x%02x 0x%02x\n", + prefix, m->desc, m->mode, m->delay, m->blocksize, m->pollindex, + m->paged ? "yes" : "no", + m->size, + m->page_size, + m->num_pages, + m->min_write_delay, + m->max_write_delay, + m->readback[0], + m->readback[1]); + } if (verbose > 4) { avrdude_message(MSG_TRACE2, "%s Memory Ops:\n" "%s Oeration Inst Bit Bit Type Bitno Value\n" @@ -669,11 +674,11 @@ void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose) } if (verbose <= 2) { - avr_mem_display(px, f, NULL, 0, verbose); + avr_mem_display(px, f, NULL, p, 0, verbose); } for (ln=lfirst(p->mem); ln; ln=lnext(ln)) { m = ldata(ln); - avr_mem_display(px, f, m, i, verbose); + avr_mem_display(px, f, m, p, i, verbose); } if (buf) diff --git a/src/libavrdude.h b/src/libavrdude.h index 0d1bf3a3..c44025b5 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -320,8 +320,8 @@ int avr_initmem(AVRPART * p); AVRMEM * avr_dup_mem(AVRMEM * m); void avr_free_mem(AVRMEM * m); AVRMEM * avr_locate_mem(AVRPART * p, char * desc); -void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type, - int verbose); +void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, + int type, int verbose); /* Functions for AVRPART structures */ AVRPART * avr_new_part(void);