amiro-blt / Target / Modules / DiWheelDrive_1-2 / Boot / makefile @ c1f21a71
History | View | Annotate | Download (10.889 KB)
1 | c1f21a71 | Thomas Schöpping | #**************************************************************************************** |
---|---|---|---|
2 | #| Description: Makefile for STM32 using CodeSourcery GNU GCC compiler toolset |
||
3 | #| File Name: makefile |
||
4 | #| |
||
5 | #|--------------------------------------------------------------------------------------- |
||
6 | #| C O P Y R I G H T |
||
7 | #|--------------------------------------------------------------------------------------- |
||
8 | #| Copyright (c) 2011 by Feaser http://www.feaser.com All rights reserved |
||
9 | #| |
||
10 | #|--------------------------------------------------------------------------------------- |
||
11 | #| L I C E N S E |
||
12 | #|--------------------------------------------------------------------------------------- |
||
13 | #| This file is part of OpenBTL. OpenBTL is free software: you can redistribute it and/or |
||
14 | #| modify it under the terms of the GNU General Public License as published by the Free |
||
15 | #| Software Foundation, either version 3 of the License, or (at your option) any later |
||
16 | #| version. |
||
17 | #| |
||
18 | #| OpenBTL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
||
19 | #| without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
||
20 | #| PURPOSE. See the GNU General Public License for more details. |
||
21 | #| |
||
22 | #| You should have received a copy of the GNU General Public License along with OpenBTL. |
||
23 | #| If not, see <http://www.gnu.org/licenses/>. |
||
24 | #| |
||
25 | #**************************************************************************************** |
||
26 | SHELL = sh |
||
27 | |||
28 | #|---------------------------------------------------------------------------------------| |
||
29 | #| Configure project name | |
||
30 | #|---------------------------------------------------------------------------------------| |
||
31 | PROJ_NAME=AMiRo-BLT_DiWheelDrive_v1-2_stm32f103 |
||
32 | |||
33 | |||
34 | #|---------------------------------------------------------------------------------------| |
||
35 | #| Speficy project source files | |
||
36 | #|---------------------------------------------------------------------------------------| |
||
37 | PROJ_FILES= \ |
||
38 | blt_conf.h \ |
||
39 | hooks.c \ |
||
40 | main.c \ |
||
41 | ./lib/CMSIS/CM3/CoreSupport/core_cm3.c \ |
||
42 | ./lib/CMSIS/CM3/CoreSupport/core_cm3.h \ |
||
43 | ./lib/CMSIS/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h \ |
||
44 | ./lib/CMSIS/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.c \ |
||
45 | ./lib/CMSIS/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.h \ |
||
46 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_adc.h \ |
||
47 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_bkp.h \ |
||
48 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_can.h \ |
||
49 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_cec.h \ |
||
50 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_crc.h \ |
||
51 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_dac.h \ |
||
52 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_dbgmcu.h \ |
||
53 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_dma.h \ |
||
54 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_exti.h \ |
||
55 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_flash.h \ |
||
56 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_fsmc.h \ |
||
57 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_gpio.h \ |
||
58 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_i2c.h \ |
||
59 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_iwdg.h \ |
||
60 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_pwr.h \ |
||
61 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_rcc.h \ |
||
62 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_rtc.h \ |
||
63 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_sdio.h \ |
||
64 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_spi.h \ |
||
65 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_tim.h \ |
||
66 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_usart.h \ |
||
67 | ./lib/STM32F10x_StdPeriph_Driver/inc/stm32f10x_wwdg.h \ |
||
68 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_adc.c \ |
||
69 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_bkp.c \ |
||
70 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_can.c \ |
||
71 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_cec.c \ |
||
72 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_crc.c \ |
||
73 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_dac.c \ |
||
74 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_dbgmcu.c \ |
||
75 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_dma.c \ |
||
76 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_exti.c \ |
||
77 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c \ |
||
78 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_fsmc.c \ |
||
79 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_gpio.c \ |
||
80 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c \ |
||
81 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_iwdg.c \ |
||
82 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_pwr.c \ |
||
83 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_rcc.c \ |
||
84 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_rtc.c \ |
||
85 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_sdio.c \ |
||
86 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c \ |
||
87 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_tim.c \ |
||
88 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c \ |
||
89 | ./lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_wwdg.c \ |
||
90 | ./lib/STM32F10x_StdPeriph_Driver/stm32f10x_conf.h \ |
||
91 | ../../../Source/boot.c \ |
||
92 | ../../../Source/boot.h \ |
||
93 | ../../../Source/com.c \ |
||
94 | ../../../Source/com.h \ |
||
95 | ../../../Source/gateway.c \ |
||
96 | ../../../Source/gateway.h \ |
||
97 | ../../../Source/xcp.c \ |
||
98 | ../../../Source/xcp.h \ |
||
99 | ../../../Source/backdoor.c \ |
||
100 | ../../../Source/backdoor.h \ |
||
101 | ../../../Source/cop.c \ |
||
102 | ../../../Source/cop.h \ |
||
103 | ../../../Source/file.c \ |
||
104 | ../../../Source/file.h \ |
||
105 | ../../../Source/assert.c \ |
||
106 | ../../../Source/assert.h \ |
||
107 | ../../../Source/plausibility.h \ |
||
108 | ../../../Source/ARMCM3_STM32/types.h \ |
||
109 | ../../../Source/ARMCM3_STM32/cpu.c \ |
||
110 | ../../../Source/ARMCM3_STM32/cpu.h \ |
||
111 | ../../../Source/ARMCM3_STM32/can.c \ |
||
112 | ../../../Source/ARMCM3_STM32/can.h \ |
||
113 | ../../../Source/ARMCM3_STM32/uart.c \ |
||
114 | ../../../Source/ARMCM3_STM32/uart.h \ |
||
115 | ../../../Source/ARMCM3_STM32/nvm.c \ |
||
116 | ../../../Source/ARMCM3_STM32/nvm.h \ |
||
117 | ../../../Source/ARMCM3_STM32/timer.c \ |
||
118 | ../../../Source/ARMCM3_STM32/timer.h \ |
||
119 | ../../../Source/ARMCM3_STM32/flash.c \ |
||
120 | ../../../Source/ARMCM3_STM32/flash.h \ |
||
121 | ../../../Source/ARMCM3_STM32/GCC/vectors.c \ |
||
122 | ../../../Source/ARMCM3_STM32/GCC/cstart.c \ |
||
123 | ../../../Source/AMiRo/amiroblt.h \ |
||
124 | ../../../Source/AMiRo/helper.h \ |
||
125 | ../../../Source/AMiRo/helper.c |
||
126 | |||
127 | |||
128 | #|---------------------------------------------------------------------------------------| |
||
129 | #| Compiler binaries | |
||
130 | #|---------------------------------------------------------------------------------------| |
||
131 | CC = arm-none-eabi-gcc |
||
132 | LN = arm-none-eabi-gcc |
||
133 | OC = arm-none-eabi-objcopy |
||
134 | OD = arm-none-eabi-objdump |
||
135 | AS = arm-none-eabi-as |
||
136 | SZ = arm-none-eabi-size |
||
137 | |||
138 | |||
139 | #|---------------------------------------------------------------------------------------| |
||
140 | #| Extract file names | |
||
141 | #|---------------------------------------------------------------------------------------| |
||
142 | PROJ_ASRCS = $(filter %.s,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) |
||
143 | PROJ_CSRCS = $(filter %.c,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) |
||
144 | PROJ_CHDRS = $(filter %.h,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) |
||
145 | PROJ_CCMPL = $(patsubst %.c,%.cpl,$(PROJ_CSRCS)) |
||
146 | PROJ_ACMPL = $(patsubst %.s,%.cpl,$(PROJ_ASRCS)) |
||
147 | |||
148 | |||
149 | #|---------------------------------------------------------------------------------------| |
||
150 | #| Set important path variables | |
||
151 | #|---------------------------------------------------------------------------------------| |
||
152 | VPATH = $(foreach path,$(sort $(foreach file,$(PROJ_FILES),$(dir $(file)))) $(subst \,/,$(OBJ_PATH)),$(path) :) |
||
153 | OBJ_PATH = obj |
||
154 | BIN_PATH = bin |
||
155 | INC_PATH = $(patsubst %,-I%,$(sort $(foreach file,$(filter %.h,$(PROJ_FILES)),$(dir $(file))))) |
||
156 | INC_PATH += -I. |
||
157 | LIB_PATH = -L../../../Source/ARMCM3_STM32/GCC/ |
||
158 | |||
159 | |||
160 | #|---------------------------------------------------------------------------------------| |
||
161 | #| Options for compiler binaries | |
||
162 | #|---------------------------------------------------------------------------------------| |
||
163 | CFLAGS = -g -D inline= -mthumb -mcpu=cortex-m3 -O1 -T memory.x |
||
164 | CFLAGS += -D PACK_STRUCT_END=__attribute\(\(packed\)\) -Wno-main |
||
165 | CFLAGS += -D ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\) |
||
166 | CFLAGS += -ffunction-sections -fdata-sections $(INC_PATH) -D STM32F10X_MD -D GCC_ARMCM3 |
||
167 | CFLAGS += -D USE_STDPERIPH_DRIVER -D VECT_TAB_FLASH -Wa,-adhlns="$(OBJ_PATH)/$(subst .o,.lst,$@)" |
||
168 | LFLAGS = -nostartfiles -Xlinker -M -Xlinker -Map=$(BIN_PATH)/$(PROJ_NAME).map |
||
169 | LFLAGS += $(LIB_PATH) -Xlinker --gc-sections |
||
170 | OFLAGS = -O ihex |
||
171 | ODFLAGS = -x |
||
172 | SZFLAGS = -B -d |
||
173 | CFLAGS += |
||
174 | |||
175 | |||
176 | #|---------------------------------------------------------------------------------------| |
||
177 | #| Specify library files | |
||
178 | #|---------------------------------------------------------------------------------------| |
||
179 | LIBS = |
||
180 | |||
181 | |||
182 | #|---------------------------------------------------------------------------------------| |
||
183 | #| Define targets | |
||
184 | #|---------------------------------------------------------------------------------------| |
||
185 | AOBJS = $(patsubst %.s,%.o,$(PROJ_ASRCS)) |
||
186 | COBJS = $(patsubst %.c,%.o,$(PROJ_CSRCS)) |
||
187 | |||
188 | |||
189 | #|---------------------------------------------------------------------------------------| |
||
190 | #| Make ALL | |
||
191 | #|---------------------------------------------------------------------------------------| |
||
192 | all : $(BIN_PATH)/$(PROJ_NAME).hex |
||
193 | |||
194 | |||
195 | $(BIN_PATH)/$(PROJ_NAME).hex : $(BIN_PATH)/$(PROJ_NAME).elf |
||
196 | @$(OC) $< $(OFLAGS) $@ |
||
197 | @$(OD) $(ODFLAGS) $< > $(BIN_PATH)/$(PROJ_NAME).map |
||
198 | @echo +++ Summary of memory consumption: |
||
199 | @$(SZ) $(SZFLAGS) $< |
||
200 | @echo +++ Build complete [$(notdir $@)] |
||
201 | |||
202 | $(BIN_PATH)/$(PROJ_NAME).elf : $(AOBJS) $(COBJS) |
||
203 | @if [ ! -d $(BIN_PATH) ]; then mkdir $(BIN_PATH); fi |
||
204 | @echo +++ Linking [$(notdir $@)] |
||
205 | @$(LN) $(CFLAGS) -o $@ $(patsubst %.o,$(OBJ_PATH)/%.o,$(^F)) $(LIBS) $(LFLAGS) |
||
206 | |||
207 | |||
208 | #|---------------------------------------------------------------------------------------| |
||
209 | #| Compile and assemble | |
||
210 | #|---------------------------------------------------------------------------------------| |
||
211 | $(AOBJS): %.o: %.s $(PROJ_CHDRS) |
||
212 | @if [ ! -d $(OBJ_PATH) ]; then mkdir $(OBJ_PATH); fi |
||
213 | @echo +++ Assembling [$(notdir $<)] |
||
214 | @$(AS) $(AFLAGS) $< -o $(OBJ_PATH)/$(@F) |
||
215 | |||
216 | $(COBJS): %.o: %.c $(PROJ_CHDRS) |
||
217 | @if [ ! -d $(OBJ_PATH) ]; then mkdir $(OBJ_PATH); fi |
||
218 | @echo +++ Compiling [$(notdir $<)] |
||
219 | @$(CC) $(CFLAGS) -c $< -o $(OBJ_PATH)/$(@F) |
||
220 | |||
221 | |||
222 | #|---------------------------------------------------------------------------------------| |
||
223 | #| Make CLEAN | |
||
224 | #|---------------------------------------------------------------------------------------| |
||
225 | clean : |
||
226 | @echo +++ Cleaning build environment |
||
227 | @rm -rf $(OBJ_PATH) |
||
228 | @rm -rf $(BIN_PATH) |
||
229 | @echo +++ Clean complete |
||
230 | |||
231 | include ../../flash.mk |
||
232 |