amiro-blt / Target / Modules / PowerManagement_1-1 / Boot / makefile @ d54d2f07
History | View | Annotate | Download (12.693 KB)
1 |
#**************************************************************************************** |
---|---|
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) 2013 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=OpenBLT_AMiRo_PowerManagement_stm32f405 |
32 |
|
33 |
|
34 |
#|---------------------------------------------------------------------------------------| |
35 |
#| Speficy project source files | |
36 |
#|---------------------------------------------------------------------------------------| |
37 |
PROJ_FILES= \ |
38 |
blt_conf.h \ |
39 |
hooks.c \ |
40 |
main.c \ |
41 |
./lib/stdperiphlib/stm32f4xx_conf.h \ |
42 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/misc.h \ |
43 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_adc.h \ |
44 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_can.h \ |
45 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_crc.h \ |
46 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_cryp.h \ |
47 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_dac.h \ |
48 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_dbgmcu.h \ |
49 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_dcmi.h \ |
50 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_dma.h \ |
51 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_exti.h \ |
52 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_flash.h \ |
53 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_fsmc.h \ |
54 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_gpio.h \ |
55 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_hash.h \ |
56 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_i2c.h \ |
57 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_iwdg.h \ |
58 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_pwr.h \ |
59 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_rcc.h \ |
60 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_rng.h \ |
61 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_rtc.h \ |
62 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_sdio.h \ |
63 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_spi.h \ |
64 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_syscfg.h \ |
65 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_tim.h \ |
66 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_usart.h \ |
67 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_wwdg.h \ |
68 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/misc.c \ |
69 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_adc.c \ |
70 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_can.c \ |
71 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_crc.c \ |
72 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp.c \ |
73 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp_aes.c \ |
74 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp_des.c \ |
75 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp_tdes.c \ |
76 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dac.c \ |
77 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dbgmcu.c \ |
78 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dcmi.c \ |
79 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dma.c \ |
80 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_exti.c \ |
81 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c \ |
82 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_fsmc.c \ |
83 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_gpio.c \ |
84 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_hash.c \ |
85 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_hash_md5.c \ |
86 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_hash_sha1.c \ |
87 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_i2c.c \ |
88 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_iwdg.c \ |
89 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_pwr.c \ |
90 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c \ |
91 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rng.c \ |
92 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rtc.c \ |
93 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_sdio.c \ |
94 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_spi.c \ |
95 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_syscfg.c \ |
96 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_tim.c \ |
97 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.c \ |
98 |
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_wwdg.c \ |
99 |
./lib/stdperiphlib/CMSIS/Include/core_cm4.h \ |
100 |
./lib/stdperiphlib/CMSIS/Include/core_cm4_simd.h \ |
101 |
./lib/stdperiphlib/CMSIS/Include/core_cmFunc.h \ |
102 |
./lib/stdperiphlib/CMSIS/Include/core_cmInstr.h \ |
103 |
./lib/stdperiphlib/CMSIS/Device/ST/STM32F4xx/Source/system_stm32f4xx.c \ |
104 |
./lib/stdperiphlib/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h \ |
105 |
./lib/stdperiphlib/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h \ |
106 |
../../../Source/boot.c \ |
107 |
../../../Source/boot.h \ |
108 |
../../../Source/com.c \ |
109 |
../../../Source/com.h \ |
110 |
../../../Source/gateway.c \ |
111 |
../../../Source/gateway.h \ |
112 |
../../../Source/net.c \ |
113 |
../../../Source/net.h \ |
114 |
../../../Source/xcp.c \ |
115 |
../../../Source/xcp.h \ |
116 |
../../../Source/backdoor.c \ |
117 |
../../../Source/backdoor.h \ |
118 |
../../../Source/cop.c \ |
119 |
../../../Source/cop.h \ |
120 |
../../../Source/file.c \ |
121 |
../../../Source/file.h \ |
122 |
../../../Source/assert.c \ |
123 |
../../../Source/assert.h \ |
124 |
../../../Source/plausibility.h \ |
125 |
../../../Source/ARMCM4_STM32/types.h \ |
126 |
../../../Source/ARMCM4_STM32/can.c \ |
127 |
../../../Source/ARMCM4_STM32/can.h \ |
128 |
../../../Source/ARMCM4_STM32/cpu.c \ |
129 |
../../../Source/ARMCM4_STM32/cpu.h \ |
130 |
../../../Source/ARMCM4_STM32/flash.c \ |
131 |
../../../Source/ARMCM4_STM32/flash.h \ |
132 |
../../../Source/ARMCM4_STM32/uart.c \ |
133 |
../../../Source/ARMCM4_STM32/uart.h \ |
134 |
../../../Source/ARMCM4_STM32/bluetoothUart.c \ |
135 |
../../../Source/ARMCM4_STM32/bluetoothUart.h \ |
136 |
../../../Source/ARMCM4_STM32/nvm.c \ |
137 |
../../../Source/ARMCM4_STM32/nvm.h \ |
138 |
../../../Source/ARMCM4_STM32/timer.c \ |
139 |
../../../Source/ARMCM4_STM32/timer.h \ |
140 |
../../../Source/ARMCM4_STM32/GCC/vectors.c \ |
141 |
../../../Source/ARMCM4_STM32/GCC/cstart.c \ |
142 |
../../../Source/AMiRo/amiroblt.h \ |
143 |
../../../Source/AMiRo/helper.h \ |
144 |
../../../Source/AMiRo/helper.c |
145 |
|
146 |
|
147 |
#|---------------------------------------------------------------------------------------| |
148 |
#| Compiler binaries | |
149 |
#|---------------------------------------------------------------------------------------| |
150 |
CC = arm-none-eabi-gcc |
151 |
LN = arm-none-eabi-gcc |
152 |
OC = arm-none-eabi-objcopy |
153 |
OD = arm-none-eabi-objdump |
154 |
AS = arm-none-eabi-as |
155 |
SZ = arm-none-eabi-size |
156 |
|
157 |
|
158 |
#|---------------------------------------------------------------------------------------| |
159 |
#| Extract file names | |
160 |
#|---------------------------------------------------------------------------------------| |
161 |
PROJ_ASRCS = $(filter %.s,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) |
162 |
PROJ_CSRCS = $(filter %.c,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) |
163 |
PROJ_CHDRS = $(filter %.h,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) |
164 |
PROJ_CCMPL = $(patsubst %.c,%.cpl,$(PROJ_CSRCS)) |
165 |
PROJ_ACMPL = $(patsubst %.s,%.cpl,$(PROJ_ASRCS)) |
166 |
|
167 |
|
168 |
#|---------------------------------------------------------------------------------------| |
169 |
#| Set important path variables | |
170 |
#|---------------------------------------------------------------------------------------| |
171 |
VPATH = $(foreach path,$(sort $(foreach file,$(PROJ_FILES),$(dir $(file)))) $(subst \,/,$(OBJ_PATH)),$(path) :) |
172 |
OBJ_PATH = obj |
173 |
BIN_PATH = bin |
174 |
INC_PATH = $(patsubst %,-I%,$(sort $(foreach file,$(filter %.h,$(PROJ_FILES)),$(dir $(file))))) |
175 |
INC_PATH += -I. |
176 |
LIB_PATH = -L../../../Source/ARMCM4_STM32/GCC/ |
177 |
|
178 |
|
179 |
#|---------------------------------------------------------------------------------------| |
180 |
#| Options for compiler binaries | |
181 |
#|---------------------------------------------------------------------------------------| |
182 |
CFLAGS = -g -D inline= -mthumb -mcpu=cortex-m4 -O1 -T memory.x |
183 |
CFLAGS += -D PACK_STRUCT_END=__attribute\(\(packed\)\) -Wno-main |
184 |
CFLAGS += -D ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\) |
185 |
CFLAGS += -ffunction-sections -fdata-sections $(INC_PATH) -D STM32F4XX -D GCC_ARMCM3 |
186 |
CFLAGS += -D USE_STDPERIPH_DRIVER -D VECT_TAB_FLASH -D HSE_VALUE=8000000 |
187 |
CFLAGS += -Wa,-adhlns="$(OBJ_PATH)/$(subst .o,.lst,$@)" -Wno-attributes |
188 |
LFLAGS = -nostartfiles -Xlinker -M -Xlinker -Map=$(BIN_PATH)/$(PROJ_NAME).map |
189 |
LFLAGS += $(LIB_PATH) -Xlinker --gc-sections |
190 |
OFLAGS = -O ihex |
191 |
ODFLAGS = -x |
192 |
SZFLAGS = -B -d |
193 |
CFLAGS += -D AMIRO_MODULE_POWERMANAGEMENT |
194 |
|
195 |
|
196 |
#|---------------------------------------------------------------------------------------| |
197 |
#| Specify library files | |
198 |
#|---------------------------------------------------------------------------------------| |
199 |
LIBS = |
200 |
|
201 |
|
202 |
#|---------------------------------------------------------------------------------------| |
203 |
#| Define targets | |
204 |
#|---------------------------------------------------------------------------------------| |
205 |
AOBJS = $(patsubst %.s,%.o,$(PROJ_ASRCS)) |
206 |
COBJS = $(patsubst %.c,%.o,$(PROJ_CSRCS)) |
207 |
|
208 |
|
209 |
#|---------------------------------------------------------------------------------------| |
210 |
#| Make ALL | |
211 |
#|---------------------------------------------------------------------------------------| |
212 |
all : $(BIN_PATH)/$(PROJ_NAME).hex |
213 |
|
214 |
|
215 |
$(BIN_PATH)/$(PROJ_NAME).hex : $(BIN_PATH)/$(PROJ_NAME).elf |
216 |
@$(OC) $< $(OFLAGS) $@ |
217 |
@$(OD) $(ODFLAGS) $< > $(BIN_PATH)/$(PROJ_NAME).map |
218 |
@echo +++ Summary of memory consumption: |
219 |
@$(SZ) $(SZFLAGS) $< |
220 |
@echo +++ Build complete [$(notdir $@)] |
221 |
|
222 |
$(BIN_PATH)/$(PROJ_NAME).elf : $(AOBJS) $(COBJS) |
223 |
@if [ ! -d $(BIN_PATH) ]; then mkdir $(BIN_PATH); fi |
224 |
@echo +++ Linking [$(notdir $@)] |
225 |
@$(LN) $(CFLAGS) -o $@ $(patsubst %.o,$(OBJ_PATH)/%.o,$(^F)) $(LIBS) $(LFLAGS) |
226 |
|
227 |
|
228 |
#|---------------------------------------------------------------------------------------| |
229 |
#| Compile and assemble | |
230 |
#|---------------------------------------------------------------------------------------| |
231 |
$(AOBJS): %.o: %.s $(PROJ_CHDRS) |
232 |
@if [ ! -d $(OBJ_PATH) ]; then mkdir $(OBJ_PATH); fi |
233 |
@echo +++ Assembling [$(notdir $<)] |
234 |
@$(AS) $(AFLAGS) $< -o $(OBJ_PATH)/$(@F) |
235 |
|
236 |
$(COBJS): %.o: %.c $(PROJ_CHDRS) |
237 |
@if [ ! -d $(OBJ_PATH) ]; then mkdir $(OBJ_PATH); fi |
238 |
@echo +++ Compiling [$(notdir $<)] |
239 |
@$(CC) $(CFLAGS) -c $< -o $(OBJ_PATH)/$(@F) |
240 |
|
241 |
|
242 |
#|---------------------------------------------------------------------------------------| |
243 |
#| Make CLEAN | |
244 |
#|---------------------------------------------------------------------------------------| |
245 |
clean : |
246 |
@echo +++ Cleaning build environment |
247 |
@rm -rf $(OBJ_PATH) |
248 |
@rm -rf $(BIN_PATH) |
249 |
@echo +++ Clean complete |
250 |
|
251 |
include ../../flash.mk |
252 |
|