From 2ef34a70c329951b3c856426191581266016a1c8 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Thu, 9 Apr 2015 19:50:30 +0000 Subject: [PATCH] bug #44717: avrdude creates empty flash dump When about to write an empty flash dump file, warn about this to avoid surprises. Document the truncation of trailing 0xFF bytes for flash memory areas. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1355 81a1dc3b-b13d-400b-aceb-764788c761c2 --- NEWS | 1 + avrdude.1 | 6 ++++++ doc/avrdude.texi | 6 ++++++ update.c | 3 +++ 4 files changed, 16 insertions(+) diff --git a/NEWS b/NEWS index 32453c2b..e6892b75 100644 --- a/NEWS +++ b/NEWS @@ -61,6 +61,7 @@ Current: - bug #42908: no external reset at JTAGICE3 - patch #8437: [PATCH] Serial-over-ethernet for Win32 - patch #8380: adds 500k 1M 2M baud to ser_posix.c + - bug #44717: avrdude creates empty flash dump * Internals: - Removing exit calls from config parser diff --git a/avrdude.1 b/avrdude.1 index a5e98ef5..682bb329 100644 --- a/avrdude.1 +++ b/avrdude.1 @@ -670,6 +670,12 @@ field is no longer optional since the filename part following the colon would otherwise be misinterpreted as .Ar format . .Pp +When reading any kind of flash memory area (including the various sub-areas +in Xmega devices), the resulting output file will be truncated to not contain +trailing 0xFF bytes which indicate unprogrammed (erased) memory. +Thus, if the entire memory is unprogrammed, this will result in an output +file that has no contents at all. +.Pp As an abbreviation, the form .Fl U Ar filename is equivalent to specifying diff --git a/doc/avrdude.texi b/doc/avrdude.texi index 383764f0..c04e562b 100644 --- a/doc/avrdude.texi +++ b/doc/avrdude.texi @@ -717,6 +717,12 @@ Note that if @var{filename} contains a colon, the @var{format} field is no longer optional since the filename part following the colon would otherwise be misinterpreted as @var{format}. +When reading any kind of flash memory area (including the various sub-areas +in Xmega devices), the resulting output file will be truncated to not contain +trailing 0xFF bytes which indicate unprogrammed (erased) memory. +Thus, if the entire memory is unprogrammed, this will result in an output +file that has no contents at all. + As an abbreviation, the form @code{-U} @var{filename} is equivalent to specifying @code{-U} @emph{flash:w:}@var{filename}@emph{:a}. diff --git a/update.c b/update.c index ecad1054..7bf5539a 100644 --- a/update.c +++ b/update.c @@ -243,6 +243,9 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f size = rc; if (quell_progress < 2) { + if (rc == 0) + avrdude_message(MSG_INFO, "%s: Flash is empty, resulting file has no contents.\n", + progname); avrdude_message(MSG_INFO, "%s: writing output file \"%s\"\n", progname, strcmp(upd->filename, "-")==0 ? "" : upd->filename);