From cc88391f1e4e7a948871fb449fd0aa5896da67f2 Mon Sep 17 00:00:00 2001 From: schodet Date: Wed, 23 Jun 2004 20:13:02 +0000 Subject: Initial revision --- n/avr/howto/avr-Makefile | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 n/avr/howto/avr-Makefile (limited to 'n/avr/howto/avr-Makefile') diff --git a/n/avr/howto/avr-Makefile b/n/avr/howto/avr-Makefile new file mode 100644 index 0000000..ec87ca3 --- /dev/null +++ b/n/avr/howto/avr-Makefile @@ -0,0 +1,69 @@ +PRG = example +OBJ = example.o +# Principalemet atmega8 ou atmega8535 +MCU_TARGET = atmega8 +OPTIMIZE = -O2 + +DEFS = +LIBS = + +# You should not have to change anything below here. + +CC = avr-gcc + +CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) +LDFLAGS = -Wl,-Map,$(PRG).map + +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump + +all: elf lst hex + +elf: $(PRG).elf +lst: $(PRG).lst + +$(PRG).elf: $(OBJ) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + +%.lst: %.elf + $(OBJDUMP) -h -S $< > $@ + +clean: + rm -f *.o $(PRG).elf *.bak + rm -f *.lst *.map $(EXTRA_CLEAN_FILES) + rm -f $(PRG).hex $(PRG).bin $(PRG).srec $(PRG)_eeprom.hex $(PRG)_eeprom.bin $(PRG)_eeprom.srec + +# Rules for building the .text rom images. + +text: hex bin srec + +hex: $(PRG).hex +bin: $(PRG).bin +srec: $(PRG).srec + +%.hex: %.elf + $(OBJCOPY) -j .text -j .data -O ihex $< $@ + +%.srec: %.elf + $(OBJCOPY) -j .text -j .data -O srec $< $@ + +%.bin: %.elf + $(OBJCOPY) -j .text -j .data -O binary $< $@ + +# Rules for building the .eeprom rom images. + +eeprom: ehex ebin esrec + +ehex: $(PRG)_eeprom.hex +ebin: $(PRG)_eeprom.bin +esrec: $(PRG)_eeprom.srec + +%_eeprom.hex: %.elf + $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ + +%_eeprom.srec: %.elf + $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@ + +%_eeprom.bin: %.elf + $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@ + -- cgit v1.2.3