Mein erster Test endete gleich mit nem Fehler, wär auch zu schön wenns gleich geht...
ich habe nur eine C Datei im VZ die Led.cZitat:
gerhard@ubuntu12:~/avr_code$ make Led
cc Led.c -o Led
Led.c:8:20: schwerwiegender Fehler: avr/io.h: Datei oder Verzeichnis nicht gefunden
Kompilierung beendet.
make: *** [Led] Fehler 1
und die "umgestrickte make.txt":Zitat:
/* Sample program for Olimex AVR-P40-USB with ATMega16 processor
* Blink Led
* Compile with AVRStudio+WinAVR (gcc version 3.4.6) */
// Verwendete CPU = ATmega_1284p
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
void PORT_Init()
{
PORTB = 0b00000000;
DDRB = 0b00000001; //set Led as output
}
int main()
{
PORT_Init();
while (1)
{
PORTB = PORTB | 0b00000001;
_delay_ms(500);
PORTB = PORTB & 0b11111110;
_delay_ms(500);
}
}
Zitat:
CC=avr-gcc
RM=rm -f
OBJCOPY=avr-objcopy
AVRDUDE=sudo avrdude -p m1284 -c avrisp -P usb -e -U flash:w:
AVRSIZE=avr-size
MCU=atmega168p
F_CPU=16000000
CFLAGS=-g -DF_CPU=$(F_CPU) -Wall -Os -mcall-prologues
OBJ = Led.o
BIN = Led.bin
HEX = Led.hex
MAP = Led.map
.phony: all
all:
$(OBJ)
$(RM) $(HEX) $(BIN) $(MAP)
$(CC) -mmcu=$(MCU) $(CFLAGS) -o $(BIN) -Wl,-Map,$(MAP) $(OBJ)
$(OBJCOPY) -R .eeprom -O ihex $(BIN) $(HEX)
%.o: %.c
$(CC) -mmcu=$(MCU) $(CFLAGS) -c $<
clean:
$(RM) $(OBJ) $(BIN) $(HEX) $(MAP)
flash: $(OBJ)
$(AVRDUDE)$(HEX)
size:
$(BIN)
$(AVRSIZE) -C --mcu=$(MCU) $(BIN)