* config_gram.y: Implement the "ocdrev" keyword

* avrpart.c: (Dito)
* avrpart.h: (Dito)
* lexer.l: (Dito)
* avrdude.conf.in: Add "ocdrev" key/value pairs, based
on the AS6 XML file information.
* jtag3.c: Use the ocdrev in the parameter block.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1124 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
joerg_wunsch 2012-12-04 13:59:37 +00:00
parent 1f7b134420
commit 05fd0beac1
7 changed files with 175 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2012-12-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* config_gram.y: Implement the "ocdrev" keyword
* avrpart.c: (Dito)
* avrpart.h: (Dito)
* lexer.l: (Dito)
* avrdude.conf.in: Add "ocdrev" key/value pairs, based
on the AS6 XML file information.
* jtag3.c: Use the ocdrev in the parameter block.
2012-12-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3.c: Make jtag3_command() public

View File

@ -1481,6 +1481,8 @@ part
programfusepolltimeout = 25;
programlockpolltimeout = 25;
ocdrev = 0;
memory "eeprom"
size = 64;
page_size = 4;
@ -2966,6 +2968,8 @@ part
spmcr = 0x68;
allowfullpagebitstream = yes;
ocdrev = 2;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -3148,6 +3152,8 @@ part
rampz = 0x3b;
allowfullpagebitstream = yes;
ocdrev = 1;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -3327,6 +3333,8 @@ part
eecr = 0x3f;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -3517,6 +3525,8 @@ part
eecr = 0x3f;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -3707,6 +3717,8 @@ part
eecr = 0x3f;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -3896,6 +3908,8 @@ part
spmcr = 0x57;
allowfullpagebitstream = yes;
ocdrev = 2;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
@ -4033,6 +4047,8 @@ part parent "m16"
poweroffdelay = 15;
resetdelayms = 1;
allowfullpagebitstream = no;
ocdrev = 3;
;
@ -4093,6 +4109,8 @@ part
spmcr = 0x57;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
@ -4237,6 +4255,8 @@ part parent "m324p"
id = "m324pa";
desc = "ATmega324PA";
signature = 0x1e 0x95 0x11;
ocdrev = 3;
;
@ -4297,6 +4317,8 @@ part
spmcr = 0x57;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -4440,6 +4462,8 @@ part parent "m644"
id = "m644p";
desc = "ATmega644P";
signature = 0x1e 0x96 0x0a;
ocdrev = 3;
;
@ -4501,6 +4525,8 @@ part
spmcr = 0x57;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -4661,6 +4687,8 @@ part
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
"x x x x x x x x x x x x x x x x";
ocdrev = 2;
memory "flash"
paged = yes;
size = 16384;
@ -5041,6 +5069,8 @@ part
idr = 0x31;
spmcr = 0x57;
ocdrev = 2;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
@ -5222,6 +5252,8 @@ part
idr = 0x31;
spmcr = 0x57;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
@ -5362,6 +5394,8 @@ part parent "m329"
id = "m329p";
desc = "ATmega329P";
signature = 0x1e 0x95 0x0b;
ocdrev = 3;
;
#------------------------------------------------------------
@ -5374,6 +5408,8 @@ part parent "m329"
id = "m3290";
desc = "ATmega3290";
signature = 0x1e 0x95 0x04;
ocdrev = 3;
;
#------------------------------------------------------------
@ -5386,6 +5422,8 @@ part parent "m3290"
id = "m3290p";
desc = "ATmega3290P";
signature = 0x1e 0x95 0x0c;
ocdrev = 3;
;
#------------------------------------------------------------
@ -5440,6 +5478,8 @@ part
idr = 0x31;
spmcr = 0x57;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -5581,6 +5621,8 @@ part parent "m649"
id = "m6490";
desc = "ATmega6490";
signature = 0x1e 0x96 0x04;
ocdrev = 3;
;
#------------------------------------------------------------
@ -5638,6 +5680,8 @@ part
spmcr = 0x57;
allowfullpagebitstream = yes;
ocdrev = 2;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
@ -6588,6 +6632,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no;
size = 128;
@ -6777,6 +6823,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no;
size = 256;
@ -6966,6 +7014,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no;
size = 512;
@ -7154,6 +7204,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no;
page_size = 4;
@ -7292,6 +7344,8 @@ part parent "m48"
id = "m48p";
desc = "ATmega48P";
signature = 0x1e 0x92 0x0a;
ocdrev = 1;
;
#------------------------------------------------------------
@ -7350,6 +7404,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no;
page_size = 4;
@ -7488,6 +7544,8 @@ part parent "m88"
id = "m88p";
desc = "ATmega88P";
signature = 0x1e 0x93 0x0f;
ocdrev = 1;
;
#------------------------------------------------------------
@ -7546,6 +7604,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no;
page_size = 4;
@ -7686,6 +7746,8 @@ part parent "m168"
id = "m168p";
desc = "ATmega168P";
signature = 0x1e 0x94 0x0b;
ocdrev = 1;
;
#------------------------------------------------------------
@ -7744,6 +7806,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no;
page_size = 4;
@ -7930,6 +7994,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no;
page_size = 4;
@ -8066,6 +8132,8 @@ part parent "m328"
id = "m328p";
desc = "ATmega328P";
signature = 0x1e 0x95 0x0F;
ocdrev = 1;
;
#------------------------------------------------------------
@ -8126,6 +8194,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 0;
memory "eeprom"
size = 128;
paged = no;
@ -8313,6 +8383,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 0;
memory "eeprom"
size = 256;
paged = no;
@ -8639,6 +8711,8 @@ part parent "pwm2"
id = "pwm2b";
desc = "AT90PWM2B";
signature = 0x1e 0x93 0x83;
ocdrev = 1;
;
#------------------------------------------------------------
@ -8650,6 +8724,8 @@ part parent "pwm2"
part parent "pwm2b"
id = "pwm3b";
desc = "AT90PWM3B";
ocdrev = 1;
;
#------------------------------------------------------------
@ -8663,6 +8739,8 @@ part parent "pwm3b"
desc = "AT90PWM316";
signature = 0x1e 0x94 0x83;
ocdrev = 1;
memory "flash"
paged = yes;
size = 16384;
@ -8762,6 +8840,8 @@ part
programfusepolltimeout = 25;
programlockpolltimeout = 25;
ocdrev = 1;
memory "eeprom"
size = 128;
paged = no;
@ -8942,6 +9022,8 @@ part
programfusepolltimeout = 25;
programlockpolltimeout = 25;
ocdrev = 1;
memory "eeprom"
size = 256;
page_size = 4;
@ -9121,6 +9203,8 @@ part
programfusepolltimeout = 25;
programlockpolltimeout = 25;
ocdrev = 1;
memory "eeprom"
size = 512;
paged = no;
@ -9301,6 +9385,8 @@ part
rampz = 0x3b;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -9489,6 +9575,8 @@ part
rampz = 0x3b;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -9629,6 +9717,8 @@ part parent "m1280"
id = "m1281";
desc = "ATmega1281";
signature = 0x1e 0x97 0x04;
ocdrev = 3;
;
#------------------------------------------------------------
@ -9688,6 +9778,8 @@ part
rampz = 0x3b;
allowfullpagebitstream = no;
ocdrev = 4;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -9832,6 +9924,8 @@ part parent "m2560"
id = "m2561";
desc = "ATmega2561";
signature = 0x1e 0x98 0x02;
ocdrev = 4;
;
#------------------------------------------------------------
@ -9846,6 +9940,8 @@ part parent "m2561"
chip_erase_delay = 55000;
bs2 = 0xE2;
ocdrev = 3;
memory "flash"
paged = yes;
size = 131072;
@ -9898,6 +9994,8 @@ part parent "m2561"
chip_erase_delay = 55000;
bs2 = 0xE2;
ocdrev = 4;
;
#------------------------------------------------------------
@ -9909,6 +10007,8 @@ part parent "m128rfa1"
desc = "ATmega128RFR2";
signature = 0x1e 0xa7 0x02;
ocdrev = 3;
;
#------------------------------------------------------------
@ -9921,6 +10021,8 @@ part parent "m128rfa1"
signature = 0x1e 0xa6 0x02;
ocdrev = 3;
memory "flash"
paged = yes;
size = 65536;
@ -10020,6 +10122,8 @@ part
programfusepolltimeout = 25;
programlockpolltimeout = 25;
ocdrev = 1;
memory "eeprom"
size = 128;
paged = no;
@ -10202,6 +10306,8 @@ part
programfusepolltimeout = 25;
programlockpolltimeout = 25;
ocdrev = 1;
memory "eeprom"
size = 256;
paged = no;
@ -10384,6 +10490,8 @@ part
programfusepolltimeout = 25;
programlockpolltimeout = 25;
ocdrev = 1;
memory "eeprom"
size = 512;
paged = no;
@ -10566,6 +10674,8 @@ part
rampz = 0x3b;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -10754,6 +10864,8 @@ part
rampz = 0x3b;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -10894,6 +11006,8 @@ part parent "usb646"
id = "usb647";
desc = "AT90USB647";
signature = 0x1e 0x96 0x82;
ocdrev = 3;
;
#------------------------------------------------------------
@ -10953,6 +11067,8 @@ part
rampz = 0x3b;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -11093,6 +11209,8 @@ part parent "usb1286"
id = "usb1287";
desc = "AT90USB1287";
signature = 0x1e 0x97 0x82;
ocdrev = 3;
;
#------------------------------------------------------------
@ -11144,6 +11262,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
@ -11328,6 +11448,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
@ -11514,6 +11636,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
@ -11699,6 +11823,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
@ -11884,6 +12010,8 @@ part
programlockpulsewidth = 0;
programlockpolltimeout = 5;
ocdrev = 1;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
@ -12070,6 +12198,8 @@ part
spmcr = 0x57;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 4; /* for parallel programming */
@ -12259,6 +12389,8 @@ part
spmcr = 0x57;
allowfullpagebitstream = no;
ocdrev = 3;
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
@ -12400,6 +12532,8 @@ part parent "m325"
id = "m3250";
desc = "ATmega3250";
signature = 0x1E 0x95 0x06;
ocdrev = 3;
;
#------------------------------------------------------------
@ -12410,6 +12544,8 @@ part parent "m645"
id = "m6450";
desc = "ATmega6450";
signature = 0x1E 0x96 0x06;
ocdrev = 3;
;
#------------------------------------------------------------

