]> mj.ucw.cz Git - home-hw.git/blob - usb/Makefile
SSR: Control program run on Turris
[home-hw.git] / usb / Makefile
1 ##########################################################################################################################
2 # File automatically-generated by tool: [projectgenerator] version: [2.27.0] date: [Fri Jun 29 23:59:44 CEST 2018] 
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 = testusb
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 # source path
32 SOURCES_DIR =  \
33 Drivers \
34 Application/User/Src/main.c \
35 Application/User/Src \
36 Application/User/Src/stm32f1xx_hal_msp.c \
37 Drivers/STM32F1xx_HAL_Driver \
38 Application/User/Src/stm32f1xx_it.c \
39 Application/User \
40 Drivers/CMSIS \
41 Application
42
43 # firmware library path
44 PERIFLIB_PATH = 
45
46 # Build path
47 BUILD_DIR = build
48
49 ######################################
50 # source
51 ######################################
52 # C sources
53 C_SOURCES =  \
54 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c \
55 Src/main.c \
56 Src/debug.c \
57 Src/usb.c \
58 Src/usbdev.c \
59 Src/display.c \
60 Src/bmp085.c \
61 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c \
62 /Src/system_stm32f1xx.c \
63 Src/stm32f1xx_it.c \
64 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c \
65 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c \
66 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
67 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
68 Src/stm32f1xx_hal_msp.c \
69 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
70 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
71 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c \
72 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
73 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
74 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
75 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
76 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
77 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
78 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
79 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c \
80 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
81 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c \
82 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \
83 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_i2c.c \
84 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c
85
86 # ASM sources
87 ASM_SOURCES =  \
88 startup_stm32f103xb.s
89
90
91 ######################################
92 # firmware library
93 ######################################
94 PERIFLIB_SOURCES = 
95
96
97 #######################################
98 # binaries
99 #######################################
100 BINPATH = /usr/bin
101 PREFIX = arm-none-eabi-
102 CC = $(BINPATH)/$(PREFIX)gcc
103 AS = $(BINPATH)/$(PREFIX)gcc -x assembler-with-cpp
104 CP = $(BINPATH)/$(PREFIX)objcopy
105 AR = $(BINPATH)/$(PREFIX)ar
106 SZ = $(BINPATH)/$(PREFIX)size
107 HEX = $(CP) -O ihex
108 BIN = $(CP) -O binary -S
109  
110 #######################################
111 # CFLAGS
112 #######################################
113 # cpu
114 CPU = -mcpu=cortex-m3
115
116 # fpu
117 # NONE for Cortex-M0/M0+/M3
118
119 # float-abi
120
121
122 # mcu
123 MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
124
125 # macros for gcc
126 # AS defines
127 AS_DEFS = 
128
129 # C defines
130 C_DEFS =  \
131 -DUSE_FULL_LL_DRIVER \
132 -DSTM32F103xB \
133 -DUSE_HAL_DRIVER
134
135
136 # AS includes
137 AS_INCLUDES = 
138
139 # C includes
140 C_INCLUDES =  \
141 -IInc \
142 -I/aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Inc \
143 -I/aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy \
144 -I/aux/misc/stm/F1-package/Drivers/CMSIS/Include \
145 -I/aux/misc/stm/F1-package/Drivers/CMSIS/Device/ST/STM32F1xx/Include
146
147
148 # compile gcc flags
149 ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
150
151 CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
152
153 ifeq ($(DEBUG), 1)
154 CFLAGS += -g -gdwarf-2
155 endif
156
157
158 # Generate dependency information
159 CFLAGS += -MMD -MF"$(@:%.o=%.d)"
160
161
162 #######################################
163 # LDFLAGS
164 #######################################
165 # link script
166 LDSCRIPT = STM32F103C8Tx_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 flash: all
177         ../bin/st-flash write $(BUILD_DIR)/$(TARGET).bin 0x8000000
178
179 #######################################
180 # build the application
181 #######################################
182 # list of objects
183 OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
184 vpath %.c $(sort $(dir $(C_SOURCES)))
185 # list of ASM program objects
186 OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
187 vpath %.s $(sort $(dir $(ASM_SOURCES)))
188
189 $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 
190         $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
191
192 $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
193         $(AS) -c $(CFLAGS) $< -o $@
194
195 $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
196         $(CC) $(OBJECTS) $(LDFLAGS) -o $@
197         $(SZ) $@
198
199 $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
200         $(HEX) $< $@
201         
202 $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
203         $(BIN) $< $@    
204         
205 $(BUILD_DIR):
206         mkdir $@                
207
208 #######################################
209 # clean up
210 #######################################
211 clean:
212         -rm -fR $(BUILD_DIR)
213   
214 #######################################
215 # dependencies
216 #######################################
217 -include $(wildcard $(BUILD_DIR)/*.d)
218
219 # *** EOF ***