Subversion Repositories dashGPS

Rev

Rev 2 | Rev 6 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
##########################################################################################################################
5 mjames 2
# File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Fri Oct 30 20:55:32 GMT 2020] 
2 mjames 3
##########################################################################################################################
4
 
5
# ------------------------------------------------
6
# Generic Makefile (based on gcc)
7
#
8
# ChangeLog :
9
#	2017-02-10 - Several enhancements + project update mode
10
#   2015-07-22 - first version
11
# ------------------------------------------------
12
 
13
######################################
14
# target
15
######################################
16
TARGET = DashGPS
17
 
18
 
19
######################################
20
# building variables
21
######################################
22
# debug build?
23
DEBUG = 1
24
# optimization
25
OPT = -Og
26
 
27
 
28
#######################################
29
# paths
30
#######################################
31
# Build path
32
BUILD_DIR = build
33
 
34
 
35
 
36
 
37
######################################
38
# source
39
######################################
40
# C sources
41
C_SOURCES =  \
42
Core/Src/main.c \
43
Core/Src/stm32f1xx_it.c \
44
Core/Src/stm32f1xx_hal_msp.c \
45
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
46
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c \
47
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
48
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
49
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
50
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
51
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
52
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
53
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
54
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
55
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
56
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \
57
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \
58
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
59
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
60
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \
61
Core/Src/system_stm32f1xx.c
62
 
63
# ASM sources
64
ASM_SOURCES =  \
65
startup_stm32f103xb.s
66
 
67
 
68
#######################################
69
# binaries
70
#######################################
71
PREFIX = arm-none-eabi-
72
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
73
# either it can be added to the PATH environment variable.
74
ifdef GCC_PATH
75
CC = $(GCC_PATH)/$(PREFIX)gcc
76
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
77
CP = $(GCC_PATH)/$(PREFIX)objcopy
78
SZ = $(GCC_PATH)/$(PREFIX)size
79
else
80
CC = $(PREFIX)gcc
81
AS = $(PREFIX)gcc -x assembler-with-cpp
82
CP = $(PREFIX)objcopy
83
SZ = $(PREFIX)size
84
endif
85
HEX = $(CP) -O ihex
86
BIN = $(CP) -O binary -S
87
 
88
#######################################
89
# CFLAGS
90
#######################################
91
# cpu
92
CPU = -mcpu=cortex-m3
93
 
94
# fpu
95
# NONE for Cortex-M0/M0+/M3
96
 
97
# float-abi
98
 
99
 
100
# mcu
101
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
102
 
103
# macros for gcc
104
# AS defines
105
AS_DEFS = 
106
 
107
# C defines
108
C_DEFS =  \
109
-DUSE_HAL_DRIVER \
110
-DSTM32F103xB
111
 
112
 
113
# AS includes
114
AS_INCLUDES = 
115
 
116
# C includes
117
C_INCLUDES =  \
118
-Iinc \
119
-ICore/Inc \
120
-IDrivers/STM32F1xx_HAL_Driver/Inc \
121
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
122
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
123
-IDrivers/CMSIS/Include
124
 
125
 
126
#############################################
127
##Add libraries
128
C_DEFS+=-DSERIAL_UART1
129
LIBSERIAL = ../libSerial
130
include $(LIBSERIAL)/libSerial.mk
131
 
5 mjames 132
# OLED library
133
HAL = stm32_hal
2 mjames 134
LIBSSD1306 = ../libSSD1306
135
include $(LIBSSD1306)/libSSD1306.mk
136
 
137
C_SOURCES += src/nmea.c
138
 
139
 
140
 
141
# compile gcc flags
142
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
143
 
144
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
145
 
146
ifeq ($(DEBUG), 1)
147
CFLAGS += -g -gdwarf-2
148
endif
149
 
150
 
151
# Generate dependency information
152
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
153
 
154
 
155
#######################################
156
# LDFLAGS
157
#######################################
158
# link script
159
LDSCRIPT = STM32F103RBTx_FLASH.ld
160
 
161
# libraries
162
LIBS = -lc -lm -lnosys 
163
LIBDIR = 
164
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
165
 
166
# default action: build all
167
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
168
 
169
 
170
#######################################
171
# build the application
172
#######################################
173
# list of objects
174
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
175
vpath %.c $(sort $(dir $(C_SOURCES)))
176
# list of ASM program objects
177
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
178
vpath %.s $(sort $(dir $(ASM_SOURCES)))
179
 
180
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 
181
	$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
182
 
183
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
184
	$(AS) -c $(CFLAGS) $< -o $@
185
 
186
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
187
	$(CC) $(OBJECTS) $(LDFLAGS) -o $@
188
	$(SZ) $@
189
 
190
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
191
	$(HEX) $< $@
192
 
193
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
194
	$(BIN) $< $@	
195
 
196
$(BUILD_DIR):
197
	mkdir $@		
198
 
199
#######################################
200
# clean up
201
#######################################
202
clean:
203
	-rm -fR $(BUILD_DIR)
204
 
205
#######################################
206
# dependencies
207
#######################################
208
-include $(wildcard $(BUILD_DIR)/*.d)
209
 
210
# *** EOF ***