45 lines
946 B
Makefile
45 lines
946 B
Makefile
PRG = fc_boot
|
|
OBJ = main.o
|
|
MCU_TARGET = atmega644p
|
|
OPTIMIZE = -Os
|
|
|
|
DEFS =
|
|
LIBS =
|
|
|
|
# Override is only needed by avr-lib build system.
|
|
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
|
|
override LDFLAGS = -Wl,-Map,$(PRG).map,--section-start=.text=0xF000
|
|
|
|
CC = avr-gcc
|
|
OBJCOPY = avr-objcopy
|
|
OBJDUMP = avr-objdump
|
|
SIZE = avr-size
|
|
|
|
all: $(PRG).elf lst text
|
|
$(SIZE) -x -A $(PRG).elf
|
|
|
|
$(PRG).elf: $(OBJ)
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
|
|
|
clean:
|
|
rm -rf *.o $(PRG).lst $(PRG).map $(PRG).elf $(PRG).hex $(PRG).bin
|
|
|
|
lst: $(PRG).lst
|
|
|
|
%.lst: %.elf
|
|
$(OBJDUMP) -h -S $< > $@
|
|
|
|
text: hex bin
|
|
|
|
hex: $(PRG).hex
|
|
bin: $(PRG).bin
|
|
|
|
%.hex: %.elf
|
|
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
|
|
|
%.bin: %.elf
|
|
$(OBJCOPY) -j .text -j .data -O binary $< $@
|
|
|
|
install: text
|
|
avrdude -c dragon_isp -P usb -p m644p -B0.3 -V -U flash:w:$(PRG).hex
|