-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
98 lines (74 loc) · 1.74 KB
/
Makefile
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Makefile for RASWare 2013
TARGET = RASDemo.axf
# Library Locations
STELLARIS = ../StellarisWare
RASLIB = ../Rasware2013/RASLib
CORTEXM4 = ../CortexM4Libs
ARMCLIB = $(dir $(shell which $(CC)))..
# Command Definitions
PREFIX = arm-none-eabi
CC := $(PREFIX)-gcc
LD := $(PREFIX)-ld
OBJCOPY := $(PREFIX)-objcopy
SIZE := $(PREFIX)-size
FLASH := lm4flash
SCREEN := screen
# File Definitions
SRC := $(wildcard src/*.c *.c)
INC = inc $(RASLIB)/.. $(STELLARIS)/.. $(STELLARIS)
LIB = ras driver-cm4f m c gcc
LDS = $(RASLIB)/lm4f.ld
OBJ := $(SRC:.c=.o)
ASM := $(SRC:.c=.s)
LDDIR += $(RASLIB)/output
LDDIR += $(STELLARIS)/driverlib/gcc-cm4f
LDDIR += $(ARMCLIB)/$(PREFIX)/lib/thumb/cortex-m4
LDDIR += $(wildcard $(ARMCLIB)/lib/gcc/$(PREFIX)/*/thumb/cortex-m4)
LDDIR += $(CORTEXM4)
# Flag Definitions
CFLAGS += -g
CFLAGS += -mthumb
CFLAGS += -mcpu=cortex-m4
CFLAGS += -mfpu=fpv4-sp-d16
CFLAGS += -mfloat-abi=softfp
CFLAGS += -O0
CFLAGS += -ffunction-sections
CFLAGS += -fdata-sections
CFLAGS += -MD
CFLAGS += -std=c99
CFLAGS += -Dgcc
CFLAGS += -DPART_LM4F120H5QR
CFLAGS += -DTARGET_IS_BLIZZARD_RA1
LDFLAGS += --entry ResetHandler
LDFLAGS += --gc-sections
LDFLAGS += --no-check-sections
CFLAGS += $(addprefix -I, $(INC))
LDFLAGS += $(addprefix -L, $(LDDIR))
LDFLAGS += $(addprefix -l, $(LIB))
-include $(OBJECTS:.o=.d)
# Rules
all: $(TARGET)
asm: $(ASM)
size: $(TARGET:.axf=.out)
$(SIZE) $<
flash: $(TARGET)
$(FLASH) $<
uart:
$(SCREEN) /dev/lm4f 115200
run: flash
$(SCREEN) /dev/lm4f 115200
clean:
-rm $(TARGET)
-rm $(TARGET:.axf=.out)
-rm $(ASM)
-rm $(OBJ:.o=.d)
%.a: $(OBJ)
$(AR) rc $@ $^
%.axf: %.out
$(OBJCOPY) -O binary $< $@
%.out: $(OBJ)
$(LD) -T $(LDS) -o $@ $(OBJ) $(LDFLAGS)
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<
%.s: %.c
$(CC) -S $(CFLAGS) -o $@ $<