bugAVR Downloader/UploaDEr - Bugs: bug #22883, Chip Erase performed even with...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #22883: Chip Erase performed even with no-write flag (-n)

Submitter:  None
Submitted:  Wed 09 Apr 2008 05:31:37 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  joerg_wunsch Originator Name:  Thomas Holland
Originator Email:  -email is unavailable- Open/Closed:  Closed
Release:  None Programmer hardware: 
Device type: 

Tue 04 Nov 2008 12:13:38 PM UTC, comment #5: 

I decided to ignore the safemode issue, and applied a fix
similar to the originally submitted one, except it also
prints a message that the chip is not being erased.

Joerg Wunsch <joerg_wunsch>
Group administrator
Wed 09 Apr 2008 11:07:14 PM UTC, comment #4: 

OK, give me a few days to finish the avrdude support in my Eclipse plugin and then I will take care of the avrdude simulation mode.

Thomas Holland <innot>
Wed 09 Apr 2008 09:02:42 PM UTC, comment #3: 

Well, sure, it's possible that the fuse values do change even
when reading, e.g. if the ISP hardware is questionable.  But
then, I would very much doubt "fixing" the fuses will make
anything better at all... but I'm fine with leaving it enabled,
after all, it will only ever attempt to write something back
after asking the user.

Oh yes, I'm fine with patches sent!

Joerg Wunsch <joerg_wunsch>
Group administrator
Wed 09 Apr 2008 08:44:25 PM UTC, comment #2: 

I am not sure.

If I use "-n" I would expect that the MCU is absolutly in the same state after avrdude as before.

So it might be better to leave safemode enabled, so when Fusebytes magically change just by reading from the MCU (is this possible?), it might be more consistent with the user intention to write the old values back, even if it does mean that something is written back.

But something else: I just noticed that -Y xxxx will also write to the eeprom regardless of "-n".
That one should be disabled as well.

And while we are at it: It might be a good idea to print a few messages if writing has been disabled by "-n" (see http://www.mikrocontroller.net/topic/95432#823132)

If you like I can implement those and send you a patch.

brgds

Thomas

Thomas Holland <innot>
Wed 09 Apr 2008 07:03:25 PM UTC, comment #1: 

I guess -n should also diable safemode, as safemode would
also potentially want to "fix" the fuses if they appear to
be broken after the session.

Joerg Wunsch <joerg_wunsch>
Group administrator
Wed 09 Apr 2008 05:31:37 PM UTC, original submission:  

While the -n flag prevents avrdude from writing anything to the flash memory, it will nevertheless happily do a chip erase.

This is somewhat unexpected, as the docs state that -n "disables actually writing data to the MCU". I would consider filling the memory with 0xff very much as writing to the MCU.

Below is a small patch to prevent the chip erase when the -n option has been selected.

brgds

Thomas

Index: main.c
===================================================================
RCS file: /sources/avrdude/avrdude/main.c,v
retrieving revision 1.131
diff -u -r1.131 main.c
--- main.c 8 Nov 2007 22:34:36 -0000 1.131
+++ main.c 9 Apr 2008 17:29:42 -0000
@@ -1015,7 +1015,7 @@
   }
 
 
-  if (erase) {
+  if (erase && !nowrite) {
     /*
      * erase the chip's flash and eeprom memories, this is required
      * before the chip can accept new programming


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by innot (Posted a comment)
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-11-04 joerg_wunsch StatusNone Fixed
        Assigned toNone joerg_wunsch
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code