bugAVR C Runtime Library - Bugs: bug #38192, eeprom_update_byte does not use...


bug #38192: eeprom_update_byte does not use bitwise AND

Submitted by:  None
Submitted on:  Tue 29 Jan 2013 11:23:56 AM UTC  
Category: LibrarySeverity: 3 - Normal
Priority: 5 - NormalItem Group: libc code
Status: NonePercent Complete: 0%
Assigned to: NoneOriginator Email: -unavailable-
Open/Closed: OpenRelease: Any
Fixed Release: None

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Tue 29 Jan 2013 11:23:56 AM UTC, original submission:

As described in AVR103, there is no need of erase cycle if new value match bitwise AND between the old value and the new value.

Patch below uses this functionality, eeprom endurance is higher and update time is reduced too.

% diff -u eeupd_byte.S.orig eeupd_byte.S
--- eeupd_byte.S.orig 2013-01-29 10:54:43.000000000 +0100
+++ eeupd_byte.S 2013-01-29 12:02:25.000000000 +0100
@@ -88,8 +88,14 @@
breq 2f

# if defined (EEPM0) && defined (EEPM1)
- ; Set programming mode: erase and write.
+ ; Set programming mode: write only
out SFR_IO_ADDR (EECR), __zero_reg_
+ ;test bitwise AND
+ and _tmp_reg_, r18
+ cpse _tmp_reg_, r18
+ ; final value different, set programing mode: erase and write
# elif defined (EEPM0) || defined (EEPM1)
# error /* Unknown EECR register. */
# endif



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

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by None (Submitted the item)

    Please enter the title of George Orwell's famous dystopian book (it's a date):



    No Changes Have Been Made to This Item

    Back to the top

    Powered by Savane 3.1-cleanup1