forked from RT-Thread-packages/nimble
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConscript
318 lines (278 loc) · 9.67 KB
/
SConscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
from building import *
import rtconfig
cwd = GetCurrentDir()
path = [cwd]
src = []
path += [
cwd + '/nimble/include',
cwd + '/nimble/host/include',
cwd + '/nimble/host/src',
cwd + '/nimble/host/services/ans/include',
cwd + '/nimble/host/services/bas/include',
cwd + '/nimble/host/services/bleuart/include',
cwd + '/nimble/host/services/gap/include',
cwd + '/nimble/host/services/gatt/include',
cwd + '/nimble/host/services/ias/include',
cwd + '/nimble/host/services/lls/include',
cwd + '/nimble/host/services/tps/include',
cwd + '/nimble/host/store/ram/include',
cwd + '/nimble/host/util/include',
cwd + '/nimble/transport/include',
cwd + '/nimble/transport/common/hci_h4/include',
cwd + '/porting/npl/rtthread/include',
cwd + '/porting/nimble/include']
# Host stack
src += Split('''
nimble/host/src/ble_att.c
nimble/host/src/ble_att_clt.c
nimble/host/src/ble_att_cmd.c
nimble/host/src/ble_att_svr.c
nimble/host/src/ble_eddystone.c
nimble/host/src/ble_gap.c
nimble/host/src/ble_gattc.c
nimble/host/src/ble_gatts.c
nimble/host/src/ble_gatts_lcl.c
nimble/host/src/ble_hs_adv.c
nimble/host/src/ble_hs_atomic.c
nimble/host/src/ble_hs.c
nimble/host/src/ble_hs_cfg.c
nimble/host/src/ble_hs_conn.c
nimble/host/src/ble_hs_flow.c
nimble/host/src/ble_hs_hci.c
nimble/host/src/ble_hs_hci_cmd.c
nimble/host/src/ble_hs_hci_evt.c
nimble/host/src/ble_hs_hci_util.c
nimble/host/src/ble_hs_id.c
nimble/host/src/ble_hs_log.c
nimble/host/src/ble_hs_mbuf.c
nimble/host/src/ble_hs_mqueue.c
nimble/host/src/ble_hs_misc.c
nimble/host/src/ble_hs_periodic_sync.c
nimble/host/src/ble_hs_pvcy.c
nimble/host/src/ble_hs_startup.c
nimble/host/src/ble_hs_stop.c
nimble/host/src/ble_ibeacon.c
nimble/host/src/ble_l2cap.c
nimble/host/src/ble_l2cap_coc.c
nimble/host/src/ble_l2cap_sig.c
nimble/host/src/ble_l2cap_sig_cmd.c
nimble/host/src/ble_sm_alg.c
nimble/host/src/ble_sm.c
nimble/host/src/ble_sm_cmd.c
nimble/host/src/ble_sm_lgcy.c
nimble/host/src/ble_sm_sc.c
nimble/host/src/ble_store.c
nimble/host/src/ble_store_util.c
nimble/host/src/ble_uuid.c
nimble/host/services/ans/src/ble_svc_ans.c
nimble/host/services/bas/src/ble_svc_bas.c
nimble/host/services/gap/src/ble_svc_gap.c
nimble/host/services/gatt/src/ble_svc_gatt.c
nimble/host/services/ias/src/ble_svc_ias.c
nimble/host/services/lls/src/ble_svc_lls.c
nimble/host/services/tps/src/ble_svc_tps.c
nimble/host/store/ram/src/ble_store_ram.c
nimble/host/util/src/addr.c
''')
# HCI transport
src += Split('''
nimble/transport/src/monitor.c
nimble/transport/src/transport.c
nimble/transport/common/hci_h4/src/hci_h4.c
''')
if GetDepend(['PKG_NIMBLE_HCI_USING_RTT_UART']):
src += Split("""
nimble/transport/rtthread/src/ble_hci_rtthread_uart.c
""")
# mesh
if GetDepend(['PKG_NIMBLE_MESH']):
path += [cwd + '/nimble/host/mesh/include']
src += Split('''
nimble/host/mesh/src/access.c
nimble/host/mesh/src/adv_ext.c
nimble/host/mesh/src/adv_legacy.c
nimble/host/mesh/src/adv.c
nimble/host/mesh/src/aes-ccm.c
nimble/host/mesh/src/app_keys.c
nimble/host/mesh/src/beacon.c
nimble/host/mesh/src/cdb.c
nimble/host/mesh/src/cfg_cli.c
nimble/host/mesh/src/cfg_srv.c
nimble/host/mesh/src/cfg.c
nimble/host/mesh/src/crypto.c
nimble/host/mesh/src/friend.c
nimble/host/mesh/src/glue.c
nimble/host/mesh/src/health_cli.c
nimble/host/mesh/src/health_srv.c
nimble/host/mesh/src/heartbeat.c
nimble/host/mesh/src/light_model.c
nimble/host/mesh/src/lpn.c
nimble/host/mesh/src/mesh.c
nimble/host/mesh/src/model_cli.c
nimble/host/mesh/src/model_srv.c
nimble/host/mesh/src/msg.c
nimble/host/mesh/src/net.c
nimble/host/mesh/src/pb_adv.c
nimble/host/mesh/src/pb_gatt_srv.c
nimble/host/mesh/src/pb_gatt.c
nimble/host/mesh/src/prov_device.c
nimble/host/mesh/src/prov.c
nimble/host/mesh/src/provisioner.c
nimble/host/mesh/src/proxy_msg.c
nimble/host/mesh/src/proxy_srv.c
nimble/host/mesh/src/rpl.c
nimble/host/mesh/src/settings.c
nimble/host/mesh/src/shell.c
nimble/host/mesh/src/subnet.c
nimble/host/mesh/src/transport.c
''')
# Few utils and data structures copied from Mynewt
src += Split('''
porting/nimble/src/nimble_port.c''')
# Few utils and data structures copied from Mynewt
src += Split('''
porting/nimble/src/endian.c
porting/nimble/src/mem.c
porting/nimble/src/os_mbuf.c
porting/nimble/src/os_mempool.c
porting/nimble/src/os_msys_init.c
porting/npl/rtthread/src/nimble_port_rtthread.c
porting/npl/rtthread/src/npl_os_rtthread.c
porting/npl/rtthread/src/npl_shell.c
''')
# tinycrypt
path += [cwd + '/ext/tinycrypt/include']
src += Split('''
ext/tinycrypt/src/aes_decrypt.c
ext/tinycrypt/src/aes_encrypt.c
ext/tinycrypt/src/cmac_mode.c
ext/tinycrypt/src/ecc.c
ext/tinycrypt/src/ecc_dh.c
ext/tinycrypt/src/utils.c
''')
# controller
if GetDepend(['PKG_NIMBLE_CTLR']):
CPPDEFINES = ['NIMBLE_CFG_CONTROLLER=1']
else:
CPPDEFINES = []
if GetDepend(['PKG_NIMBLE_CTLR']):
path += [cwd + '/nimble/controller/include']
if GetDepend(['PKG_NIMBLE_BSP_NRF51']):
path += [cwd + '/nimble/drivers/nrf51/include']
src += Split("""
nimble/drivers/nrf51/src/ble_hw.c
nimble/drivers/nrf51/src/ble_phy.c
""")
else:
path += [cwd + '/nimble/drivers/nrf52/include']
src += Split("""
nimble/drivers/nrf52/src/ble_hw.c
nimble/drivers/nrf52/src/ble_phy.c
""")
src += Split("""
nimble/controller/src/ble_ll_sched.c
nimble/controller/src/ble_ll_whitelist.c
nimble/controller/src/ble_ll_ctrl.c
nimble/controller/src/ble_ll_hci.c
nimble/controller/src/ble_ll_supp_cmd.c
nimble/controller/src/ble_ll_adv.c
nimble/controller/src/ble_ll_conn.c
nimble/controller/src/ble_ll_resolv.c
nimble/controller/src/ble_ll_conn_hci.c
nimble/controller/src/ble_ll_rand.c
nimble/controller/src/ble_ll.c
nimble/controller/src/ble_ll_scan.c
nimble/controller/src/ble_ll_dtm.c
nimble/controller/src/ble_ll_hci_ev.c
nimble/controller/src/ble_ll_hci_vs.c
nimble/controller/src/ble_ll_iso.c
nimble/controller/src/ble_ll_rfmgmt.c
nimble/controller/src/ble_ll_scan_aux.c
nimble/controller/src/ble_ll_sync.c
nimble/controller/src/ble_ll_utils.c
porting/nimble/src/os_cputime.c
porting/nimble/src/os_cputime_pwr2.c
porting/nimble/src/hal_timer.c
porting/npl/rtthread/src/nrf5x_isr.c
""")
# advertiser sample
if GetDepend(['PKG_NIMBLE_SAMPLE_ADVERTISER']):
src += Split("""
apps/advertiser/src/advertiser.c
""")
# central sample
if GetDepend(['PKG_NIMBLE_SAMPLE_CENTRAL']):
path += [cwd + '/apps/blecent/src']
src += Split("""
apps/blecent/src/blecent.c
apps/blecent/src/misc.c
apps/blecent/src/peer.c
""")
# blecsc sensor
if GetDepend(['PKG_NIMBLE_SAMPLE_BLECSC']):
path += [cwd + '/apps/blecsc/src']
src += Split("""
apps/blecsc/src/blecsc_sens.c
apps/blecsc/src/gatt_svr.c
""")
# peripheral heart-rate sample
if GetDepend(['PKG_NIMBLE_SAMPLE_PER_HR']):
path += [cwd + '/apps/blehr/src']
src += Split("""
apps/blehr/src/blehr.c
apps/blehr/src/gatt_svr.c
""")
# bleprph sample
if GetDepend(['PKG_NIMBLE_SAMPLE_PERIPHERAL']):
path += [cwd + '/apps/bleprph/src']
src += Split("""
apps/bleprph/src/bleprph.c
apps/bleprph/src/gatt_svr.c
apps/bleprph/src/misc.c
""")
# bletest
if GetDepend(['PKG_NIMBLE_SAMPLE_BLETEST']):
path += [cwd + '/apps/bletest/src']
src += Split("""
apps/bletest/src/bletest_hci.c
apps/bletest/src/bletest.c
""")
# bleuart
if GetDepend(['PKG_NIMBLE_SAMPLE_BLEUART']):
path += [cwd + '/apps/bleuart/src']
src += Split("""
apps/bleuart/src/bleuart.c
nimble/host/services/bleuart/src/bleuart.c
""")
# btshell
if GetDepend(['PKG_NIMBLE_SAMPLE_BTSHELL']):
path += [cwd + '/apps/btshell/src']
src += Split("""
apps/btshell/src/btshell.c
apps/btshell/src/cmd_gatt.c
apps/btshell/src/cmd_l2cap.c
apps/btshell/src/cmd.c
apps/btshell/src/gatt_svr.c
apps/btshell/src/misc.c
apps/btshell/src/parse.c
""")
# ble external advertiser sample
if GetDepend(['PKG_NIMBLE_SAMPLE_EXT_ADVERTISER']):
path += [cwd + '/apps/ext_advertiser/src']
src += Split("""
apps/ext_advertiser/src/ext_advertiser.c
""")
# beacon sample
if GetDepend(['PKG_NIMBLE_SAMPLE_BEACON']):
src += Glob('apps/ibeacon/src/ibeacon.c')
LOCAL_CCFLAGS = ''
if rtconfig.CROSS_TOOL == 'keil':
LOCAL_CCFLAGS += ' --gnu --diag_suppress=111'
# __BYTE_ORDER__ & __ORDER_BIG_ENDIAN__ & __ORDER_LITTLE_ENDIAN__ is not defined in keil, the specific values comes from gcc.
CPPDEFINES.append('__ORDER_LITTLE_ENDIAN__=1234')
CPPDEFINES.append('__ORDER_BIG_ENDIAN__=4321')
CPPDEFINES.append('__BYTE_ORDER__=1234')
if rtconfig.CROSS_TOOL == 'gcc':
LOCAL_CCFLAGS += ' -Wno-format -Wno-unused-variable -Wno-unused-but-set-variable'
group = DefineGroup('nimble', src, depend = ['PKG_USING_NIMBLE'], CPPPATH = path, CPPDEFINES = CPPDEFINES, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
Return('group')