-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
70 lines (58 loc) · 1.34 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
##########################################################
CROSS_COMPILE = arm-none-eabi-
# ST sources
SOURCES = \
st_lib/system_stm32f10x.c \
st_lib/core_cm3.c \
st_lib/stm32f10x_rcc.c \
st_lib/stm32f10x_gpio.c \
st_lib/stm32f10x_usart.c \
st_lib/stm32f10x_pwr.c \
st_lib/stm32f10x_rtc.c \
st_lib/stm32f10x_tim.c \
st_lib/stm32f10x_flash.c \
st_lib/misc.c
# FreeRTOS sources
SOURCES += \
freertos/tasks.c \
freertos/queue.c \
freertos/timers.c \
freertos/list.c \
freertos/heap_2.c \
freertos/port/port.c
# Application sources
SOURCES += \
crt0.c \
serial.c \
rtc.c \
malloc.c \
readline.c \
cmd.c \
am2302.c \
gpio.c \
conf.c \
dimmer.c \
pid.c \
fp.c \
syscalls.c \
main.c
INCLUDE = \
-I./ \
-I./st_lib \
-I./freertos/include \
-I./freertos/port
DEFS = \
-DSTM32F10X_MD \
-DUSE_STDPERIPH_DRIVER
BIN = firmware.elf
OBJCOPY = $(CROSS_COMPILE)objcopy
TTY = /dev/ttyUSB0
ARCH = -mcpu=cortex-m3 -mthumb
firmware.bin: $(BIN)
$(OBJCOPY) -S -O binary $< $@
flash: firmware.bin
stm32flash -v -w $< $(TTY)
firmware.elf_CFLAGS := -g -Wall -O2 -fno-common -ffunction-sections -std=c99 $(ARCH) $(INCLUDE) $(DEFS)
firmware.elf_LDFLAGS := -Tstm32_flash.ld -nostartfiles -Wl,--cref,--gc-sections,-Map=firmware.map $(ARCH)
##########################################################
include common.mk