Add support for the -x devcode option, and document it.

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@769 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
joerg_wunsch 2008-03-24 21:22:04 +00:00
parent 8b391a8150
commit da0f0105bb
5 changed files with 123 additions and 35 deletions

View File

@ -1,3 +1,9 @@
2008-03-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avr910.c: Add support for the -x devcode option.
* avrdude.1: Document -x devcode for avr910.
* doc/avrdude.texi: (Ditto.)
2008-03-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Add initial support for the Atmel STK600, for

4
NEWS
View File

@ -16,6 +16,10 @@ Current:
* Add support for the Atmel STK600 for "classic" AVRs (AT90, ATtiny,
ATmega), using either ISP or high-voltage programming modes.
* Add support for the -x devcode extended parameter to the avr910
programmer, to allow overriding the device code sent to the
programmer.
Version 5.5:
* Add support for the USBtinyISP programmer (patch #6233)

View File

@ -47,6 +47,7 @@
struct pdata
{
char has_auto_incr_addr;
unsigned char devcode;
};
#define PDATA(pgm) ((struct pdata *)(pgm->cookie))
@ -193,6 +194,8 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
if (PDATA(pgm)->has_auto_incr_addr == 'Y')
fprintf(stderr, "Programmer supports auto addr increment.\n");
if (PDATA(pgm)->devcode == 0) {
/* Get list of devices that the programmer supports. */
avr910_send(pgm, "t", 1);
@ -222,13 +225,17 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
if (!ovsigck)
exit(1);
}
/* Tell the programmer which part we selected.
If the user forced the selection, use the first device
/* If the user forced the selection, use the first device
type that is supported by the programmer. */
buf[0] = 'T';
buf[1] = ovsigck? devtype_1st: p->avr910_devcode;
} else {
/* devcode overridden by -x devcode= option */
buf[1] = (char)(PDATA(pgm)->devcode);
}
/* Tell the programmer which part we selected. */
buf[0] = 'T';
/* buf[1] has been set up above */
avr910_send(pgm, buf, 2);
avr910_vfy_cmd_sent(pgm, "select device");
@ -284,6 +291,45 @@ static int avr910_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
}
static int avr910_parseextparms(PROGRAMMER * pgm, LISTID extparms)
{
LNODEID ln;
const char *extended_param;
int rv = 0;
for (ln = lfirst(extparms); ln; ln = lnext(ln)) {
extended_param = ldata(ln);
if (strncmp(extended_param, "devcode=", strlen("devcode=")) == 0) {
int devcode;
if (sscanf(extended_param, "devcode=%i", &devcode) != 1 ||
devcode <= 0 || devcode > 255) {
fprintf(stderr,
"%s: avr910_parseextparms(): invalid devcode '%s'\n",
progname, extended_param);
rv = -1;
continue;
}
if (verbose >= 2) {
fprintf(stderr,
"%s: avr910_parseextparms(): devcode overwritten as 0x%02x\n",
progname, devcode);
}
PDATA(pgm)->devcode = devcode;
continue;
}
fprintf(stderr,
"%s: avr910_parseextparms(): invalid extended parameter '%s'\n",
progname, extended_param);
rv = -1;
}
return rv;
}
static int avr910_open(PROGRAMMER * pgm, char * port)
{
/*
@ -634,6 +680,7 @@ void avr910_initpgm(PROGRAMMER * pgm)
pgm->read_sig_bytes = avr910_read_sig_bytes;
pgm->parseextparams = avr910_parseextparms;
pgm->setup = avr910_setup;
pgm->teardown = avr910_teardown;
}

View File

@ -19,7 +19,7 @@
.\"
.\" $Id$
.\"
.Dd DATE March 14, 2008
.Dd DATE March 24, 2008
.Os
.Dt AVRDUDE 1
.Sh NAME
@ -666,7 +666,7 @@ Set the target's supply voltage to
.Ar voltage
Volts.
.Em Only supported on the STK500 and STK600 programmer.
.It Ar varef Op channel Ar voltage
.It Ar varef Oo Ar channel Oc Ar voltage
Set the adjustable voltage source to
.Ar voltage
Volts.
@ -780,6 +780,22 @@ bits after the target AVR, respectively.
Each AVR unit within the chain shifts by 4 bits.
Other JTAG units might require a different bit shift count.
.El
.It Ar AVR910
.Bl -tag -offset indent -width indent
.It Ar devcode=VALUE
Override the device code selection by using
.Ar VALUE
as the device code.
The programmer is not queried for the list of supported
device codes, and the specified
.Ar VALUE
is not verified but used directly within the
.Ql T
command sent to the programmer.
.Ar VALUE
can be specified using the conventional number notation of the
C programming language.
.El
.El
.Sh FILES
.Bl -tag -offset indent -width /dev/ppi0XXX

View File

@ -802,7 +802,7 @@ should not be used.
When using the JTAG ICE mkII or AVR Dragon in JTAG mode, the
following extended parameter is accepted:
@table @code
@item @var{jtagchain=UB,UA,BB,BA}
@item @samp{jtagchain=UB,UA,BB,BA}
Setup the JTAG scan chain for @var{UB} units before, @var{UA} units
after, @var{BB} bits before, and @var{BA} bits after the target AVR,
respectively.
@ -810,6 +810,21 @@ Each AVR unit within the chain shifts by 4 bits.
Other JTAG units might require a different bit shift count.
@end table
@item AVR910
The AVR910 programmer type accepts the following extended parameter:
@table @code
@item @samp{devcode=VALUE}
Override the device code selection by using @var{VALUE}
as the device code.
The programmer is not queried for the list of supported
device codes, and the specified @var{VALUE}
is not verified but used directly within the
@code{T} command sent to the programmer.
@var{VALUE} can be specified using the conventional number notation of the
C programming language.
@end table
@end table
@page
@ -1060,7 +1075,7 @@ and STK600 programmer:
@item vtarg @var{voltage}
Set the target's supply voltage to @var{voltage} Volts.
@item varef @var{[channel]} @var{voltage}
@item varef [@var{channel}] @var{voltage}
Set the adjustable voltage source to @var{voltage} Volts.
This voltage is normally used to drive the target's
@emph{Aref} input on the STK500 and STK600.
@ -1068,10 +1083,10 @@ The STK600 offers two reference voltages, which can be
selected by the optional parameter @var{channel} (either
0 or 1).
@item fosc @var{freq}[@var{M}|@var{k}]
@item fosc @var{freq}[@code{M}|@code{k}]
Set the master oscillator to @var{freq} Hz.
An optional trailing letter @var{M}
multiplies by 1E6, a trailing letter @var{k} by 1E3.
An optional trailing letter @code{M}
multiplies by 1E6, a trailing letter @code{k} by 1E3.
@item fosc off
Turn the master oscillator off.