Subversion Repositories dualCDC

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
##########################################################################################################################
2
# File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Fri Jan 01 14:18:57 GMT 2021] 
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 = dualCDC
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
# source
36
######################################
37
# C sources
38
C_SOURCES =  \
39
Core/Src/main.c \
40
Core/Src/stm32f1xx_it.c \
41
Core/Src/stm32f1xx_hal_msp.c \
42
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
43
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
44
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
45
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.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_pcd.c \
57
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c \
58
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \
59
Core/Src/system_stm32f1xx.c \
60
USB_DEVICE/App/usb_device.c \
61
USB_DEVICE/App/usbd_desc.c \
62
USB_DEVICE/App/usbd_cdc_if.c \
63
USB_DEVICE/Target/usbd_conf.c \
64
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
65
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
66
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
67
Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
68
 
69
# ASM sources
70
ASM_SOURCES =  \
71
startup_stm32f103xb.s
72
 
73
 
74
 
75
 
76
#######################################
77
# binaries
78
#######################################
79
PREFIX = arm-none-eabi-
80
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
81
# either it can be added to the PATH environment variable.
82
ifdef GCC_PATH
83
CC = $(GCC_PATH)/$(PREFIX)gcc
84
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
85
CP = $(GCC_PATH)/$(PREFIX)objcopy
86
SZ = $(GCC_PATH)/$(PREFIX)size
87
else
88
CC = $(PREFIX)gcc
89
AS = $(PREFIX)gcc -x assembler-with-cpp
90
CP = $(PREFIX)objcopy
91
SZ = $(PREFIX)size
92
endif
93
HEX = $(CP) -O ihex
94
BIN = $(CP) -O binary -S
95
 
96
#######################################
97
# CFLAGS
98
#######################################
99
# cpu
100
CPU = -mcpu=cortex-m3
101
 
102
# fpu
103
# NONE for Cortex-M0/M0+/M3
104
 
105
# float-abi
106
 
107
 
108
# mcu
109
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
110
 
111
# macros for gcc
112
# AS defines
113
AS_DEFS = 
114
 
115
# C defines
116
C_DEFS =  \
117
-DUSE_HAL_DRIVER \
118
-DSTM32F103xB
119
 
120
 
121
# AS includes
122
AS_INCLUDES = 
123
 
124
# C includes
125
C_INCLUDES =  \
126
-ICore/Inc \
127
-IDrivers/STM32F1xx_HAL_Driver/Inc \
128
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
129
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
130
-IDrivers/CMSIS/Include \
131
-IDrivers/CMSIS/Include \
132
-IUSB_DEVICE/App \
133
-IUSB_DEVICE/Target \
134
-IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc \
135
-IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
136
 
137
 
138
 
139
 
140
# compile gcc flags
141
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
142
 
143
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
144
 
145
ifeq ($(DEBUG), 1)
146
CFLAGS += -g -gdwarf-2
147
endif
148
 
149
 
150
# Generate dependency information
151
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
152
 
153
 
154
#######################################
155
CFLAGS += -DSERIAL_UART1
156
LIBSERIAL=../libSerial
157
include $(LIBSERIAL)/libSerial.mk
158
#######################################
159
 
160
 
161
 
162
#######################################
163
# LDFLAGS
164
#######################################
165
# link script
166
LDSCRIPT = STM32F103CBTx_FLASH.ld
167
 
168
# libraries
169
LIBS = -lc -lm -lnosys 
170
LIBDIR = 
171
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
172
 
173
# default action: build all
174
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
175
 
176
 
177
#######################################
178
# build the application
179
#######################################
180
# list of objects
181
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
182
vpath %.c $(sort $(dir $(C_SOURCES)))
183
# list of ASM program objects
184
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
185
vpath %.s $(sort $(dir $(ASM_SOURCES)))
186
 
187
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 
188
	$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
189
 
190
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
191
	$(AS) -c $(CFLAGS) $< -o $@
192
 
193
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
194
	$(CC) $(OBJECTS) $(LDFLAGS) -o $@
195
	$(SZ) $@
196
 
197
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
198
	$(HEX) $< $@
199
 
200
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
201
	$(BIN) $< $@	
202
 
203
$(BUILD_DIR):
204
	mkdir $@		
205
 
206
#######################################
207
# clean up
208
#######################################
209
clean:
210
	-rm -fR $(BUILD_DIR)
211
 
212
#######################################
213
# dependencies
214
#######################################
215
-include $(wildcard $(BUILD_DIR)/*.d)
216
 
217
# *** EOF ***