Hello All, 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. A topic on AvrFreaks http://www.avrfreaks.com/index.php?name=PNphpBB2&file=viewtopic&t=21371 discussed the fact that the eeprom_read functions are not atomic. I.e. An interrupt could potentially mess up EEARL & EEARH. 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) No 2 is improved by first reading the eeprom location and skipping the write if not necessary. Generaly when writing a block of data, usually contained in a structure, only a few bytes have been changed. This mod made a huge difference to my application No 3 was a trivial fix. Just protecting the read was necessary, the write was already protected. To use this I include the correct library in my Makefile using "LDFLAGS += libee1F.a" for the 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 think ? Nigel Winterbottom _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-libc-dev