SConscript 9.9 KB

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