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