SConscript 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. src += Split('''
  23. nimble/host/src/ble_att.c
  24. nimble/host/src/ble_att_clt.c
  25. nimble/host/src/ble_att_cmd.c
  26. nimble/host/src/ble_att_svr.c
  27. nimble/host/src/ble_eddystone.c
  28. nimble/host/src/ble_gap.c
  29. nimble/host/src/ble_gattc.c
  30. nimble/host/src/ble_gatts.c
  31. nimble/host/src/ble_gatts_lcl.c
  32. nimble/host/src/ble_hs_adv.c
  33. nimble/host/src/ble_hs_atomic.c
  34. nimble/host/src/ble_hs.c
  35. nimble/host/src/ble_hs_cfg.c
  36. nimble/host/src/ble_hs_conn.c
  37. nimble/host/src/ble_hs_dbg.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_pvcy.c
  49. nimble/host/src/ble_hs_startup.c
  50. nimble/host/src/ble_hs_stop.c
  51. nimble/host/src/ble_ibeacon.c
  52. nimble/host/src/ble_l2cap.c
  53. nimble/host/src/ble_l2cap_coc.c
  54. nimble/host/src/ble_l2cap_sig.c
  55. nimble/host/src/ble_l2cap_sig_cmd.c
  56. nimble/host/src/ble_monitor.c
  57. nimble/host/src/ble_sm_alg.c
  58. nimble/host/src/ble_sm.c
  59. nimble/host/src/ble_sm_cmd.c
  60. nimble/host/src/ble_sm_lgcy.c
  61. nimble/host/src/ble_sm_sc.c
  62. nimble/host/src/ble_store.c
  63. nimble/host/src/ble_store_util.c
  64. nimble/host/src/ble_uuid.c
  65. nimble/host/services/ans/src/ble_svc_ans.c
  66. nimble/host/services/bas/src/ble_svc_bas.c
  67. nimble/host/services/bleuart/src/ble_svc_uart.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. nimble/src/ble_util.c
  76. ''')
  77. # Few utils and data structures copied from Mynewt
  78. src += Split('''
  79. porting/nimble/src/nimble_port.c''')
  80. # Few utils and data structures copied from Mynewt
  81. src += Split('''
  82. porting/nimble/src/endian.c
  83. porting/nimble/src/mem.c
  84. porting/nimble/src/os_mbuf.c
  85. porting/nimble/src/os_mempool.c
  86. porting/nimble/src/os_msys_init.c
  87. porting/npl/rtthread/src/modlog.c
  88. porting/npl/rtthread/src/nimble_port_rtthread.c
  89. porting/npl/rtthread/src/npl_os_rtthread.c
  90. porting/npl/rtthread/src/npl_shell.c
  91. ''')
  92. if GetDepend(['NIMBLE_BSP_NRF52']):
  93. src += Glob('porting/npl/rtthread/src/nrf5x_isr.c')
  94. # tinycrypt
  95. path += [cwd + '/ext/tinycrypt/include']
  96. src += Split('''
  97. ext/tinycrypt/src/aes_decrypt.c
  98. ext/tinycrypt/src/aes_encrypt.c
  99. ext/tinycrypt/src/cmac_mode.c
  100. ext/tinycrypt/src/ecc.c
  101. ext/tinycrypt/src/ecc_dh.c
  102. ext/tinycrypt/src/utils.c
  103. ''')
  104. # controller
  105. if GetDepend(['NIMBLE_CTLR']):
  106. CPPDEFINES = ['NIMBLE_CFG_CONTROLLER=1']
  107. else:
  108. CPPDEFINES = ['']
  109. if GetDepend(['NIMBLE_CTLR']):
  110. path += [
  111. cwd + '/nimble/transport/ram/include',
  112. cwd + '/nimble/controller/include',
  113. cwd + '/nimble/drivers/nrf52/include']
  114. src += Split("""
  115. nimble/transport/ram/src/ble_hci_ram.c
  116. nimble/controller/src/ble_ll_sched.c
  117. nimble/controller/src/ble_ll_xcvr.c
  118. nimble/controller/src/ble_ll_whitelist.c
  119. nimble/controller/src/ble_ll_ctrl.c
  120. nimble/controller/src/ble_ll_hci.c
  121. nimble/controller/src/ble_ll_supp_cmd.c
  122. nimble/controller/src/ble_ll_adv.c
  123. nimble/controller/src/ble_ll_conn.c
  124. nimble/controller/src/ble_ll_resolv.c
  125. nimble/controller/src/ble_ll_conn_hci.c
  126. nimble/controller/src/ble_ll_rand.c
  127. nimble/controller/src/ble_ll.c
  128. nimble/controller/src/ble_ll_scan.c
  129. nimble/controller/src/ble_ll_dtm.c
  130. nimble/controller/src/ble_ll_hci_ev.c
  131. nimble/drivers/nrf52/src/ble_hw.c
  132. nimble/drivers/nrf52/src/ble_phy.c
  133. porting/nimble/src/os_cputime.c
  134. porting/nimble/src/os_cputime_pwr2.c
  135. porting/nimble/src/hal_timer.c
  136. """)
  137. # central sample
  138. if GetDepend(['NIMBLE_SAMPLE_CENTRAL']):
  139. path += [cwd + '/apps/blecent/src']
  140. src += Split("""
  141. apps/blecent/src/blecent.c
  142. apps/blecent/src/misc.c
  143. apps/blecent/src/peer.c
  144. """)
  145. # blecsc sensor
  146. if GetDepend(['NIMBLE_SAMPLE_BLECSC']):
  147. path += [cwd + '/apps/blecsc/src']
  148. src += Split("""
  149. apps/blecsc/src/blecsc_sens.c
  150. apps/blecsc/src/gatt_svr.c
  151. """)
  152. # peripheral heart-rate sample
  153. if GetDepend(['NIMBLE_SAMPLE_PER_HR']):
  154. path += [cwd + '/apps/blehr/src']
  155. src += Split("""
  156. apps/blehr/src/blehr.c
  157. apps/blehr/src/gatt_svr.c
  158. """)
  159. # bleprph sample
  160. if GetDepend(['NIMBLE_SAMPLE_PERIPHERAL']):
  161. path += [cwd + '/apps/bleprph/src']
  162. src += Split("""
  163. apps/bleprph/src/bleprph.c
  164. apps/bleprph/src/gatt_svr.c
  165. apps/bleprph/src/misc.c
  166. """)
  167. # bletest
  168. if GetDepend(['NIMBLE_SAMPLE_BLETEST']):
  169. path += [cwd + '/apps/bletest/src']
  170. src += Split("""
  171. apps/bletest/src/bletest_hci.c
  172. apps/bletest/src/bletest.c
  173. """)
  174. # bleuart
  175. if GetDepend(['NIMBLE_SAMPLE_BLEUART']):
  176. path += [cwd + '/apps/bleuart/src']
  177. src += Split("""
  178. apps/bleuart/src/bleuart.c
  179. """)
  180. # btshell
  181. if GetDepend(['NIMBLE_SAMPLE_BTSHELL']):
  182. path += [cwd + '/apps/btshell/src']
  183. src += Split("""
  184. apps/btshell/src/btshell.c
  185. apps/btshell/src/cmd_gatt.c
  186. apps/btshell/src/cmd_l2cap.c
  187. apps/btshell/src/cmd.c
  188. apps/btshell/src/gatt_svr.c
  189. apps/btshell/src/misc.c
  190. apps/btshell/src/parse.c
  191. """)
  192. # ble external advertiser sample
  193. if GetDepend(['NIMBLE_SAMPLE_EXT_ADVERTISER']):
  194. path += [cwd + '/apps/ext_advertiser/src']
  195. src += Split("""
  196. apps/ext_advertiser/src/ext_advertiser.c
  197. """)
  198. # beacon sample
  199. if GetDepend(['NIMBLE_SAMPLE_BEACON']):
  200. src += Glob('apps/ibeacon/src/ibeacon.c')
  201. LOCAL_CCFLAGS = ''
  202. if rtconfig.CROSS_TOOL == 'keil':
  203. LOCAL_CCFLAGS += ' --gnu --diag_suppress=111'
  204. group = DefineGroup('nimble', src, depend = ['PKG_USING_NIMBLE'], CPPPATH = path, CPPDEFINES = CPPDEFINES, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
  205. Return('group')