Subversion Repositories LedShow

Rev

Rev 6 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
##########################################################################################################################
2
# File automatically-generated by tool: [projectgenerator] version: [3.3.0] date: [Thu Jul 11 21:09:58 BST 2019] 
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 = DigitalLeds
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
Src/main.c \
40
Src/usb_device.c \
41
Src/usbd_conf.c \
42
Src/usbd_desc.c \
43
Src/usbd_cdc_if.c \
44
Src/stm32f1xx_it.c \
45
Src/stm32f1xx_hal_msp.c \
46
Src/leds.c \
47
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
48
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c \
49
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c \
50
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \
51
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \
52
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c \
53
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
54
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
55
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \
56
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
57
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
58
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
59
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
60
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
61
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
62
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
63
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
64
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
65
Src/system_stm32f1xx.c \
66
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
67
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
68
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
69
Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
70
 
71
# ASM sources
72
ASM_SOURCES =  \
73
startup_stm32f103xb.s
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
-IInc \
127
-IDrivers/STM32F1xx_HAL_Driver/Inc \
128
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
129
-IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc \
130
-IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \
131
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
132
-IDrivers/CMSIS/Include
133
 
134
 
135
# compile gcc flags
136
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
137
 
138
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
139
 
140
ifeq ($(DEBUG), 1)
141
CFLAGS += -g -gdwarf-2
142
endif
143
 
144
 
145
# Generate dependency information
146
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
147
 
148
 
149
#######################################
150
# LDFLAGS
151
#######################################
152
# link script
153
LDSCRIPT = STM32F103C8Tx_FLASH.ld
154
 
155
# libraries
156
LIBS = -lc -lm -lnosys 
157
LIBDIR = 
158
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
159
 
160
# default action: build all
161
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
162
 
163
 
164
#######################################
165
# build the application
166
#######################################
167
# list of objects
168
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
169
vpath %.c $(sort $(dir $(C_SOURCES)))
170
# list of ASM program objects
171
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
172
vpath %.s $(sort $(dir $(ASM_SOURCES)))
173
 
174
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 
175
	$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
176
 
177
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
178
	$(AS) -c $(CFLAGS) $< -o $@
179
 
180
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
181
	$(CC) $(OBJECTS) $(LDFLAGS) -o $@
182
	$(SZ) $@
183
 
184
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
185
	$(HEX) $< $@
186
 
187
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
188
	$(BIN) $< $@	
189
 
190
$(BUILD_DIR):
191
	mkdir $@		
192
 
193
#######################################
194
# clean up
195
#######################################
196
clean:
197
	-rm -fR $(BUILD_DIR)
198
 
199
#######################################
200
# dependencies
201
#######################################
202
-include $(wildcard $(BUILD_DIR)/*.d)
203
 
204
# *** EOF ***