xref: /btstack/port/archive/msp430f5229lp-cc2564b/Makefile (revision 1664436fd643daf66517dc309e6cc72448e8a86d)
1*1664436fSMatthias Ringwald# Makefile for MSP-EXP430F5438 board with CC2560B/CC2564B/CC2567 modules
2*1664436fSMatthias Ringwald#
3*1664436fSMatthias Ringwald# mspgcc is used: http://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=MSPGCC_Wiki
4*1664436fSMatthias Ringwald#
5*1664436fSMatthias Ringwald
6*1664436fSMatthias Ringwald# init scripts
7*1664436fSMatthias RingwaldCC2560B = bluetooth_init_cc2560B_1.8_BT_Spec_4.1.o
8*1664436fSMatthias RingwaldCC2564B = bluetooth_init_cc2564B_1.8_BT_Spec_4.1.o
9*1664436fSMatthias RingwaldCC2567  = CC256x_BT_Service_Pack_2.8_ANT_1.16.o
10*1664436fSMatthias Ringwald
11*1664436fSMatthias RingwaldBTSTACK_ROOT ?= ../..
12*1664436fSMatthias RingwaldVPATH += example
13*1664436fSMatthias RingwaldVPATH += firmware
14*1664436fSMatthias RingwaldVPATH += src
15*1664436fSMatthias RingwaldVPATH += ${BTSTACK_ROOT}/platform/msp430
16*1664436fSMatthias RingwaldVPATH += $(BTSTACK_ROOT)/src
17*1664436fSMatthias RingwaldVPATH += $(BTSTACK_ROOT)/src/ble
18*1664436fSMatthias RingwaldVPATH += $(BTSTACK_ROOT)/src/classic
19*1664436fSMatthias RingwaldVPATH += $(BTSTACK_ROOT)/chipset/cc256x
20*1664436fSMatthias RingwaldVPATH += $(BTSTACK_ROOT)/platform/embedded
21*1664436fSMatthias RingwaldVPATH += $(BTSTACK_ROOT)/example
22*1664436fSMatthias Ringwald
23*1664436fSMatthias RingwaldMCU = msp430f5529
24*1664436fSMatthias Ringwald
25*1664436fSMatthias RingwaldCC      = msp430-gcc
26*1664436fSMatthias RingwaldCFLAGS  = -mmcu=${MCU} -Os -Wall -fno-toplevel-reorder
27*1664436fSMatthias RingwaldCFLAGS += \
28*1664436fSMatthias Ringwald	-I. \
29*1664436fSMatthias Ringwald	-I src \
30*1664436fSMatthias Ringwald	-I firmware \
31*1664436fSMatthias Ringwald  	-I$(BTSTACK_ROOT)/src \
32*1664436fSMatthias Ringwald	-I$(BTSTACK_ROOT)/chipset/cc256x \
33*1664436fSMatthias Ringwald	-I$(BTSTACK_ROOT)/platform/embedded \
34*1664436fSMatthias Ringwald    -I${BTSTACK_ROOT}/platform/msp430 \
35*1664436fSMatthias Ringwald
36*1664436fSMatthias RingwaldLDFLAGS = -mmcu=${MCU}
37*1664436fSMatthias Ringwald
38*1664436fSMatthias RingwaldCORE   = \
39*1664436fSMatthias Ringwald    btstack_linked_list.c     \
40*1664436fSMatthias Ringwald    btstack_memory.c          \
41*1664436fSMatthias Ringwald    btstack_memory_pool.c       \
42*1664436fSMatthias Ringwald    btstack_run_loop.c		    \
43*1664436fSMatthias Ringwald    btstack_run_loop_embedded.c \
44*1664436fSMatthias Ringwald    btstack_tlv.c             \
45*1664436fSMatthias Ringwald    hal_board.c	              \
46*1664436fSMatthias Ringwald    hal_compat.c              \
47*1664436fSMatthias Ringwald    hal_cpu.c                 \
48*1664436fSMatthias Ringwald    hal_led.c 				  \
49*1664436fSMatthias Ringwald    hal_tick.c	              \
50*1664436fSMatthias Ringwald    hal_usb.c                 \
51*1664436fSMatthias Ringwald    hci_dump.c		          \
52*1664436fSMatthias Ringwald    main.c 					  \
53*1664436fSMatthias Ringwald    btstack_util.c			          \
54*1664436fSMatthias Ringwald
55*1664436fSMatthias RingwaldCOMMON = \
56*1664436fSMatthias Ringwald	ad_parser.c                        \
57*1664436fSMatthias Ringwald	btstack_chipset_cc256x.c           \
58*1664436fSMatthias Ringwald	btstack_link_key_db_memory.c       \
59*1664436fSMatthias Ringwald    btstack_uart_block_embedded.c      \
60*1664436fSMatthias Ringwald    hal_uart_dma.c            		   \
61*1664436fSMatthias Ringwald    hci.c			          		   \
62*1664436fSMatthias Ringwald    hci_cmd.c		          		   \
63*1664436fSMatthias Ringwald    hci_transport_h4.c                 \
64*1664436fSMatthias Ringwald
65*1664436fSMatthias RingwaldSPP = \
66*1664436fSMatthias Ringwald    l2cap.c			          \
67*1664436fSMatthias Ringwald    l2cap_signaling.c         \
68*1664436fSMatthias Ringwald	rfcomm.c			      \
69*1664436fSMatthias Ringwald    sdp_util.c                \
70*1664436fSMatthias Ringwald    spp_server.c              \
71*1664436fSMatthias Ringwald
72*1664436fSMatthias RingwaldSDP_CLIENT += \
73*1664436fSMatthias Ringwald    sdp_client.o		      \
74*1664436fSMatthias Ringwald	sdp_client_rfcomm.o		  \
75*1664436fSMatthias Ringwald
76*1664436fSMatthias RingwaldBLE = \
77*1664436fSMatthias Ringwald	att_db.c 					  \
78*1664436fSMatthias Ringwald	att_server.c     		  \
79*1664436fSMatthias Ringwald	le_device_db_memory.c     \
80*1664436fSMatthias Ringwald	sm.c                      \
81*1664436fSMatthias Ringwald	att_dispatch.c            \
82*1664436fSMatthias Ringwald	l2cap.c 				  \
83*1664436fSMatthias Ringwald    l2cap_signaling.c         \
84*1664436fSMatthias Ringwald	${CC2564B}                \
85*1664436fSMatthias Ringwald#	gatt_client.c             \
86*1664436fSMatthias Ringwald
87*1664436fSMatthias RingwaldLCD = hal_lcd.c hal_lcd_fonts.c
88*1664436fSMatthias Ringwald
89*1664436fSMatthias Ringwald
90*1664436fSMatthias RingwaldCORE_OBJ   = $(CORE:.c=.o)
91*1664436fSMatthias RingwaldCOMMON_OBJ = $(COMMON:.c=.o)
92*1664436fSMatthias RingwaldSPP_OBJ    = $(SPP:.c=.o)
93*1664436fSMatthias RingwaldBLE_OBJ    = $(BLE:.c=.o)
94*1664436fSMatthias Ringwald
95*1664436fSMatthias Ringwald# create .hex file from .out
96*1664436fSMatthias Ringwald%.hex: %.out
97*1664436fSMatthias Ringwald	msp430-objcopy -O ihex $< $@
98*1664436fSMatthias Ringwald
99*1664436fSMatthias Ringwald# create firmware image from common objects and example source file
100*1664436fSMatthias Ringwald
101*1664436fSMatthias Ringwaldall: led_counter.hex spp_counter.hex gap_inquiry.hex spp_flowcontrol.hex \
102*1664436fSMatthias Ringwald	 sdp_rfcomm_query.hex sdp_general_query.hex
103*1664436fSMatthias Ringwald# ble_server.hex
104*1664436fSMatthias Ringwald
105*1664436fSMatthias Ringwald# fetch and convert init scripts
106*1664436fSMatthias Ringwaldinclude ${BTSTACK_ROOT}/chipset/cc256x/Makefile.inc
107*1664436fSMatthias Ringwald
108*1664436fSMatthias Ringwald# compiling requires a 20-bit mspgcc version
109*1664436fSMatthias Ringwald# spp_and_gatt_counter.hex
110*1664436fSMatthias Ringwald
111*1664436fSMatthias Ringwald# compiling ant-test requires special ant init script
112*1664436fSMatthias Ringwald# ant-test.hex
113*1664436fSMatthias Ringwald
114*1664436fSMatthias Ringwald# compile GATT database
115*1664436fSMatthias Ringwald%.h: %.gatt
116*1664436fSMatthias Ringwald	python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
117*1664436fSMatthias Ringwald
118*1664436fSMatthias Ringwald
119*1664436fSMatthias Ringwaldled_counter.out: ${CORE_OBJ} ${COMMON_OBJ} ${CC2560B} led_counter.o
120*1664436fSMatthias Ringwald	${CC} $^ ${LDFLAGS} -o $@
121*1664436fSMatthias Ringwald
122*1664436fSMatthias Ringwaldant-test.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} profile.h ant_cmds.o ${CC2567} ant-test.o
123*1664436fSMatthias Ringwald	${CC} $^ ${LDFLAGS} -o $@
124*1664436fSMatthias Ringwald
125*1664436fSMatthias Ringwaldble_server.out: ${CORE_OBJ} ${COMMON_OBJ} ${BLE_OBJ} profile.h ble_server.o
126*1664436fSMatthias Ringwald	${CC} $^ ${LDFLAGS} -o $@
127*1664436fSMatthias Ringwald
128*1664436fSMatthias Ringwaldspp_and_gatt_counter.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${BLE_OBJ} spp_and_gatt_counter.h spp_and_gatt_counter.o sdp_server.o
129*1664436fSMatthias Ringwald	${CC} $^ ${LDFLAGS} -o $@
130*1664436fSMatthias Ringwald
131*1664436fSMatthias Ringwaldspp_counter.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} spp_counter.o sdp_server.o
132*1664436fSMatthias Ringwald	${CC} $^ ${LDFLAGS} -o $@
133*1664436fSMatthias Ringwald
134*1664436fSMatthias Ringwaldspp_flowcontrol.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} spp_flowcontrol.o sdp_server.o
135*1664436fSMatthias Ringwald	${CC} $^ ${LDFLAGS} -o $@
136*1664436fSMatthias Ringwald
137*1664436fSMatthias Ringwaldgap_inquiry.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} ad_parser.o gap_inquiry.o
138*1664436fSMatthias Ringwald	${CC} $^ ${LDFLAGS} -o $@
139*1664436fSMatthias Ringwald
140*1664436fSMatthias Ringwaldsdp_rfcomm_query.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${SDP_CLIENT} ${CC2560B} sdp_rfcomm_query.o
141*1664436fSMatthias Ringwald	${CC} $^ ${LDFLAGS} -o $@
142*1664436fSMatthias Ringwald
143*1664436fSMatthias Ringwaldsdp_general_query.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${SDP_CLIENT} ${CC2560B} sdp_general_query.o
144*1664436fSMatthias Ringwald	${CC} $^ ${LDFLAGS} -o $@
145*1664436fSMatthias Ringwald
146*1664436fSMatthias Ringwaldclean:
147*1664436fSMatthias Ringwald	rm -f $ *.o *.out *.hex profile.h spp_and_gatt_counter.h ../driver/*.o ../../src/*.o ../src/*.o ../firmware/*.o ${BTSTACK_ROOT}/chipset/cc256x/*.o ${BTSTACK_ROOT}/src/*.o
148*1664436fSMatthias Ringwald
149*1664436fSMatthias Ringwaldsize: all
150*1664436fSMatthias Ringwald	msp430-size *.o
151*1664436fSMatthias Ringwald	msp430-size *.out
152*1664436fSMatthias Ringwald
153*1664436fSMatthias Ringwald%.flash: %.hex
154*1664436fSMatthias Ringwald	mspdebug tilib --force-reset "prog $^"
155*1664436fSMatthias Ringwald
156