]> mj.ucw.cz Git - home-hw.git/blob - ssr/Makefile
SSR: Fix generated code
[home-hw.git] / ssr / Makefile
1 ##########################################################################################################################
2 # File automatically-generated by tool: [projectgenerator] version: [2.27.0] date: [Wed Aug 08 11:17:04 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 = ssr
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/ds18b20.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_tim.c \
83 /aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c
84
85 # ASM sources
86 ASM_SOURCES =  \
87 startup_stm32f103xb.s
88
89
90 ######################################
91 # firmware library
92 ######################################
93 PERIFLIB_SOURCES = 
94
95
96 #######################################
97 # binaries
98 #######################################
99 BINPATH = /usr/bin
100 PREFIX = arm-none-eabi-
101 CC = $(BINPATH)/$(PREFIX)gcc
102 AS = $(BINPATH)/$(PREFIX)gcc -x assembler-with-cpp
103 CP = $(BINPATH)/$(PREFIX)objcopy
104 AR = $(BINPATH)/$(PREFIX)ar
105 SZ = $(BINPATH)/$(PREFIX)size
106 HEX = $(CP) -O ihex
107 BIN = $(CP) -O binary -S
108  
109 #######################################
110 # CFLAGS
111 #######################################
112 # cpu
113 CPU = -mcpu=cortex-m3
114
115 # fpu
116 # NONE for Cortex-M0/M0+/M3
117
118 # float-abi
119
120
121 # mcu
122 MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
123
124 # macros for gcc
125 # AS defines
126 AS_DEFS = 
127
128 # C defines
129 C_DEFS =  \
130 -DUSE_FULL_LL_DRIVER \
131 -DSTM32F103xB \
132 -DUSE_HAL_DRIVER
133
134
135 # AS includes
136 AS_INCLUDES = 
137
138 # C includes
139 C_INCLUDES =  \
140 -IInc \
141 -I/aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Inc \
142 -I/aux/misc/stm/F1-package/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy \
143 -I/aux/misc/stm/F1-package/Drivers/CMSIS/Include \
144 -I/aux/misc/stm/F1-package/Drivers/CMSIS/Device/ST/STM32F1xx/Include
145
146
147 # compile gcc flags
148 ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
149
150 CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
151
152 ifeq ($(DEBUG), 1)
153 CFLAGS += -g -gdwarf-2
154 endif
155
156
157 # Generate dependency information
158 CFLAGS += -MMD -MF"$(@:%.o=%.d)"
159
160
161 #######################################
162 # LDFLAGS
163 #######################################
164 # link script
165 LDSCRIPT = STM32F103C8Tx_FLASH.ld
166
167 # libraries
168 LIBS = -lc -lm -lnosys 
169 LIBDIR = 
170 LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
171
172 # default action: build all
173 all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
174
175 flash: all
176         ../bin/st-flash write $(BUILD_DIR)/$(TARGET).bin 0x8000000
177
178 #######################################
179 # build the application
180 #######################################
181 # list of objects
182 OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
183 vpath %.c $(sort $(dir $(C_SOURCES)))
184 # list of ASM program objects
185 OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
186 vpath %.s $(sort $(dir $(ASM_SOURCES)))
187
188 $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 
189         $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
190
191 $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
192         $(AS) -c $(CFLAGS) $< -o $@
193
194 $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
195         $(CC) $(OBJECTS) $(LDFLAGS) -o $@
196         $(SZ) $@
197
198 $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
199         $(HEX) $< $@
200         
201 $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
202         $(BIN) $< $@    
203         
204 $(BUILD_DIR):
205         mkdir $@                
206
207 #######################################
208 # clean up
209 #######################################
210 clean:
211         -rm -fR $(BUILD_DIR)
212   
213 #######################################
214 # dependencies
215 #######################################
216 -include $(wildcard $(BUILD_DIR)/*.d)
217
218 # *** EOF ***