[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] Re: [patch #6878] eewr_byte.S update for patch #6718

From: Bob Paddock
Subject: [avr-libc-dev] Re: [patch #6878] eewr_byte.S update for patch #6718
Date: Thu, 6 Aug 2009 12:46:27 -0400

> Follow-up Comment #2, patch #6878 (project avr-libc):
> There is a problem using r20 register: it is used to count bytes to write in
> eewr_block (look in eedef.h) that uses eewr_byte function. If you use that
> register you will overwrite the counter and the eeprom_write_block function
> will not work anymore.

Thanks for finding that.  I'll look at the rest of the files to see
what is free.

> There is another point: there's no need to look for NVM busy after a buffer
> erase, it will not erase eeprom locations but only the buffer.

Table 28-4 for command number 0x36 indicates that busy should be used, says the same.

> I tested the eewr_byte function with all the write/update functions
> (word/dword/block) because they all uses the byte write function.
> I suggest to update the CVS with this file, no need to change the other write
> and update functions.

I agree that is the way it works now.  I think it would be better if they
were changed to use mapped memory.  The time overhead for a block could
be reduced by about 32 times (32 byte buffer) by removing the call to
byte write so many times.
I was hopping to get to this over the weekend.  Change
byte/write/dwrite to simply
be block writes of 1/2/4 bytes.

> P.S. The function 'eeprom_write_r18' uses one more scratch register, r17 
> would it not?
> Update "readme_eeprom.txt" accordingly.

I'm not sure I follow?  I don't see that r17 is used, at least not
finding with grep in the .S files.
Using r17 would be in confilct with what the FAQ says:
"Call-used registers (r18-r27, r30-r31):
May be allocated by gcc for local data. You *may* use them freely in
assembler subroutines. Calling C subroutines can clobber any of them -
the caller is responsible for saving and restoring."

Maybe you mean readme_eeprom.txt does need updated with the new
register usage, which won't be r17?
I'll take care of that too.

> (file #18534)
> File name: eewr_byte.S                    Size:4 KB

reply via email to

[Prev in Thread] Current Thread [Next in Thread]