I posted a query here http://www.avrfreaks.com/index.php?name=PNphpBB2&file=viewtopic&t=26005
but it was ignored. Please read it, it's a good introduction to my query.
I am aware of 3 problems with the eeprom support in avr-libc.
1. The SFR addresses are wrong for mega48, mega169, mega329 and the like.
2. eeprom_write_block takes a very long time even for small blocks. (56-Bytes takes approx 0.5s)
3. As discussed here http://www.avrfreaks.com/index.php?name=PNphpBB2&file=viewtopic&t=21371
The eeprom_read functions are not atomic. I.e. An interrupt could potentially mess up EEARL & EEARH.
To solve 2 & 3, I have taken the avr-libc source "eeprom.S" and heavily modified it to create "eeprom1.S" and I've made 2 libraries as follows:
1. libee1C.a for EECR at 0x1C (for Mega128 etc)
2. libee1F.a for EECR at 0x1F (for Mega169, Mega48 etc)
To use this I include the correct library in my Makefile using "LDFLAGS += libee1F.a" for mega169 example. This library overrides the avr-libc functions of the same name.
A zip file (libee.zip) is attached which contains the source, libraries and the Makefile used to build the libraries.
To solve 1 properly is somewhat more difficult.
Let's assume that creating separate builds of avr-libc specific to each micro is not on the cards.
Could then, the eeprom modules be stripped out of the standard "core dependant" builds of avr-libc and be provided as separate "SFR Location" based builds. We might only need the above 2 to start with:
It is then the users responsibility to include the correct library in his Makefile as I did above.
Much better still is that the linker script that invokes the correct avr-libc for each micro could also invoke the correct libeeXX.a.
What do people (especially Eric Weddington & Jörg Wunsch) think ?