-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
90 lines (56 loc) · 1.74 KB
/
Makefile.common
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
# name of executable
ELF=$(notdir $(CURDIR)).elf
# Library path
LIBROOT=../STM32F4xx_DSP_StdPeriph_Lib_V1.5.1
# Tools
CC=arm-none-eabi-gcc
LD=arm-none-eabi-gcc
AR=arm-none-eabi-ar
AS=arm-none-eabi-as
# Code Paths
DEVICE=$(LIBROOT)/Libraries/CMSIS/Device/ST/STM32F4xx/Include/
CORE=$(LIBROOT)/Libraries/CMSIS/Include/
PERIPH=$(LIBROOT)/Libraries/STM32F4xx_StdPeriph_Driver/
# Search path for standard files
vpath %.c $(TEMPLATEROOT)
# Search path for perpheral library
vpath %.c $(CORE)
vpath %.c $(PERIPH)/src
vpath %.c $(DEVICE)
vpath %.c ../usart
# Search path for Library
#vpath %.c $(TEMPLATEROOT)/Library/ff9/src
#vpath %.c $(TEMPLATEROOT)/Library/ff9/src/option
#vpath %.c $(TEMPLATEROOT)/Library
# Processor specific
PTYPE = STM32F40_41xxx
LDSCRIPT = $(TEMPLATEROOT)/stm32_flash.ld
STARTUP = startup_stm32f4xx.o system_stm32f4xx.o
USART = usart.o syscalls.o ring.o
# Compilation Flags
FULLASSERT = -DUSE_FULL_ASSERT
#Generic ARM options
LDFLAGS+= -T$(LDSCRIPT) -mthumb -mcpu=cortex-m4
CFLAGS+= -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=soft
#-mthumb-interwork -std=c99
#STM options
CFLAGS+= -DHSE_VALUE=8000000
#ENV options
CFLAGS+= -I$(TEMPLATEROOT) -I$(DEVICE) -I$(CORE) -I$(PERIPH)/inc -I.
CFLAGS+= -D$(PTYPE) -DUSE_STDPERIPH_DRIVER $(FULLASSERT)
#CFLAGE+= -I$(TEMPLATEROOT)/Library/ff9/src -I$(TEMPLATEROOT)/Library
# Build executable
$(ELF) : $(OBJS)
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
# compile and generate dependency info
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
$(CC) -MM $(CFLAGS) $< > $*.d
%.o: %.s
$(CC) -c $(CFLAGS) $< -o $@
clean:
rm -f $(OBJS) $(OBJS:.o=.d) $(ELF) startup_stm32f* $(CLEANOTHER)
debug: $(ELF)
arm-none-eabi-gdb $(ELF)
# pull in dependencies
-include $(OBJS:.o=.d)