On 19-Nov-2015 9:10 pm, "Ajay Garg" <ajaygargn...@gmail.com> wrote:
>
> Hi All.
>
> I am trying to build a hello-world program using a linux-gcc-toolchain.
>
>
> Following is the program ::
>
> #####################################################
> /* ledblink.c, an LED blinking program */
>
> #include<avr/io.h>
> #include<util/delay.h>
> void sleep(uint8_t millisec)
> {
>         while(millisec)
>
>         {
>                 _delay_ms(1);/* 1 ms delay */
>                 millisec--;
>         }
> }
> main()
> {
>
>         DDRC |=1<<PC2;  /* PC2 will now be the output pin */
>         while(1)
>         {
>                 PORTC &= ~(1<<PC2);/* PC2 LOW */
>                 sleep(100);/* 100 ms delay */
>
>                 PORTC |=(1<<PC2); /* PC2 HIGH */
>                 sleep(100);/* 100 ms delay */
>         }
> }
> #####################################################
>
>
>
>
> When I compile with -mmcu=atmega8, the device is found, and the program
builds fine.
>
>
>
> However with avrxmega7, it fails at the very beginning, with the error
"device not found" ::
>
>

avrxmega7 is not a real device - it represents a prototypical device for a
variant of the xmega ISA.

The device header and peripheral macros are only available for a real
device, which is why you're getting these errors.
#####################################################
> ajay@ajay-HP-15-Notebook-PC:~$ avr-gcc -mmcu=avrxmega7 ledblink.c -o
ledblink.o
> In file included from ledblink.c:2:0:
> /usr/lib/avr/include/avr/io.h:428:6: warning: #warning "device type not
defined" [-Wcpp]
>  #    warning "device type not defined"
>       ^
> In file included from ledblink.c:3:0:
> /usr/lib/avr/include/util/delay.h:90:3: warning: #warning "F_CPU not
defined for <util/delay.h>" [-Wcpp]
>  # warning "F_CPU not defined for <util/delay.h>"
>    ^
> /usr/lib/avr/include/util/delay.h:95:3: warning: #warning "Compiler
optimizations disabled; functions from <util/delay.h> won't work as
designed" [-Wcpp]
>  # warning "Compiler optimizations disabled; functions from
<util/delay.h> won't work as designed"
>    ^
> ledblink.c: In function ‘main’:
> ledblink.c:16:9: error: ‘DDRC’ undeclared (first use in this function)
>          DDRC |=1<<PC2;  /* PC2 will now be the output pin */
>          ^
> ledblink.c:16:9: note: each undeclared identifier is reported only once
for each function it appears in
> ledblink.c:16:19: error: ‘PC2’ undeclared (first use in this function)
>          DDRC |=1<<PC2;  /* PC2 will now be the output pin */
>                    ^
> ledblink.c:19:17: error: ‘PORTC’ undeclared (first use in this function)
>                  PORTC &= ~(1<<PC2);/* PC2 LOW */
> #####################################################
>
>
>
>
> Following are the various package-versions ::
>
> #####################################################
> ajay@ajay-HP-15-Notebook-PC:~$ dpkg -l | grep avr
> ii  avr-libc
1:1.8.0-4.1                                         all          Standard C
library for Atmel AVR development
> ii  avrdude
6.0.1-1                                             i386         software
for programming Atmel AVR microcontrollers
> ii  binutils-avr
2.23.1-2.1                                          i386         Binary
utilities supporting Atmel's AVR targets
> ii  gcc-avr
1:4.8-2.1                                           i386         The GNU C
compiler (cross compiler for avr)
> ii  gdb-avr
7.6-1                                               i386         The GNU
Debugger for avr
> ii  libavresample2:i386
6:11-1trusty                                        i386         Libav
audio resampling library
> #####################################################
>
>
> What am I missing?
>
>
> --
> Regards,
> Ajay
>
> _______________________________________________
> AVR-GCC-list mailing list
> AVR-GCC-list@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to