xref: /btstack/port/archive/ez430-rf2560/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.6_BT_Spec_4.1.o
8CC2564B = bluetooth_init_cc2564B_1.6_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
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    hal_board.c	              \
40    hal_compat.c              \
41    hal_cpu.c                 \
42    hal_led.c 				  \
43    hal_tick.c	              \
44    hal_usb.c                 \
45    hci_dump.c		          \
46    main.c 					  \
47    btstack_memory_pool.c        \
48    btstack_run_loop.c		     \
49    btstack_run_loop_embedded.c  \
50    btstack_util.c			          \
51    btstack_tlv.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# spp_and_gatt_counter.hex spp_accel.hex spp_flowcontrol.hex spp_counter.hex
106# sdp_rfcomm_query.hex sdp_general_query.hex
107# gap_inquiry.hex
108
109# compiling ant-test requires special ant init script
110# ant-test.hex
111
112# compile GATT database
113%.h: %.gatt
114	python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
115
116
117led_counter.out: ${CORE_OBJ} ${COMMON_OBJ} ${CC2560B} led_counter.o
118	${CC} $^ ${LDFLAGS} -o $@
119
120ant-test.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} profile.h sdp_server.o ant_cmds.o ${CC2567} ant-test.o
121	${CC} $^ ${LDFLAGS} -o $@
122
123ble_server.out: ${CORE_OBJ} ${COMMON_OBJ} ${BLE_OBJ} ${LCD_OBJ} profile.h ble_server.o
124	${CC} $^ ${LDFLAGS} -o $@
125
126hid_demo.out: ${CORE_OBJ} ${COMMON_OBJ} ${LCD_OBJ} ${SPP_OBJ} ${CC2560B} hid_demo.o
127	${CC} $^ ${LDFLAGS} -o $@
128
129spp_accel.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} spp_accel.o sdp_server.o hal_adc.o
130	${CC} $^ ${LDFLAGS} -o $@
131
132spp_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
133	${CC} $^ ${LDFLAGS} -o $@
134
135spp_counter.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} spp_counter.o sdp_server.o
136	${CC} $^ ${LDFLAGS} -o $@
137
138spp_flowcontrol.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} spp_flowcontrol.o sdp_server.o
139	${CC} $^ ${LDFLAGS} -o $@
140
141gap_inquiry.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${CC2560B} ad_parser.o gap_inquiry.o
142	${CC} $^ ${LDFLAGS} -o $@
143
144sdp_rfcomm_query.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${SDP_CLIENT} ${CC2560B} sdp_rfcomm_query.o
145	${CC} $^ ${LDFLAGS} -o $@
146
147sdp_general_query.out: ${CORE_OBJ} ${COMMON_OBJ} ${SPP_OBJ} ${SDP_CLIENT} ${CC2560B} sdp_general_query.o
148	${CC} $^ ${LDFLAGS} -o $@
149
150clean:
151	rm -f $ *.o *.out *.hex profile.h spp_and_gatt_counter.h bluetooth*.c BLE*.c *.bts
152
153size: all
154	msp430-size *.o
155	msp430-size *.out
156