Merge pull request #815 from MCUdude/add-memory-sections

Add more memory sections to read from
This commit is contained in:
Jörg Wunsch 2022-01-21 21:49:29 +01:00 committed by GitHub
commit cce7a934d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 233 additions and 57 deletions

View File

@ -16582,6 +16582,42 @@ part
readsize = 0x3D; 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" memory "fuses"
size = 9; size = 9;
offset = 0x1280; offset = 0x1280;
@ -16595,48 +16631,96 @@ part
readsize = 1; readsize = 1;
; ;
memory "wdtcfg"
size = 1;
offset = 0x1280;
readsize = 1;
;
memory "fuse1" memory "fuse1"
size = 1; size = 1;
offset = 0x1281; offset = 0x1281;
readsize = 1; readsize = 1;
; ;
memory "bodcfg"
size = 1;
offset = 0x1281;
readsize = 1;
;
memory "fuse2" memory "fuse2"
size = 1; size = 1;
offset = 0x1282; offset = 0x1282;
readsize = 1; readsize = 1;
; ;
memory "osccfg"
size = 1;
offset = 0x1282;
readsize = 1;
;
memory "fuse4" memory "fuse4"
size = 1; size = 1;
offset = 0x1284; offset = 0x1284;
readsize = 1; readsize = 1;
; ;
memory "tcd0cfg"
size = 1;
offset = 0x1284;
readsize = 1;
;
memory "fuse5" memory "fuse5"
size = 1; size = 1;
offset = 0x1285; offset = 0x1285;
readsize = 1; readsize = 1;
; ;
memory "syscfg0"
size = 1;
offset = 0x1285;
readsize = 1;
;
memory "fuse6" memory "fuse6"
size = 1; size = 1;
offset = 0x1286; offset = 0x1286;
readsize = 1; readsize = 1;
; ;
memory "syscfg1"
size = 1;
offset = 0x1286;
readsize = 1;
;
memory "fuse7" memory "fuse7"
size = 1; size = 1;
offset = 0x1287; offset = 0x1287;
readsize = 1; readsize = 1;
; ;
memory "append"
size = 1;
offset = 0x1287;
readsize = 1;
;
memory "fuse8" memory "fuse8"
size = 1; size = 1;
offset = 0x1288; offset = 0x1288;
readsize = 1; readsize = 1;
; ;
memory "bootend"
size = 1;
offset = 0x1288;
readsize = 1;
;
memory "lock" memory "lock"
size = 1; size = 1;
offset = 0x128a; offset = 0x128a;
@ -17790,6 +17874,18 @@ part
readsize = 0x7D; readsize = 0x7D;
; ;
memory "tempsense"
size = 2;
offset = 0x1104;
readsize = 1;
;
memory "sernum"
size = 16;
offset = 0x1110;
readsize = 1;
;
memory "fuses" memory "fuses"
size = 9; size = 9;
offset = 0x1050; offset = 0x1050;
@ -17803,48 +17899,108 @@ part
readsize = 1; readsize = 1;
; ;
memory "wdtcfg"
size = 1;
offset = 0x1050;
readsize = 1;
;
memory "fuse1" memory "fuse1"
size = 1; size = 1;
offset = 0x1051; offset = 0x1051;
readsize = 1; readsize = 1;
; ;
memory "bodcfg"
size = 1;
offset = 0x1051;
readsize = 1;
;
memory "fuse2" memory "fuse2"
size = 1; size = 1;
offset = 0x1052; offset = 0x1052;
readsize = 1; readsize = 1;
; ;
memory "osccfg"
size = 1;
offset = 0x1052;
readsize = 1;
;
memory "fuse4" memory "fuse4"
size = 1; size = 1;
offset = 0x1054; offset = 0x1054;
readsize = 1; readsize = 1;
; ;
memory "tcd0cfg"
size = 1;
offset = 0x1054;
readsize = 1;
;
memory "fuse5" memory "fuse5"
size = 1; size = 1;
offset = 0x1055; offset = 0x1055;
readsize = 1; readsize = 1;
; ;
memory "syscfg0"
size = 1;
offset = 0x1055;
readsize = 1;
;
memory "fuse6" memory "fuse6"
size = 1; size = 1;
offset = 0x1056; offset = 0x1056;
readsize = 1; readsize = 1;
; ;
memory "syscfg1"
size = 1;
offset = 0x1056;
readsize = 1;
;
memory "fuse7" memory "fuse7"
size = 1; size = 1;
offset = 0x1057; offset = 0x1057;
readsize = 1; readsize = 1;
; ;
memory "codesize"
size = 1;
offset = 0x1057;
readsize = 1;
;
memory "append"
size = 1;
offset = 0x1057;
readsize = 1;
;
memory "fuse8" memory "fuse8"
size = 1; size = 1;
offset = 0x1058; offset = 0x1058;
readsize = 1; readsize = 1;
; ;
memory "bootsize"
size = 1;
offset = 0x1058;
readsize = 1;
;
memory "bootend"
size = 1;
offset = 0x1058;
readsize = 1;
;
memory "lock" memory "lock"
size = 4; size = 4;
offset = 0x1040; offset = 0x1040;

