xref: /btstack/port/max32630-fthr/example/template/Makefile (revision 06816492480ce7ade9146f46190a1bd8fa90f994)
1################################################################################
2 # Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
3 # Ismail H. Kose <[email protected]>
4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the "Software"),
6 # to deal in the Software without restriction, including without limitation
7 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 # and/or sell copies of the Software, and to permit persons to whom the
9 # Software is furnished to do so, subject to the following conditions:
10 #
11 # The above copyright notice and this permission notice shall be included
12 # in all copies or substantial portions of the Software.
13 #
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 # IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
18 # OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 # OTHER DEALINGS IN THE SOFTWARE.
21 #
22 # Except as contained in this notice, the name of Maxim Integrated
23 # Products, Inc. shall not be used except as stated in the Maxim Integrated
24 # Products, Inc. Branding Policy.
25 #
26 # The mere transfer of this software does not imply any licenses
27 # of trade secrets, proprietary technology, copyrights, patents,
28 # trademarks, maskwork rights, or any other form of intellectual
29 # property whatsoever. Maxim Integrated Products, Inc. retains all
30 # ownership rights.
31 #
32 # $Date: 2016-03-23 13:28:53 -0700 (Wed, 23 Mar 2016) $
33 # $Revision: 22067 $
34 #
35 ###############################################################################
36
37# Maxim ARM Toolchain and Libraries
38# https://www.maximintegrated.com/en/products/digital/microcontrollers/MAX32630.html
39
40# This is the name of the build output file
41PROJECT=spp_and_le_streamer
42
43# Specify the target processor
44TARGET=MAX3263x
45PROJ_CFLAGS+=-DRO_FREQ=96000000
46PROJ_CFLAGS+=-g3 -ggdb -DDEBUG
47CPPFLAGS+=-g3 -ggdb -DDEBUG
48
49# Create Target name variables
50TARGET_UC:=$(shell echo $(TARGET) | tr a-z A-Z)
51TARGET_LC:=$(shell echo $(TARGET) | tr A-Z a-z)
52
53CC2564B = bluetooth_init_cc2564B_1.8_BT_Spec_4.1.o
54
55# Select 'GCC' or 'IAR' compiler
56COMPILER=GCC
57
58ifeq "$(MAXIM_PATH)" ""
59LIBS_DIR=/$(subst \,/,$(subst :,,$(HOME))/Maxim/Firmware/$(TARGET_UC)/Libraries)
60$(warning "MAXIM_PATH need to be set. Please run setenv bash file in the Maxim Toolchain directory.")
61else
62LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
63endif
64
65CMSIS_ROOT=$(LIBS_DIR)/CMSIS
66
67# Where to find source files for this test
68VPATH= . ../../src
69
70# Where to find header files for this test
71IPATH= . ../../src
72
73BOARD_DIR=$(LIBS_DIR)/Boards
74
75IPATH += ../../board/
76VPATH += ../../board/
77
78# Source files for this test (add path to VPATH below)
79SRCS = main.c
80SRCS += hal_tick.c
81SRCS += btstack_port.c
82SRCS += ${PROJECT}.c
83SRCS += board.c
84SRCS += stdio.c
85SRCS += led.c
86SRCS += pb.c
87SRCS += max14690n.c
88
89# Where to find BSP source files
90VPATH += $(BOARD_DIR)/Source
91
92# Where to find BSP header files
93IPATH += $(BOARD_DIR)/Include
94
95# BTstack
96BTSTACK_ROOT ?= ../../../..
97VPATH += $(BTSTACK_ROOT)/chipset/cc256x
98VPATH += $(BTSTACK_ROOT)/example
99VPATH += $(BTSTACK_ROOT)/port/pegasus-max3263x
100VPATH += $(BTSTACK_ROOT)/src
101VPATH += $(BTSTACK_ROOT)/src/ble
102VPATH += $(BTSTACK_ROOT)/src/classic
103VPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce
104VPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce
105VPATH += ${BTSTACK_ROOT}/3rd-party/hxcmod-player
106VPATH += ${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods
107VPATH += ${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/
108VPATH += ${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4
109VPATH += ${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv6
110VPATH += ${BTSTACK_ROOT}/3rd-party/lwip/core/src/netif
111VPATH += ${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http
112VPATH += ${BTSTACK_ROOT}/3rd-party/lwip/dhcp-server
113VPATH += ${BTSTACK_ROOT}/3rd-party/md5
114VPATH += ${BTSTACK_ROOT}/3rd-party/yxml
115VPATH += ${BTSTACK_ROOT}/3rd-party/micro-ecc
116VPATH += ${BTSTACK_ROOT}/platform/embedded
117VPATH += ${BTSTACK_ROOT}/platform/lwip
118VPATH += ${BTSTACK_ROOT}/platform/lwip/port
119VPATH += ${BTSTACK_ROOT}/src/ble/gatt-service/
120
121PROJ_CFLAGS += \
122    -I$(BTSTACK_ROOT)/src \
123    -I$(BTSTACK_ROOT)/src/ble \
124    -I$(BTSTACK_ROOT)/src/classic \
125    -I$(BTSTACK_ROOT)/chipset/cc256x \
126    -I$(BTSTACK_ROOT)/platform/embedded \
127    -I$(BTSTACK_ROOT)/platform/lwip \
128    -I$(BTSTACK_ROOT)/platform/lwip/port \
129    -I${BTSTACK_ROOT}/port/pegasus-max3263x \
130    -I${BTSTACK_ROOT}/src/ble/gatt-service/ \
131    -I${BTSTACK_ROOT}/example \
132    -I${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include \
133	-I${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include \
134    -I${BTSTACK_ROOT}/3rd-party/md5 \
135    -I${BTSTACK_ROOT}/3rd-party/yxml \
136	-I${BTSTACK_ROOT}/3rd-party/micro-ecc \
137	-I${BTSTACK_ROOT}/3rd-party/hxcmod-player \
138	-I${BTSTACK_ROOT}/3rd-party/lwip/core/src/include \
139	-I${BTSTACK_ROOT}/3rd-party/lwip/dhcp-server \
140
141
142CORE = \
143    ad_parser.o \
144    btstack_linked_list.o \
145    btstack_memory.o \
146    btstack_memory_pool.o \
147    btstack_run_loop.o \
148    btstack_util.o \
149    l2cap.o \
150    l2cap_signaling.o \
151    btstack_run_loop_embedded.o \
152	$(CC2564B) \
153    hci_transport_h4.o
154
155COMMON = \
156    btstack_chipset_cc256x.o  \
157    hci.o                     \
158    hci_cmd.o                 \
159    hci_dump.o                \
160    hci_dump_embedded_stdout.o    \
161    hci_event_builder.o       \
162    btstack_uart_block_embedded.o \
163    hal_flash_bank_mxc.o      \
164    btstack_audio.o           \
165    btstack_tlv.o             \
166    btstack_tlv_flash_bank.o  \
167    btstack_stdin_embedded.o  \
168    btstack_crypto.o          \
169
170CLASSIC = \
171    btstack_link_key_db_tlv.o \
172    hid_device.o              \
173    hid_host.o                \
174    rfcomm.o                  \
175    sdp_util.o              \
176    spp_server.o            \
177    sdp_server.o              \
178    sdp_client.o              \
179    sdp_client_rfcomm.o
180
181BLE = \
182    att_db.o                      \
183    att_server.o              \
184    le_device_db_tlv.o  \
185    att_dispatch.o            \
186    sm.o \
187    ancs_client.o \
188    gatt_client.o \
189    hid_device.o \
190    battery_service_server.o \
191    uECC.o \
192
193AVDTP += \
194	avdtp_util.c  		\
195	avdtp.c  			\
196	avdtp_initiator.c 	\
197	avdtp_acceptor.c  	\
198	avdtp_source.c 		\
199	avdtp_sink.c  		\
200	a2dp.c				\
201	a2dp_source.c 		\
202	a2dp_sink.c  		\
203	btstack_ring_buffer.c \
204    btstack_resample.c  \
205	avrcp.c \
206	avrcp_target.c \
207	avrcp_controller.c \
208
209HFP_OBJ += sco_demo_util.o btstack_ring_buffer.o hfp.o hfp_gsm_model.o hfp_ag.o hfp_hf.o
210
211# List of files for Bluedroid SBC codec
212include ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/Makefile.inc
213include ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/Makefile.inc
214
215SBC_DECODER += \
216	btstack_sbc_plc.c \
217	btstack_sbc_decoder_bluedroid.c \
218
219SBC_ENCODER += \
220	btstack_sbc_encoder_bluedroid.c \
221	hfp_msbc.c \
222    hfp_codec.c
223
224HXCMOD_PLAYER = \
225	hxcmod.c 						\
226	nao-deceased_by_disease.c 	\
227
228LWIP_CORE_SRC  = init.c mem.c memp.c netif.c udp.c ip.c pbuf.c inet_chksum.c def.c tcp.c tcp_in.c tcp_out.c timeouts.c sys_arch.c
229LWIP_IPV4_SRC  = acd.c dhcp.c etharp.c icmp.c ip4.c ip4_frag.c ip4_addr.c
230LWIP_NETIF_SRC = ethernet.c
231LWIP_HTTPD = altcp_proxyconnect.c fs.c httpd.c
232LWIP_SRC = ${LWIP_CORE_SRC} ${LWIP_IPV4_SRC} ${LWIP_NETIF_SRC} ${LWIP_HTTPD} dhserver.c
233
234ADDITION =
235
236CORE_OBJ   = $(CORE:.c=.o)
237COMMON_OBJ = $(COMMON:.c=.o)
238BLE_OBJ    = $(BLE:.c=.o)
239CLASSIC_OBJ = $(CLASSIC:.c=.o)
240AVDTP_OBJ   = $(AVDTP:.c=.o)
241SBC_DECODER_OBJ  = $(SBC_DECODER:.c=.o)
242SBC_ENCODER_OBJ  = $(SBC_ENCODER:.c=.o)
243CVSD_PLC_OBJ = $(CVSD_PLC:.c=.o)
244HXCMOD_PLAYER_OBJ = $(HXCMOD_PLAYER:.c=.o)
245
246SRCS += $(CORE_OBJ)
247SRCS += $(COMMON_OBJ)
248SRCS += $(BLE_OBJ)
249SRCS += $(CLASSIC_OBJ)
250SRCS += $(AVDTP_OBJ)
251SRCS += $(SBC_DECODER_OBJ)
252SRCS += $(SBC_ENCODER_OBJ)
253SRCS += $(CVSD_PLC_OBJ)
254SRCS += $(HXCMOD_PLAYER_OBJ)
255SRCS += $(HFP_OBJ)
256SRCS += hsp_hs.o hsp_ag.o
257SRCS += obex_parser.o goep_client.o pbap_client.o md5.o yxml.o
258SRCS += pan.c bnep.c bnep_lwip.c
259SRCS += ${LWIP_SRC}
260
261# Enable assertion checking for development
262PROJ_CFLAGS+=-DMXC_ASSERT_ENABLE
263
264# Use this variables to specify and alternate tool path
265#TOOL_DIR=/opt/gcc-arm-none-eabi-4_8-2013q4/bin
266
267# Use these variables to add project specific tool options
268#PROJ_CFLAGS+=--specs=nano.specs
269#PROJ_LDFLAGS+=--specs=nano.specs
270
271# Point this variable to a startup file to override the default file
272#STARTUPFILE=start.S
273
274# Point this variable to a linker file to override the default file
275# LINKERFILE=$(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC/$(TARGET_LC).ld
276
277%.h: %.gatt
278	python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
279
280all: spp_and_le_streamer.h
281
282# Include the peripheral driver
283PERIPH_DRIVER_DIR=$(LIBS_DIR)/$(TARGET_UC)PeriphDriver
284include $(PERIPH_DRIVER_DIR)/periphdriver.mk
285
286################################################################################
287# Include the rules for building for this target. All other makefiles should be
288# included before this one.
289include $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/$(COMPILER)/$(TARGET_LC).mk
290
291# fetch and convert init scripts
292# use bluetooth_init_cc2564B_1.8_BT_Spec_4.1.c
293include ${BTSTACK_ROOT}/chipset/cc256x/Makefile.inc
294
295rm-compiled-gatt-file:
296	rm -f spp_and_le_counter.h
297
298clean: rm-compiled-gatt-file
299
300# The rule to clean out all the build products.
301distclean: clean
302	$(MAKE) -C ${PERIPH_DRIVER_DIR} clean
303