mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-28 12:06:59 +03:00
Provide option -c for terminal config cmd
This commit is contained in:
@@ -1263,7 +1263,7 @@ values of all matching properties are displayed.
|
||||
Show all possible values of the named configuration property (notice the
|
||||
trailing =). The one that is currently set is the only one not commented
|
||||
out. As before, wildcards or initial strings are permitted.
|
||||
.It Ar config {<-f|-v>} <property>=<value> {<-f|-v>}
|
||||
.It Ar config {<-f|-v|-c>} <property>=<value> {<-f|-v|-c>}
|
||||
Modify the named configuration property to the given value. The
|
||||
corresponding fuse or lock bits will be changed immediately but the change
|
||||
will normally only take effect the next time the part is reset, at which
|
||||
@@ -1271,7 +1271,10 @@ point the fuses and lock bits are utilised. Value can either be a valid
|
||||
integer or one of the symbolic mnemonics, if known. Wildcards or initial
|
||||
strings are permitted for either the property or the assigned mnemonic
|
||||
value, but an assignment only happens if both the property and the name
|
||||
can be uniquely resolved.
|
||||
can be uniquely resolved. Option -v shows the value of the assigned
|
||||
configuration property by reading it again from the fuse. In absence of -v
|
||||
the option -c confirms the new value of the configuration property only if
|
||||
it has changed.
|
||||
.Pp
|
||||
It is quite possible, as is with direct writing to the underlying fuses
|
||||
and lock bits, to brick a part, i.e., make it unresponsive to further
|
||||
|
||||
@@ -2935,8 +2935,8 @@ or after EOF on input is encountered. The @code{abort} command resets the
|
||||
cache discarding all previous writes to the flash, EEPROM, bootrow and
|
||||
usersig cache.
|
||||
|
||||
@item config @var{[opts]}
|
||||
@cindex @code{config} @var{[opts]}
|
||||
@item config @var{[-f|-a|-v]}
|
||||
@cindex @code{config} @var{[-f|-a|-v]}
|
||||
Show all configuration properties of the part; these are usually bitfields
|
||||
in fuses or lock bits bytes that can take on values, which typically have
|
||||
a mnemonic name. Each part has their own set of configurable items. The
|
||||
@@ -2948,20 +2948,20 @@ assigned mnemonic values are the ones that are not commented out. The
|
||||
option @code{-v} increases the verbosity of the output of the config
|
||||
command.
|
||||
|
||||
@item config @var{[opts]} @var{property} @var{[opts]}
|
||||
@cindex @code{config} @var{[opts]} @var{property} @var{[opts]}
|
||||
@item config @var{[-f|-v]} @var{property} @var{[-f|-v]}
|
||||
@cindex @code{config} @var{[-f|-v]} @var{property} @var{[-f|-v]}
|
||||
Show the current value of the named configuration property. Wildcards or
|
||||
initial strings are permitted (but not both), in which case the current
|
||||
values of all matching properties are displayed.
|
||||
|
||||
@item config @var{[opts]} @var{property=} @var{[opts]}
|
||||
@cindex @code{config} @var{[opts]} @var{property=} @var{[opts]}
|
||||
@item config @var{[-f|-v]} @var{property=} @var{[-f|-v]}
|
||||
@cindex @code{config} @var{[-f|-v]} @var{property=} @var{[-f|-v]}
|
||||
Show all possible values of the named configuration property (notice the
|
||||
trailing @code{=}). The one that is currently set is the only one not
|
||||
commented out. As before, wildcards or initial strings are permitted.
|
||||
|
||||
@item config @var{[opts]} @var{property=value} @var{[opts]}
|
||||
@cindex @code{config} @var{[opts]} @var{property=value} @var{[opts]}
|
||||
@item config @var{[-f|-v|-c]} @var{property=value} @var{[-f|-v|-c]}
|
||||
@cindex @code{config} @var{[-f|-v|-c]} @var{property=value} @var{[-f|-v|-c]}
|
||||
Modify the named configuration property to the given value. The
|
||||
corresponding fuse or lock bits will be changed immediately but the change
|
||||
will normally only take effect the next time the part is reset, at which
|
||||
@@ -2969,7 +2969,10 @@ point the fuses and lock bits are utilised. Value can either be a valid
|
||||
integer or one of the symbolic mnemonics, if known. Wildcards or initial
|
||||
strings are permitted for either the property or the assigned mnemonic
|
||||
value, but an assignment only happens if both the property and the name
|
||||
can be uniquely resolved.
|
||||
can be uniquely resolved. Option @code{-v} shows the value of the assigned
|
||||
configuration property by reading it again from the fuse. In absence of
|
||||
@code{-v} the option @code{-c} confirms the new value of the configuration
|
||||
property only if it has changed.
|
||||
|
||||
It is quite possible, as is with direct writing to the underlying fuses
|
||||
and lock bits, to brick a part, i.e., make it unresponsive to further
|
||||
|
||||
10
src/term.c
10
src/term.c
@@ -1387,7 +1387,7 @@ typedef struct {
|
||||
} Cnfg;
|
||||
|
||||
typedef struct { // Context parameters to be passed to functions
|
||||
int verb, allscript, flheaders, allv, vmax, printfactory;
|
||||
int verb, confirm, allscript, flheaders, allv, vmax, printfactory;
|
||||
} Cfg_opts;
|
||||
|
||||
// Cache the contents of the fuse and lock bits memories that a particular Configitem is involved in
|
||||
@@ -1694,6 +1694,9 @@ static int cmd_config(const PROGRAMMER *pgm, const AVRPART *p, int argc, const c
|
||||
case 'v':
|
||||
o.verb++;
|
||||
break;
|
||||
case 'c':
|
||||
o.confirm++;
|
||||
break;
|
||||
case 'a':
|
||||
o.allscript++; // Fall through
|
||||
case 'f':
|
||||
@@ -1719,6 +1722,7 @@ static int cmd_config(const PROGRAMMER *pgm, const AVRPART *p, int argc, const c
|
||||
" -f show value of fuse and lock bit memories as well\n"
|
||||
" -a output an initialisation script with all possible assignments\n"
|
||||
" -v increase verbosity, show explanations alongside output\n"
|
||||
" -c confirm new value of changed configuration properties\n"
|
||||
" -h show this help message\n"
|
||||
"\n"
|
||||
"Config alone shows all property names and current settings of the part's\n"
|
||||
@@ -1973,7 +1977,9 @@ static int cmd_config(const PROGRAMMER *pgm, const AVRPART *p, int argc, const c
|
||||
goto finished;
|
||||
}
|
||||
|
||||
int confirm = 0;
|
||||
if(towrite.i != fusel.current) {
|
||||
confirm = o.confirm;
|
||||
for(int i = 0; i < mem->size; i++)
|
||||
if(led_write_byte(pgm, p, mem, i, towrite.b[i]) < 0) {
|
||||
pmsg_error("(config) cannot write to %s's %s memory\n", p->desc, mem->desc);
|
||||
@@ -1983,7 +1989,7 @@ static int cmd_config(const PROGRAMMER *pgm, const AVRPART *p, int argc, const c
|
||||
}
|
||||
|
||||
const char *av[] = { "confirm", cc[ci].t->name, NULL };
|
||||
if(o.verb > 0 && !str_eq(argv[0], "confirm"))
|
||||
if((confirm || o.verb > 0) && !str_eq(argv[0], "confirm"))
|
||||
cmd_config(pgm, p, 2, av);
|
||||
|
||||
finished:
|
||||
|
||||
Reference in New Issue
Block a user