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