Mega-commit to bring in both, the STK500v2 support from Erik

Walthinsen, as well as JTAG ICE mkII support (by me).

Erik's submission has been cleaned up a little bit, mostly to add his
name and the current year to the copyright of the new file, remove
trailing white space before importing the files, and fix the minor
syntax errors in his avrdude.conf.in additions (missing semicolons).

The JTAG ICE mkII support should be considered alpha to beta quality
at this point.  Few things are still to be done, like defering the
hfuse (OCDEN) tweaks until they are really required.  Also, for
reasons not yet known, the target MCU doesn't start to run after
signing off from the ICE, it needs a power-cycle first (at least on my
STK500).

Note that for the JTAG ICE, I did change a few things in the internal
API.  Notably I made the serial receive timeout configurable by the
backends via an exported variable (done in both the Posix and the
Win32 implementation), and I made the serial_recv() function return a
-1 instead of bailing out with exit(1) upon encountering a receive
timeout (currently only done in the Posix implementation).  Both
measures together allow me to receive a datastreem from the ICE at 115
kbps on a somewhat lossy PCI multi-UART card that occasionally drops a
character.  The JTAG ICE mkII protocol has enough of safety layers to
allow recovering from these events, but the previous code wasn't
prepared for any kind of recovery.  The Win32 change for this still
has to be done, and the traditional drivers need to be converted to
exit(1) upon encountering a timeout (as they're now getting a -1
returned they didn't see before in that case).


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@451 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch
2005-05-10 19:17:12 +00:00
parent bcd52759b1
commit 04831af970
16 changed files with 2227 additions and 85 deletions

View File

@@ -33,9 +33,11 @@
#include "ppi.h"
#include "pgm.h"
#include "stk500.h"
#include "stk500v2.h"
#include "avr910.h"
#include "butterfly.h"
#include "avr.h"
#include "jtagmkII.h"
#if defined(WIN32NATIVE)
#define strtok_r( _s, _sep, _lasts ) \
@@ -87,6 +89,7 @@ static int parse_cmdbits(OPCODE * op);
%token K_FLASH
%token K_ID
%token K_IO
%token K_JTAG_MKII
%token K_LOADPAGE
%token K_MAX_WRITE_DELAY
%token K_MIN_WRITE_DELAY
@@ -111,6 +114,7 @@ static int parse_cmdbits(OPCODE * op);
%token K_SCK
%token K_SIZE
%token K_STK500
%token K_STK500V2
%token K_AVR910
%token K_BUTTERFLY
%token K_TYPE
@@ -121,6 +125,36 @@ static int parse_cmdbits(OPCODE * op);
%token K_NO
%token K_YES
/* stk500 v2 xml file parameters */
%token K_TIMEOUT
%token K_STABDELAY
%token K_CMDEXEDELAY
%token K_SYNCHLOOPS
%token K_BYTEDELAY
%token K_POLLVALUE
%token K_POLLINDEX
%token K_PREDELAY
%token K_POSTDELAY
%token K_POLLMETHOD
%token K_MODE
%token K_DELAY
%token K_BLOCKSIZE
%token K_READSIZE
/* JTAG ICE mkII specific parameters */
%token K_ALLOWFULLPAGEBITSTREAM /*
* Internal parameter for the JTAG
* ICE; describes the internal JTAG
* streaming behaviour inside the MCU.
* 1 for all older chips, 0 for newer
* MCUs.
*/
%token K_ENABLEPAGEPROGRAMMING /* ? yes for mega256*, mega406 */
%token K_HAS_JTAG /* MCU has JTAG i/f. */
%token K_IDR /* address of OCD register in IO space */
%token K_RAMPZ /* address of RAMPZ reg. in IO space */
%token K_SPMCR /* address of SPMC[S]R in memory space */
%token TKN_COMMA
%token TKN_EQUAL
%token TKN_SEMI
@@ -296,6 +330,12 @@ prog_parm :
}
} |
K_TYPE TKN_EQUAL K_STK500V2 {
{
stk500v2_initpgm(current_prog);
}
} |
K_TYPE TKN_EQUAL K_AVR910 {
{
avr910_initpgm(current_prog);
@@ -308,6 +348,12 @@ prog_parm :
}
} |
K_TYPE TKN_EQUAL K_JTAG_MKII {
{
jtagmkII_initpgm(current_prog);
}
} |
K_DESC TKN_EQUAL TKN_STRING {
strncpy(current_prog->desc, $3->value.string, PGM_DESCLEN);
current_prog->desc[PGM_DESCLEN-1] = 0;
@@ -483,6 +529,114 @@ part_parm :
free_tokens(2, $1, $3);
} |
K_TIMEOUT TKN_EQUAL TKN_NUMBER
{
current_part->timeout = $3->value.number;
free_token($3);
} |
K_STABDELAY TKN_EQUAL TKN_NUMBER
{
current_part->stabdelay = $3->value.number;
free_token($3);
} |
K_CMDEXEDELAY TKN_EQUAL TKN_NUMBER
{
current_part->cmdexedelay = $3->value.number;
free_token($3);
} |
K_SYNCHLOOPS TKN_EQUAL TKN_NUMBER
{
current_part->synchloops = $3->value.number;
free_token($3);
} |
K_BYTEDELAY TKN_EQUAL TKN_NUMBER
{
current_part->bytedelay = $3->value.number;
free_token($3);
} |
K_POLLVALUE TKN_EQUAL TKN_NUMBER
{
current_part->pollvalue = $3->value.number;
free_token($3);
} |
K_POLLINDEX TKN_EQUAL TKN_NUMBER
{
current_part->pollindex = $3->value.number;
free_token($3);
} |
K_PREDELAY TKN_EQUAL TKN_NUMBER
{
current_part->predelay = $3->value.number;
free_token($3);
} |
K_POSTDELAY TKN_EQUAL TKN_NUMBER
{
current_part->postdelay = $3->value.number;
free_token($3);
} |
K_POLLMETHOD TKN_EQUAL TKN_NUMBER
{
current_part->pollmethod = $3->value.number;
free_token($3);
} |
K_HAS_JTAG TKN_EQUAL yesno
{
if ($3->primary == K_YES)
current_part->flags |= AVRPART_HAS_JTAG;
else if ($3->primary == K_NO)
current_part->flags &= ~AVRPART_HAS_JTAG;
free_token($3);
} |
K_ALLOWFULLPAGEBITSTREAM TKN_EQUAL yesno
{
if ($3->primary == K_YES)
current_part->flags |= AVRPART_ALLOWFULLPAGEBITSTREAM;
else if ($3->primary == K_NO)
current_part->flags &= ~AVRPART_ALLOWFULLPAGEBITSTREAM;
free_token($3);
} |
K_ENABLEPAGEPROGRAMMING TKN_EQUAL yesno
{
if ($3->primary == K_YES)
current_part->flags |= AVRPART_ENABLEPAGEPROGRAMMING;
else if ($3->primary == K_NO)
current_part->flags &= ~AVRPART_ENABLEPAGEPROGRAMMING;
free_token($3);
} |
K_IDR TKN_EQUAL TKN_NUMBER
{
current_part->idr = $3->value.number;
free_token($3);
} |
K_RAMPZ TKN_EQUAL TKN_NUMBER
{
current_part->rampz = $3->value.number;
free_token($3);
} |
K_SPMCR TKN_EQUAL TKN_NUMBER
{
current_part->spmcr = $3->value.number;
free_token($3);
} |
K_SERIAL TKN_EQUAL yesno
{
if ($3->primary == K_YES)
@@ -630,6 +784,38 @@ mem_spec :
free_token($3);
} |
K_MODE TKN_EQUAL TKN_NUMBER
{
current_mem->mode = $3->value.number;
free_token($3);
} |
K_DELAY TKN_EQUAL TKN_NUMBER
{
current_mem->delay = $3->value.number;
free_token($3);
} |
K_BLOCKSIZE TKN_EQUAL TKN_NUMBER
{
current_mem->blocksize = $3->value.number;
free_token($3);
} |
K_READSIZE TKN_EQUAL TKN_NUMBER
{
current_mem->readsize = $3->value.number;
free_token($3);
} |
K_POLLINDEX TKN_EQUAL TKN_NUMBER
{
current_mem->pollindex = $3->value.number;
free_token($3);
} |
opcode TKN_EQUAL string_list {
{
int opnum;