Subversion Repositories dashGPS

Rev

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

Rev Author Line No. Line
2 mjames 1
##########################################################################################################################
28 mjames 2
# File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Mon Jan 10 16:30:16 GMT 2022] 
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.c \
47
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
48
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
49
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
50
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
51
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
52
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
53
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
54
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
55
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \
56
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \
57
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
58
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
59
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \
11 mjames 60
Core/Src/system_stm32f1xx.c \
13 mjames 61
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c \
16 mjames 62
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c \
63
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c \
13 mjames 64
USB_DEVICE/App/usb_device.c \
65
USB_DEVICE/App/usbd_desc.c \
66
USB_DEVICE/App/usbd_cdc_if.c \
67
USB_DEVICE/Target/usbd_conf.c \
68
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c \
69
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c \
70
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \
71
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
72
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
73
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
27 mjames 74
Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c \
75
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_iwdg.c
2 mjames 76
 
77
# ASM sources
78
ASM_SOURCES =  \
79
startup_stm32f103xb.s
80
 
81
 
82
#######################################
83
# binaries
84
#######################################
85
PREFIX = arm-none-eabi-
86
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
87
# either it can be added to the PATH environment variable.
88
ifdef GCC_PATH
89
CC = $(GCC_PATH)/$(PREFIX)gcc
6 mjames 90
CXX = $(GCC_PATH)/$(PREFIX)g++
2 mjames 91
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
92
CP = $(GCC_PATH)/$(PREFIX)objcopy
93
SZ = $(GCC_PATH)/$(PREFIX)size
94
else
95
CC = $(PREFIX)gcc
6 mjames 96
CXX = $(PREFIX)g++
2 mjames 97
AS = $(PREFIX)gcc -x assembler-with-cpp
98
CP = $(PREFIX)objcopy
99
SZ = $(PREFIX)size
100
endif
101
HEX = $(CP) -O ihex
102
BIN = $(CP) -O binary -S
103
 
104
#######################################
105
# CFLAGS
106
#######################################
107
# cpu
108
CPU = -mcpu=cortex-m3
109
 
110
# fpu
111
# NONE for Cortex-M0/M0+/M3
112
 
113
# float-abi
114
 
115
 
116
# mcu
117
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
118
 
119
# macros for gcc
120
# AS defines
121
AS_DEFS = 
122
 
123
# C defines
16 mjames 124
C_DEFS =  -DUSB_DEVICE \
2 mjames 125
-DUSE_HAL_DRIVER \
126
-DSTM32F103xB
127
 
128
 
129
# AS includes
130
AS_INCLUDES = 
131
 
132
# C includes
133
C_INCLUDES =  \
134
-Iinc \
135
-ICore/Inc \
136
-IDrivers/STM32F1xx_HAL_Driver/Inc \
137
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
138
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
13 mjames 139
-IDrivers/CMSIS/Include \
140
-IUSB_DEVICE/App \
141
-IUSB_DEVICE/Target \
142
-IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc \
143
-IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
2 mjames 144
 
145
 
146
#############################################
147
##Add libraries
148
C_DEFS+=-DSERIAL_UART1
149
LIBSERIAL = ../libSerial
150
include $(LIBSERIAL)/libSerial.mk
151
 
8 mjames 152
# New OLED library
5 mjames 153
HAL = stm32_hal
6 mjames 154
LIBOLED = ../libOLED
155
include $(LIBOLED)/libOLED.mk
156
 
11 mjames 157
#sensor Library 
20 mjames 158
LIBBMP280 = ../libBMP280
159
include $(LIBBMP280)/libBMP280.mk
6 mjames 160
 
13 mjames 161
#printf Library
162
LIBSMALLPRINTF = ../libSmallPrintf
163
include $(LIBSMALLPRINTF)/libSmallPrintf.mk
11 mjames 164
 
16 mjames 165
# NMEA library
166
LIBNMEA = ../libNMEA
167
include $(LIBNMEA)/libNMEA.mk
168
 
26 mjames 169
#LSM9DS1 gyro library
170
LIBLSM9DS1 = ../libLSM9DS1
171
include $(LIBLSM9DS1)/libLSM9DS1.mk
172
 
173
 
6 mjames 174
CPP_SOURCES += src/display.cpp
2 mjames 175
 
176
 
177
# compile gcc flags
178
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
179
 
180
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
181
 
182
ifeq ($(DEBUG), 1)
183
CFLAGS += -g -gdwarf-2
184
endif
185
 
186
 
6 mjames 187
 
2 mjames 188
# Generate dependency information
6 mjames 189
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" 
2 mjames 190
 
191
 
6 mjames 192
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
193
 
2 mjames 194
#######################################
195
# LDFLAGS
196
#######################################
197
# link script
198
LDSCRIPT = STM32F103RBTx_FLASH.ld
199
 
200
# libraries
6 mjames 201
LIBS = -lc -lm -lnosys -lgcc
2 mjames 202
LIBDIR = 
203
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
204
 
10 mjames 205
 
2 mjames 206
# default action: build all
207
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
208
 
209
 
210
#######################################
211
# build the application
212
#######################################
213
# list of objects
214
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
215
vpath %.c $(sort $(dir $(C_SOURCES)))
6 mjames 216
 
217
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SOURCES:.cpp=.o)))
218
vpath %.cpp $(sort $(dir $(CPP_SOURCES)))
219
 
2 mjames 220
# list of ASM program objects
221
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
222
vpath %.s $(sort $(dir $(ASM_SOURCES)))
223
 
224
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 
225
	$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
226
 
6 mjames 227
$(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR) 
228
	$(CXX) -c $(CXXFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
229
 
2 mjames 230
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
231
	$(AS) -c $(CFLAGS) $< -o $@
232
 
233
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
234
	$(CC) $(OBJECTS) $(LDFLAGS) -o $@
235
	$(SZ) $@
236
 
237
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
238
	$(HEX) $< $@
239
 
240
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
241
	$(BIN) $< $@	
242
 
243
$(BUILD_DIR):
244
	mkdir $@		
245
 
246
#######################################
247
# clean up
248
#######################################
249
clean:
250
	-rm -fR $(BUILD_DIR)
251
 
252
#######################################
253
# dependencies
254
#######################################
255
-include $(wildcard $(BUILD_DIR)/*.d)
256
 
257
# *** EOF ***