Sconscript 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. Import('RTT_ROOT')
  2. Import('rtconfig')
  3. from building import *
  4. import os
  5. # get current directory
  6. cwd = GetCurrentDir()
  7. if GetDepend(['PKG_USING_NRF5X_SDK']):
  8. if GetDepend('SOC_NRF52840') == True:
  9. source = cwd + r'\templete_project\pca10056\template.*'
  10. elif GetDepend('SOC_NRF52832') == True:
  11. source = cwd + r'\templete_project\pca10040\template.*'
  12. elif GetDepend('SOC_NRF52833') == True:
  13. source = cwd + r'\templete_project\pca10100\template.*'
  14. target = cwd + r'"\..\..\"'
  15. copy_command = 'copy "' + source + r'" "' + target + r'"'
  16. print(copy_command)
  17. os.system(copy_command)
  18. path = []
  19. CPPDEFINES = []
  20. NRF_BLE_SRC = Split('''
  21. ./components/ble/ble_db_discovery/ble_db_discovery.c
  22. ./components/ble/common/ble_advdata.c
  23. ./components/ble/common/ble_srv_common.c
  24. ./components/ble/common/ble_conn_state.c
  25. ./components/ble/nrf_ble_gatt/nrf_ble_gatt.c
  26. ./components/ble/nrf_ble_gq/nrf_ble_gq.c
  27. ./components/ble/nrf_ble_scan/nrf_ble_scan.c
  28. ./components/ble/nrf_ble_qwr/nrf_ble_qwr.c
  29. ./components/ble/ble_link_ctx_manager/ble_link_ctx_manager.c
  30. ./components/ble/ble_advertising/ble_advertising.c
  31. ./rtt_adapter/ble_conn_params_rtt.c
  32. ./integration/nrfx/legacy/nrf_drv_clock.c
  33. ''')
  34. path += [cwd + '/components/ble/ble_db_discovery']
  35. path += [cwd + '/components/ble/common']
  36. path += [cwd + '/components/ble/nrf_ble_gatt']
  37. path += [cwd + '/components/ble/nrf_ble_gq']
  38. path += [cwd + '/components/ble/nrf_ble_scan']
  39. path += [cwd + '/components/ble/nrf_ble_qwr']
  40. path += [cwd + '/components/ble/ble_link_ctx_manager']
  41. path += [cwd + '/components/ble/ble_advertising']
  42. NRF_SOFTDEVICE_SRC = Split('''
  43. ./components/softdevice/common/nrf_sdh.c
  44. ./components/softdevice/common/nrf_sdh_ble.c
  45. ./components/softdevice/common/nrf_sdh_soc.c
  46. ''')
  47. path += [cwd + '/components/softdevice/common']
  48. NRF_LIBRARIES_SRC = Split('''
  49. ./components/libraries/util/app_error.c
  50. ./components/libraries/util/app_error_handler_keil.c
  51. ./components/libraries/util/app_error_weak.c
  52. ./components/libraries/scheduler/app_scheduler.c
  53. ./components/libraries/fifo/app_fifo.c
  54. ./components/libraries/util/app_util_platform.c
  55. ./components/libraries/hardfault/hardfault_implementation.c
  56. ./components/libraries/util/nrf_assert.c
  57. ./components/libraries/atomic/nrf_atomic.c
  58. ./components/libraries/atomic_fifo/nrf_atfifo.c
  59. ./components/libraries/atomic_flags/nrf_atflags.c
  60. ./components/libraries/balloc/nrf_balloc.c
  61. ./components/libraries/memobj/nrf_memobj.c
  62. ./components/libraries/queue/nrf_queue.c
  63. ./components/libraries/ringbuf/nrf_ringbuf.c
  64. ./components/libraries/experimental_section_vars/nrf_section_iter.c
  65. ./components/libraries/sortlist/nrf_sortlist.c
  66. ./components/libraries/strerror/nrf_strerror.c
  67. ./components/libraries/sensorsim/sensorsim.c
  68. ''')
  69. path += [cwd + '/components/libraries/util']
  70. path += [cwd + '/components/libraries/scheduler']
  71. path += [cwd + '/components/libraries/timer']
  72. path += [cwd + '/components/libraries/fifo']
  73. path += [cwd + '/components/libraries/hardfault']
  74. path += [cwd + '/components/libraries/atomic']
  75. path += [cwd + '/components/libraries/atomic_fifo']
  76. path += [cwd + '/components/libraries/atomic_flags']
  77. path += [cwd + '/components/libraries/balloc']
  78. path += [cwd + '/components/libraries/memobj']
  79. path += [cwd + '/components/libraries/queue']
  80. path += [cwd + '/components/libraries/ringbuf']
  81. path += [cwd + '/components/libraries/experimental_section_vars']
  82. path += [cwd + '/components/libraries/sortlist']
  83. path += [cwd + '/components/libraries/strerror']
  84. path += [cwd + '/components/libraries/log']
  85. path += [cwd + '/components/libraries/log/src']
  86. path += [cwd + '/components/libraries/sensorsim']
  87. # ./integration/nrfx/legacy/nrf_drv_clock.c
  88. NRF_NRFX_SRC = Split('''
  89. ''')
  90. path += [cwd + '/components/softdevice/common']
  91. if GetDepend('SOC_NRF52840') == True:
  92. path += [cwd + '/components/softdevice/s140/headers']
  93. path += [cwd + '/components/softdevice/s140/headers/nrf52']
  94. if GetDepend('SOC_NRF52832') == True:
  95. path += [cwd + '/components/softdevice/s132/headers']
  96. path += [cwd + '/components/softdevice/s132/headers/nrf52']
  97. if GetDepend('SOC_NRF52833') == True:
  98. path += [cwd + '/components/softdevice/s140/headers']
  99. path += [cwd + '/components/softdevice/s140/headers/nrf52']
  100. path += [cwd + '/integration/nrfx/legacy']
  101. CPPDEFINES = ['SOFTDEVICE_PRESENT', 'CONFIG_GPIO_AS_PINRESET']
  102. NRF_BLE_SERVICE_SRC = []
  103. if GetDepend('SD_BLE_APP_UART_C') == True:
  104. NRF_BLE_SERVICE_SRC += Split('''
  105. ./rtt_adapter/ble_app_uart_c.c
  106. ''')
  107. NRF_BLE_SERVICE_SRC += Split('''
  108. ./components/ble/ble_services/ble_nus_c/ble_nus_c.c
  109. ''')
  110. path += [cwd + '/components/ble/ble_services/ble_nus_c']
  111. if GetDepend('SD_BLE_APP_BEACON') == True:
  112. NRF_BLE_SERVICE_SRC += Split('''
  113. ./rtt_adapter/ble_app_beacon.c
  114. ''')
  115. if GetDepend('SD_BLE_APP_BLINKY') == True:
  116. NRF_BLE_SERVICE_SRC += Split('''
  117. ./rtt_adapter/ble_app_blinky.c
  118. ''')
  119. NRF_BLE_SERVICE_SRC += Split('''
  120. ./components/ble/ble_services/ble_lbs/ble_lbs.c
  121. ''')
  122. path += [cwd + '/components/ble/ble_services/ble_lbs']
  123. if GetDepend('SD_BLE_APP_UART') == True:
  124. NRF_BLE_SERVICE_SRC += Split('''
  125. ./rtt_adapter/ble_app_uart.c
  126. ''')
  127. NRF_BLE_SERVICE_SRC += Split('''
  128. ./components/ble/ble_services/ble_nus/ble_nus.c
  129. ''')
  130. path += [cwd + '/components/ble/ble_services/ble_nus']
  131. if GetDepend('SD_BLE_APP_HRS') == True:
  132. NRF_BLE_SERVICE_SRC += Split('''
  133. ./rtt_adapter/ble_app_hrs.c
  134. ''')
  135. NRF_BLE_SERVICE_SRC += Split('''
  136. ./components/ble/ble_services/ble_hrs/ble_hrs.c
  137. ''')
  138. path += [cwd + '/components/ble/ble_services/ble_hrs']
  139. NRF_BLE_SERVICE_SRC += Split('''
  140. ./components/ble/ble_services/ble_dis/ble_dis.c
  141. ''')
  142. path += [cwd + '/components/ble/ble_services/ble_dis']
  143. NRF_BLE_SERVICE_SRC += Split('''
  144. ./components/ble/ble_services/ble_bas/ble_bas.c
  145. ''')
  146. path += [cwd + '/components/ble/ble_services/ble_bas']
  147. NRF_BLE_SERVICE_SRC += Split('''
  148. ./components/ble/ble_services/ble_lbs/ble_lbs.c
  149. ''')
  150. path += [cwd + '/components/ble/ble_services/ble_lbs']
  151. if GetDepend('SD_BLE_APP_BAS') == True:
  152. NRF_BLE_SERVICE_SRC += Split('''
  153. ./rtt_adapter/ble_app_bas.c
  154. ''')
  155. NRF_BLE_SERVICE_SRC += Split('''
  156. ./components/ble/ble_services/ble_bas/ble_bas.c
  157. ''')
  158. path += [cwd + '/components/ble/ble_services/ble_bas']
  159. group = DefineGroup('nRF_NRFX', NRF_NRFX_SRC, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
  160. group = DefineGroup('nRF_BLE', NRF_BLE_SRC, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
  161. group = DefineGroup('nRF_BLE_Services', NRF_BLE_SERVICE_SRC, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
  162. group = DefineGroup('nRF_SoftDevice', NRF_SOFTDEVICE_SRC, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
  163. group = DefineGroup('nRF_Libraries', NRF_LIBRARIES_SRC, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
  164. else:
  165. NRF_NRFX_SRC = Split('''
  166. ''')
  167. NRF_BLE_SRC = Split('''
  168. ''')
  169. NRF_BLE_SERVICE_SRC = Split('''
  170. ''')
  171. NRF_SOFTDEVICE_SRC = Split('''
  172. ''')
  173. NRF_LIBRARIES_SRC = Split('''
  174. ''')
  175. group = DefineGroup('nRF_NRFX', NRF_NRFX_SRC, depend = [''])
  176. group = DefineGroup('nRF_BLE', NRF_BLE_SRC, depend = [''])
  177. group = DefineGroup('nRF_BLE_Services', NRF_BLE_SERVICE_SRC, depend = [''])
  178. group = DefineGroup('nRF_SoftDevice', NRF_SOFTDEVICE_SRC, depend = [''])
  179. group = DefineGroup('nRF_Libraries', NRF_LIBRARIES_SRC, depend = [''])
  180. Return('group')