You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
Makefile
41 lines
1.0 KiB
Makefile
TARGET = main.elf
|
|
FILES = main yaMBSiavr
|
|
MCU = atxmega32a4
|
|
PROGC = x32a4
|
|
CC = avr-gcc
|
|
TOOL = atmelice_pdi
|
|
|
|
BUILDDIR = build
|
|
|
|
DEFINES = -DF_CPU=32000000UL -DBOARDTYPE=9ch_pt100
|
|
|
|
CFLAGS =-mmcu=$(MCU) -O2 -Wall $(DEFINES) -std=c99 -ffunction-sections -fdata-sections
|
|
LDFLAGS =-mmcu=$(MCU) -Wl,--gc-sections
|
|
|
|
LDFILES = $(foreach FILE,$(FILES),$(BUILDDIR)/$(FILE).o)
|
|
|
|
all: clean $(BUILDDIR)/$(TARGET).elf
|
|
|
|
$(BUILDDIR)/%.o: %.c
|
|
@mkdir -p $(BUILDDIR)
|
|
$(CC) $(CFLAGS) -c $< -o $(BUILDDIR)/$*.o
|
|
|
|
$(BUILDDIR)/$(TARGET).elf: $(LDFILES)
|
|
mkdir -p $(BUILDDIR)
|
|
$(CC) $(LDFLAGS) $(LDFILES) -o $(BUILDDIR)/$(TARGET).elf
|
|
|
|
$(BUILDDIR)/$(TARGET).hex : $(BUILDDIR)/$(TARGET).elf
|
|
avr-objcopy -j .data -j .text -O ihex $< $@
|
|
|
|
fuse:
|
|
avrdude -p $(PROGC) -c $(TOOL) -U lfuse:w:0xE8:m -U hfuse:w:0xD1:m
|
|
|
|
load: $(BUILDDIR)/$(TARGET).hex
|
|
avrdude -p $(PROGC) -c $(TOOL) -U flash:w:$(BUILDDIR)/$(TARGET).hex -v -B 2
|
|
|
|
size: $(BUILDDIR)/$(TARGET).elf
|
|
avr-size -C --mcu=$(MCU) $(BUILDDIR)/$(TARGET).elf
|
|
|
|
clean:
|
|
rm -rf $(BUILDDIR)
|