On Wed, Aug 20, 2014 at 04:53:02PM +0200, Karol Babioch wrote:
> Hi,
> 
> I can built avr-libc 1.8.0 just fine with the following commands:
> 
> [johnpatcher@vpcs avr-libc-1.8.0]$ ./configure
> --build=x86_64-unknown-linux-gnu --host=avr --prefix=/usr
> [johnpatcher@vpcs avr-libc-1.8.0]$ make
> 
> However, the same won't work for avr-libc 1.8.1 as it complains about a
> device type not being defined:
> 
> The output is quite long, but essentially it looks something like this:
> 
> avr-gcc -DHAVE_CONFIG_H -I. -I../../../..  -I../../../../common
> -I../../../../include -I../../../../include  -I../../../../common
> -I../../../../include -I../../../../include -x assembler-with-cpp
> -mmcu=atxmega256a3bu  -DIOSYMFILE=\"iosym/atxmega256a3bu.S\"   -MT
> gcrt1.o -MD -MP -MF .deps/gcrt1.Tpo -c -o gcrt1.o ../../../../crt1/gcrt1.S
> In file included from ../../../../common/macros.inc:39:0,
>                  from ../../../../crt1/gcrt1.S:40:
> ../../../../include/avr/io.h:530:6: warning: #warning "device type not
> defined" [-Wcpp]
>  #    warning "device type not defined"
>       ^
> ../../../../crt1/gcrt1.S: Assembler messages:
> ../../../../crt1/gcrt1.S:55: Error: non-constant expression in ".if"
> statement
> 
> [...]
> 
> Makefile:411: recipe for target 'gcrt1.o' failed
> make[5]: *** [gcrt1.o] Error 1
> 
> I've found this thread [1] with an answer from Joerg Wunsch, but I'm not
> sure what to make of it. Is this a mistake on my side (why does it work
> for avr-libc 1.8.0 then?) or is there something wrong with the build
> tools? My avr-gcc version is 4.9.0 in case it makes any difference.

avr-libc support for the failing device (atxmega256a3bu) was added after
1.8.0, which is why the build goes fine with 1.8.0.

The reason for the failure is because of a typo in the compiler defined
macro for the device in gcc (see r209446).
-AVR_MCU ("atxmega256a3bu",   ARCH_AVRXMEGA6, AVR_ISA_NONE, 
"__AVR_ATxmega258A3BU__",   0x2000, 5, "x256a3bu")
+AVR_MCU ("atxmega256a3bu",   ARCH_AVRXMEGA6, AVR_ISA_NONE, 
"__AVR_ATxmega256A3BU__",   0x2000, 5, "x256a3bu")

The fix has been backported to gcc 4.9.1, so upgrading avr-gcc to that
version should fix the problem. If you don't want to do that and don't 
care about the device, you can just change include/avr/io.h to check for
the wrong name :)

diff --git avr-libc/include/avr/io.h avr-libc/include/avr/io.h
index 591a0b3..3df2e2f 100644
--- avr-libc/include/avr/io.h
+++ avr-libc/include/avr/io.h
@@ -488,7 +488,7 @@
 #  include <avr/iox256a3u.h>
 #elif defined (__AVR_ATxmega256A3B__)
 #  include <avr/iox256a3b.h>
-#elif defined (__AVR_ATxmega256A3BU__)
+#elif defined (__AVR_ATxmega258A3BU__)
 #  include <avr/iox256a3bu.h>
 #elif defined (__AVR_ATxmega256C3__)
 #  include <avr/iox256c3.h>

Hope this helps.

Regards
Senthil

_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to