Rev 2 | Rev 4 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | ########################################################################################################################## |
3 | mjames | 2 | # File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Sat Aug 15 16:02:26 BST 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 = FuelGauge |
||
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 | # source |
||
36 | ###################################### |
||
37 | # C sources |
||
38 | C_SOURCES = \ |
||
39 | Src/main.c \ |
||
40 | Src/stm32f0xx_it.c \ |
||
41 | Src/stm32f0xx_hal_msp.c \ |
||
42 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_adc.c \ |
||
43 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_adc_ex.c \ |
||
44 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_rcc.c \ |
||
45 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_rcc_ex.c \ |
||
46 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal.c \ |
||
47 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_i2c.c \ |
||
48 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_i2c_ex.c \ |
||
49 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_gpio.c \ |
||
50 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_dma.c \ |
||
51 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_cortex.c \ |
||
52 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_pwr.c \ |
||
53 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_pwr_ex.c \ |
||
54 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_flash.c \ |
||
55 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_flash_ex.c \ |
||
56 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_exti.c \ |
||
57 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_tim.c \ |
||
58 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_tim_ex.c \ |
||
59 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_uart.c \ |
||
60 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_uart_ex.c \ |
||
3 | mjames | 61 | Src/system_stm32f0xx.c \ |
62 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_spi.c \ |
||
63 | Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_spi_ex.c |
||
2 | mjames | 64 | |
65 | # ASM sources |
||
66 | ASM_SOURCES = \ |
||
67 | startup_stm32f030x6.s |
||
68 | |||
69 | |||
70 | ####################################### |
||
71 | # binaries |
||
72 | ####################################### |
||
73 | PREFIX = arm-none-eabi- |
||
74 | # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) |
||
75 | # either it can be added to the PATH environment variable. |
||
76 | ifdef GCC_PATH |
||
77 | CC = $(GCC_PATH)/$(PREFIX)gcc |
||
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 |
||
83 | AS = $(PREFIX)gcc -x assembler-with-cpp |
||
84 | CP = $(PREFIX)objcopy |
||
85 | SZ = $(PREFIX)size |
||
86 | endif |
||
87 | HEX = $(CP) -O ihex |
||
88 | BIN = $(CP) -O binary -S |
||
89 | |||
90 | ####################################### |
||
91 | # CFLAGS |
||
92 | ####################################### |
||
93 | # cpu |
||
94 | CPU = -mcpu=cortex-m0 |
||
95 | |||
96 | # fpu |
||
97 | # NONE for Cortex-M0/M0+/M3 |
||
98 | |||
99 | # float-abi |
||
100 | |||
101 | |||
102 | # mcu |
||
103 | MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) |
||
104 | |||
105 | # macros for gcc |
||
106 | # AS defines |
||
107 | AS_DEFS = |
||
108 | |||
109 | # C defines |
||
110 | C_DEFS = \ |
||
111 | -DUSE_HAL_DRIVER \ |
||
112 | -DSTM32F030x6 |
||
113 | |||
114 | |||
115 | # AS includes |
||
116 | AS_INCLUDES = |
||
117 | |||
118 | # C includes |
||
119 | C_INCLUDES = \ |
||
120 | -IInc \ |
||
121 | -IDrivers/STM32F0xx_HAL_Driver/Inc \ |
||
122 | -IDrivers/STM32F0xx_HAL_Driver/Inc/Legacy \ |
||
123 | -IDrivers/CMSIS/Device/ST/STM32F0xx/Include \ |
||
124 | -IDrivers/CMSIS/Include |
||
125 | |||
126 | |||
127 | |||
128 | # compile gcc flags |
||
129 | ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections |
||
130 | |||
131 | CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections |
||
132 | |||
133 | ifeq ($(DEBUG), 1) |
||
134 | CFLAGS += -g -gdwarf-2 |
||
135 | endif |
||
136 | |||
137 | |||
138 | # Generate dependency information |
||
139 | CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" |
||
140 | |||
141 | |||
142 | ####################################### |
||
143 | # LDFLAGS |
||
144 | ####################################### |
||
145 | # link script |
||
146 | LDSCRIPT = STM32F030F4Px_FLASH.ld |
||
147 | |||
148 | # libraries |
||
149 | LIBS = -lc -lm -lnosys |
||
150 | LIBDIR = |
||
151 | LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections |
||
152 | |||
153 | # default action: build all |
||
154 | all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin |
||
155 | |||
156 | |||
157 | ####################################### |
||
158 | # build the application |
||
159 | ####################################### |
||
160 | # list of objects |
||
161 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) |
||
162 | vpath %.c $(sort $(dir $(C_SOURCES))) |
||
163 | # list of ASM program objects |
||
164 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) |
||
165 | vpath %.s $(sort $(dir $(ASM_SOURCES))) |
||
166 | |||
167 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) |
||
168 | $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ |
||
169 | |||
170 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) |
||
171 | $(AS) -c $(CFLAGS) $< -o $@ |
||
172 | |||
173 | $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile |
||
174 | $(CC) $(OBJECTS) $(LDFLAGS) -o $@ |
||
175 | $(SZ) $@ |
||
176 | |||
177 | $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) |
||
178 | $(HEX) $< $@ |
||
179 | |||
180 | $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) |
||
181 | $(BIN) $< $@ |
||
182 | |||
183 | $(BUILD_DIR): |
||
184 | mkdir $@ |
||
185 | |||
186 | ####################################### |
||
187 | # clean up |
||
188 | ####################################### |
||
189 | clean: |
||
190 | -rm -fR $(BUILD_DIR) |
||
191 | |||
192 | ####################################### |
||
193 | # dependencies |
||
194 | ####################################### |
||
195 | -include $(wildcard $(BUILD_DIR)/*.d) |
||
196 | |||
197 | # *** EOF *** |