I just discover a new and strange bug in the compiler. The codes are like this
#define EEPROM_SIZE (E2END+1)
typedef unsigned char u08 ;
typedef unsigned short u16;
u08 i ;
u16 aa ;
for (i=1;i<3;i++) eeprom_wb(aa++,i+1) ;
return 0 ;
I have no problem in the compilation stage. These are the make command output
avr-gcc -c -g -Os -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst -mmcu=at90s2313 -I. test.c -o test.o
avr-gcc test.o -Wl,-Map=test.map,--cref -mmcu=at90s2313 -o test.elf
avr-objcopy -O avrobj -R .eeprom test.elf test.obj
avr-objcopy -O ihex -R .eeprom test.elf test.rom
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex test.elf test.eep
However, when I try program the AT90S2313, I got a failure in the verification of the eeprom at address 0x10 and 0x11. I have try several variants and find that the failure addresses are indentical to those used in my program. Whne I read the eeprom back, I found the values of 02 and 03 in address 0x10 and 0x11 respectively instead of the 0xff !
The strange thing is I do have another program which use eeprom_wb() and it work prefectly OK ! I did compare the two and is uable to locate the difference which activate the problem.
Did anyone encounter this problem before ?
Any suggestion which can get around this problem will be appreciated.
The attached zip file is my complete project file. The slave.c is the one with the bug.