SConscript 7.3 KB

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