Print alias names if present

This commit is contained in:
MCUdude 2022-01-17 20:53:00 +01:00
parent 4453d54296
commit 0e451f73cf
1 changed files with 31 additions and 9 deletions

View File

@ -375,6 +375,8 @@ AVRMEM * avr_locate_mem(AVRPART * p, char * desc)
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p, void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p,
int type, int verbose) int type, int verbose)
{ {
static LNODEID ln;
static AVRMEM * n;
static unsigned int prev_mem_offset, prev_mem_size; static unsigned int prev_mem_offset, prev_mem_size;
int i, j; int i, j;
char * optr; char * optr;
@ -382,24 +384,44 @@ void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p,
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);
} }
if ((prev_mem_offset != m->offset || prev_mem_size != m->size) || (strcmp(p->family_id, "") == 0)) { // Don't print memory aliases
// Get the next memory section, and stop before going out of band
if (ln == NULL)
ln = lnext(lfirst(p->mem));
else
ln = lnext(ln);
if (ln != NULL)
n = ldata(ln);
// Only print memory section if the previous section printed isn't identical
if(prev_mem_offset != m->offset || prev_mem_size != m->size || (strcmp(p->family_id, "") == 0)) {
prev_mem_offset = m->offset; prev_mem_offset = m->offset;
prev_mem_size = m->size; 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, fprintf(f,
"%s%-11s %4d %5d %5d %4d %-6s %6d %4d %6d %5d %5d 0x%02x 0x%02x\n", "%s%-11s %-8s %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, prefix,
m->desc,
mem_desc_alias,
m->mode, m->delay, m->blocksize, m->pollindex,
m->paged ? "yes" : "no", m->paged ? "yes" : "no",
m->size, m->size,
m->page_size, m->page_size,