From e829a46a49660a9cff0cf4e9f8fc0eb2d3b24cc5 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 28 Jun 2024 13:47:41 +0100 Subject: [PATCH] Add developer option /c for listing configuration options --- src/developer_opts.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index 7fe483ca..84ef3fb2 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -860,9 +860,9 @@ static const Avrintel *silent_locate_uP(const AVRPART *p) { return idx < 0? NULL: uP_table + idx; } -// -p /[dsASRveow*tiBCUPTIJWHQ] +// -p /[dsASRvceow*tiBCUPTIJWHQ] void dev_output_part_defs(char *partdesc) { - bool cmdok, waits, opspi, descs, vtabs, astrc, strct, cmpst, injct, raw, all, tsv; + bool cmdok, waits, opspi, descs, vtabs, confs, astrc, strct, cmpst, injct, raw, all, tsv; char *flags; int nprinted; AVRPART *nullpart = avr_new_part(); @@ -873,7 +873,7 @@ void dev_output_part_defs(char *partdesc) { if(!flags && str_eq(partdesc, "*")) // Treat -p * as if it was -p */s flags = "s"; - if(!*flags || !strchr("dsASRveow*tiBCUPTIJWHQ", *flags)) { + if(!*flags || !strchr("dsASRvceow*tiBCUPTIJWHQ", *flags)) { dev_info("%s: flags for developer option -p / not recognised\n", progname); dev_info( "Wildcard examples (these need protecting in the shell through quoting):\n" @@ -887,7 +887,8 @@ void dev_output_part_defs(char *partdesc) { " A show entries of avrdude.conf parts with all values\n" " S show entries of avrdude.conf parts with necessary values\n" " R show entries of avrdude.conf parts as raw dump\n" - " v show vector table list for parts\n" + " v list interrupt vector names for parts\n" + " c list configuration options for parts\n" " e check and report errors in address bits of SPI commands\n" " o opcodes for SPI programming parts and memories\n" " w wd_... constants for ISP parts\n" @@ -915,6 +916,7 @@ void dev_output_part_defs(char *partdesc) { all = *flags == '*'; descs = all || !!strchr(flags, 'd'); vtabs = all || !!strchr(flags, 'v'); + confs = all || !!strchr(flags, 'c'); cmdok = all || !!strchr(flags, 'e'); opspi = all || !!strchr(flags, 'o'); waits = all || !!strchr(flags, 'w'); @@ -1129,6 +1131,21 @@ void dev_output_part_defs(char *partdesc) { if(vtabs && (up = silent_locate_uP(p)) && up->isrtable) for(int i=0; i < up->ninterrupts; i++) dev_info("%s\t%3d\t%s\n", p->desc, i, up->isrtable[i]); + + if(confs && (up = silent_locate_uP(p)) && up->cfgtable) + for(int i=0; i < up->nconfigs; i++) { + const Configitem *cp = up->cfgtable+i; + unsigned c, n = cp->nvalues; + if(!n || !cp->vlist) { // Count bits set in mask + for(n = cp->mask, c=0; n; c++) + n &= n-1; + n = 1<desc, n, cp->name); + if(cp->vlist && verbose) + for(int k=0; k < cp->nvalues; k++) + dev_info("%s\t\tvalue\t%3d\t%s\n", p->desc, cp->vlist[k].value, cp->vlist[k].label); + } } if(opspi) {