SConscript 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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_hs_adv.c
  32. nimble/host/src/ble_hs_atomic.c
  33. nimble/host/src/ble_hs.c
  34. nimble/host/src/ble_hs_cfg.c
  35. nimble/host/src/ble_hs_conn.c
  36. nimble/host/src/ble_hs_dbg.c
  37. nimble/host/src/ble_hs_flow.c
  38. nimble/host/src/ble_hs_hci.c
  39. nimble/host/src/ble_hs_hci_cmd.c
  40. nimble/host/src/ble_hs_hci_evt.c
  41. nimble/host/src/ble_hs_hci_util.c
  42. nimble/host/src/ble_hs_id.c
  43. nimble/host/src/ble_hs_log.c
  44. nimble/host/src/ble_hs_mbuf.c
  45. nimble/host/src/ble_hs_mqueue.c
  46. nimble/host/src/ble_hs_misc.c
  47. nimble/host/src/ble_hs_pvcy.c
  48. nimble/host/src/ble_hs_startup.c
  49. nimble/host/src/ble_hs_stop.c
  50. nimble/host/src/ble_ibeacon.c
  51. nimble/host/src/ble_l2cap.c
  52. nimble/host/src/ble_l2cap_coc.c
  53. nimble/host/src/ble_l2cap_sig.c
  54. nimble/host/src/ble_l2cap_sig_cmd.c
  55. nimble/host/src/ble_monitor.c
  56. nimble/host/src/ble_sm_alg.c
  57. nimble/host/src/ble_sm.c
  58. nimble/host/src/ble_sm_cmd.c
  59. nimble/host/src/ble_sm_lgcy.c
  60. nimble/host/src/ble_sm_sc.c
  61. nimble/host/src/ble_store.c
  62. nimble/host/src/ble_store_util.c
  63. nimble/host/src/ble_uuid.c
  64. nimble/host/services/ans/src/ble_svc_ans.c
  65. nimble/host/services/bas/src/ble_svc_bas.c
  66. nimble/host/services/gap/src/ble_svc_gap.c
  67. nimble/host/services/gatt/src/ble_svc_gatt.c
  68. nimble/host/services/ias/src/ble_svc_ias.c
  69. nimble/host/services/lls/src/ble_svc_lls.c
  70. nimble/host/services/tps/src/ble_svc_tps.c
  71. nimble/host/store/ram/src/ble_store_ram.c
  72. nimble/host/util/src/addr.c
  73. nimble/src/ble_util.c
  74. ''')
  75. # Few utils and data structures copied from Mynewt
  76. src += Split('''
  77. porting/nimble/src/nimble_port.c''')
  78. # Few utils and data structures copied from Mynewt
  79. src += Split('''
  80. porting/nimble/src/endian.c
  81. porting/nimble/src/mem.c
  82. porting/nimble/src/os_mbuf.c
  83. porting/nimble/src/os_mempool.c
  84. porting/nimble/src/os_msys_init.c
  85. porting/npl/rtthread/src/modlog.c
  86. porting/npl/rtthread/src/nimble_port_rtthread.c
  87. porting/npl/rtthread/src/npl_os_rtthread.c
  88. ''')
  89. if GetDepend(['NIMBLE_BSP_NRF52']):
  90. src += Glob('porting/npl/rtthread/src/nrf5x_isr.c')
  91. # tinycrypt
  92. path += [cwd + '/ext/tinycrypt/include']
  93. src += Split('''
  94. ext/tinycrypt/src/aes_decrypt.c
  95. ext/tinycrypt/src/aes_encrypt.c
  96. ext/tinycrypt/src/cmac_mode.c
  97. ext/tinycrypt/src/ecc.c
  98. ext/tinycrypt/src/ecc_dh.c
  99. ext/tinycrypt/src/utils.c
  100. ''')
  101. # controller
  102. if GetDepend(['NIMBLE_CTLR']):
  103. CPPDEFINES = ['NIMBLE_CFG_CONTROLLER=1']
  104. else:
  105. CPPDEFINES = ['']
  106. if GetDepend(['NIMBLE_CTLR']):
  107. path += [
  108. cwd + '/nimble/transport/ram/include',
  109. cwd + '/nimble/controller/include',
  110. cwd + '/nimble/drivers/nrf52/include']
  111. src += Split("""
  112. nimble/transport/ram/src/ble_hci_ram.c
  113. nimble/controller/src/ble_ll_sched.c
  114. nimble/controller/src/ble_ll_xcvr.c
  115. nimble/controller/src/ble_ll_whitelist.c
  116. nimble/controller/src/ble_ll_ctrl.c
  117. nimble/controller/src/ble_ll_hci.c
  118. nimble/controller/src/ble_ll_supp_cmd.c
  119. nimble/controller/src/ble_ll_adv.c
  120. nimble/controller/src/ble_ll_conn.c
  121. nimble/controller/src/ble_ll_resolv.c
  122. nimble/controller/src/ble_ll_conn_hci.c
  123. nimble/controller/src/ble_ll_rand.c
  124. nimble/controller/src/ble_ll.c
  125. nimble/controller/src/ble_ll_scan.c
  126. nimble/controller/src/ble_ll_dtm.c
  127. nimble/controller/src/ble_ll_hci_ev.c
  128. nimble/drivers/nrf52/src/ble_hw.c
  129. nimble/drivers/nrf52/src/ble_phy.c
  130. porting/nimble/src/os_cputime.c
  131. porting/nimble/src/os_cputime_pwr2.c
  132. porting/nimble/src/hal_timer.c
  133. """)
  134. # peripheral heart-rate sample
  135. if GetDepend(['NIMBLE_SAMPLE_PER_HR']):
  136. path += [cwd + '/apps/blehr/src']
  137. src += Split("""
  138. apps/blehr/src/blehr.c
  139. apps/blehr/src/gatt_svr.c
  140. """)
  141. # beacon sample
  142. if GetDepend(['NIMBLE_SAMPLE_BEACON']):
  143. src += Glob('apps/ibeacon/src/ibeacon.c')
  144. LOCAL_CCFLAGS = ''
  145. if rtconfig.CROSS_TOOL == 'keil':
  146. LOCAL_CCFLAGS += ' --gnu --diag_suppress=111'
  147. group = DefineGroup('nimble', src, depend = ['PKG_USING_NIMBLE'], CPPPATH = path, CPPDEFINES = CPPDEFINES, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
  148. Return('group')