Submitted by Fred (magister):

bug #38951: AVR109 use byte offset instead of word offset
patch #8045: AVR109 butterfly failing
* butterfly.c (butterfly_paged_load, butterfly_paged_write):
fix calculation of 'A' address when operating on flash memory.
It must be given in terms of 16-bit words rather than bytes.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1205 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
joerg_wunsch 2013-09-03 21:24:16 +00:00
parent 5eca827eb3
commit 2f00bdcac5
3 changed files with 22 additions and 8 deletions

View File

@ -1,6 +1,15 @@
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Fred (magister):
bug #38951: AVR109 use byte offset instead of word offset
patch #8045: AVR109 butterfly failing
* butterfly.c (butterfly_paged_load, butterfly_paged_write):
fix calculation of 'A' address when operating on flash memory.
It must be given in terms of 16-bit words rather than bytes.
2013-09-03 Rene Liebscher <R.Liebscher@gmx.de> 2013-09-03 Rene Liebscher <R.Liebscher@gmx.de>
* avrftdi.c, avrftdi_private.h: added tx buffer size, and use * avrftdi.c, avrftdi_private.h: added tx buffer size, and use
smaller block sizes as larger sometimes hang smaller block sizes as larger sometimes hang
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de> 2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>

1
NEWS
View File

@ -89,6 +89,7 @@ Current:
- bug #38307: Can't write usersig of an xmega256a3 - bug #38307: Can't write usersig of an xmega256a3
- bug #38580 Current svn head, xmega and fuses, all fuses tied to fuse0 - bug #38580 Current svn head, xmega and fuses, all fuses tied to fuse0
- bug #39691 Buffer overrun when reading EEPROM byte with JTAGICE3 - bug #39691 Buffer overrun when reading EEPROM byte with JTAGICE3
- bug #38951: AVR109 use byte offset instead of word offset
* Keep track of input file contents * Keep track of input file contents

View File

@ -589,17 +589,18 @@ static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
char *cmd; char *cmd;
unsigned int blocksize = PDATA(pgm)->buffersize; unsigned int blocksize = PDATA(pgm)->buffersize;
int use_ext_addr = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL; int use_ext_addr = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL;
unsigned int wr_size = 2;
if (strcmp(m->desc, "flash") && strcmp(m->desc, "eeprom")) if (strcmp(m->desc, "flash") && strcmp(m->desc, "eeprom"))
return -2; return -2;
if (m->desc[0] == 'e') if (m->desc[0] == 'e')
blocksize = 1; /* Write to eeprom single bytes only */ wr_size = blocksize = 1; /* Write to eeprom single bytes only */
if (use_ext_addr) { if (use_ext_addr) {
butterfly_set_extaddr(pgm, addr); butterfly_set_extaddr(pgm, addr / wr_size);
} else { } else {
butterfly_set_addr(pgm, addr); butterfly_set_addr(pgm, addr / wr_size);
} }
#if 0 #if 0
@ -638,24 +639,27 @@ static int butterfly_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
unsigned int addr, unsigned int n_bytes) unsigned int addr, unsigned int n_bytes)
{ {
unsigned int max_addr = addr + n_bytes; unsigned int max_addr = addr + n_bytes;
int rd_size = 1; int rd_size = 2;
int blocksize = PDATA(pgm)->buffersize;
int use_ext_addr = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL; int use_ext_addr = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL;
/* check parameter syntax: only "flash" or "eeprom" is allowed */ /* check parameter syntax: only "flash" or "eeprom" is allowed */
if (strcmp(m->desc, "flash") && strcmp(m->desc, "eeprom")) if (strcmp(m->desc, "flash") && strcmp(m->desc, "eeprom"))
return -2; return -2;
if (m->desc[0] == 'e')
rd_size = blocksize = 1; /* Read from eeprom single bytes only */
{ /* use buffered mode */ { /* use buffered mode */
char cmd[4]; char cmd[4];
int blocksize = PDATA(pgm)->buffersize;
cmd[0] = 'g'; cmd[0] = 'g';
cmd[3] = toupper((int)(m->desc[0])); cmd[3] = toupper((int)(m->desc[0]));
if (use_ext_addr) { if (use_ext_addr) {
butterfly_set_extaddr(pgm, addr); butterfly_set_extaddr(pgm, addr / rd_size);
} else { } else {
butterfly_set_addr(pgm, addr); butterfly_set_addr(pgm, addr / rd_size);
} }
while (addr < max_addr) { while (addr < max_addr) {
if ((max_addr - addr) < blocksize) { if ((max_addr - addr) < blocksize) {