View File

@ -460,6 +460,7 @@ AVRPART * avr_new_part(void)
p->lineno = 0;
memset(p->signature, 0xFF, 3);
p->ctl_stack_type = CTL_STACK_NONE;
p->ocdrev = -1;
p->mem = lcreat(NULL, 0);

View File

@ -157,6 +157,7 @@ typedef struct avrpart {
unsigned short eecr; /* JTAC ICE mkII XML file parameter */
unsigned int mcu_base; /* Base address of MCU control block in ATxmega devices */
unsigned int nvm_base; /* Base address of NVM controller in ATxmega devices */
int ocdrev; /* OCD revision (JTAGICE3 parameter, from AS6 XML files) */
OPCODE * op[AVR_OP_MAX]; /* opcodes */

View File

@ -99,6 +99,7 @@ static int pin_name;
%token K_MOSI
%token K_NUM_PAGES
%token K_NVM_BASE
%token K_OCDREV
%token K_OFFSET
%token K_PAGEL
%token K_PARALLEL
@ -1095,6 +1096,12 @@ part_parm :
free_token($3);
} |
K_OCDREV TKN_EQUAL TKN_NUMBER
{
current_part->ocdrev = $3->value.number;
free_token($3);
} |
K_SERIAL TKN_EQUAL yesno
{
if ($3->primary == K_YES)

21
jtag3.c
View File

@ -817,6 +817,7 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
struct mega_device_desc md;
LNODEID ln;
AVRMEM * m;
unsigned int flashsize;
memset(&md, 0, sizeof md);
@ -825,7 +826,7 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
if (strcmp(m->desc, "flash") == 0) {
PDATA(pgm)->flash_pagesize = m->page_size;
u16_to_b2(md.flash_page_size, m->page_size);
u32_to_b4(md.flash_size, m->size);
u32_to_b4(md.flash_size, (flashsize = m->size));
// do we need it? just a wild guess
u32_to_b4(md.boot_address, (m->size - m->page_size * 4) / 2);
} else if (strcmp(m->desc, "eeprom") == 0) {
@ -836,7 +837,23 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
}
//md.sram_offset[2] = p->sram; // do we need it?
md.ocd_revision = 3; /* XXX! */
if (p->ocdrev == -1) {
int ocdrev;
/* lacking a proper definition, guess the OCD revision */
if (p->flags & AVRPART_HAS_DW)
ocdrev = 1; /* exception: ATtiny13, 2313, 4313 */
else if (flashsize > 128 * 1024)
ocdrev = 4;
else
ocdrev = 3; /* many exceptions from that, actually */
fprintf(stderr,
"%s: part definition for %s lacks \"ocdrev\"; guessing %d\n",
progname, p->desc, ocdrev);
md.ocd_revision = ocdrev;
} else {
md.ocd_revision = p->ocdrev;
}
md.always_one = 1;
md.allow_full_page_bitstream = (p->flags & AVRPART_ALLOWFULLPAGEBITSTREAM) != 0;
md.idr_address = p->idr;

View File

@ -179,6 +179,7 @@ no { yylval=new_token(K_NO); return K_NO; }
num_banks { yylval=NULL; return K_NUM_PAGES; }
num_pages { yylval=NULL; return K_NUM_PAGES; }
nvm_base { yylval=NULL; return K_NVM_BASE; }
ocdrev { yylval=NULL; return K_OCDREV; }
offset { yylval=NULL; return K_OFFSET; }
page_size { yylval=NULL; return K_PAGE_SIZE; }
paged { yylval=NULL; return K_PAGED; }