I get the following error when compiling if the board is set to ATtiny85. To keep things simple, I was trying to compile the sample "blink.ino" sketch.
In file included from D:\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino/Arduino.h:193,
from Blink.ino:10:
D:\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino/HardwareSerial.h:125:2: error: #error TXC0 not definable in HardwareSerial.h
The relevant section of the header file is (the indenting is mine to make it easier to understand):
#if !defined(TXC0)
#if defined(TXC)
#define TXC0 TXC
#elif defined(TXC1)
// Some devices have uart1 but no uart0
#define TXC0 TXC1
#else
#error TXC0 not definable in HardwareSerial.h
#endif
#endif
The #ifdef's don't account for the case where neither TXC0 nor TXC1 exist
In HardwareSerial.cpp, the following #ifdef's are used to exclude all of the code, which also supresses the include for HardwareSerial.h, however, in Arduino.h, it goes ahead and include HardwareSerial.h anyways.
// this next line disables the entire HardwareSerial.cpp,
// this is so I can support Attiny series and any other chip without a uart
#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
If I modify Arduino.h to wrap the #include for HardwareSerial.h with the same #ifdef, then the error changes to:
D:\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino\IPAddress.cpp: In member function 'virtual size_t IPAddress::printTo(Print&) const':
D:\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino\IPAddress.cpp:49: error: invalid use of incomplete type 'struct Print'
D:\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino/Printable.h:25: error: forward declaration of 'struct Print'
D:\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino\IPAddress.cpp:49: error: 'DEC' was not declared in this scope
D:\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino\IPAddress.cpp:50: error: invalid use of incomplete type 'struct Print'
D:\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino/Printable.h:25: error: forward declaration of 'struct Print'
D:\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino\IPAddress.cpp:52: error: invalid use of incomplete type 'struct Print'
D:\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino/Printable.h:25: error: forward declaration of 'struct Print'
D:\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino\IPAddress.cpp:52: error: 'DEC' was not declared in this scope
I would have expected Arduino.h to have been the "top" header file, but that doesn't seem to be the case. It looks like the IPAddress code is dependent on a serial port being present and to somehow define or include the proper Print functions.
The includes and #ifdef's are rather broken for the AT tiny parts that don't have serial. It also looks like things are being included that shouldn't (blink really shouldn't have any need to include the IPAddress code at all, but it does).
I'm more than happy to help sort this out, but I'll need some ideas on where to start looking, more precisely, I'll need to know where to look for what the command line is that is used to start compiling so I know which headers to look at (and in more or less which order).
Camz.