Compiling for different boards doesn't work?

Hi,
I've got a bit of a problem... I run arduino 0017 on my Mac and I wrote a (long) program with several libraries included. It fits on Atmega168 perfectly (12,5kB :slight_smile: ) but I need 5 more kB and I wanted to use atmega328 (tryed to compile "original 12,5kB code), but it went OK with all boards but with ones using 328. It returns an error:

In function 'char s_write_byte(unsigned char)':
error: 'PB1' was not declared in this scope In function 'unsigned char s_read_byte(unsigned char)':
 In function 'void s_transstart()':
 In function 'void s_connectionreset()':

Any idea what is different if I use other processor?

Regards,
Peter

It's very likely that the library containing s_write_byte is not being rebuilt. Locate the dot-oh file, delete it, and try again.

There is an issue with the short form port/pin names (e.g. PB1) not being defined within the AVR AtMega328 header files.

The solution is to change "PB1" in the source to "PORTB1". This is just a longer form name for the same constant and will work for all the AtMega based Arduino's.

The culprit is "portpins.h" in the avr directory.

It should contain sections like:

#if defined(PB0) && !defined(PORTB0)
#  define PORTB0 PB0
#elif defined(PORTB0) && !defined(PB0)
#  define PB0 PORTB0
#endif

The one coming with arduino-17 on windows and mac only has this:

#if defined(PB0)
#  define PORTB0 PB0
#endif

Up to date version of the toolchain have it fixed, so on linux this may work, depending on the version of avr-libc. Hopefully this will be fixed in 018.

Thanks for that, it works :slight_smile: Now to get back to work...

Regards,
Peter