> 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, 28.11.5.2 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 _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-libc-dev