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