From: Ragnar S. <ra...@na...> - 2001-01-14 15:29:17
|
--On den 13 januari 2001 22:16 +0100 Wolfgang Rapp <wol...@ra...> wrote: > My sdcc generate wron code for procudures in small model tested ... I have had so much problems with calling that I have started to avoid it. Sad, and my code looks like crap of course. Is there anyone out there that has looked into this? Is there any work going on to try to fix this situation? ... > extern BYTE EZUSB_ReadI2C_(BYTE xdata * dat, BYTE addr, BYTE l); ... Since you are using sdcc with EZUSB framework and I2C I can save you the following debugging; SDCC has a problem with idata struct members and postincrement. EZUSB framework's I2C code has this global state struct: typedef struct { BYTE length; BYTE *dat; BYTE count; BYTE status; }I2CPCKT; extern I2CPCKT I2CPckt; The interrupt service routine "i2c_isr" does this: I2DAT = I2CPckt.dat[I2CPckt.count++]; There is a bug in the compiler that will make the ++ a pre-increment in this particular case, not post-, as written. Replace it with: I2DAT = myI2CPckt.dat[myI2CPckt.count]; myI2CPckt.count++; instead. I haven't tried to fix this bug (either). /ragge |