code8825 / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

ATmega168/328 bootloader fails to compile with avr-libs 1.6.7 #152

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
avr-libc: 1.6.7-4.5
avr-gcc: 4.4.2

reason: EEWE bit definition is missing. apparently removed from avr/eeprom.h

offending code:

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__)
                                while(bit_is_set(EECR,EEPE));             
     //Wait for previous EEPROM writes to complete
#else
                                while(bit_is_set(EECR,EEWE));             
     //Wait for previous EEPROM writes to complete
#endif
                                asm volatile( 

related forum post:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1260104386

Original issue reported on code.google.com by madworm_...@spitzenpfeil.org on 7 Dec 2009 at 11:06

GoogleCodeExporter commented 9 years ago
This should be easy to fix. Change it to read:

#if defined(EEPE)
                while(bit_is_set(EECR,EEPE));           //Wait for previous EEPROM writes to complete
#else
                while(bit_is_set(EECR,EEWE));           //Wait for previous EEPROM writes to complete
#endif

While you're at it, this should probably be changed too:

#if defined(SPMCSR)
                     : "=m" (SPMCSR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
#else
                     : "=m" (SPMCR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
#endif

This way when new devices are added these don't need to be changed yet again.

Original comment by walker...@gmail.com on 8 Jun 2010 at 10:53