xref: /btstack/port/max32630-fthr/example/template/Makefile (revision c37cd8f3d1350b92a2f66c31b2a5fcd75f8c91a4)
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.6_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/micro-ecc
108VPATH += ${BTSTACK_ROOT}/platform/embedded
109VPATH += ${BTSTACK_ROOT}/src/ble/gatt-service/
110
111PROJ_CFLAGS += \
112    -I$(BTSTACK_ROOT)/src \
113    -I$(BTSTACK_ROOT)/src/ble \
114    -I$(BTSTACK_ROOT)/src/classic \
115    -I$(BTSTACK_ROOT)/chipset/cc256x \
116    -I$(BTSTACK_ROOT)/platform/embedded \
117    -I${BTSTACK_ROOT}/port/pegasus-max3263x \
118    -I${BTSTACK_ROOT}/src/ble/gatt-service/ \
119    -I${BTSTACK_ROOT}/example \
120    -I${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include \
121	-I${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include \
122	-I${BTSTACK_ROOT}/3rd-party/micro-ecc \
123	-I${BTSTACK_ROOT}/3rd-party/hxcmod-player \
124
125
126CORE = \
127    ad_parser.o \
128    btstack_linked_list.o \
129    btstack_memory.o \
130    btstack_memory_pool.o \
131    btstack_run_loop.o \
132    btstack_util.o \
133    l2cap.o \
134    l2cap_signaling.o \
135    btstack_run_loop_embedded.o \
136	$(CC2564B) \
137    hci_transport_h4.o
138
139COMMON = \
140    btstack_chipset_cc256x.o  \
141    hci.o                     \
142    hci_cmd.o                 \
143    hci_dump.o                \
144    btstack_uart_block_embedded.o \
145    hal_flash_bank_mxc.o      \
146    btstack_tlv.o             \
147    btstack_tlv_flash_bank.o  \
148    btstack_stdin_embedded.o  \
149
150CLASSIC = \
151    btstack_link_key_db_tlv.o \
152    rfcomm.o                  \
153    sdp_util.o              \
154    spp_server.o            \
155    sdp_server.o              \
156    sdp_client.o              \
157    sdp_client_rfcomm.o
158
159BLE = \
160    att_db.o                      \
161    att_server.o              \
162    le_device_db_tlv.o  \
163    att_dispatch.o            \
164    sm.o \
165    ancs_client.o \
166    gatt_client.o \
167    hid_device.o \
168    battery_service_server.o \
169    uECC.o \
170
171AVDTP += \
172	avdtp_util.c  		\
173	avdtp.c  			\
174	avdtp_initiator.c 	\
175	avdtp_acceptor.c  	\
176	avdtp_source.c 		\
177	avdtp_sink.c  		\
178	a2dp_source.c 		\
179	a2dp_sink.c  		\
180	btstack_ring_buffer.c \
181	avrcp.c \
182	avrcp_target.c \
183	avrcp_controller.c \
184
185HFP_OBJ += sco_demo_util.o btstack_ring_buffer.o hfp.o hfp_gsm_model.o hfp_ag.o hfp_hf.o
186
187# List of files for Bluedroid SBC codec
188include ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/Makefile.inc
189include ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/Makefile.inc
190
191SBC_DECODER += \
192	btstack_sbc_plc.c \
193	btstack_sbc_decoder_bluedroid.c \
194
195SBC_ENCODER += \
196	btstack_sbc_encoder_bluedroid.c \
197	hfp_msbc.c \
198
199HXCMOD_PLAYER = \
200	hxcmod.c 						\
201	nao-deceased_by_disease.c 	\
202
203
204ADDITION =
205
206CORE_OBJ   = $(CORE:.c=.o)
207COMMON_OBJ = $(COMMON:.c=.o)
208BLE_OBJ    = $(BLE:.c=.o)
209CLASSIC_OBJ = $(CLASSIC:.c=.o)
210AVDTP_OBJ   = $(AVDTP:.c=.o)
211SBC_DECODER_OBJ  = $(SBC_DECODER:.c=.o)
212SBC_ENCODER_OBJ  = $(SBC_ENCODER:.c=.o)
213CVSD_PLC_OBJ = $(CVSD_PLC:.c=.o)
214HXCMOD_PLAYER_OBJ = $(HXCMOD_PLAYER:.c=.o)
215
216SRCS += $(CORE_OBJ)
217SRCS += $(COMMON_OBJ)
218SRCS += $(BLE_OBJ)
219SRCS += $(CLASSIC_OBJ)
220SRCS += $(AVDTP_OBJ)
221SRCS += $(SBC_DECODER_OBJ)
222SRCS += $(SBC_ENCODER_OBJ)
223SRCS += $(CVSD_PLC_OBJ)
224SRCS += $(HXCMOD_PLAYER_OBJ)
225SRCS += $(HFP_OBJ)
226SRCS += hsp_hs.o hsp_ag.o
227SRCS += obex_iterator.o goep_client.o pbap_client.o
228
229# Enable assertion checking for development
230PROJ_CFLAGS+=-DMXC_ASSERT_ENABLE
231
232# Use this variables to specify and alternate tool path
233#TOOL_DIR=/opt/gcc-arm-none-eabi-4_8-2013q4/bin
234
235# Use these variables to add project specific tool options
236#PROJ_CFLAGS+=--specs=nano.specs
237#PROJ_LDFLAGS+=--specs=nano.specs
238
239# Point this variable to a startup file to override the default file
240#STARTUPFILE=start.S
241
242# Point this variable to a linker file to override the default file
243# LINKERFILE=$(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC/$(TARGET_LC).ld
244
245%.h: %.gatt
246	python ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
247
248all: spp_and_le_streamer.h
249
250# Include the peripheral driver
251PERIPH_DRIVER_DIR=$(LIBS_DIR)/$(TARGET_UC)PeriphDriver
252include $(PERIPH_DRIVER_DIR)/periphdriver.mk
253
254################################################################################
255# Include the rules for building for this target. All other makefiles should be
256# included before this one.
257include $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/$(COMPILER)/$(TARGET_LC).mk
258
259# fetch and convert init scripts
260# use bluetooth_init_cc2564B_1.6_BT_Spec_4.1.c
261# include ${BTSTACK_ROOT}/chipset/cc256x/Makefile.inc
262
263#include ${BTSTACK_ROOT}/example/Makefile.inc
264
265rm-compiled-gatt-file:
266	rm -f spp_and_le_counter.h
267
268clean: rm-compiled-gatt-file
269
270# The rule to clean out all the build products.
271distclean: clean
272	$(MAKE) -C ${PERIPH_DRIVER_DIR} clean
273