SConscript 9.3 KB

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