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