From 889b1f3e48e1b24e8cd1f3b78f052702d6558871 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Tue, 4 Nov 2008 12:10:28 +0000 Subject: [PATCH] bug #22883: Chip Erase performed even with no-write flag (-n) Do not erase the chip if both, -e and -n options have been specified. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@784 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/ChangeLog | 6 ++++++ avrdude/main.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog index a12f8703..d27876af 100644 --- a/avrdude/ChangeLog +++ b/avrdude/ChangeLog @@ -1,3 +1,9 @@ +2008-11-04 Joerg Wunsch + + bug #22883: Chip Erase performed even with no-write flag (-n) + * main.c: Do not erase the chip if both, -e and -n options have + been specified. + 2008-11-04 Joerg Wunsch bug #24589: AT90USB64* have wrong signature diff --git a/avrdude/main.c b/avrdude/main.c index dccb1bb5..0f986bf3 100644 --- a/avrdude/main.c +++ b/avrdude/main.c @@ -1037,10 +1037,16 @@ int main(int argc, char * argv []) * erase the chip's flash and eeprom memories, this is required * before the chip can accept new programming */ - if (quell_progress < 2) { - fprintf(stderr, "%s: erasing chip\n", progname); + if (nowrite) { + fprintf(stderr, + "%s: conflicting -e and -n options specified, NOT erasing chip\n", + progname); + } else { + if (quell_progress < 2) { + fprintf(stderr, "%s: erasing chip\n", progname); + } + avr_chip_erase(pgm, p); } - avr_chip_erase(pgm, p); }