Rev 46 | Rev 50 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
28 | mjames | 1 | ########################################################################################################################## |
46 | mjames | 2 | # File automatically-generated by tool: [projectgenerator] version: [3.16.0] date: [Sun Sep 11 14:57:08 BST 2022] |
28 | mjames | 3 | ########################################################################################################################## |
2 | mjames | 4 | |
28 | mjames | 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 | # ------------------------------------------------ |
||
2 | mjames | 12 | |
28 | mjames | 13 | ###################################### |
14 | # target |
||
15 | ###################################### |
||
16 | TARGET = EngineBay2 |
||
2 | mjames | 17 | |
18 | |||
28 | mjames | 19 | ###################################### |
20 | # building variables |
||
21 | ###################################### |
||
22 | # debug build? |
||
23 | DEBUG = 1 |
||
24 | # optimization |
||
39 | mjames | 25 | OPT = -Og |
2 | mjames | 26 | |
27 | |||
28 | mjames | 28 | ####################################### |
29 | # paths |
||
30 | ####################################### |
||
31 | # Build path |
||
32 | BUILD_DIR = build |
||
2 | mjames | 33 | |
28 | mjames | 34 | ###################################### |
35 | # source |
||
36 | ###################################### |
||
37 | # C sources |
||
38 | C_SOURCES = \ |
||
37 | mjames | 39 | Core/Src/main.c \ |
40 | Core/Src/stm32f1xx_it.c \ |
||
46 | mjames | 41 | Core/Src/stm32f1xx_hal_msp.c \ |
42 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \ |
||
43 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c \ |
||
44 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c \ |
||
45 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ |
||
46 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \ |
||
47 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \ |
||
48 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \ |
||
49 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \ |
||
50 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \ |
||
51 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \ |
||
52 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \ |
||
53 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \ |
||
54 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \ |
||
55 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c \ |
||
56 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \ |
||
57 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ |
||
58 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ |
||
59 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \ |
||
60 | Core/Src/system_stm32f1xx.c |
||
2 | mjames | 61 | |
28 | mjames | 62 | # ASM sources |
63 | ASM_SOURCES = \ |
||
39 | mjames | 64 | startup_stm32f103xb.s |
2 | mjames | 65 | |
66 | |||
28 | mjames | 67 | ####################################### |
68 | # binaries |
||
69 | ####################################### |
||
70 | PREFIX = arm-none-eabi- |
||
71 | # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) |
||
72 | # either it can be added to the PATH environment variable. |
||
73 | ifdef GCC_PATH |
||
74 | CC = $(GCC_PATH)/$(PREFIX)gcc |
||
75 | AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp |
||
76 | CP = $(GCC_PATH)/$(PREFIX)objcopy |
||
77 | SZ = $(GCC_PATH)/$(PREFIX)size |
||
48 | mjames | 78 | ## User added |
79 | CXX = $(GCC_PATH)/$(PREFIX)g++ |
||
28 | mjames | 80 | else |
81 | CC = $(PREFIX)gcc |
||
82 | AS = $(PREFIX)gcc -x assembler-with-cpp |
||
83 | CP = $(PREFIX)objcopy |
||
84 | SZ = $(PREFIX)size |
||
48 | mjames | 85 | ## User added |
86 | CXX = $(PREFIX)g++ |
||
28 | mjames | 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 |
||
2 | mjames | 96 | |
28 | mjames | 97 | # fpu |
98 | # NONE for Cortex-M0/M0+/M3 |
||
2 | mjames | 99 | |
28 | mjames | 100 | # float-abi |
2 | mjames | 101 | |
102 | |||
28 | mjames | 103 | # mcu |
104 | MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) |
||
2 | mjames | 105 | |
28 | mjames | 106 | # macros for gcc |
107 | # AS defines |
||
108 | AS_DEFS = |
||
2 | mjames | 109 | |
28 | mjames | 110 | # C defines |
111 | C_DEFS = \ |
||
112 | -DUSE_HAL_DRIVER \ |
||
37 | mjames | 113 | -DSTM32F103xB |
2 | mjames | 114 | |
115 | |||
28 | mjames | 116 | # AS includes |
117 | AS_INCLUDES = |
||
2 | mjames | 118 | |
28 | mjames | 119 | # C includes |
120 | C_INCLUDES = \ |
||
37 | mjames | 121 | -ICore/Inc \ |
122 | -IDrivers/STM32F1xx_HAL_Driver/Inc \ |
||
123 | -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \ |
||
46 | mjames | 124 | -IDrivers/CMSIS/Device/ST/STM32F1xx/Include \ |
125 | -IDrivers/CMSIS/Include |
||
48 | mjames | 126 | ############################################# |
127 | # User added |
||
128 | # C++ sources |
||
129 | CPP_SOURCES += |
||
2 | mjames | 130 | |
28 | mjames | 131 | ####################################################### |
132 | # Additional code |
||
2 | mjames | 133 | |
37 | mjames | 134 | C_INCLUDES += -IInc |
28 | mjames | 135 | C_SOURCES += Src/misc.c |
2 | mjames | 136 | |
137 | |||
28 | mjames | 138 | # PLX code library |
139 | LIBPLX=../libPLX |
||
140 | include $(LIBPLX)/libPLX.mk |
||
2 | mjames | 141 | |
37 | mjames | 142 | # Using UART1 with LibSerial. |
143 | C_DEFS += -DSERIAL_UART1 |
||
2 | mjames | 144 | |
28 | mjames | 145 | LIBSERIAL=../libSerial |
146 | include $(LIBSERIAL)/libSerial.mk |
||
2 | mjames | 147 | |
48 | mjames | 148 | # Get the common RPM timing code |
149 | LIBIGNTIMING=../libIgnTiming |
||
150 | include $(LIBIGNTIMING)/libIgnTiming.mk |
||
2 | mjames | 151 | |
28 | mjames | 152 | # compile gcc flags |
153 | ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections |
||
2 | mjames | 154 | |
46 | mjames | 155 | CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections |
2 | mjames | 156 | |
28 | mjames | 157 | ifeq ($(DEBUG), 1) |
158 | CFLAGS += -g -gdwarf-2 |
||
159 | endif |
||
2 | mjames | 160 | |
161 | |||
28 | mjames | 162 | # Generate dependency information |
163 | CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" |
||
48 | mjames | 164 | ## User added |
165 | CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions |
||
2 | mjames | 166 | |
167 | |||
28 | mjames | 168 | ####################################### |
169 | # LDFLAGS |
||
170 | ####################################### |
||
171 | # link script |
||
37 | mjames | 172 | LDSCRIPT = STM32F103C8Tx_FLASH.ld |
2 | mjames | 173 | |
28 | mjames | 174 | # libraries |
175 | LIBS = -lc -lm -lnosys |
||
176 | LIBDIR = |
||
177 | LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections |
||
2 | mjames | 178 | |
28 | mjames | 179 | # default action: build all |
180 | all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin |
||
2 | mjames | 181 | |
182 | |||
28 | mjames | 183 | ####################################### |
184 | # build the application |
||
185 | ####################################### |
||
186 | # list of objects |
||
187 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) |
||
188 | vpath %.c $(sort $(dir $(C_SOURCES))) |
||
189 | # list of ASM program objects |
||
190 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) |
||
191 | vpath %.s $(sort $(dir $(ASM_SOURCES))) |
||
48 | mjames | 192 | ## User added List of C++ compiled objects |
193 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SOURCES:.cpp=.o))) |
||
194 | vpath %.cpp $(sort $(dir $(CPP_SOURCES))) |
||
2 | mjames | 195 | |
48 | mjames | 196 | ## User added C++ compilation rule |
197 | $(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR) |
||
198 | $(CXX) -c $(CXXFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ |
||
28 | mjames | 199 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) |
200 | $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ |
||
2 | mjames | 201 | |
28 | mjames | 202 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) |
203 | $(AS) -c $(CFLAGS) $< -o $@ |
||
9 | mjames | 204 | |
28 | mjames | 205 | $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile |
206 | $(CC) $(OBJECTS) $(LDFLAGS) -o $@ |
||
207 | $(SZ) $@ |
||
9 | mjames | 208 | |
28 | mjames | 209 | $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) |
210 | $(HEX) $< $@ |
||
2 | mjames | 211 | |
28 | mjames | 212 | $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) |
213 | $(BIN) $< $@ |
||
9 | mjames | 214 | |
28 | mjames | 215 | $(BUILD_DIR): |
216 | mkdir $@ |
||
2 | mjames | 217 | |
28 | mjames | 218 | ####################################### |
219 | # clean up |
||
220 | ####################################### |
||
221 | clean: |
||
222 | -rm -fR $(BUILD_DIR) |
||
223 | |||
224 | ####################################### |
||
225 | # dependencies |
||
226 | ####################################### |
||
227 | -include $(wildcard $(BUILD_DIR)/*.d) |
||
2 | mjames | 228 | |
46 | mjames | 229 | # *** EOF *** |