ATtiny2313 with arduino-tiny core libs 0100-0015: compile errors

Hi,
I get compile errors when trying to build a simple sketch for the ATtiny2313 with the core libs which I downloaded from here:
http://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0100-0015.zip

The error reads:

In file included from /usr/lib/gcc/avr/4.7.0/../../../avr/include/util/delay.h:44:0,
                 from /usr/lib/gcc/avr/4.7.0/../../../avr/include/avr/delay.h:37,
                 from /usr/share/arduino/hardware/tiny/cores/tiny/wiring_private.h:32,
                 from /usr/share/arduino/hardware/tiny/cores/tiny/WInterrupts.c:37:
/usr/lib/gcc/avr/4.7.0/../../../avr/include/math.h:427:15: error: expected identifier or ‘(’ before ‘double’
/usr/lib/gcc/avr/4.7.0/../../../avr/include/math.h:427:15: error: expected ‘)’ before ‘>=’ token

I followed several suggestions uncommenting the line in math.h (Google Code Archive - Long-term storage for Google Code Project Hosting.):

#define round(x)     ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

That did not help me either because that produces another error:

/usr/share/arduino/hardware/tiny/cores/tiny/HardwareSerial.cpp:94:15: error: attempt to use poisoned "SIG_USART0_RECV"

I compile against avr 4.7.0 with Arduino 1.0.1 on Ubuntu 12.10.
Maybe it's the gcc-avr version which produces the error ?

Did anybody solve the problem with the above mentioned libs under Arduino 1.0.1 ?

Regards
AgeBee

Does this help...
http://code.google.com/p/arduino/issues/detail?id=955

Thanks for your instant reply.
I already came across this article which suggests downgrading the gcc-avr to 4.3.5.
The strange thing however is that my setup works for all other boards (controllers) like the ATtiny4313, ATtiny44, ATTiny25, ATtiny85 a.s.o.
The only one not working is the ATtiny2313. That prevented me from downgrading very quickly.

No problem. I will offer a potential solution but there is a condition. You have to report back if the solution works (or doesn't). Agreed? Excellent, let's get started...

• Locate and open HardwareSerial.cpp in the {Sketch}/hardware/tiny/cores/tiny directory/

• Replace all occurrences of SIGNAL with ISR

• Save and close HardwareSerial.cpp

• Try to compile

Thanks a bunch for your quick help. Sure I will and I did as you wanted but without success:

/usr/share/arduino/hardware/tiny/cores/tiny/HardwareSerial.cpp:94:15: error: attempt to use poisoned "SIG_USART0_RECV"

In HardwareSerial.cpp line 94 reads this:

#elif defined(SIG_USART0_RECV) && defined(UDR0)

Huh. That thing is a righteous mess isn't it.

This is what I did...

• Replace SIG_USART0_RECV with USART0_RECV_vect

• Replace SIG_UART0_RECV with UART0_RECV_vect

• Replace SIG_UART_RECV with UART_RECV_vect

• Delete the following starting at line #167...
#elif defined(SIG_USART3_RECV)
#error SIG_USART3_RECV

• Delete the following starting at line #157...
#elif defined(SIG_USART2_RECV)
#error SIG_USART2_RECV

• Delete the following starting at line #147...
#elif defined(SIG_USART1_RECV)
#error SIG_USART1_RECV

Attached to this post is the updated HardwareSerial.cpp. Locate the version on your computer and replace it with the one attached. Same condition as before: please let me know what happens.

HardwareSerial.cpp (8.4 KB)

Hi Coding Badly,
that worked like charm ! Thank you very much for your help.
If this forum would have the status 'holy' for the members it would be definitely you who deserves it first.
Wishing you a pleasant and sound new year.
Harald

AgeBee:
that worked like charm !

Excellent. Thank you for letting me know.

Thank you very much for your help.

You are welcome.

Wishing you a pleasant and sound new year.

Back at ya!