Eclipse and NewSoftSerial tunedDelay

Hi,

I've been using an Arduino for a while now, but have hit a complete developement wall with using Eclipse and NewSoftSerial.

There seems to have been some talk on this subject a while ago (madworm's posts, here: [EDIT - links in next post, forum wont let me post links in my first post!] ) but the fix described there does not work for me :/

To elaborate, the problem is with the ASM register constraints in the following function (part of NSS).

inline void NewSoftSerial::tunedDelay(uint16_t delay) {
  uint8_t tmp=0;

  asm volatile("sbiw    %0, 0x01 \n\t"
    "ldi %1, 0xFF \n\t"
    "cpi %A0, 0xFF \n\t"
    "cpc %B0, %1 \n\t"
    "brne .-10 \n\t"
    : "+w" (delay), "+a" (tmp)
    : "0" (delay)
    );
}

I've tried several combinations of the constraints described here: [EDIT: Link included in next post, see previous reason why] to no avail, but I only have passing familiarity with avr asm anyway, so I'm in the dark here.

It works fine in the Arduino IDE, but once included in Eclipse (source in an 'Arduino' project, linked to the main project, such that it becomes part of the library) I get "inconsistent operand constraints in an 'asm' NewSoftSerial.cpp /DiecimilaCore/NewSoftSerial line 184 C/C++ Problem"

My platform is Ubuntu Linux 9.10, Eclipse 3.5.2, avr-gcc 4.3.3.

Any help at this stage would be greatly useful! :)

Thanks in advance!

Links

Post referred to: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1233298805/75 AVR reference referred to: http://www.nongnu.org/avr-libc/user-manual/inline_asm.html#io_ops

Aha!

Got it, for those who find this post, my solution is this:

inline void NewSoftSerial::tunedDelay(uint16_t delay) {
  uint8_t tmp=0;

  asm volatile("sbiw    %0, 0x01 \n\t"
    "ldi %1, 0xFF \n\t"
    "cpi %A0, 0xFF \n\t"
    "cpc %B0, %1 \n\t"
    "brne .-10 \n\t"
    : "=r" (delay), "+a" (tmp)
    : "0" (delay)
    );
}