Okay, so the midnight oil must not have been burning very brightly last night! It turns out the problem was caused when reading data across the serial line. The serial port was translating carriage returns (0x0d) to newlines (0x0a)... So there was not a compiler problem after all! Steve -----Original Message----- From: Conner, W Steven Sent: Tuesday, June 12, 2001 3:10 AM To: [EMAIL PROTECTED] Cc: '[EMAIL PROTECTED]' Subject: avr-gcc bug for 16bit short integers? We have noticed a bug with using 16bit short integers on the motes that we believe may be generated by avr-gcc. I have attached a simple tinyos application based on cnt_to_rfm.desc that increments a 16bit short integer on each clock cycle and sends it over the radio. On motes based on both the 8535 and the mega163 we are seeing an error when the counter is incremented above 0x0cff. In this case, (0x0cff + 1) becomes 0x0a00 instead of the correct value 0x0d00. The counter then recovers when the high byte transitions to 0x0e00: the incorrect (0x0aff + 1) becomes the correct value 0x0e00. Has anyone experience similar problems with 16bit counters on the motes? We upgraded to the latest release of avr-gcc for Linux (build 060601), but this did not fix the problem. We are thinking of implementing our own 16-bit counters based on 8-bit chars as a workaround, but this makes us a bit nervous about what other bugs may be lurking around in our compiler generated code... Has anyone experimented with compilers other than avr-gcc to build tinyos applications for the motes? Steve
