mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-09-27 14:35:27 +00:00
Various fixes for Xmega devices.
* avrdude.conf.in: Correctly declare EEPROM page sizes for all Xmega devices (0x20 instead of 0x100). * avr.c: If a memory region has a page size declared, try using the paged IO routines regardless of the target memory name. Xmega EEPROM requires to be written in paged mode. Correctly use a long (rather than unsigned long) variable to evaluate the success status of the paged mode write attempt. * stk500v2.c: Don't apply TIF space offsets twice (bug #27995: AVRDUDE 5.8svn fails to program and read XMEGA); use stk500v2_loadaddr() prior to paged mode (EEPROM and flash) writes, otherwise programming of flash areas will fail; while being there, check the return value of stk500v2_loadaddr() everywhere; use the correct write/erase mode bits (same as AVR Studio does). git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@907 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
57
avr.c
57
avr.c
@@ -171,26 +171,18 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
*/
|
||||
memset(buf, 0xff, size);
|
||||
|
||||
if ((strcmp(mem->desc, "eeprom")==0) ||
|
||||
(strcmp(mem->desc, "flash")==0) ||
|
||||
(strcmp(mem->desc, "application")==0) ||
|
||||
(strcmp(mem->desc, "apptable")==0) ||
|
||||
(strcmp(mem->desc, "boot")==0) ||
|
||||
(strcmp(mem->desc, "usersig")==0) ||
|
||||
(strcmp(mem->desc, "prodsig")==0)) {
|
||||
if (pgm->paged_load != NULL && mem->page_size != 0) {
|
||||
/*
|
||||
* the programmer supports a paged mode read, perhaps more
|
||||
* efficiently than we can read it directly, so use its routine
|
||||
* instead
|
||||
*/
|
||||
rc = pgm->paged_load(pgm, p, mem, mem->page_size, size);
|
||||
if (rc >= 0) {
|
||||
if (strcasecmp(mem->desc, "flash") == 0)
|
||||
return avr_mem_hiaddr(mem);
|
||||
else
|
||||
return rc;
|
||||
}
|
||||
if (pgm->paged_load != NULL && mem->page_size != 0) {
|
||||
/*
|
||||
* the programmer supports a paged mode read, perhaps more
|
||||
* efficiently than we can read it directly, so use its routine
|
||||
* instead
|
||||
*/
|
||||
rc = pgm->paged_load(pgm, p, mem, mem->page_size, size);
|
||||
if (rc >= 0) {
|
||||
if (strcasecmp(mem->desc, "flash") == 0)
|
||||
return avr_mem_hiaddr(mem);
|
||||
else
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,7 +537,7 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
{
|
||||
int rc;
|
||||
int wsize;
|
||||
unsigned long i;
|
||||
long i;
|
||||
unsigned char data;
|
||||
int werror;
|
||||
AVRMEM * m;
|
||||
@@ -574,21 +566,14 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
progbuf, wsize);
|
||||
}
|
||||
|
||||
if ((strcmp(m->desc, "application")==0) ||
|
||||
(strcmp(m->desc, "apptable")==0) ||
|
||||
(strcmp(m->desc, "boot")==0) ||
|
||||
(strcmp(m->desc, "flash")==0) ||
|
||||
(strcmp(m->desc, "prodsig")==0) ||
|
||||
(strcmp(m->desc, "usersig")==0)) {
|
||||
if (pgm->paged_write != NULL && m->page_size != 0) {
|
||||
/*
|
||||
* the programmer supports a paged mode write, perhaps more
|
||||
* efficiently than we can read it directly, so use its routine
|
||||
* instead
|
||||
*/
|
||||
if ((i = pgm->paged_write(pgm, p, m, m->page_size, size)) >= 0)
|
||||
return i;
|
||||
}
|
||||
if (pgm->paged_write != NULL && m->page_size != 0) {
|
||||
/*
|
||||
* the programmer supports a paged mode write, perhaps more
|
||||
* efficiently than we can read it directly, so use its routine
|
||||
* instead
|
||||
*/
|
||||
if ((i = pgm->paged_write(pgm, p, m, m->page_size, size)) >= 0)
|
||||
return i;
|
||||
}
|
||||
|
||||
if (pgm->write_setup) {
|
||||
|
Reference in New Issue
Block a user