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