-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
117 lines (103 loc) · 3.1 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
###
### Common definitions
###
# Compilers
C= C:/cseapp/CodeLite/tools/gcc-arm/bin/arm-none-eabi
CC= $C-gcc
AS= $C-as
LINKER= $C-g++
POST= $C-objcopy
# Flags
CCFLAGS= -g \
-O0 \
-Wall \
-mthumb \
-mcpu=cortex-m4 \
-mfloat-abi=hard \
-mfpu=fpv4-sp-d16 \
-fverbose-asm \
-DSTM32F40_41xxx \
-I ./device/inc \
-I ./driver/inc
ASFLAGS= -IIFLAGS
LINKERFLAGS= --specs=nano.specs \
-mthumb \
-mfloat-abi=hard \
-mfpu=fpv4-sp-d16 \
-mcpu=cortex-m4 \
-nostartfiles \
-T ./md407-ram.x \
-Wl,-Map=./Debug/RTS-Lab.map,--cref
POSTFLAGS= -S -O srec
# Directories
DEBUGDIR= ./Debug/
DRIVERDIR= ./driver/src/
MKDIR= test -d $(DEBUGDIR) || mkdir -p $(DEBUGDIR)
# Objects
OBJECTS= $(DEBUGDIR)dispatch.o \
$(DEBUGDIR)TinyTimber.o \
$(DEBUGDIR)canTinyTimber.o \
$(DEBUGDIR)sciTinyTimber.o \
$(DEBUGDIR)stm32f4xx_can.o \
$(DEBUGDIR)stm32f4xx_dac.o \
$(DEBUGDIR)stm32f4xx_exti.o \
$(DEBUGDIR)stm32f4xx_gpio.o \
$(DEBUGDIR)stm32f4xx_rcc.o \
$(DEBUGDIR)stm32f4xx_syscfg.o \
$(DEBUGDIR)stm32f4xx_tim.o \
$(DEBUGDIR)stm32f4xx_usart.o \
$(DEBUGDIR)startup.o \
$(DEBUGDIR)application.o \
$(DEBUGDIR)semaphore.o
###
### Main target
###
.PHONY: all
all: $(DEBUGDIR) $(DEBUGDIR)RTS-Lab.elf $(DEBUGDIR)RTS-Lab.s19
###
### Intermediate targets
###
# System-defined targets
$(DEBUGDIR):
$(MKDIR)
$(DEBUGDIR)RTS-Lab.elf: $(OBJECTS)
$(LINKER) -o $@ $(LINKERFLAGS) $^
$(DEBUGDIR)RTS-Lab.s19: $(DEBUGDIR)RTS-Lab.elf
$(POST) $(POSTFLAGS) $< $@
$(DEBUGDIR)dispatch.o: dispatch.s
$(AS) $< -o $@ $(ASFLAGS)
$(DEBUGDIR)stm32f4xx_can.o: $(DRIVERDIR)stm32f4xx_can.c
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)stm32f4xx_dac.o: $(DRIVERDIR)stm32f4xx_dac.c
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)stm32f4xx_exti.o: $(DRIVERDIR)stm32f4xx_exti.c
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)stm32f4xx_gpio.o: $(DRIVERDIR)stm32f4xx_gpio.c
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)stm32f4xx_rcc.o: $(DRIVERDIR)stm32f4xx_rcc.c
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)stm32f4xx_syscfg.o: $(DRIVERDIR)stm32f4xx_syscfg.c
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)stm32f4xx_tim.o: $(DRIVERDIR)stm32f4xx_tim.c
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)stm32f4xx_usart.o: $(DRIVERDIR)stm32f4xx_usart.c
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)startup.o: startup.c
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)TinyTimber.o: TinyTimber.c TinyTimber.h
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)canTinyTimber.o: canTinyTimber.c canTinyTimber.h
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)sciTinyTimber.o: sciTinyTimber.c sciTinyTimber.h
$(CC) -c $< -o $@ $(CCFLAGS)
$(DEBUGDIR)semaphore.o: semaphore.c semaphore.h
$(CC) -c $< -o $@ $(CCFLAGS)
# User-defined targets
$(DEBUGDIR)application.o: application.c TinyTimber.h sciTinyTimber.h canTinyTimber.h semaphore.h
$(CC) -c $< -o $@ $(CCFLAGS)
###
### Clean
###
.PHONY: clean
clean:
rm -vrf $(DEBUGDIR)