Start implementing support for ATmega256x;

jtag2 and bitbang programmers are working, stk500v2
still needs to be done.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@581 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2006-05-23 22:27:43 +00:00
parent d01b112d65
commit 554fe39832
7 changed files with 353 additions and 2 deletions

View File

@ -1,3 +1,14 @@
2006-04-18 Joerg Wunsch <j@uriah.heep.sax.de>
* avr.c: Start implementing support for ATmega256x;
jtag2 and bitbang programmers are working, stk500v2
still needs to be done.
* avrdude.conf.in: (Ditto.)
* avrpart.c: (Ditto.)
* avrpart.h: (Ditto.)
* config_gram.y: (Ditto.)
* lexer.l: (Ditto.)
2006-04-18 Joerg Wunsch <j@uriah.heep.sax.de> 2006-04-18 Joerg Wunsch <j@uriah.heep.sax.de>
Contributed by Julius Luukko <Julius.Luukko@lut.fi>: Contributed by Julius Luukko <Julius.Luukko@lut.fi>:

28
avr.c
View File

@ -51,7 +51,7 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
unsigned char cmd[4]; unsigned char cmd[4];
unsigned char res[4]; unsigned char res[4];
unsigned char data; unsigned char data;
OPCODE * readop; OPCODE * readop, * lext;
pgm->pgm_led(pgm, ON); pgm->pgm_led(pgm, ON);
pgm->err_led(pgm, OFF); pgm->err_led(pgm, OFF);
@ -79,6 +79,18 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
return -1; return -1;
} }
/*
* If this device has a "load extended address" command, issue it.
*/
lext = mem->op[AVR_OP_LOAD_EXT_ADDR];
if (lext != NULL) {
memset(cmd, 0, sizeof(cmd));
avr_set_bits(lext, cmd);
avr_set_addr(lext, cmd, addr);
pgm->cmd(pgm, cmd, res);
}
memset(cmd, 0, sizeof(cmd)); memset(cmd, 0, sizeof(cmd));
avr_set_bits(readop, cmd); avr_set_bits(readop, cmd);
@ -234,7 +246,7 @@ int avr_write_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
{ {
unsigned char cmd[4]; unsigned char cmd[4];
unsigned char res[4]; unsigned char res[4];
OPCODE * wp; OPCODE * wp, * lext;
wp = mem->op[AVR_OP_WRITEPAGE]; wp = mem->op[AVR_OP_WRITEPAGE];
if (wp == NULL) { if (wp == NULL) {
@ -254,6 +266,18 @@ int avr_write_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
pgm->pgm_led(pgm, ON); pgm->pgm_led(pgm, ON);
pgm->err_led(pgm, OFF); pgm->err_led(pgm, OFF);
/*
* If this device has a "load extended address" command, issue it.
*/
lext = mem->op[AVR_OP_LOAD_EXT_ADDR];
if (lext != NULL) {
memset(cmd, 0, sizeof(cmd));
avr_set_bits(lext, cmd);
avr_set_addr(lext, cmd, addr);
pgm->cmd(pgm, cmd, res);
}
memset(cmd, 0, sizeof(cmd)); memset(cmd, 0, sizeof(cmd));
avr_set_bits(wp, cmd); avr_set_bits(wp, cmd);

View File

@ -6500,6 +6500,316 @@ part
; ;
; ;
#------------------------------------------------------------
# ATmega2560
#------------------------------------------------------------
part
id = "m2560";
desc = "ATMEGA2560";
signature = 0x1e 0x98 0x01;
has_jtag = yes;
# stk500_devcode = 0xB2;
# avr910_devcode = 0x43;
chip_erase_delay = 9000;
pagel = 0xD7;
bs2 = 0xA0;
reset = dedicated;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
"x x x x x x x x x x x x x x x x";
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0",
"x x x x x x x x x x x x x x x x";
timeout = 200;
stabdelay = 100;
cmdexedelay = 25;
synchloops = 32;
bytedelay = 0;
pollindex = 3;
pollvalue = 0x53;
predelay = 1;
postdelay = 1;
pollmethod = 1;
idr = 0x31;
spmcr = 0x57;
rampz = 0x3b;
allowfullpagebitstream = no;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
size = 4096;
min_write_delay = 9000;
max_write_delay = 9000;
readback_p1 = 0x00;
readback_p2 = 0x00;
read = " 1 0 1 0 0 0 0 0",
" x x x x a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
write = " 1 1 0 0 0 0 0 0",
" x x x x a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
mode = 0x41;
delay = 10;
blocksize = 8;
readsize = 256;
;
memory "flash"
paged = yes;
size = 262144;
page_size = 256;
num_pages = 1024;
min_write_delay = 4500;
max_write_delay = 4500;
readback_p1 = 0x00;
readback_p2 = 0x00;
read_lo = " 0 0 1 0 0 0 0 0",
"a15 a14 a13 a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
read_hi = " 0 0 1 0 1 0 0 0",
"a15 a14 a13 a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
loadpage_lo = " 0 1 0 0 0 0 0 0",
" x x x x x x x x",
" x a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
loadpage_hi = " 0 1 0 0 1 0 0 0",
" x x x x x x x x",
" x a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
writepage = " 0 1 0 0 1 1 0 0",
"a15 a14 a13 a12 a11 a10 a9 a8",
" a7 x x x x x x x",
" x x x x x x x x";
load_ext_addr = " 0 1 0 0 1 1 0 1",
" 0 0 0 0 0 0 0 0",
" 0 0 0 0 0 0 0 a16",
" 0 0 0 0 0 0 0 0";
mode = 0x41;
delay = 6;
blocksize = 256;
readsize = 256;
;
memory "lfuse"
size = 1;
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
"x x x x x x x x i i i i i i i i";
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
"x x x x x x x x o o o o o o o o";
;
memory "hfuse"
size = 1;
write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
"x x x x x x x x i i i i i i i i";
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
"x x x x x x x x o o o o o o o o";
;
memory "efuse"
size = 1;
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
"x x x x x x x x x x x x x x i i";
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
"x x x x x x x x o o o o o o o o";
;
memory "lock"
size = 1;
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
"x x x x x x x x x x o o o o o o";
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
"x x x x x x x x 1 1 i i i i i i";
;
memory "calibration"
size = 1;
read = "0 0 1 1 1 0 0 0 x x x x x x x x",
"0 0 0 0 0 0 0 0 o o o o o o o o";
;
memory "signature"
size = 3;
read = "0 0 1 1 0 0 0 0 x x x x x x x x",
"x x x x x x a1 a0 o o o o o o o o";
;
;
#------------------------------------------------------------
# ATmega2561
#------------------------------------------------------------
part
id = "m2561";
desc = "ATMEGA2561";
signature = 0x1e 0x98 0x02;
has_jtag = yes;
# stk500_devcode = 0xB2;
# avr910_devcode = 0x43;
chip_erase_delay = 9000;
pagel = 0xD7;
bs2 = 0xA0;
reset = dedicated;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
"x x x x x x x x x x x x x x x x";
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0",
"x x x x x x x x x x x x x x x x";
timeout = 200;
stabdelay = 100;
cmdexedelay = 25;
synchloops = 32;
bytedelay = 0;
pollindex = 3;
pollvalue = 0x53;
predelay = 1;
postdelay = 1;
pollmethod = 1;
idr = 0x31;
spmcr = 0x57;
rampz = 0x3b;
allowfullpagebitstream = no;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
size = 4096;
min_write_delay = 9000;
max_write_delay = 9000;
readback_p1 = 0x00;
readback_p2 = 0x00;
read = " 1 0 1 0 0 0 0 0",
" x x x x a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
write = " 1 1 0 0 0 0 0 0",
" x x x x a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
mode = 0x41;
delay = 10;
blocksize = 8;
readsize = 256;
;
memory "flash"
paged = yes;
size = 262144;
page_size = 256;
num_pages = 1024;
min_write_delay = 4500;
max_write_delay = 4500;
readback_p1 = 0x00;
readback_p2 = 0x00;
read_lo = " 0 0 1 0 0 0 0 0",
"a15 a14 a13 a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
read_hi = " 0 0 1 0 1 0 0 0",
"a15 a14 a13 a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
loadpage_lo = " 0 1 0 0 0 0 0 0",
" x x x x x x x x",
" x a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
loadpage_hi = " 0 1 0 0 1 0 0 0",
" x x x x x x x x",
" x a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
writepage = " 0 1 0 0 1 1 0 0",
"a15 a14 a13 a12 a11 a10 a9 a8",
" a7 x x x x x x x",
" x x x x x x x x";
load_ext_addr = " 0 1 0 0 1 1 0 1",
" 0 0 0 0 0 0 0 0",
" 0 0 0 0 0 0 0 a16",
" 0 0 0 0 0 0 0 0";
mode = 0x41;
delay = 6;
blocksize = 256;
readsize = 256;
;
memory "lfuse"
size = 1;
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
"x x x x x x x x i i i i i i i i";
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
"x x x x x x x x o o o o o o o o";
;
memory "hfuse"
size = 1;
write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
"x x x x x x x x i i i i i i i i";
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
"x x x x x x x x o o o o o o o o";
;
memory "efuse"
size = 1;
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
"x x x x x x x x x x x x x x i i";
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
"x x x x x x x x o o o o o o o o";
;
memory "lock"
size = 1;
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
"x x x x x x x x x x o o o o o o";
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
"x x x x x x x x 1 1 i i i i i i";
;
memory "calibration"
size = 1;
read = "0 0 1 1 1 0 0 0 x x x x x x x x",
"0 0 0 0 0 0 0 0 o o o o o o o o";
;
memory "signature"
size = 3;
read = "0 0 1 1 0 0 0 0 x x x x x x x x",
"x x x x x x a1 a0 o o o o o o o o";
;
;
#------------------------------------------------------------ #------------------------------------------------------------
# ATtiny24 # ATtiny24
#------------------------------------------------------------ #------------------------------------------------------------

View File

@ -174,6 +174,7 @@ char * avr_op_str(int op)
case AVR_OP_WRITE_HI : return "WRITE_HI"; break; case AVR_OP_WRITE_HI : return "WRITE_HI"; break;
case AVR_OP_LOADPAGE_LO : return "LOADPAGE_LO"; break; case AVR_OP_LOADPAGE_LO : return "LOADPAGE_LO"; break;
case AVR_OP_LOADPAGE_HI : return "LOADPAGE_HI"; break; case AVR_OP_LOADPAGE_HI : return "LOADPAGE_HI"; break;
case AVR_OP_LOAD_EXT_ADDR : return "LOAD_EXT_ADDR"; break;
case AVR_OP_WRITEPAGE : return "WRITEPAGE"; break; case AVR_OP_WRITEPAGE : return "WRITEPAGE"; break;
case AVR_OP_CHIP_ERASE : return "CHIP_ERASE"; break; case AVR_OP_CHIP_ERASE : return "CHIP_ERASE"; break;
case AVR_OP_PGM_ENABLE : return "PGM_ENABLE"; break; case AVR_OP_PGM_ENABLE : return "PGM_ENABLE"; break;

View File

@ -41,6 +41,7 @@ enum {
AVR_OP_WRITE_HI, AVR_OP_WRITE_HI,
AVR_OP_LOADPAGE_LO, AVR_OP_LOADPAGE_LO,
AVR_OP_LOADPAGE_HI, AVR_OP_LOADPAGE_HI,
AVR_OP_LOAD_EXT_ADDR,
AVR_OP_WRITEPAGE, AVR_OP_WRITEPAGE,
AVR_OP_CHIP_ERASE, AVR_OP_CHIP_ERASE,
AVR_OP_PGM_ENABLE, AVR_OP_PGM_ENABLE,

View File

@ -65,6 +65,7 @@ static int parse_cmdbits(OPCODE * op);
%token K_WRITE_HI %token K_WRITE_HI
%token K_LOADPAGE_LO %token K_LOADPAGE_LO
%token K_LOADPAGE_HI %token K_LOADPAGE_HI
%token K_LOAD_EXT_ADDR
%token K_WRITEPAGE %token K_WRITEPAGE
%token K_CHIP_ERASE %token K_CHIP_ERASE
%token K_PGM_ENABLE %token K_PGM_ENABLE
@ -468,6 +469,7 @@ opcode :
K_WRITE_HI | K_WRITE_HI |
K_LOADPAGE_LO | K_LOADPAGE_LO |
K_LOADPAGE_HI | K_LOADPAGE_HI |
K_LOAD_EXT_ADDR |
K_WRITEPAGE | K_WRITEPAGE |
K_CHIP_ERASE | K_CHIP_ERASE |
K_PGM_ENABLE K_PGM_ENABLE
@ -927,6 +929,7 @@ static int which_opcode(TOKEN * opcode)
case K_WRITE_HI : return AVR_OP_WRITE_HI; break; case K_WRITE_HI : return AVR_OP_WRITE_HI; break;
case K_LOADPAGE_LO : return AVR_OP_LOADPAGE_LO; break; case K_LOADPAGE_LO : return AVR_OP_LOADPAGE_LO; break;
case K_LOADPAGE_HI : return AVR_OP_LOADPAGE_HI; break; case K_LOADPAGE_HI : return AVR_OP_LOADPAGE_HI; break;
case K_LOAD_EXT_ADDR : return AVR_OP_LOAD_EXT_ADDR; break;
case K_WRITEPAGE : return AVR_OP_WRITEPAGE; break; case K_WRITEPAGE : return AVR_OP_WRITEPAGE; break;
case K_CHIP_ERASE : return AVR_OP_CHIP_ERASE; break; case K_CHIP_ERASE : return AVR_OP_CHIP_ERASE; break;
case K_PGM_ENABLE : return AVR_OP_PGM_ENABLE; break; case K_PGM_ENABLE : return AVR_OP_PGM_ENABLE; break;

View File

@ -208,6 +208,7 @@ write_lo { yylval=new_token(K_WRITE_LO); return K_WRITE_LO; }
write_hi { yylval=new_token(K_WRITE_HI); return K_WRITE_HI; } write_hi { yylval=new_token(K_WRITE_HI); return K_WRITE_HI; }
loadpage_lo { yylval=new_token(K_LOADPAGE_LO); return K_LOADPAGE_LO; } loadpage_lo { yylval=new_token(K_LOADPAGE_LO); return K_LOADPAGE_LO; }
loadpage_hi { yylval=new_token(K_LOADPAGE_HI); return K_LOADPAGE_HI; } loadpage_hi { yylval=new_token(K_LOADPAGE_HI); return K_LOADPAGE_HI; }
load_ext_addr { yylval=new_token(K_LOAD_EXT_ADDR); return K_LOAD_EXT_ADDR; }
writepage { yylval=new_token(K_WRITEPAGE); return K_WRITEPAGE; } writepage { yylval=new_token(K_WRITEPAGE); return K_WRITEPAGE; }
chip_erase { yylval=new_token(K_CHIP_ERASE); return K_CHIP_ERASE; } chip_erase { yylval=new_token(K_CHIP_ERASE); return K_CHIP_ERASE; }
pgm_enable { yylval=new_token(K_PGM_ENABLE); return K_PGM_ENABLE; } pgm_enable { yylval=new_token(K_PGM_ENABLE); return K_PGM_ENABLE; }