]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/chibios/chibios.mk
Merge commit '28203e909e83b1ac6becb45a3eadae23b190df32' into master-core-pull
[tmk_keyboard.git] / tmk_core / tool / chibios / chibios.mk
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 -std=gnu99 -DPROTOCOL_CHIBIOS
9 endif
10
11 # C specific options here (added to USE_OPT).
12 ifeq ($(USE_COPT),)
13 USE_COPT =
14 endif
15
16 # include specific config.h?
17 ifdef CONFIG_H
18 USE_COPT += -include $(CONFIG_H)
19 endif
20
21 # C++ specific options here (added to USE_OPT).
22 ifeq ($(USE_CPPOPT),)
23 USE_CPPOPT = -fno-rtti
24 endif
25
26 # Enable this if you want the linker to remove unused code and data
27 ifeq ($(USE_LINK_GC),)
28 USE_LINK_GC = yes
29 endif
30
31 # Linker extra options here.
32 ifeq ($(USE_LDOPT),)
33 USE_LDOPT =
34 endif
35
36 # Enable this if you want link time optimizations (LTO)
37 ifeq ($(USE_LTO),)
38 USE_LTO = yes
39 endif
40
41 # If enabled, this option allows to compile the application in THUMB mode.
42 ifeq ($(USE_THUMB),)
43 USE_THUMB = yes
44 endif
45
46 # Enable this if you want to see the full log while compiling.
47 ifeq ($(USE_VERBOSE_COMPILE),)
48 USE_VERBOSE_COMPILE = no
49 endif
50
51 # If enabled, this option makes the build process faster by not compiling
52 # modules not used in the current configuration.
53 ifeq ($(USE_SMART_BUILD),)
54 USE_SMART_BUILD = yes
55 endif
56
57 #
58 # Build global options
59 ##############################################################################
60
61 ##############################################################################
62 # Architecture or project specific options
63 #
64
65 # Stack size to be allocated to the Cortex-M process stack. This stack is
66 # the stack used by the main() thread.
67 ifeq ($(USE_PROCESS_STACKSIZE),)
68 USE_PROCESS_STACKSIZE = 0x200
69 endif
70
71 # Stack size to the allocated to the Cortex-M main/exceptions stack. This
72 # stack is used for processing interrupts and exceptions.
73 ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
74 USE_EXCEPTIONS_STACKSIZE = 0x400
75 endif
76
77 #
78 # Architecture or project specific options
79 ##############################################################################
80
81 ##############################################################################
82 # Project, sources and paths
83 #
84
85 # Imported source files and paths
86 CHIBIOS = $(TMK_DIR)/tool/chibios/chibios
87 # Startup files.
88 include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk
89 # HAL-OSAL files (optional).
90 include $(CHIBIOS)/os/hal/hal.mk
91 include $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/platform.mk
92 ifneq ("$(wildcard $(TARGET_DIR)/boards/$(BOARD))","")
93 include $(TARGET_DIR)/boards/$(BOARD)/board.mk
94 else
95 include $(CHIBIOS)/os/hal/boards/$(BOARD)/board.mk
96 endif
97 include $(CHIBIOS)/os/hal/osal/rt/osal.mk
98 # RTOS files (optional).
99 include $(CHIBIOS)/os/rt/rt.mk
100 include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v$(ARMV)m.mk
101 # Other files (optional).
102
103 # Define linker script file here
104 ifneq ("$(wildcard $(TARGET_DIR)/ld/$(MCU_LDSCRIPT).ld)","")
105 LDSCRIPT = $(TARGET_DIR)/ld/$(MCU_LDSCRIPT).ld
106 else
107 LDSCRIPT = $(STARTUPLD)/$(MCU_LDSCRIPT).ld
108 endif
109
110 # C sources that can be compiled in ARM or THUMB mode depending on the global
111 # setting.
112 CSRC = $(STARTUPSRC) \
113 $(KERNSRC) \
114 $(PORTSRC) \
115 $(OSALSRC) \
116 $(HALSRC) \
117 $(PLATFORMSRC) \
118 $(BOARDSRC) \
119 $(CHIBIOS)/os/hal/lib/streams/chprintf.c \
120 $(TMK_DIR)/protocol/chibios/usb_main.c \
121 $(TMK_DIR)/protocol/chibios/main.c \
122 $(SRC)
123
124 # C++ sources that can be compiled in ARM or THUMB mode depending on the global
125 # setting.
126 CPPSRC =
127
128 # C sources to be compiled in ARM mode regardless of the global setting.
129 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
130 # option that results in lower performance and larger code size.
131 ACSRC =
132
133 # C++ sources to be compiled in ARM mode regardless of the global setting.
134 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
135 # option that results in lower performance and larger code size.
136 ACPPSRC =
137
138 # C sources to be compiled in THUMB mode regardless of the global setting.
139 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
140 # option that results in lower performance and larger code size.
141 TCSRC =
142
143 # C sources to be compiled in THUMB mode regardless of the global setting.
144 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
145 # option that results in lower performance and larger code size.
146 TCPPSRC =
147
148 # List ASM source files here
149 ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
150
151 INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
152 $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
153 $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various \
154 $(TMK_DIR) $(COMMON_DIR) $(TMK_DIR)/protocol/chibios \
155 $(TMK_DIR)/protocol $(TARGET_DIR)
156
157 #
158 # Project, sources and paths
159 ##############################################################################
160
161 ##############################################################################
162 # Compiler settings
163 #
164
165 #TRGT = arm-elf-
166 TRGT = arm-none-eabi-
167 CC = $(TRGT)gcc
168 CPPC = $(TRGT)g++
169 # Enable loading with g++ only if you need C++ runtime support.
170 # NOTE: You can use C++ even without C++ support if you are careful. C++
171 # runtime support makes code size explode.
172 LD = $(TRGT)gcc
173 #LD = $(TRGT)g++
174 CP = $(TRGT)objcopy
175 AS = $(TRGT)gcc -x assembler-with-cpp
176 AR = $(TRGT)ar
177 OD = $(TRGT)objdump
178 SZ = $(TRGT)size
179 HEX = $(CP) -O ihex
180 BIN = $(CP) -O binary
181
182 # ARM-specific options here
183 AOPT =
184
185 # THUMB-specific options here
186 TOPT = -mthumb -DTHUMB
187
188 # Define C warning options here
189 CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -Wno-missing-field-initializers
190
191 # Define C++ warning options here
192 CPPWARN = -Wall -Wextra -Wundef
193
194 #
195 # Compiler settings
196 ##############################################################################
197
198 ##############################################################################
199 # Start of user section
200 #
201
202 # List all user C define here, like -D_DEBUG=1
203 ## Select which interfaces to include here!
204 UDEFS = $(OPT_DEFS)
205
206 # Define ASM defines here
207 UADEFS = $(OPT_DEFS)
208 # bootloader definitions may be used in the startup .s file
209 ifneq ("$(wildcard $(TARGET_DIR)/bootloader_defs.h)","")
210 UADEFS += -include $(TARGET_DIR)/bootloader_defs.h
211 UDEFS += -include $(TARGET_DIR)/bootloader_defs.h
212 else ifneq ("$(wildcard $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h)","")
213 UADEFS += -include $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h
214 UDEFS += -include $(TARGET_DIR)/boards/$(BOARD)/bootloader_defs.h
215 endif
216
217 # List all user directories here
218 UINCDIR =
219
220 # List the user directory to look for the libraries here
221 ULIBDIR =
222
223 # List all user libraries here
224 ULIBS =
225
226 #
227 # End of user defines
228 ##############################################################################
229
230 RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
231 include $(RULESPATH)/rules.mk
Imprint / Impressum