Subversion Repositories LedShow

Rev

Rev 2 | Rev 8 | Go to most recent revision | Details | Compare with Previous | 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 \
6 mjames 47
Src/dmx.c \
2 mjames 48
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
49
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c \
50
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c \
51
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \
52
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \
53
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c \
54
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
55
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
56
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \
57
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
58
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
59
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
60
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
61
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
62
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
63
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
64
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
65
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
66
Src/system_stm32f1xx.c \
67
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
68
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
69
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
70
Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
71
 
72
# ASM sources
73
ASM_SOURCES =  \
74
startup_stm32f103xb.s
75
 
76
 
77
#######################################
78
# binaries
79
#######################################
80
PREFIX = arm-none-eabi-
81
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
82
# either it can be added to the PATH environment variable.
83
ifdef GCC_PATH
84
CC = $(GCC_PATH)/$(PREFIX)gcc
85
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
86
CP = $(GCC_PATH)/$(PREFIX)objcopy
87
SZ = $(GCC_PATH)/$(PREFIX)size
88
else
89
CC = $(PREFIX)gcc
90
AS = $(PREFIX)gcc -x assembler-with-cpp
91
CP = $(PREFIX)objcopy
92
SZ = $(PREFIX)size
93
endif
94
HEX = $(CP) -O ihex
95
BIN = $(CP) -O binary -S
96
 
97
#######################################
98
# CFLAGS
99
#######################################
100
# cpu
101
CPU = -mcpu=cortex-m3
102
 
103
# fpu
104
# NONE for Cortex-M0/M0+/M3
105
 
106
# float-abi
107
 
108
 
109
# mcu
110
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
111
 
112
# macros for gcc
113
# AS defines
114
AS_DEFS = 
115
 
116
# C defines
117
C_DEFS =  \
118
-DUSE_HAL_DRIVER \
119
-DSTM32F103xB
120
 
121
 
122
# AS includes
123
AS_INCLUDES = 
124
 
125
# C includes
126
C_INCLUDES =  \
127
-IInc \
128
-IDrivers/STM32F1xx_HAL_Driver/Inc \
129
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
130
-IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc \
131
-IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \
132
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
133
-IDrivers/CMSIS/Include
134
 
135
 
136
# compile gcc flags
137
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
138
 
139
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
140
 
141
ifeq ($(DEBUG), 1)
142
CFLAGS += -g -gdwarf-2
143
endif
144
 
145
 
146
# Generate dependency information
147
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
148
 
149
 
150
#######################################
151
# LDFLAGS
152
#######################################
153
# link script
154
LDSCRIPT = STM32F103C8Tx_FLASH.ld
155
 
156
# libraries
157
LIBS = -lc -lm -lnosys 
158
LIBDIR = 
159
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
160
 
161
# default action: build all
162
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
163
 
164
 
165
#######################################
166
# build the application
167
#######################################
168
# list of objects
169
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
170
vpath %.c $(sort $(dir $(C_SOURCES)))
171
# list of ASM program objects
172
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
173
vpath %.s $(sort $(dir $(ASM_SOURCES)))
174
 
175
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 
176
	$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
177
 
178
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
179
	$(AS) -c $(CFLAGS) $< -o $@
180
 
181
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
182
	$(CC) $(OBJECTS) $(LDFLAGS) -o $@
183
	$(SZ) $@
184
 
185
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
186
	$(HEX) $< $@
187
 
188
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
189
	$(BIN) $< $@	
190
 
191
$(BUILD_DIR):
192
	mkdir $@		
193
 
194
#######################################
195
# clean up
196
#######################################
197
clean:
198
	-rm -fR $(BUILD_DIR)
199
 
200
#######################################
201
# dependencies
202
#######################################
203
-include $(wildcard $(BUILD_DIR)/*.d)
204
 
205
# *** EOF ***