Rev 10 | Rev 13 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | ########################################################################################################################## |
11 | mjames | 2 | # File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Fri Dec 25 11:35:41 GMT 2020] |
2 | mjames | 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 = DashGPS |
||
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 | |||
36 | |||
37 | ###################################### |
||
38 | # source |
||
39 | ###################################### |
||
40 | # C sources |
||
41 | C_SOURCES = \ |
||
42 | Core/Src/main.c \ |
||
43 | Core/Src/stm32f1xx_it.c \ |
||
44 | Core/Src/stm32f1xx_hal_msp.c \ |
||
45 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \ |
||
46 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c \ |
||
47 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ |
||
48 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \ |
||
49 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \ |
||
50 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \ |
||
51 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \ |
||
52 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \ |
||
53 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \ |
||
54 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \ |
||
55 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \ |
||
56 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \ |
||
57 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \ |
||
58 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ |
||
59 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ |
||
60 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \ |
||
11 | mjames | 61 | Core/Src/system_stm32f1xx.c \ |
62 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c |
||
2 | mjames | 63 | |
64 | # ASM sources |
||
65 | ASM_SOURCES = \ |
||
66 | startup_stm32f103xb.s |
||
67 | |||
68 | |||
69 | ####################################### |
||
70 | # binaries |
||
71 | ####################################### |
||
72 | PREFIX = arm-none-eabi- |
||
73 | # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) |
||
74 | # either it can be added to the PATH environment variable. |
||
75 | ifdef GCC_PATH |
||
76 | CC = $(GCC_PATH)/$(PREFIX)gcc |
||
6 | mjames | 77 | CXX = $(GCC_PATH)/$(PREFIX)g++ |
2 | mjames | 78 | AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp |
79 | CP = $(GCC_PATH)/$(PREFIX)objcopy |
||
80 | SZ = $(GCC_PATH)/$(PREFIX)size |
||
81 | else |
||
82 | CC = $(PREFIX)gcc |
||
6 | mjames | 83 | CXX = $(PREFIX)g++ |
2 | mjames | 84 | AS = $(PREFIX)gcc -x assembler-with-cpp |
85 | CP = $(PREFIX)objcopy |
||
86 | SZ = $(PREFIX)size |
||
87 | endif |
||
88 | HEX = $(CP) -O ihex |
||
89 | BIN = $(CP) -O binary -S |
||
90 | |||
91 | ####################################### |
||
92 | # CFLAGS |
||
93 | ####################################### |
||
94 | # cpu |
||
95 | CPU = -mcpu=cortex-m3 |
||
96 | |||
97 | # fpu |
||
98 | # NONE for Cortex-M0/M0+/M3 |
||
99 | |||
100 | # float-abi |
||
101 | |||
102 | |||
103 | # mcu |
||
104 | MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) |
||
105 | |||
106 | # macros for gcc |
||
107 | # AS defines |
||
108 | AS_DEFS = |
||
109 | |||
110 | # C defines |
||
111 | C_DEFS = \ |
||
112 | -DUSE_HAL_DRIVER \ |
||
113 | -DSTM32F103xB |
||
114 | |||
115 | |||
116 | # AS includes |
||
117 | AS_INCLUDES = |
||
118 | |||
119 | # C includes |
||
120 | C_INCLUDES = \ |
||
121 | -Iinc \ |
||
122 | -ICore/Inc \ |
||
123 | -IDrivers/STM32F1xx_HAL_Driver/Inc \ |
||
124 | -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \ |
||
125 | -IDrivers/CMSIS/Device/ST/STM32F1xx/Include \ |
||
126 | -IDrivers/CMSIS/Include |
||
127 | |||
128 | |||
129 | ############################################# |
||
130 | ##Add libraries |
||
131 | C_DEFS+=-DSERIAL_UART1 |
||
132 | LIBSERIAL = ../libSerial |
||
133 | include $(LIBSERIAL)/libSerial.mk |
||
134 | |||
8 | mjames | 135 | # New OLED library |
5 | mjames | 136 | HAL = stm32_hal |
6 | mjames | 137 | LIBOLED = ../libOLED |
138 | include $(LIBOLED)/libOLED.mk |
||
139 | |||
11 | mjames | 140 | #sensor Library |
141 | LIBBMP280 = ../libBMP280 |
||
142 | include $(LIBBMP280)/libBMP280.mk |
||
6 | mjames | 143 | |
11 | mjames | 144 | |
2 | mjames | 145 | C_SOURCES += src/nmea.c |
6 | mjames | 146 | CPP_SOURCES += src/display.cpp |
2 | mjames | 147 | |
148 | |||
149 | |||
6 | mjames | 150 | |
2 | mjames | 151 | # compile gcc flags |
152 | ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections |
||
153 | |||
154 | CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections |
||
155 | |||
156 | ifeq ($(DEBUG), 1) |
||
157 | CFLAGS += -g -gdwarf-2 |
||
158 | endif |
||
159 | |||
160 | |||
6 | mjames | 161 | |
2 | mjames | 162 | # Generate dependency information |
6 | mjames | 163 | CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" |
2 | mjames | 164 | |
165 | |||
6 | mjames | 166 | CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions |
167 | |||
2 | mjames | 168 | ####################################### |
169 | # LDFLAGS |
||
170 | ####################################### |
||
171 | # link script |
||
172 | LDSCRIPT = STM32F103RBTx_FLASH.ld |
||
173 | |||
174 | # libraries |
||
6 | mjames | 175 | LIBS = -lc -lm -lnosys -lgcc |
2 | mjames | 176 | LIBDIR = |
177 | LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections |
||
178 | |||
10 | mjames | 179 | |
2 | mjames | 180 | # default action: build all |
181 | all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin |
||
182 | |||
183 | |||
184 | ####################################### |
||
185 | # build the application |
||
186 | ####################################### |
||
187 | # list of objects |
||
188 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) |
||
189 | vpath %.c $(sort $(dir $(C_SOURCES))) |
||
6 | mjames | 190 | |
191 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SOURCES:.cpp=.o))) |
||
192 | vpath %.cpp $(sort $(dir $(CPP_SOURCES))) |
||
193 | |||
2 | mjames | 194 | # list of ASM program objects |
195 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) |
||
196 | vpath %.s $(sort $(dir $(ASM_SOURCES))) |
||
197 | |||
198 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) |
||
199 | $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ |
||
200 | |||
6 | mjames | 201 | $(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR) |
202 | $(CXX) -c $(CXXFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ |
||
203 | |||
2 | mjames | 204 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) |
205 | $(AS) -c $(CFLAGS) $< -o $@ |
||
206 | |||
207 | $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile |
||
208 | $(CC) $(OBJECTS) $(LDFLAGS) -o $@ |
||
209 | $(SZ) $@ |
||
210 | |||
211 | $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) |
||
212 | $(HEX) $< $@ |
||
213 | |||
214 | $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) |
||
215 | $(BIN) $< $@ |
||
216 | |||
217 | $(BUILD_DIR): |
||
218 | mkdir $@ |
||
219 | |||
220 | ####################################### |
||
221 | # clean up |
||
222 | ####################################### |
||
223 | clean: |
||
224 | -rm -fR $(BUILD_DIR) |
||
225 | |||
226 | ####################################### |
||
227 | # dependencies |
||
228 | ####################################### |
||
229 | -include $(wildcard $(BUILD_DIR)/*.d) |
||
230 | |||
231 | # *** EOF *** |