Attempting to build a program for the new ATmega328PB, it seems the
device-specific IO file is not found:
avr-gcc -std=gnu99 -Wall -Os -DF_CPU=16000000 -mmcu=atmega328pb -flto
In file included from src/test.c:1:0:
/usr/lib/avr/include/avr/io.h:623:6: warning: #warning "device type not
# warning "device type not defined"
Further, I see that iom328pb.h isn't listed in the big long section of
#ifdef-guarded #includes in the main io.h. I see there is an attempted generic
fallback section based on value of __AVR_DEV_LIB_NAME__ but it seems for
whatever reason that isn't kicking in today.
If I simply add the required 2 lines (by copying the 328P example), my code
will compile fine. Attached is my patch and the new file.
I've attached a new patch (add_m328pb_to_svn_r2548.diff) that can be applied
to the now-current (rev 2548) svn trunk and which will add support for the
atmega328pb. This includes edits to various makefiles and scripts so that
support gets built in, plus two critical files: (1) atmega328pb.S which I
generated using the existing devtools/ioreg.pl against the ATmega328PB.atdf
XML file provided by Atmel in the now-current ATmega_DFP.1.2.272.atpack that I
retrieved from http://packs.download.atmel.com/; and (2) iom328pb.h which I
pulled from this atpack as well. One therefore need not use the
Atmel-distributed binary copies of crtatmega328pb.o and libatmega328pb.a
It seems to work for me, but better support for this chip can/should be added,
e.g. util/twi.h assumes only a single TWI module exists.