]> mj.ucw.cz Git - home-hw.git/blob - Makefile
Display on I2C2 (not working)
[home-hw.git] / Makefile
1 ##########################################################################################################################
2 # File automatically-generated by tool: [projectgenerator] version: [2.27.0] date: [Sat Jun 23 19:52:50 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 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c \
61 /Src/system_stm32f1xx.c \
62 Src/stm32f1xx_it.c \
63 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c \
64 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c \
65 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
66 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
67 Src/stm32f1xx_hal_msp.c \
68 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
69 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
70 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c \
71 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
72 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
73 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
74 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
75 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
76 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
77 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
78 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c \
79 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
80 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c \
81 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \
82 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_i2c.c
83
84 # ASM sources
85 ASM_SOURCES =  \
86 startup_stm32f103xb.s
87
88
89 ######################################
90 # firmware library
91 ######################################
92 PERIFLIB_SOURCES = 
93
94
95 #######################################
96 # binaries
97 #######################################
98 BINPATH = /usr/bin
99 PREFIX = arm-none-eabi-
100 CC = $(BINPATH)/$(PREFIX)gcc
101 AS = $(BINPATH)/$(PREFIX)gcc -x assembler-with-cpp
102 CP = $(BINPATH)/$(PREFIX)objcopy
103 AR = $(BINPATH)/$(PREFIX)ar
104 SZ = $(BINPATH)/$(PREFIX)size
105 HEX = $(CP) -O ihex
106 BIN = $(CP) -O binary -S
107  
108 #######################################
109 # CFLAGS
110 #######################################
111 # cpu
112 CPU = -mcpu=cortex-m3
113
114 # fpu
115 # NONE for Cortex-M0/M0+/M3
116
117 # float-abi
118
119
120 # mcu
121 MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
122
123 # macros for gcc
124 # AS defines
125 AS_DEFS = 
126
127 # C defines
128 C_DEFS =  \
129 -DUSE_FULL_LL_DRIVER \
130 -DSTM32F103xB \
131 -DUSE_HAL_DRIVER
132
133
134 # AS includes
135 AS_INCLUDES = 
136
137 # C includes
138 C_INCLUDES =  \
139 -IInc \
140 -I/aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Inc \
141 -I/aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy \
142 -I/aux/misc/stm/F1-package/Drivers/CMSIS/Include \
143 -I/aux/misc/stm/F1-package/Drivers/CMSIS/Device/ST/STM32F1xx/Include
144
145
146 # compile gcc flags
147 ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
148
149 CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
150
151 ifeq ($(DEBUG), 1)
152 CFLAGS += -g -gdwarf-2
153 endif
154
155
156 # Generate dependency information
157 CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
158
159
160 #######################################
161 # LDFLAGS
162 #######################################
163 # link script
164 LDSCRIPT = STM32F103C8Tx_FLASH.ld
165
166 # libraries
167 LIBS = -lc -lm -lnosys 
168 LIBDIR = 
169 LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
170
171 # default action: build all
172 all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
173
174 flash: all
175         LD_LIBRARY_PATH=../stlink ../stlink/st-flash write $(BUILD_DIR)/$(TARGET).bin 0x8000000
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 .dep $(BUILD_DIR)
211   
212 #######################################
213 # dependencies
214 #######################################
215 -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
216
217 # *** EOF ***