xref: /btstack/port/max32630-fthr/example/template/Makefile (revision 6b7adbe5dd4b0af3c7d33d07ce150d2f4a3a18e0)
1*6b7adbe5SMatthias Ringwald################################################################################
2*6b7adbe5SMatthias Ringwald # Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
3*6b7adbe5SMatthias Ringwald # Ismail H. Kose <[email protected]>
4*6b7adbe5SMatthias Ringwald # Permission is hereby granted, free of charge, to any person obtaining a
5*6b7adbe5SMatthias Ringwald # copy of this software and associated documentation files (the "Software"),
6*6b7adbe5SMatthias Ringwald # to deal in the Software without restriction, including without limitation
7*6b7adbe5SMatthias Ringwald # the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*6b7adbe5SMatthias Ringwald # and/or sell copies of the Software, and to permit persons to whom the
9*6b7adbe5SMatthias Ringwald # Software is furnished to do so, subject to the following conditions:
10*6b7adbe5SMatthias Ringwald #
11*6b7adbe5SMatthias Ringwald # The above copyright notice and this permission notice shall be included
12*6b7adbe5SMatthias Ringwald # in all copies or substantial portions of the Software.
13*6b7adbe5SMatthias Ringwald #
14*6b7adbe5SMatthias Ringwald # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15*6b7adbe5SMatthias Ringwald # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16*6b7adbe5SMatthias Ringwald # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17*6b7adbe5SMatthias Ringwald # IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
18*6b7adbe5SMatthias Ringwald # OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*6b7adbe5SMatthias Ringwald # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*6b7adbe5SMatthias Ringwald # OTHER DEALINGS IN THE SOFTWARE.
21*6b7adbe5SMatthias Ringwald #
22*6b7adbe5SMatthias Ringwald # Except as contained in this notice, the name of Maxim Integrated
23*6b7adbe5SMatthias Ringwald # Products, Inc. shall not be used except as stated in the Maxim Integrated
24*6b7adbe5SMatthias Ringwald # Products, Inc. Branding Policy.
25*6b7adbe5SMatthias Ringwald #
26*6b7adbe5SMatthias Ringwald # The mere transfer of this software does not imply any licenses
27*6b7adbe5SMatthias Ringwald # of trade secrets, proprietary technology, copyrights, patents,
28*6b7adbe5SMatthias Ringwald # trademarks, maskwork rights, or any other form of intellectual
29*6b7adbe5SMatthias Ringwald # property whatsoever. Maxim Integrated Products, Inc. retains all
30*6b7adbe5SMatthias Ringwald # ownership rights.
31*6b7adbe5SMatthias Ringwald #
32*6b7adbe5SMatthias Ringwald # $Date: 2016-03-23 13:28:53 -0700 (Wed, 23 Mar 2016) $
33*6b7adbe5SMatthias Ringwald # $Revision: 22067 $
34*6b7adbe5SMatthias Ringwald #
35*6b7adbe5SMatthias Ringwald ###############################################################################
36*6b7adbe5SMatthias Ringwald
37*6b7adbe5SMatthias Ringwald# Maxim ARM Toolchain and Libraries
38*6b7adbe5SMatthias Ringwald# https://www.maximintegrated.com/en/products/digital/microcontrollers/MAX32630.html
39*6b7adbe5SMatthias Ringwald
40*6b7adbe5SMatthias Ringwald# This is the name of the build output file
41*6b7adbe5SMatthias RingwaldPROJECT=spp_and_le_streamer
42*6b7adbe5SMatthias Ringwald
43*6b7adbe5SMatthias Ringwald# Specify the target processor
44*6b7adbe5SMatthias RingwaldTARGET=MAX3263x
45*6b7adbe5SMatthias RingwaldPROJ_CFLAGS+=-DRO_FREQ=96000000
46*6b7adbe5SMatthias Ringwald
47*6b7adbe5SMatthias Ringwald# Create Target name variables
48*6b7adbe5SMatthias RingwaldTARGET_UC:=$(shell echo $(TARGET) | tr a-z A-Z)
49*6b7adbe5SMatthias RingwaldTARGET_LC:=$(shell echo $(TARGET) | tr A-Z a-z)
50*6b7adbe5SMatthias Ringwald
51*6b7adbe5SMatthias RingwaldCC2564B = bluetooth_init_cc2564B_1.6_BT_Spec_4.1.o
52*6b7adbe5SMatthias Ringwald
53*6b7adbe5SMatthias Ringwald# Select 'GCC' or 'IAR' compiler
54*6b7adbe5SMatthias RingwaldCOMPILER=GCC
55*6b7adbe5SMatthias Ringwald
56*6b7adbe5SMatthias Ringwaldifeq "$(MAXIM_PATH)" ""
57*6b7adbe5SMatthias RingwaldLIBS_DIR=/$(subst \,/,$(subst :,,$(HOME))/Maxim/Firmware/$(TARGET_UC)/Libraries)
58*6b7adbe5SMatthias Ringwald$(warning "MAXIM_PATH need to be set. Please run setenv bash file in the Maxim Toolchain directory.")
59*6b7adbe5SMatthias Ringwaldelse
60*6b7adbe5SMatthias RingwaldLIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
61*6b7adbe5SMatthias Ringwaldendif
62*6b7adbe5SMatthias Ringwald
63*6b7adbe5SMatthias RingwaldCMSIS_ROOT=$(LIBS_DIR)/CMSIS
64*6b7adbe5SMatthias Ringwald
65*6b7adbe5SMatthias Ringwald# Where to find source files for this test
66*6b7adbe5SMatthias RingwaldVPATH= . ../../src
67*6b7adbe5SMatthias Ringwald
68*6b7adbe5SMatthias Ringwald# Where to find header files for this test
69*6b7adbe5SMatthias RingwaldIPATH= . ../../src
70*6b7adbe5SMatthias Ringwald
71*6b7adbe5SMatthias RingwaldBOARD_DIR=$(LIBS_DIR)/Boards
72*6b7adbe5SMatthias Ringwald
73*6b7adbe5SMatthias RingwaldIPATH += ../../board/
74*6b7adbe5SMatthias RingwaldVPATH += ../../board/
75*6b7adbe5SMatthias Ringwald
76*6b7adbe5SMatthias Ringwald# Source files for this test (add path to VPATH below)
77*6b7adbe5SMatthias RingwaldSRCS = main.c
78*6b7adbe5SMatthias RingwaldSRCS += hal_tick.c
79*6b7adbe5SMatthias RingwaldSRCS += btstack_port.c
80*6b7adbe5SMatthias RingwaldSRCS += ${PROJECT}.c
81*6b7adbe5SMatthias RingwaldSRCS += board.c
82*6b7adbe5SMatthias RingwaldSRCS += stdio.c
83*6b7adbe5SMatthias RingwaldSRCS += led.c
84*6b7adbe5SMatthias RingwaldSRCS += pb.c
85*6b7adbe5SMatthias RingwaldSRCS += max14690n.c
86*6b7adbe5SMatthias Ringwald
87*6b7adbe5SMatthias Ringwald# Where to find BSP source files
88*6b7adbe5SMatthias RingwaldVPATH += $(BOARD_DIR)/Source
89*6b7adbe5SMatthias Ringwald
90*6b7adbe5SMatthias Ringwald# Where to find BSP header files
91*6b7adbe5SMatthias RingwaldIPATH += $(BOARD_DIR)/Include
92*6b7adbe5SMatthias Ringwald
93*6b7adbe5SMatthias Ringwald# BTstack
94*6b7adbe5SMatthias RingwaldBTSTACK_ROOT = ../../../..
95*6b7adbe5SMatthias RingwaldVPATH += $(BTSTACK_ROOT)/src
96*6b7adbe5SMatthias RingwaldVPATH += $(BTSTACK_ROOT)/src/ble
97*6b7adbe5SMatthias RingwaldVPATH += $(BTSTACK_ROOT)/src/classic
98*6b7adbe5SMatthias RingwaldVPATH += $(BTSTACK_ROOT)/chipset/cc256x
99*6b7adbe5SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/embedded
100*6b7adbe5SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/src/ble/gatt-service/
101*6b7adbe5SMatthias RingwaldVPATH += $(BTSTACK_ROOT)/port/pegasus-max3263x
102*6b7adbe5SMatthias RingwaldVPATH += $(BTSTACK_ROOT)/example
103*6b7adbe5SMatthias Ringwald
104*6b7adbe5SMatthias RingwaldPROJ_CFLAGS += \
105*6b7adbe5SMatthias Ringwald    -I$(BTSTACK_ROOT)/src \
106*6b7adbe5SMatthias Ringwald    -I$(BTSTACK_ROOT)/src/ble \
107*6b7adbe5SMatthias Ringwald    -I$(BTSTACK_ROOT)/src/classic \
108*6b7adbe5SMatthias Ringwald    -I$(BTSTACK_ROOT)/chipset/cc256x \
109*6b7adbe5SMatthias Ringwald    -I$(BTSTACK_ROOT)/platform/embedded \
110*6b7adbe5SMatthias Ringwald    -I${BTSTACK_ROOT}/port/pegasus-max3263x \
111*6b7adbe5SMatthias Ringwald    -I${BTSTACK_ROOT}/src/ble/gatt-service/ \
112*6b7adbe5SMatthias Ringwald    -I${BTSTACK_ROOT}/example
113*6b7adbe5SMatthias Ringwald
114*6b7adbe5SMatthias RingwaldCORE = \
115*6b7adbe5SMatthias Ringwald        ad_parser.o \
116*6b7adbe5SMatthias Ringwald        btstack_linked_list.o \
117*6b7adbe5SMatthias Ringwald        btstack_memory.o \
118*6b7adbe5SMatthias Ringwald        btstack_memory_pool.o \
119*6b7adbe5SMatthias Ringwald        btstack_run_loop.o \
120*6b7adbe5SMatthias Ringwald        btstack_util.o \
121*6b7adbe5SMatthias Ringwald        l2cap.o \
122*6b7adbe5SMatthias Ringwald        l2cap_signaling.o \
123*6b7adbe5SMatthias Ringwald        btstack_run_loop_embedded.o \
124*6b7adbe5SMatthias Ringwald		$(CC2564B) \
125*6b7adbe5SMatthias Ringwald        hci_transport_h4.o
126*6b7adbe5SMatthias Ringwald
127*6b7adbe5SMatthias RingwaldCOMMON = \
128*6b7adbe5SMatthias Ringwald    btstack_chipset_cc256x.o  \
129*6b7adbe5SMatthias Ringwald    hci.o                     \
130*6b7adbe5SMatthias Ringwald    hci_cmd.o                 \
131*6b7adbe5SMatthias Ringwald    hci_dump.o                \
132*6b7adbe5SMatthias Ringwald    btstack_uart_block_embedded.o
133*6b7adbe5SMatthias Ringwald
134*6b7adbe5SMatthias RingwaldCLASSIC = \
135*6b7adbe5SMatthias Ringwald    btstack_link_key_db_memory.o \
136*6b7adbe5SMatthias Ringwald    rfcomm.o                  \
137*6b7adbe5SMatthias Ringwald    sdp_util.o              \
138*6b7adbe5SMatthias Ringwald    spp_server.o            \
139*6b7adbe5SMatthias Ringwald    sdp_server.o              \
140*6b7adbe5SMatthias Ringwald    sdp_client.o              \
141*6b7adbe5SMatthias Ringwald    sdp_client_rfcomm.o
142*6b7adbe5SMatthias Ringwald
143*6b7adbe5SMatthias RingwaldBLE = \
144*6b7adbe5SMatthias Ringwald    att_db.o                      \
145*6b7adbe5SMatthias Ringwald    att_server.o              \
146*6b7adbe5SMatthias Ringwald    le_device_db_memory.o  \
147*6b7adbe5SMatthias Ringwald    att_dispatch.o            \
148*6b7adbe5SMatthias Ringwald    sm.o
149*6b7adbe5SMatthias Ringwald
150*6b7adbe5SMatthias RingwaldADDITION =
151*6b7adbe5SMatthias Ringwald
152*6b7adbe5SMatthias RingwaldCORE_OBJ   = $(CORE:.c=.o)
153*6b7adbe5SMatthias RingwaldCOMMON_OBJ = $(COMMON:.c=.o)
154*6b7adbe5SMatthias RingwaldBLE_OBJ    = $(BLE:.c=.o)
155*6b7adbe5SMatthias RingwaldCLASSIC_OBJ = $(CLASSIC:.c=.o)
156*6b7adbe5SMatthias Ringwald
157*6b7adbe5SMatthias RingwaldSRCS += $(CORE_OBJ)
158*6b7adbe5SMatthias RingwaldSRCS += $(COMMON_OBJ)
159*6b7adbe5SMatthias RingwaldSRCS += $(BLE_OBJ)
160*6b7adbe5SMatthias RingwaldSRCS += $(CLASSIC_OBJ)
161*6b7adbe5SMatthias Ringwald
162*6b7adbe5SMatthias Ringwald# Enable assertion checking for development
163*6b7adbe5SMatthias RingwaldPROJ_CFLAGS+=-DMXC_ASSERT_ENABLE
164*6b7adbe5SMatthias Ringwald
165*6b7adbe5SMatthias Ringwald# Use this variables to specify and alternate tool path
166*6b7adbe5SMatthias Ringwald#TOOL_DIR=/opt/gcc-arm-none-eabi-4_8-2013q4/bin
167*6b7adbe5SMatthias Ringwald
168*6b7adbe5SMatthias Ringwald# Use these variables to add project specific tool options
169*6b7adbe5SMatthias Ringwald#PROJ_CFLAGS+=--specs=nano.specs
170*6b7adbe5SMatthias Ringwald#PROJ_LDFLAGS+=--specs=nano.specs
171*6b7adbe5SMatthias Ringwald
172*6b7adbe5SMatthias Ringwald# Point this variable to a startup file to override the default file
173*6b7adbe5SMatthias Ringwald#STARTUPFILE=start.S
174*6b7adbe5SMatthias Ringwald
175*6b7adbe5SMatthias Ringwald# Point this variable to a linker file to override the default file
176*6b7adbe5SMatthias Ringwald# LINKERFILE=$(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC/$(TARGET_LC).ld
177*6b7adbe5SMatthias Ringwald
178*6b7adbe5SMatthias Ringwald%.h: %.gatt
179*6b7adbe5SMatthias Ringwald	python ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
180*6b7adbe5SMatthias Ringwald
181*6b7adbe5SMatthias Ringwaldall: spp_and_le_streamer.h
182*6b7adbe5SMatthias Ringwald
183*6b7adbe5SMatthias Ringwald# Include the peripheral driver
184*6b7adbe5SMatthias RingwaldPERIPH_DRIVER_DIR=$(LIBS_DIR)/$(TARGET_UC)PeriphDriver
185*6b7adbe5SMatthias Ringwaldinclude $(PERIPH_DRIVER_DIR)/periphdriver.mk
186*6b7adbe5SMatthias Ringwald
187*6b7adbe5SMatthias Ringwald################################################################################
188*6b7adbe5SMatthias Ringwald# Include the rules for building for this target. All other makefiles should be
189*6b7adbe5SMatthias Ringwald# included before this one.
190*6b7adbe5SMatthias Ringwaldinclude $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/$(COMPILER)/$(TARGET_LC).mk
191*6b7adbe5SMatthias Ringwald
192*6b7adbe5SMatthias Ringwald# fetch and convert init scripts
193*6b7adbe5SMatthias Ringwald# use bluetooth_init_cc2564B_1.6_BT_Spec_4.1.c
194*6b7adbe5SMatthias Ringwald# include ${BTSTACK_ROOT}/chipset/cc256x/Makefile.inc
195*6b7adbe5SMatthias Ringwald
196*6b7adbe5SMatthias Ringwald#include ${BTSTACK_ROOT}/example/Makefile.inc
197*6b7adbe5SMatthias Ringwald
198*6b7adbe5SMatthias Ringwaldrm-compiled-gatt-file:
199*6b7adbe5SMatthias Ringwald	rm -f spp_and_le_counter.h
200*6b7adbe5SMatthias Ringwald
201*6b7adbe5SMatthias Ringwaldclean: rm-compiled-gatt-file
202*6b7adbe5SMatthias Ringwald
203*6b7adbe5SMatthias Ringwald# The rule to clean out all the build products.
204*6b7adbe5SMatthias Ringwalddistclean: clean
205*6b7adbe5SMatthias Ringwald	$(MAKE) -C ${PERIPH_DRIVER_DIR} clean
206