git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@852 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
dhoerl 2009-10-10 20:09:56 +00:00
parent c85c54cffb
commit 8ab13f94d5
1 changed files with 78 additions and 77 deletions

29
main.c
View File

@ -679,7 +679,6 @@ int main(int argc, char * argv [])
if ((strcmp(pgm->type, "STK500") == 0) ||
(strcmp(pgm->type, "avr910") == 0) ||
(strcmp(pgm->type, "BusPirate") == 0) ||
(strcmp(pgm->type, "STK500V2") == 0) ||
(strcmp(pgm->type, "JTAGMKII") == 0)) {
if (port == default_parallel) {
@ -723,6 +722,12 @@ int main(int argc, char * argv [])
}
}
if(p->flags & AVRPART_AVR32) {
if(erase) p->flags |= AVRPART_CHIP_ERASE;
safemode = 0;
auto_erase = 0;
}
/*
* set up seperate instances of the avr part, one for use in
* programming, one for use in verifying. These are separate
@ -751,7 +756,6 @@ int main(int argc, char * argv [])
if(p->avr910_devcode)fprintf(stderr, "0x%x\n", p->avr910_devcode);
else fprintf(stderr, "none\n");
}
}
if (baudrate != 0) {
@ -765,7 +769,6 @@ int main(int argc, char * argv [])
if (verbose) {
fprintf(stderr, "%sSetting bit clk period : %.1f\n", progbuf, bitclock);
}
pgm->bitclock = bitclock * 1e-6;
}
@ -861,6 +864,7 @@ int main(int argc, char * argv [])
* against 0xffffff / 0x000000 should ensure that the signature bytes
* are valid.
*/
if(!(p->flags & AVRPART_AVR32)) {
if (init_ok) {
rc = avr_signature(pgm, p);
if (rc != 0) {
@ -910,6 +914,7 @@ int main(int argc, char * argv [])
goto main_exit;
}
}
}
if (sig->size != 3 ||
sig->buf[0] != p->signature[0] ||
@ -957,15 +962,14 @@ int main(int argc, char * argv [])
exitrc = 1;
goto main_exit;
}
}
else {
} else {
//Save the fuses as default
safemode_memfuses(1, &safemode_lfuse, &safemode_hfuse, &safemode_efuse, &safemode_fuse);
}
}
if ((p->flags & AVRPART_HAS_PDI) != 0) {
if (p->flags & AVRPART_HAS_PDI) {
/*
* This is an ATxmega which can page erase, so no auto erase is
* needed.
@ -973,10 +977,8 @@ int main(int argc, char * argv [])
auto_erase = 0;
}
if ((erase == 0) && (auto_erase == 1)) {
AVRMEM * m;
for (ln=lfirst(updates); ln; ln=lnext(ln)) {
upd = ldata(ln);
m = avr_locate_mem(p, upd->memtype);
@ -1001,7 +1003,7 @@ int main(int argc, char * argv [])
*
* The cycle count will be displayed anytime it will be changed later.
*/
if (init_ok &&
if (init_ok && !(p->flags & AVRPART_AVR32) &&
(set_cycles == -1) && ((erase == 0) || (do_cycles == 0))) {
/*
* see if the cycle count in the last four bytes of eeprom seems
@ -1018,7 +1020,7 @@ int main(int argc, char * argv [])
}
}
if (init_ok && set_cycles != -1) {
if (init_ok && set_cycles != -1 && !(p->flags & AVRPART_AVR32)) {
rc = avr_get_cycle_count(pgm, p, &cycles);
if (rc == 0) {
/*
@ -1040,7 +1042,6 @@ int main(int argc, char * argv [])
}
}
if (init_ok && erase) {
/*
* erase the chip's flash and eeprom memories, this is required
@ -1054,11 +1055,11 @@ int main(int argc, char * argv [])
if (quell_progress < 2) {
fprintf(stderr, "%s: erasing chip\n", progname);
}
avr_chip_erase(pgm, p);
exitrc = avr_chip_erase(pgm, p);
if(exitrc) goto main_exit;
}
}
if (terminal) {
/*
* terminal mode
@ -1086,7 +1087,7 @@ int main(int argc, char * argv [])
/* Right before we exit programming mode, which will make the fuse
bits active, check to make sure they are still correct */
if (safemode == 1){
if (safemode == 1) {
/* If safemode is enabled, go ahead and read the current low,
* high, and extended fuse bytes as needed */
unsigned char safemodeafter_lfuse = 0xff;