commandline.scons 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. # Commandline options
  2. # To build updater-related targets, you need to set this option
  3. AddOption(
  4. "--with-updater",
  5. dest="fullenv",
  6. action="store_true",
  7. help="Full firmware environment",
  8. )
  9. AddOption(
  10. "--options",
  11. dest="optionfile",
  12. type="string",
  13. nargs=1,
  14. action="store",
  15. default="fbt_options.py",
  16. help="Enviroment option file",
  17. )
  18. AddOption(
  19. "--extra-int-apps",
  20. action="store",
  21. dest="extra_int_apps",
  22. default="",
  23. help="List of applications to add to firmare's built-ins. Also see FIRMWARE_APP_SET and FIRMWARE_APPS",
  24. )
  25. AddOption(
  26. "--extra-ext-apps",
  27. action="store",
  28. dest="extra_ext_apps",
  29. default="",
  30. help="List of applications to forcefully build as standalone .elf",
  31. )
  32. AddOption(
  33. "--proxy-env",
  34. action="store",
  35. dest="proxy_env",
  36. default="",
  37. help="Comma-separated list of additional environment variables to pass to child SCons processes",
  38. )
  39. # Construction environment variables
  40. vars = Variables(GetOption("optionfile"), ARGUMENTS)
  41. vars.AddVariables(
  42. BoolVariable(
  43. "VERBOSE",
  44. help="Print full commands",
  45. default=False,
  46. ),
  47. BoolVariable(
  48. "FORCE",
  49. help="Force target action (for supported targets)",
  50. default=False,
  51. ),
  52. BoolVariable(
  53. "DEBUG",
  54. help="Enable debug build",
  55. default=True,
  56. ),
  57. BoolVariable(
  58. "COMPACT",
  59. help="Optimize for size",
  60. default=False,
  61. ),
  62. EnumVariable(
  63. "TARGET_HW",
  64. help="Hardware target",
  65. default="7",
  66. allowed_values=[
  67. "7",
  68. ],
  69. ),
  70. BoolVariable(
  71. "DEBUG_TOOLS",
  72. help="Enable debug tools to be built",
  73. default=False,
  74. ),
  75. BoolVariable(
  76. "FAP_EXAMPLES",
  77. help="Enable example applications to be built",
  78. default=False,
  79. ),
  80. (
  81. "DIST_SUFFIX",
  82. "Suffix for binaries in build output for dist targets",
  83. "local",
  84. ),
  85. (
  86. "UPDATE_VERSION_STRING",
  87. "Version string for updater package",
  88. "${DIST_SUFFIX}",
  89. ),
  90. (
  91. "COPRO_CUBE_VERSION",
  92. "Cube version",
  93. "",
  94. ),
  95. (
  96. "COPRO_STACK_ADDR",
  97. "Core2 Firmware address",
  98. "0",
  99. ),
  100. (
  101. "COPRO_STACK_BIN",
  102. "Core2 Firmware file name",
  103. "",
  104. ),
  105. (
  106. "COPRO_DISCLAIMER",
  107. "Value to pass to bundling script to confirm dangerous operations",
  108. "",
  109. ),
  110. PathVariable(
  111. "COPRO_OB_DATA",
  112. help="Path to OB reference data",
  113. validator=PathVariable.PathIsFile,
  114. default="",
  115. ),
  116. PathVariable(
  117. "COPRO_STACK_BIN_DIR",
  118. help="Path to ST-provided stacks",
  119. validator=PathVariable.PathIsDir,
  120. default="",
  121. ),
  122. PathVariable(
  123. "COPRO_CUBE_DIR",
  124. help="Path to Cube root",
  125. validator=PathVariable.PathIsDir,
  126. default="",
  127. ),
  128. EnumVariable(
  129. "COPRO_STACK_TYPE",
  130. help="Core2 stack type",
  131. default="ble_light",
  132. allowed_values=[
  133. "ble_full",
  134. "ble_light",
  135. "ble_basic",
  136. ],
  137. ),
  138. PathVariable(
  139. "SVD_FILE",
  140. help="Path to SVD file",
  141. validator=PathVariable.PathAccept,
  142. default="",
  143. ),
  144. PathVariable(
  145. "OTHER_ELF",
  146. help="Path to prebuilt ELF file to debug",
  147. validator=PathVariable.PathAccept,
  148. default="",
  149. ),
  150. (
  151. "FBT_TOOLCHAIN_VERSIONS",
  152. "Whitelisted toolchain versions (leave empty for no check)",
  153. tuple(),
  154. ),
  155. (
  156. "OPENOCD_OPTS",
  157. "Options to pass to OpenOCD",
  158. "",
  159. ),
  160. (
  161. "BLACKMAGIC",
  162. "Blackmagic probe location",
  163. "auto",
  164. ),
  165. (
  166. "OPENOCD_ADAPTER_SERIAL",
  167. "OpenOCD adapter serial number",
  168. "auto",
  169. ),
  170. (
  171. "UPDATE_SPLASH",
  172. "Directory name with slideshow frames to render after installing update package",
  173. "update_default",
  174. ),
  175. (
  176. "LOADER_AUTOSTART",
  177. "Application name to automatically run on Flipper boot",
  178. "",
  179. ),
  180. (
  181. "FIRMWARE_APPS",
  182. "Map of (configuration_name->application_list)",
  183. {
  184. "default": (
  185. # Svc
  186. "basic_services",
  187. # Apps
  188. "main_apps",
  189. "system_apps",
  190. # Settings
  191. "settings_apps",
  192. # Plugins
  193. # "basic_plugins",
  194. # Debug
  195. # "debug_apps",
  196. )
  197. },
  198. ),
  199. (
  200. "FIRMWARE_APP_SET",
  201. "Application set to use from FIRMWARE_APPS",
  202. "default",
  203. ),
  204. (
  205. "APPSRC",
  206. "Application source directory for app to build & upload",
  207. "",
  208. ),
  209. # List of tuples (directory, add_to_global_include_path)
  210. (
  211. "APPDIRS",
  212. "Directories to search for firmware components & external apps",
  213. [
  214. ("applications", False),
  215. ("applications/services", True),
  216. ("applications/main", True),
  217. ("applications/settings", False),
  218. ("applications/system", False),
  219. ("applications/debug", False),
  220. ("applications/plugins", False),
  221. ("applications_user", False),
  222. ],
  223. ),
  224. )
  225. Return("vars")