Package: avr-libc
Version: 1:2.0.0+Atmel3.5.4-1
Severity: normal
Tags: patch

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 
-ffunction-sections ...
In file included from src/test.c:1:0:
/usr/lib/avr/include/avr/io.h:623:6: warning: #warning "device type not 
defined" [-Wcpp]
 #    warning "device type not defined"
      ^

I do have the required iom328pb.h file though:

-rw-r--r-- 1 root root 27K Jul 22  2016 /usr/lib/avr/include/avr/iom328pb.h

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.


-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages avr-libc depends on:
ii  binutils-avr  2.26.20160125+Atmel3.5.3-1
ii  gcc-avr       1:4.9.2+Atmel3.5.4-1

avr-libc recommends no packages.

avr-libc suggests no packages.

-- no debconf information
--- /usr/lib/avr/include/avr/io.h.orig	2017-07-05 00:48:35.739212601 +0100
+++ /usr/lib/avr/include/avr/io.h	2017-07-05 00:47:21.191361651 +0100
@@ -270,6 +270,8 @@
 #  include <avr/iom3250pa.h>  
 #elif defined (__AVR_ATmega328P__)
 #  include <avr/iom328p.h>
+#elif (defined __AVR_ATmega328PB__)
+#  include <avr/iom328pb.h>
 #elif (defined __AVR_ATmega328__)
 #include <avr/iom328.h>
 #elif defined (__AVR_ATmega329__)

Reply via email to