Building code
Andreas Höschler <[email protected]>
| Newsgroups | gmane.comp.hardware.avr.gcc |
|---|---|
| Message-ID | <[email protected]> |
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'
....
It seems avr-gcc is missing something!? Any idea what the problem might be?
Thanks for getting me (re)started (after years)!!
Andreas