SConscript 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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_dbg.c
  39. nimble/host/src/ble_hs_flow.c
  40. nimble/host/src/ble_hs_hci.c
  41. nimble/host/src/ble_hs_hci_cmd.c
  42. nimble/host/src/ble_hs_hci_evt.c
  43. nimble/host/src/ble_hs_hci_util.c
  44. nimble/host/src/ble_hs_id.c
  45. nimble/host/src/ble_hs_log.c
  46. nimble/host/src/ble_hs_mbuf.c
  47. nimble/host/src/ble_hs_mqueue.c
  48. nimble/host/src/ble_hs_misc.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/bleuart/src/ble_svc_uart.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. nimble/src/ble_util.c
  77. ''')
  78. # Few utils and data structures copied from Mynewt
  79. src += Split('''
  80. porting/nimble/src/nimble_port.c''')
  81. # Few utils and data structures copied from Mynewt
  82. src += Split('''
  83. porting/nimble/src/endian.c
  84. porting/nimble/src/mem.c
  85. porting/nimble/src/os_mbuf.c
  86. porting/nimble/src/os_mempool.c
  87. porting/nimble/src/os_msys_init.c
  88. porting/npl/rtthread/src/modlog.c
  89. porting/npl/rtthread/src/nimble_port_rtthread.c
  90. porting/npl/rtthread/src/npl_os_rtthread.c
  91. porting/npl/rtthread/src/npl_shell.c
  92. ''')
  93. # tinycrypt
  94. path += [cwd + '/ext/tinycrypt/include']
  95. src += Split('''
  96. ext/tinycrypt/src/aes_decrypt.c
  97. ext/tinycrypt/src/aes_encrypt.c
  98. ext/tinycrypt/src/cmac_mode.c
  99. ext/tinycrypt/src/ecc.c
  100. ext/tinycrypt/src/ecc_dh.c
  101. ext/tinycrypt/src/utils.c
  102. ''')
  103. # controller
  104. if GetDepend(['PKG_NIMBLE_CTLR']):
  105. CPPDEFINES = ['NIMBLE_CFG_CONTROLLER=1']
  106. else:
  107. CPPDEFINES = ['']
  108. if GetDepend(['PKG_NIMBLE_CTLR']):
  109. path += [
  110. cwd + '/nimble/transport/ram/include',
  111. cwd + '/nimble/controller/include']
  112. if GetDepend(['PKG_NIMBLE_BSP_NRF51']):
  113. path += [cwd + '/nimble/drivers/nrf51/include']
  114. src += Split("""
  115. nimble/drivers/nrf51/src/ble_hw.c
  116. nimble/drivers/nrf51/src/ble_phy.c
  117. """)
  118. else:
  119. path += [cwd + '/nimble/drivers/nrf52/include']
  120. src += Split("""
  121. nimble/drivers/nrf52/src/ble_hw.c
  122. nimble/drivers/nrf52/src/ble_phy.c
  123. """)
  124. src += Split("""
  125. nimble/transport/ram/src/ble_hci_ram.c
  126. nimble/controller/src/ble_ll_sched.c
  127. nimble/controller/src/ble_ll_xcvr.c
  128. nimble/controller/src/ble_ll_whitelist.c
  129. nimble/controller/src/ble_ll_ctrl.c
  130. nimble/controller/src/ble_ll_hci.c
  131. nimble/controller/src/ble_ll_supp_cmd.c
  132. nimble/controller/src/ble_ll_adv.c
  133. nimble/controller/src/ble_ll_conn.c
  134. nimble/controller/src/ble_ll_resolv.c
  135. nimble/controller/src/ble_ll_conn_hci.c
  136. nimble/controller/src/ble_ll_rand.c
  137. nimble/controller/src/ble_ll.c
  138. nimble/controller/src/ble_ll_scan.c
  139. nimble/controller/src/ble_ll_dtm.c
  140. nimble/controller/src/ble_ll_hci_ev.c
  141. porting/nimble/src/os_cputime.c
  142. porting/nimble/src/os_cputime_pwr2.c
  143. porting/nimble/src/hal_timer.c
  144. porting/npl/rtthread/src/nrf5x_isr.c
  145. """)
  146. # central sample
  147. if GetDepend(['PKG_NIMBLE_SAMPLE_CENTRAL']):
  148. path += [cwd + '/apps/blecent/src']
  149. src += Split("""
  150. apps/blecent/src/blecent.c
  151. apps/blecent/src/misc.c
  152. apps/blecent/src/peer.c
  153. """)
  154. # blecsc sensor
  155. if GetDepend(['PKG_NIMBLE_SAMPLE_BLECSC']):
  156. path += [cwd + '/apps/blecsc/src']
  157. src += Split("""
  158. apps/blecsc/src/blecsc_sens.c
  159. apps/blecsc/src/gatt_svr.c
  160. """)
  161. # peripheral heart-rate sample
  162. if GetDepend(['PKG_NIMBLE_SAMPLE_PER_HR']):
  163. path += [cwd + '/apps/blehr/src']
  164. src += Split("""
  165. apps/blehr/src/blehr.c
  166. apps/blehr/src/gatt_svr.c
  167. """)
  168. # bleprph sample
  169. if GetDepend(['PKG_NIMBLE_SAMPLE_PERIPHERAL']):
  170. path += [cwd + '/apps/bleprph/src']
  171. src += Split("""
  172. apps/bleprph/src/bleprph.c
  173. apps/bleprph/src/gatt_svr.c
  174. apps/bleprph/src/misc.c
  175. """)
  176. # bletest
  177. if GetDepend(['PKG_NIMBLE_SAMPLE_BLETEST']):
  178. path += [cwd + '/apps/bletest/src']
  179. src += Split("""
  180. apps/bletest/src/bletest_hci.c
  181. apps/bletest/src/bletest.c
  182. """)
  183. # bleuart
  184. if GetDepend(['PKG_NIMBLE_SAMPLE_BLEUART']):
  185. path += [cwd + '/apps/bleuart/src']
  186. src += Split("""
  187. apps/bleuart/src/bleuart.c
  188. """)
  189. # btshell
  190. if GetDepend(['PKG_NIMBLE_SAMPLE_BTSHELL']):
  191. path += [cwd + '/apps/btshell/src']
  192. src += Split("""
  193. apps/btshell/src/btshell.c
  194. apps/btshell/src/cmd_gatt.c
  195. apps/btshell/src/cmd_l2cap.c
  196. apps/btshell/src/cmd.c
  197. apps/btshell/src/gatt_svr.c
  198. apps/btshell/src/misc.c
  199. apps/btshell/src/parse.c
  200. """)
  201. # ble external advertiser sample
  202. if GetDepend(['PKG_NIMBLE_SAMPLE_EXT_ADVERTISER']):
  203. path += [cwd + '/apps/ext_advertiser/src']
  204. src += Split("""
  205. apps/ext_advertiser/src/ext_advertiser.c
  206. """)
  207. # beacon sample
  208. if GetDepend(['PKG_NIMBLE_SAMPLE_BEACON']):
  209. src += Glob('apps/ibeacon/src/ibeacon.c')
  210. LOCAL_CCFLAGS = ''
  211. if rtconfig.CROSS_TOOL == 'keil':
  212. LOCAL_CCFLAGS += ' --gnu --diag_suppress=111'
  213. group = DefineGroup('nimble', src, depend = ['PKG_USING_NIMBLE'], CPPPATH = path, CPPDEFINES = CPPDEFINES, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
  214. Return('group')