SConscript 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. import os
  2. import rtconfig
  3. from building import *
  4. cwd = GetCurrentDir()
  5. # add file
  6. src = Split('''
  7. src/btstack_util.c
  8. src/btstack_run_loop.c
  9. src/btstack_tlv.c
  10. src/hci_dump.c
  11. src/hci_cmd.c
  12. src/ad_parser.c
  13. src/btstack_linked_list.c
  14. src/btstack_crypto.c
  15. src/hci.c
  16. src/l2cap.c
  17. src/l2cap_signaling.c
  18. src/btstack_memory.c
  19. src/btstack_memory_pool.c
  20. src/ble/att_server.c
  21. src/ble/sm.c
  22. src/ble/att_dispatch.c
  23. src/ble/att_db.c
  24. src/ble/gatt-service/battery_service_server.c
  25. src/ble/gatt-service/device_information_service_server.c
  26. ''')
  27. path = [cwd]
  28. path += [cwd + '/src']
  29. path += [cwd + '/src/ble/gatt-service']
  30. # Adapt for HM package
  31. if not GetDepend(['PKG_BTSTACK_USING_HM']):
  32. src += Split("""
  33. platform/posix/btstack_stdin_posix.c
  34. platform/posix/btstack_uart_block_posix.c
  35. platform/posix/btstack_tlv_posix.c
  36. platform/posix/btstack_run_loop_posix.c
  37. src/hci_transport_h4.c
  38. src/classic/btstack_link_key_db_tlv.c
  39. src/ble/le_device_db_tlv.c
  40. port/posix-h4-bcm/btstack_main.c
  41. rtt_adapter/rtt_btstack_adapter.c
  42. chipset/bcm/btstack_chipset_bcm.c
  43. chipset/bcm/btstack_chipset_bcm_download_firmware.c
  44. """)
  45. path += [cwd + '/platform/posix']
  46. path += [cwd + '/chipset/bcm']
  47. path += [cwd + '/port/posix-h4-bcm']
  48. path += [cwd + '/rtt_adapter']
  49. if GetDepend(['PKG_BTSTACK_USING_HM']):
  50. src += Split("""
  51. platform/rtthread/btstack_run_loop_rtthread.c
  52. platform/rtthread/hci_dump_rtthread_stdout.c
  53. src/ble/le_device_db_memory.c
  54. 3rd-party/micro-ecc/uECC.c
  55. """)
  56. path += [cwd + '/platform/rtthread']
  57. path += [cwd + '/3rd-party/micro-ecc']
  58. #CLASS
  59. if GetDepend(['ENABLE_CLASSIC']):
  60. path += [cwd + '/src/class']
  61. src += Split("""
  62. src/classic/sdp_util.c
  63. src/classic/gatt_sdp.c
  64. src/classic/spp_server.c
  65. src/classic/rfcomm.c
  66. src/classic/bnep.c
  67. src/classic/sdp_server.c
  68. src/classic/device_id_server.c
  69. """)
  70. if GetDepend(['PKG_BTSTACK_SDP_CLIENT']):
  71. src += Split("""
  72. src/classic/sdp_client.c
  73. src/classic/sdp_client_rfcomm.c
  74. """)
  75. #encode decode
  76. if GetDepend(['PKG_BTSTACK_AUDIO']):
  77. src += Split("""
  78. src/btstack_audio.c
  79. """)
  80. if GetDepend(['PKG_BTSTACK_SBC_ENC']):
  81. path += [cwd + '/3rd-party/bluedroid/encoder/include']
  82. src += Split("""
  83. 3rd-party/bluedroid/encoder/srce/sbc_analysis.c
  84. 3rd-party/bluedroid/encoder/srce/sbc_dct.c
  85. 3rd-party/bluedroid/encoder/srce/sbc_dct_coeffs.c
  86. 3rd-party/bluedroid/encoder/srce/sbc_enc_bit_alloc_mono.c
  87. 3rd-party/bluedroid/encoder/srce/sbc_enc_bit_alloc_ste.c
  88. 3rd-party/bluedroid/encoder/srce/sbc_enc_coeffs.c
  89. 3rd-party/bluedroid/encoder/srce/sbc_encoder.c
  90. 3rd-party/bluedroid/encoder/srce/sbc_packing.c
  91. src/classic/btstack_sbc_encoder_bluedroid.c
  92. src/classic/hfp_msbc.c
  93. """)
  94. if GetDepend(['PKG_BTSTACK_SBC_DEC']):
  95. path += [cwd + '/3rd-party/bluedroid/decoder/include']
  96. src += Split("""
  97. 3rd-party/bluedroid/decoder/srce/alloc.c
  98. 3rd-party/bluedroid/decoder/srce/bitalloc.c
  99. 3rd-party/bluedroid/decoder/srce/bitalloc-sbc.c
  100. 3rd-party/bluedroid/decoder/srce/bitstream-decode.c
  101. 3rd-party/bluedroid/decoder/srce/decoder-oina.c
  102. 3rd-party/bluedroid/decoder/srce/decoder-private.c
  103. 3rd-party/bluedroid/decoder/srce/decoder-sbc.c
  104. 3rd-party/bluedroid/decoder/srce/dequant.c
  105. 3rd-party/bluedroid/decoder/srce/framing.c
  106. 3rd-party/bluedroid/decoder/srce/framing-sbc.c
  107. 3rd-party/bluedroid/decoder/srce/oi_codec_version.c
  108. 3rd-party/bluedroid/decoder/srce/synthesis-sbc.c
  109. 3rd-party/bluedroid/decoder/srce/synthesis-dct8.c
  110. 3rd-party/bluedroid/decoder/srce/synthesis-8-generated.c
  111. src/classic/btstack_sbc_plc.c
  112. src/classic/btstack_sbc_decoder_bluedroid.c
  113. """)
  114. #CVSD
  115. if GetDepend(['PKG_BTSTACK_CVSD']):
  116. src += Split("""
  117. src/classic/btstack_cvsd_plc.c
  118. """)
  119. #MESH
  120. if GetDepend(['ENABLE_MESH']):
  121. path += [cwd + '/src/mesh']
  122. src += Split("""
  123. src/mesh/adv_bearer.c
  124. src/mesh/mesh_access.c
  125. src/mesh/beacon.c
  126. src/mesh/gatt_bearer.c
  127. src/mesh/mesh.c
  128. src/mesh/mesh_crypto.c
  129. src/mesh/mesh_configuration_client.c
  130. src/mesh/mesh_configuration_server.c
  131. src/mesh/mesh_foundation.c
  132. src/mesh/mesh_generic_default_transition_time_client.c
  133. src/mesh/mesh_generic_default_transition_time_server.c
  134. src/mesh/mesh_generic_level_client.c
  135. src/mesh/mesh_generic_level_server.c
  136. src/mesh/mesh_generic_on_off_client.c
  137. src/mesh/mesh_generic_on_off_server.c
  138. src/mesh/mesh_health_server.c
  139. src/mesh/mesh_iv_index_seq_number.c
  140. src/mesh/mesh_keys.c
  141. src/mesh/mesh_lower_transport.c
  142. src/mesh/mesh_network.c
  143. src/mesh/mesh_peer.c
  144. src/mesh/mesh_proxy.c
  145. src/mesh/mesh_node.c
  146. src/mesh/mesh_upper_transport.c
  147. src/mesh/mesh_virtual_addresses.c
  148. src/mesh/pb_adv.c
  149. src/mesh/pb_gatt.c
  150. src/mesh/provisioning.c
  151. src/mesh/provisioning_device.c
  152. src/mesh/provisioning_provisioner.c
  153. src/ble/gatt-service/mesh_provisioning_service_server.c
  154. src/ble/gatt-service/mesh_proxy_service_server.c
  155. """)
  156. #example
  157. #===================ble service==============
  158. if GetDepend('PKG_BTSTACK_SAMPLE_DISABLE') == False:
  159. path += [cwd + '/example/inc']
  160. if GetDepend(['PKG_BTSTACK_SAMPLE_LE_COUNTER']):
  161. example_src = Split("""
  162. example/gatt_counter.c
  163. """)
  164. if GetDepend(['PKG_BTSTACK_SAMPLE_LE_DATA_CHANNEL_SERVER']):
  165. example_src = Split("""
  166. example/le_data_channel_server.c
  167. """)
  168. if GetDepend(['PKG_BTSTACK_SAMPLE_LE_DATA_CHANNEL_SERVER']):
  169. example_src = Split("""
  170. example/le_data_channel_server.c
  171. """)
  172. if GetDepend(['PKG_BTSTACK_SAMPLE_LE_BLUFI_SERVER']):
  173. example_src = Split("""
  174. rtt_adapter/rtt_btstack_gatt_blufi.c
  175. """)
  176. if GetDepend(['PKG_BTSTACK_SAMPLE_LE_STREAMER']):
  177. example_src = Split("""
  178. example/nordic_spp_le_streamer.c
  179. src/ble/gatt-service/nordic_spp_service_server.c
  180. """)
  181. if GetDepend(['PKG_BTSTACK_SAMPLE_NORDIC_LE_COUNTER']):
  182. example_src = Split("""
  183. example/nordic_spp_le_counter.c
  184. src/ble/gatt-service/nordic_spp_service_server.c
  185. """)
  186. if GetDepend(['PKG_BTSTACK_SAMPLE_UBLOX_LE_COUNTER']):
  187. example_src = Split("""
  188. example/ublox_spp_le_counter.c
  189. src/ble/gatt-service/device_information_service_server
  190. src/ble/gatt-service/ublox_spp_service_server.c
  191. """)
  192. if GetDepend(['PKG_BTSTACK_SAMPLE_ATT_DELAYED_RESPONSE']):
  193. example_src = Split("""
  194. example/att_delayed_response.c
  195. """)
  196. if GetDepend(['PKG_BTSTACK_SAMPLE_SM_PAIRING_PERIPHERAL']):
  197. example_src = Split("""
  198. example/sm_pairing_peripheral.c
  199. """)
  200. if GetDepend(['PKG_BTSTACK_SAMPLE_GATT_STREAMER_PERIPHERAL']):
  201. example_src = Split("""
  202. example/gatt_streamer_server.c
  203. """)
  204. if GetDepend(['PKG_BTSTACK_SAMPLE_ANCS_CLIENT_DEMO']):
  205. example_src = Split("""
  206. example/ancs_client_demo.c
  207. src/ble/ancs_client.c
  208. src/ble/gatt_client.c
  209. """)
  210. #==============hogp ble service=============
  211. if GetDepend(['PKG_BTSTACK_SAMPLE_HOGP_KEYBOARD_DEMO']):
  212. example_src = Split("""
  213. example/hog_keyboard_demo.c
  214. src/ble/gatt-service/hids_device.c
  215. src/btstack_ring_buffer.c
  216. """)
  217. if GetDepend(['PKG_BTSTACK_SAMPLE_HOGP_MOUSER_DEMO']):
  218. example_src = Split("""
  219. example/hog_mouse_demo.c
  220. src/ble/gatt-service/hids_device.c
  221. """)
  222. #===========mesh=========================
  223. if GetDepend(['PKG_BTSTACK_SAMPLE_MESH_DEMO']):
  224. example_src = Split("""
  225. example/mesh_node_demo.c
  226. """)
  227. if GetDepend(['PKG_BTSTACK_SAMPLE_TMALL_MESH_DEMO']):
  228. example_src = Split("""
  229. rtt_adapter/mesh_node_demo_tmall.c
  230. """)
  231. #======dual mode==============
  232. if GetDepend(['PKG_BTSTACK_SAMPLE_SPP_GATT_COUNTER_DEMO']):
  233. example_src = Split("""
  234. src/ble/gatt-service/device_information_service_server.c
  235. src/ble/gatt-service/nordic_spp_service_server.c
  236. example/spp_and_gatt_counter.c
  237. """)
  238. if GetDepend(['PKG_BTSTACK_SAMPLE_SPP_GATT_STREAMER_DEMO']):
  239. example_src = Split("""
  240. src/ble/gatt-service/nordic_spp_service_server.c
  241. example/nordic_spp_le_streamer.c
  242. """)
  243. #================CLASSIC SPP==========
  244. if GetDepend(['PKG_BTSTACK_SAMPLE_SPP_COUNTER_DEMO']):
  245. example_src = Split("""
  246. example/spp_counter.c
  247. """)
  248. if GetDepend(['PKG_BTSTACK_SAMPLE_SPP_STREAMER_DEMO']):
  249. example_src = Split("""
  250. example/spp_streamer.c
  251. """)
  252. #================CLASSIC HFP==========
  253. if GetDepend(['PKG_BTSTACK_SAMPLE_HFP_HF_DEMO']):
  254. example_src = Split("""
  255. platform/posix/wav_util.c
  256. example/sco_demo_util.c
  257. src/btstack_ring_buffer.c
  258. src/classic/hfp.c
  259. src/classic/hfp_hf.c
  260. example/hfp_hf_demo.c
  261. """)
  262. if GetDepend(['PKG_BTSTACK_SAMPLE_HFP_AG_DEMO']):
  263. example_src = Split("""
  264. platform/posix/wav_util.c
  265. example/sco_demo_util.c
  266. src/btstack_ring_buffer.c
  267. src/classic/hfp.c
  268. src/classic/hfp_gsm_model.c
  269. src/classic/hfp_ag.c
  270. example/hfp_ag_demo.c
  271. """)
  272. if GetDepend(['PKG_BTSTACK_SAMPLE_HSP_HS_DEMO']):
  273. example_src = Split("""
  274. platform/posix/wav_util.c
  275. example/sco_demo_util.c
  276. src/btstack_ring_buffer.c
  277. src/classic/hsp_hs.c
  278. example/hsp_hs_demo.c
  279. """)
  280. if GetDepend(['PKG_BTSTACK_SAMPLE_HSP_AG_DEMO']):
  281. example_src = Split("""
  282. platform/posix/wav_util.c
  283. example/sco_demo_util.c
  284. src/btstack_ring_buffer.c
  285. src/classic/hsp_ag.c
  286. example/hsp_ag_demo.c
  287. """)
  288. LOCAL_CCFLAGS = ''
  289. if rtconfig.CROSS_TOOL == 'keil':
  290. LOCAL_CCFLAGS += ' --gnu'
  291. group = DefineGroup('RTT_BTSTACK', src, depend = [''], CPPPATH = path, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
  292. if GetDepend('PKG_BTSTACK_SAMPLE_DISABLE') == False:
  293. group = group + DefineGroup('btstack_example', example_src, depend = [''], CPPPATH = path)
  294. Return('group')