View File

@ -373,38 +373,65 @@ AVRMEM * avr_locate_mem(AVRPART * p, char * desc)
} }
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type, void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p,
int verbose) int type, int verbose)
{ {
static LNODEID ln;
static AVRMEM * n;
static unsigned int prev_mem_offset, prev_mem_size;
int i, j; int i, j;
char * optr; char * optr;
if (m == NULL) { if (m == NULL) {
fprintf(f, fprintf(f,
"%s Block Poll Page Polled\n" "%s Block Poll Page Polled\n"
"%sMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n" "%sMemory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n"
"%s----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n", "%s----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n",
prefix, prefix, prefix); prefix, prefix, prefix);
} }
else { else {
if (verbose > 2) { if (verbose > 2) {
fprintf(f, fprintf(f,
"%s Block Poll Page Polled\n" "%s Block Poll Page Polled\n"
"%sMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n" "%sMemory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n"
"%s----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n", "%s----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n",
prefix, prefix, prefix); prefix, prefix, prefix);
} }
fprintf(f,
"%s%-11s %4d %5d %5d %4d %-6s %6d %4d %6d %5d %5d 0x%02x 0x%02x\n", // Get the next memory section, and stop before going out of band
prefix, m->desc, m->mode, m->delay, m->blocksize, m->pollindex, if (ln == NULL)
m->paged ? "yes" : "no", ln = lnext(lfirst(p->mem));
m->size, else
m->page_size, ln = lnext(ln);
m->num_pages, if (ln != NULL)
m->min_write_delay, n = ldata(ln);
m->max_write_delay,
m->readback[0], // Only print memory section if the previous section printed isn't identical
m->readback[1]); if(prev_mem_offset != m->offset || prev_mem_size != m->size || (strcmp(p->family_id, "") == 0)) {
prev_mem_offset = m->offset;
prev_mem_size = m->size;
/* Show alias if the current and the next memory section has the same offset
and size, we're not out of band and a family_id is present */
char * mem_desc_alias = m->offset == n->offset && \
m->size == n->size && \
ln != NULL && \
strcmp(p->family_id, "") != 0 ?
n->desc : "";
fprintf(f,
"%s%-11s %-8s %4d %5d %5d %4d %-6s %6d %4d %6d %5d %5d 0x%02x 0x%02x\n",
prefix,
m->desc,
mem_desc_alias,
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) { if (verbose > 4) {
avrdude_message(MSG_TRACE2, "%s Memory Ops:\n" avrdude_message(MSG_TRACE2, "%s Memory Ops:\n"
"%s Oeration Inst Bit Bit Type Bitno Value\n" "%s Oeration Inst Bit Bit Type Bitno Value\n"
@ -622,40 +649,33 @@ void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose)
LNODEID ln; LNODEID ln;
AVRMEM * m; AVRMEM * m;
fprintf(f, fprintf( f, "%sAVR Part : %s\n", prefix, p->desc);
"%sAVR Part : %s\n" if (p->chip_erase_delay)
"%sChip Erase delay : %d us\n" fprintf(f, "%sChip Erase delay : %d us\n", prefix, p->chip_erase_delay);
"%sPAGEL : P%02X\n" if (p->pagel)
"%sBS2 : P%02X\n" fprintf(f, "%sPAGEL : P%02X\n", prefix, p->pagel);
"%sRESET disposition : %s\n" if (p->bs2)
"%sRETRY pulse : %s\n" fprintf(f, "%sBS2 : P%02X\n", prefix, p->bs2);
"%sserial program mode : %s\n" fprintf( f, "%sRESET disposition : %s\n", prefix, reset_disp_str(p->reset_disposition));
"%sparallel program mode : %s\n" fprintf( f, "%sRETRY pulse : %s\n", prefix, avr_pin_name(p->retry_pulse));
"%sTimeout : %d\n" fprintf( f, "%sSerial program mode : %s\n", prefix, (p->flags & AVRPART_SERIALOK) ? "yes" : "no");
"%sStabDelay : %d\n" fprintf( f, "%sParallel program mode : %s\n", prefix, (p->flags & AVRPART_PARALLELOK) ?
"%sCmdexeDelay : %d\n" ((p->flags & AVRPART_PSEUDOPARALLEL) ? "pseudo" : "yes") : "no");
"%sSyncLoops : %d\n" if(p->timeout)
"%sByteDelay : %d\n" fprintf(f, "%sTimeout : %d\n", prefix, p->timeout);
"%sPollIndex : %d\n" if(p->stabdelay)
"%sPollValue : 0x%02x\n" fprintf(f, "%sStabDelay : %d\n", prefix, p->stabdelay);
"%sMemory Detail :\n\n", if(p->cmdexedelay)
prefix, p->desc, fprintf(f, "%sCmdexeDelay : %d\n", prefix, p->cmdexedelay);
prefix, p->chip_erase_delay, if(p->synchloops)
prefix, p->pagel, fprintf(f, "%sSyncLoops : %d\n", prefix, p->synchloops);
prefix, p->bs2, if(p->bytedelay)
prefix, reset_disp_str(p->reset_disposition), fprintf(f, "%sByteDelay : %d\n", prefix, p->bytedelay);
prefix, avr_pin_name(p->retry_pulse), if(p->pollindex)
prefix, (p->flags & AVRPART_SERIALOK) ? "yes" : "no", fprintf(f, "%sPollIndex : %d\n", prefix, p->pollindex);
prefix, (p->flags & AVRPART_PARALLELOK) ? if(p->pollvalue)
((p->flags & AVRPART_PSEUDOPARALLEL) ? "pseudo" : "yes") : "no", fprintf(f, "%sPollValue : 0x%02x\n", prefix, p->pollvalue);
prefix, p->timeout, fprintf( f, "%sMemory Detail :\n\n", prefix);
prefix, p->stabdelay,
prefix, p->cmdexedelay,
prefix, p->synchloops,
prefix, p->bytedelay,
prefix, p->pollindex,
prefix, p->pollvalue,
prefix);
px = prefix; px = prefix;
i = strlen(prefix) + 5; i = strlen(prefix) + 5;
@ -670,11 +690,11 @@ void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose)
} }
if (verbose <= 2) { 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)) { for (ln=lfirst(p->mem); ln; ln=lnext(ln)) {
m = ldata(ln); m = ldata(ln);
avr_mem_display(px, f, m, i, verbose); avr_mem_display(px, f, m, p, i, verbose);
} }
if (buf) if (buf)

View File

@ -311,8 +311,8 @@ int avr_initmem(AVRPART * p);
AVRMEM * avr_dup_mem(AVRMEM * m); AVRMEM * avr_dup_mem(AVRMEM * m);
void avr_free_mem(AVRMEM * m); void avr_free_mem(AVRMEM * m);
AVRMEM * avr_locate_mem(AVRPART * p, char * desc); AVRMEM * avr_locate_mem(AVRPART * p, char * desc);
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type, void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p,
int verbose); int type, int verbose);
/* Functions for AVRPART structures */ /* Functions for AVRPART structures */
AVRPART * avr_new_part(void); AVRPART * avr_new_part(void);