xref: /nrf52832-nimble/packages/NimBLE-latest/SConscript (revision 042d53a763ad75cb1465103098bb88c245d95138)
1from building import *
2import rtconfig
3
4cwd = GetCurrentDir()
5path = [cwd]
6src = []
7
8path += [
9    cwd + '/nimble/include',
10    cwd + '/nimble/host/include',
11    cwd + '/nimble/host/src',
12    cwd + '/nimble/host/services/ans/include',
13    cwd + '/nimble/host/services/bas/include',
14    cwd + '/nimble/host/services/bleuart/include',
15    cwd + '/nimble/host/services/gap/include',
16    cwd + '/nimble/host/services/gatt/include',
17    cwd + '/nimble/host/services/ias/include',
18    cwd + '/nimble/host/services/lls/include',
19    cwd + '/nimble/host/services/tps/include',
20    cwd + '/nimble/host/store/ram/include',
21    cwd + '/nimble/host/util/include',
22    cwd + '/porting/nimble/include',
23    cwd + '/porting/npl/rtthread/include']
24
25# Host stack
26src += Split('''
27    nimble/host/src/ble_att.c
28    nimble/host/src/ble_att_clt.c
29    nimble/host/src/ble_att_cmd.c
30    nimble/host/src/ble_att_svr.c
31    nimble/host/src/ble_eddystone.c
32    nimble/host/src/ble_gap.c
33    nimble/host/src/ble_gattc.c
34    nimble/host/src/ble_gatts.c
35    nimble/host/src/ble_gatts_lcl.c
36    nimble/host/src/ble_hs_adv.c
37    nimble/host/src/ble_hs_atomic.c
38    nimble/host/src/ble_hs.c
39    nimble/host/src/ble_hs_cfg.c
40    nimble/host/src/ble_hs_conn.c
41    nimble/host/src/ble_hs_dbg.c
42    nimble/host/src/ble_hs_flow.c
43    nimble/host/src/ble_hs_hci.c
44    nimble/host/src/ble_hs_hci_cmd.c
45    nimble/host/src/ble_hs_hci_evt.c
46    nimble/host/src/ble_hs_hci_util.c
47    nimble/host/src/ble_hs_id.c
48    nimble/host/src/ble_hs_log.c
49    nimble/host/src/ble_hs_mbuf.c
50    nimble/host/src/ble_hs_mqueue.c
51    nimble/host/src/ble_hs_misc.c
52    nimble/host/src/ble_hs_pvcy.c
53    nimble/host/src/ble_hs_startup.c
54    nimble/host/src/ble_hs_stop.c
55    nimble/host/src/ble_ibeacon.c
56    nimble/host/src/ble_l2cap.c
57    nimble/host/src/ble_l2cap_coc.c
58    nimble/host/src/ble_l2cap_sig.c
59    nimble/host/src/ble_l2cap_sig_cmd.c
60    nimble/host/src/ble_monitor.c
61    nimble/host/src/ble_sm_alg.c
62    nimble/host/src/ble_sm.c
63    nimble/host/src/ble_sm_cmd.c
64    nimble/host/src/ble_sm_lgcy.c
65    nimble/host/src/ble_sm_sc.c
66    nimble/host/src/ble_store.c
67    nimble/host/src/ble_store_util.c
68    nimble/host/src/ble_uuid.c
69    nimble/host/services/ans/src/ble_svc_ans.c
70    nimble/host/services/bas/src/ble_svc_bas.c
71    nimble/host/services/bleuart/src/ble_svc_uart.c
72    nimble/host/services/gap/src/ble_svc_gap.c
73    nimble/host/services/gatt/src/ble_svc_gatt.c
74    nimble/host/services/ias/src/ble_svc_ias.c
75    nimble/host/services/lls/src/ble_svc_lls.c
76    nimble/host/services/tps/src/ble_svc_tps.c
77    nimble/host/store/ram/src/ble_store_ram.c
78    nimble/host/util/src/addr.c
79    nimble/src/ble_util.c
80    ''')
81
82# Few utils and data structures copied from Mynewt
83src += Split('''
84    porting/nimble/src/nimble_port.c''')
85
86# Few utils and data structures copied from Mynewt
87src += Split('''
88    porting/nimble/src/endian.c
89    porting/nimble/src/mem.c
90    porting/nimble/src/os_mbuf.c
91    porting/nimble/src/os_mempool.c
92    porting/nimble/src/os_msys_init.c
93    porting/npl/rtthread/src/modlog.c
94    porting/npl/rtthread/src/nimble_port_rtthread.c
95    porting/npl/rtthread/src/npl_os_rtthread.c
96    porting/npl/rtthread/src/npl_shell.c
97    ''')
98
99# tinycrypt
100path += [cwd + '/ext/tinycrypt/include']
101
102src += Split('''
103    ext/tinycrypt/src/aes_decrypt.c
104    ext/tinycrypt/src/aes_encrypt.c
105    ext/tinycrypt/src/cmac_mode.c
106    ext/tinycrypt/src/ecc.c
107    ext/tinycrypt/src/ecc_dh.c
108    ext/tinycrypt/src/utils.c
109    ''')
110
111# controller
112if GetDepend(['PKG_NIMBLE_CTLR']):
113    CPPDEFINES = ['NIMBLE_CFG_CONTROLLER=1']
114else:
115    CPPDEFINES = ['']
116
117if GetDepend(['PKG_NIMBLE_CTLR']):
118    path += [
119        cwd + '/nimble/transport/ram/include',
120        cwd + '/nimble/controller/include',
121        cwd + '/nimble/drivers/nrf52/include']
122
123    src += Split("""
124        nimble/transport/ram/src/ble_hci_ram.c
125        nimble/controller/src/ble_ll_sched.c
126        nimble/controller/src/ble_ll_xcvr.c
127        nimble/controller/src/ble_ll_whitelist.c
128        nimble/controller/src/ble_ll_ctrl.c
129        nimble/controller/src/ble_ll_hci.c
130        nimble/controller/src/ble_ll_supp_cmd.c
131        nimble/controller/src/ble_ll_adv.c
132        nimble/controller/src/ble_ll_conn.c
133        nimble/controller/src/ble_ll_resolv.c
134        nimble/controller/src/ble_ll_conn_hci.c
135        nimble/controller/src/ble_ll_rand.c
136        nimble/controller/src/ble_ll.c
137        nimble/controller/src/ble_ll_scan.c
138        nimble/controller/src/ble_ll_dtm.c
139        nimble/controller/src/ble_ll_hci_ev.c
140        nimble/drivers/nrf52/src/ble_hw.c
141        nimble/drivers/nrf52/src/ble_phy.c
142        porting/nimble/src/os_cputime.c
143        porting/nimble/src/os_cputime_pwr2.c
144        porting/nimble/src/hal_timer.c
145        porting/npl/rtthread/src/nrf5x_isr.c
146        """)
147
148# central sample
149if GetDepend(['PKG_NIMBLE_SAMPLE_CENTRAL']):
150    path += [cwd + '/apps/blecent/src']
151
152    src += Split("""
153        apps/blecent/src/blecent.c
154        apps/blecent/src/misc.c
155        apps/blecent/src/peer.c
156        """)
157
158# blecsc sensor
159if GetDepend(['PKG_NIMBLE_SAMPLE_BLECSC']):
160    path += [cwd + '/apps/blecsc/src']
161
162    src += Split("""
163        apps/blecsc/src/blecsc_sens.c
164        apps/blecsc/src/gatt_svr.c
165        """)
166
167
168# peripheral heart-rate sample
169if GetDepend(['PKG_NIMBLE_SAMPLE_PER_HR']):
170    path += [cwd + '/apps/blehr/src']
171
172    src += Split("""
173        apps/blehr/src/blehr.c
174        apps/blehr/src/gatt_svr.c
175        """)
176
177# bleprph sample
178if GetDepend(['PKG_NIMBLE_SAMPLE_PERIPHERAL']):
179    path += [cwd + '/apps/bleprph/src']
180
181    src += Split("""
182        apps/bleprph/src/bleprph.c
183        apps/bleprph/src/gatt_svr.c
184        apps/bleprph/src/misc.c
185        """)
186
187# bletest
188if GetDepend(['PKG_NIMBLE_SAMPLE_BLETEST']):
189    path += [cwd + '/apps/bletest/src']
190
191    src += Split("""
192        apps/bletest/src/bletest_hci.c
193        apps/bletest/src/bletest.c
194        """)
195
196# bleuart
197if GetDepend(['PKG_NIMBLE_SAMPLE_BLEUART']):
198    path += [cwd + '/apps/bleuart/src']
199
200    src += Split("""
201        apps/bleuart/src/bleuart.c
202        """)
203
204# btshell
205if GetDepend(['PKG_NIMBLE_SAMPLE_BTSHELL']):
206    path += [cwd + '/apps/btshell/src']
207
208    src += Split("""
209        apps/btshell/src/btshell.c
210        apps/btshell/src/cmd_gatt.c
211        apps/btshell/src/cmd_l2cap.c
212        apps/btshell/src/cmd.c
213        apps/btshell/src/gatt_svr.c
214        apps/btshell/src/misc.c
215        apps/btshell/src/parse.c
216        """)
217
218# ble external advertiser sample
219if GetDepend(['PKG_NIMBLE_SAMPLE_EXT_ADVERTISER']):
220    path += [cwd + '/apps/ext_advertiser/src']
221
222    src += Split("""
223        apps/ext_advertiser/src/ext_advertiser.c
224        """)
225
226# beacon sample
227if GetDepend(['PKG_NIMBLE_SAMPLE_BEACON']):
228    src += Glob('apps/ibeacon/src/ibeacon.c')
229
230LOCAL_CCFLAGS = ''
231
232if rtconfig.CROSS_TOOL == 'keil':
233    LOCAL_CCFLAGS += ' --gnu --diag_suppress=111'
234
235group = DefineGroup('nimble', src, depend = ['PKG_USING_NIMBLE'], CPPPATH = path, CPPDEFINES = CPPDEFINES, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
236
237Return('group')
238