This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
/
Makefile
executable file
·165 lines (134 loc) · 2.98 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
TARGET = firmware
OBJS =
# Startup files
OBJS += startup/start.o
OBJS += startup/init.o
#OBJS += external/printf/printf.o
# BSP
OBJS += bsp/crm.o
OBJS += bsp/gpio.o
OBJS += bsp/misc.o
OBJS += bsp/tmr.o
# Drivers
OBJS += driver/audio.o
OBJS += driver/battery.o
OBJS += driver/beep.o
OBJS += driver/bk1080.o
OBJS += driver/bk4819.o
OBJS += driver/crm.o
OBJS += driver/delay.o
OBJS += driver/key.o
OBJS += driver/led.o
OBJS += driver/pwm.o
OBJS += driver/serial-flash.o
OBJS += driver/speaker.o
OBJS += driver/st7735s.o
OBJS += driver/uart.o
# "App" logic
OBJS += app/css.o
OBJS += app/fm.o
OBJS += app/lock.o
OBJS += app/menu.o
OBJS += app/radio.o
OBJS += app/t9.o
OBJS += app/uart.o
# Helper code
OBJS += helper/dtmf.o
OBJS += helper/helper.o
OBJS += helper/inputbox.o
# Misc data
OBJS += misc.o
# Radio management
OBJS += radio/channels.o
OBJS += radio/data.o
OBJS += radio/detector.o
OBJS += radio/frequencies.o
OBJS += radio/hardware.o
OBJS += radio/scheduler.o
OBJS += radio/settings.o
# Tasks
OBJS += task/alarm.o
OBJS += task/battery.o
OBJS += task/cursor.o
OBJS += task/encrypt.o
OBJS += task/fmscanner.o
OBJS += task/keys.o
OBJS += task/idle.o
OBJS += task/incoming.o
OBJS += task/lock.o
OBJS += task/noaa.o
OBJS += task/ptt.o
OBJS += task/rssi.o
OBJS += task/scanner.o
OBJS += task/screen.o
OBJS += task/sidekeys.o
OBJS += task/timeout.o
OBJS += task/voice.o
OBJS += task/vox.o
# User Interface
OBJS += ui/boot.o
OBJS += ui/dialog.o
OBJS += ui/font.o
OBJS += ui/gfx.o
OBJS += ui/helper.o
OBJS += ui/logo.o
OBJS += ui/main.o
OBJS += ui/menu.o
OBJS += ui/noaa.o
OBJS += ui/version.o
OBJS += ui/vfo.o
OBJS += ui/welcome.o
# Main
OBJS += main.o
ifeq ($(OS),Windows_NT)
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
else
TOP := $(shell pwd)
endif
SDK := $(TOP)/external/SDK
LINKER_SCRIPT := $(SDK)/libraries/cmsis/cm4/device_support/startup/gcc/linker/AT32F421x8_FLASH.ld
AS = arm-none-eabi-as
CC = arm-none-eabi-gcc
LD = arm-none-eabi-gcc
OBJCOPY = arm-none-eabi-objcopy
SIZE = arm-none-eabi-size
GIT_HASH_TMP := $(shell git rev-parse --short HEAD)
ifeq ($(GIT_HASH_TMP),)
GIT_HASH := "NOGIT"
else
GIT_HASH := $(GIT_HASH_TMP)
endif
ASFLAGS = -mcpu=cortex-m4
CFLAGS = -Os -Wall -Werror -mcpu=cortex-m4 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
CFLAGS += -DAT32F421C8T7
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
LDFLAGS = -mcpu=cortex-m4 -nostartfiles -Wl,-T,firmware.ld
ifeq ($(DEBUG),1)
ASFLAGS += -g
CFLAGS += -g
LDFLAGS += -g
endif
INC =
INC += -I $(TOP)
INC += -I $(SDK)/libraries/cmsis/cm4/device_support
INC += -I $(SDK)/libraries/cmsis/cm4/core_support/
INC += -I $(SDK)/libraries/drivers/inc/
LIBS =
DEPS = $(OBJS:.o=.d)
all: $(TARGET)
$(OBJCOPY) -O binary $< $<.bin
$(SIZE) $<
ctags:
ctags -R -f .tags .
ui/version.o: .FORCE
$(TARGET): $(OBJS)
$(LD) $(LDFLAGS) $^ -o $@ $(LIBS)
%.o: %.c
$(CC) $(CFLAGS) $(INC) -c $< -o $@
%.o: %.S
$(AS) $(ASFLAGS) $< -o $@
.FORCE:
-include $(DEPS)
clean:
rm -f $(TARGET).bin $(TARGET) $(OBJS) $(DEPS)