Re: Building code

Senthil Kumar Selvaraj <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
On Thu, Oct 09, 2014 at 12:54:48AM +0200, Andreas Höschler wrote:
> Hi all,
> 
> I have just got my avr tool chain running on Solaris, established communication of avrdude with the USB programmer and am now trying to recompile my first program (one that I wrote years ago on another machine).
> 
> It goes like so:
> 
> main.c
> ======
> #define F_CPU 16000000UL  /* 16 MHz CPU clock */
> #include "Global.h"
> #include <util/delay.h>
> #include <avr/io.h>
> #include <avr/interrupt.h>
> #include <inttypes.h>
> #include <Serial.h>
> #include <AnalogDigital.h>
> #include <Timer.h>
> #define OUTPUTPORT PORTB
> #define OUTPUTPIN PD5
> 
> static volatile uint16_t startA;
> ...
> 
> Makefile
> ==========
> # AVR-GCC Makefile
> PROJECT=toggle_led
> SOURCES=main.c Serial.c Timer.c AnalogDigital.c
> HEADERS=Serial.h
> CC=avr-gcc
> OBJCOPY=avr-objcopy
> MMCU=atmega8
> 
> CFLAGS=-mmcu=$(MMCU) -Wall -O2
> 
> $(PROJECT).hex: $(PROJECT).out
>         $(OBJCOPY) -j .text -O ihex $(PROJECT).out $(PROJECT).hex
> 
> $(PROJECT).out: $(SOURCES)
>         $(CC) $(CFLAGS) -I./ -o $(PROJECT).out $(SOURCES)
> 
> program: $(PROJECT).hex
>         avrdude  -p atmega8 -c avrispmkII -P usb -e -U flash:w:$(PROJECT).hex
> clean:
>         rm -f $(PROJECT).out
>         rm -f $(PROJECT).hex
> 
> 
> When I try to make this I get 
> 
> -bash-3.2# make
> avr-gcc -mmcu=atmega8 -Wall -O2 -I./ -o toggle_led.out main.c Serial.c Timer.c AnalogDigital.c
> main.c:3:24: error: util/delay.h: No such file or directory
> main.c:4:20: error: avr/io.h: No such file or directory
> main.c:5:27: error: avr/interrupt.h: No such file or directory
> main.c:6:22: error: inttypes.h: No such file or directory
> In file included from main.c:7:
> ./Serial.h:3: error: expected ')' before 'baud'
> ./Serial.h:4: error: expected ')' before 'data'
> 

The compiler is not able to find header files supplied by avr-libc. Did
you build both of them with the same install prefix? Can you paste the
output of running avr-gcc with -v?

Regards
Senthil
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.