-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (38 loc) · 1.18 KB
/
Makefile
File metadata and controls
49 lines (38 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# Makefile for the C demo
#
# Targets:
# all generates flash file
# install downloads elf file to mcu
#
PROJNAME = lab_5
FILENAME = main
OBJFILES = main.o neo_color.o
DBGPATH = Debug
DBGOBJS = $(addprefix $(DBGPATH)/, $(OBJFILES))
MCU = atmega1284
CCLD = avr-gcc
#CCFLAGS = -mmcu=$(MCU) -Wall -Os -gstabs
CCFLAGS = -mmcu=$(MCU) -Wall -Os -frename-registers
CCFLAGS += -fshort-enums -fpack-struct
#CCFLAGS += -dwarf -g2
LDFLAGS = -mmcu=$(MCU)
PORT = usb
PROGRAMMER = dragon_jtag
PROG = avrdude
PRFLAGS = -v -c $(PROGRAMMER) -p $(PARTNO) -P$(PORT)
OBJCOPY = avr-objcopy
OBJFLAGS = -j .text -j .data -O ihex
all: $(DBGOBJS) $(DBGPATH)/$(PROJNAME).hex $(PROJNAME).elf $(DBGPATH)/$(PROJNAME).lss
$(PROJNAME).elf: $(DBGOBJS)
$(CCLD) $(LDFLAGS) -o $@ $^
$(DBGPATH)/%.o: %.s
$(CCLD) $(CCFLAGS) -c -o $@ $<
$(DBGPATH)/%.o: %.c
$(CCLD) $(CCFLAGS) -c -o $@ $<
$(DBGPATH)/$(PROJNAME).hex: $(PROJNAME).elf
$(OBJCOPY) $(OBJFLAGS) $< $@
$(DBGPATH)/$(PROJNAME).lss: $(PROJNAME).elf
avr-objdump -h -S $< > $@
clean:
rm -f $(DBGPATH)/$(PROJNAME).hex $(DBGPATH)/$(PROJNAME).elf $(DBGOBJS) $(DBGPATH)/$(PROJNAME).lss