d0f5454f9e85c746b5f37e92c1c96cab052c6479
[mTask.git] / client / Makefile
1 ##############################################################################
2 # Build global options
3 # NOTE: Can be overridden externally.
4 #
5
6 # Compiler options here.
7 ifeq ($(USE_OPT),)
8 USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
9 endif
10
11 # C specific options here (added to USE_OPT).
12 ifeq ($(USE_COPT),)
13 USE_COPT =
14 endif
15
16 # C++ specific options here (added to USE_OPT).
17 ifeq ($(USE_CPPOPT),)
18 USE_CPPOPT = -fno-rtti
19 endif
20
21 # Enable this if you want the linker to remove unused code and data
22 ifeq ($(USE_LINK_GC),)
23 USE_LINK_GC = yes
24 endif
25
26 # Linker extra options here.
27 ifeq ($(USE_LDOPT),)
28 USE_LDOPT =
29 endif
30
31 # Enable this if you want link time optimizations (LTO)
32 ifeq ($(USE_LTO),)
33 USE_LTO = yes
34 endif
35
36 # If enabled, this option allows to compile the application in THUMB mode.
37 ifeq ($(USE_THUMB),)
38 USE_THUMB = yes
39 endif
40
41 # Enable this if you want to see the full log while compiling.
42 ifeq ($(USE_VERBOSE_COMPILE),)
43 USE_VERBOSE_COMPILE = no
44 endif
45
46 # If enabled, this option makes the build process faster by not compiling
47 # modules not used in the current configuration.
48 ifeq ($(USE_SMART_BUILD),)
49 USE_SMART_BUILD = yes
50 endif
51
52 #
53 # Build global options
54 ##############################################################################
55
56 ##############################################################################
57 # Architecture or project specific options
58 #
59
60 # Stack size to be allocated to the Cortex-M process stack. This stack is
61 # the stack used by the main() thread.
62 ifeq ($(USE_PROCESS_STACKSIZE),)
63 USE_PROCESS_STACKSIZE = 0x400
64 endif
65
66 # Stack size to the allocated to the Cortex-M main/exceptions stack. This
67 # stack is used for processing interrupts and exceptions.
68 ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
69 USE_EXCEPTIONS_STACKSIZE = 0x400
70 endif
71
72 # Enables the use of FPU (no, softfp, hard).
73 ifeq ($(USE_FPU),)
74 USE_FPU = no
75 endif
76
77 # FPU-related options.
78 ifeq ($(USE_FPU_OPT),)
79 USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv5-d16
80 endif
81
82 #
83 # Architecture or project specific options
84 ##############################################################################
85
86 ##############################################################################
87 # Project, sources and paths
88 #
89
90 # Define project name here
91 PROJECT = mTask
92
93 # Imported source files and paths
94 CHIBIOS = ./ChibiOS
95 # Startup files.
96 include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f7xx.mk
97 # HAL-OSAL files (optional).
98 include $(CHIBIOS)/os/hal/hal.mk
99 include $(CHIBIOS)/os/hal/ports/STM32/STM32F7xx/platform.mk
100 include $(CHIBIOS)/os/hal/boards/ST_NUCLEO144_F767ZI/board.mk
101 include $(CHIBIOS)/os/hal/osal/rt/osal.mk
102 # RTOS files (optional).
103 include $(CHIBIOS)/os/rt/rt.mk
104 include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
105 # Other files (optional).
106 include $(CHIBIOS)/test/rt/test.mk
107
108 # Define linker script file here
109 LDSCRIPT= $(STARTUPLD)/STM32F76xxI.ld
110
111 # C sources that can be compiled in ARM or THUMB mode depending on the global
112 # setting.
113 CSRC = $(STARTUPSRC) \
114 $(KERNSRC) \
115 $(PORTSRC) \
116 $(OSALSRC) \
117 $(HALSRC) \
118 $(PLATFORMSRC) \
119 $(BOARDSRC) \
120 $(TESTSRC) \
121 $(filter-out interface_linux.c,$(wildcard *.c))
122
123 # C++ sources that can be compiled in ARM or THUMB mode depending on the global
124 # setting.
125 CPPSRC =
126
127 # C sources to be compiled in ARM mode regardless of the global setting.
128 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
129 # option that results in lower performance and larger code size.
130 ACSRC =
131
132 # C++ sources to be compiled in ARM mode regardless of the global setting.
133 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
134 # option that results in lower performance and larger code size.
135 ACPPSRC =
136
137 # C sources to be compiled in THUMB mode regardless of the global setting.
138 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
139 # option that results in lower performance and larger code size.
140 TCSRC =
141
142 # C sources to be compiled in THUMB mode regardless of the global setting.
143 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
144 # option that results in lower performance and larger code size.
145 TCPPSRC =
146
147 # List ASM source files here
148 ASMSRC =
149 ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
150
151 INCDIR = $(CHIBIOS)/os/license \
152 $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
153 $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
154 $(CHIBIOS)/os/various
155
156 #
157 # Project, sources and paths
158 ##############################################################################
159
160 ##############################################################################
161 # Compiler settings
162 #
163
164 MCU = cortex-m7
165
166 #TRGT = arm-elf-
167 TRGT = arm-none-eabi-
168 CC = $(TRGT)gcc
169 CPPC = $(TRGT)g++
170 # Enable loading with g++ only if you need C++ runtime support.
171 # NOTE: You can use C++ even without C++ support if you are careful. C++
172 # runtime support makes code size explode.
173 LD = $(TRGT)gcc
174 #LD = $(TRGT)g++
175 CP = $(TRGT)objcopy
176 AS = $(TRGT)gcc -x assembler-with-cpp
177 AR = $(TRGT)ar
178 OD = $(TRGT)objdump
179 SZ = $(TRGT)size
180 HEX = $(CP) -O ihex
181 BIN = $(CP) -O binary
182
183 # ARM-specific options here
184 AOPT =
185
186 # THUMB-specific options here
187 TOPT = -mthumb -DTHUMB
188
189 # Define C warning options here
190 CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -Werror
191
192 # Define C++ warning options here
193 CPPWARN = -Wall -Wextra -Wundef
194
195 #
196 # Compiler settings
197 ##############################################################################
198
199 ##############################################################################
200 # Start of user section
201 #
202
203 # List all user C define here, like -D_DEBUG=1
204 UDEFS = -DSTM #-DDEBUG
205
206 # Define ASM defines here
207 UADEFS =
208
209 # List all user directories here
210 UINCDIR =
211
212 # List the user directory to look for the libraries here
213 ULIBDIR =
214
215 # List all user libraries here
216 ULIBS =
217
218 #
219 # End of user defines
220 ##############################################################################
221
222 RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
223 include $(RULESPATH)/rules.mk
224
225 flash: build/$(PROJECT).bin
226 sudo `which openocd` \
227 -f interface/stlink-v2-1.cfg\
228 -c "transport select hla_swd"\
229 -f target/stm32f7x.cfg \
230 -c init\
231 -c "reset halt"\
232 -c "flash write_image erase "$<" 0x08000000"\
233 -c "reset run"\
234 -c shutdown