unleashed-firmware/site_scons/commandline.scons

280 lines
6.4 KiB
Text
Raw Permalink Normal View History

# Commandline options
# To build updater-related targets, you need to set this option
AddOption(
"--with-updater",
dest="fullenv",
action="store_true",
help="Full firmware environment",
)
AddOption(
"--options",
dest="optionfile",
type="string",
nargs=1,
action="store",
default="fbt_options.py",
help="Environment option file",
)
AddOption(
"--extra-int-apps",
action="store",
dest="extra_int_apps",
default="",
help="List of applications to add to firmware's built-ins. Also see FIRMWARE_APP_SET and FIRMWARE_APPS",
)
AddOption(
"--extra-define",
action="append",
dest="extra_defines",
default=[],
help="Extra global define that will be passed to C/C++ compiler, can be specified multiple times",
)
AddOption(
"--extra-ext-apps",
action="store",
dest="extra_ext_apps",
default="",
help="List of applications to forcefully build as standalone .elf",
)
AddOption(
"--proxy-env",
action="store",
dest="proxy_env",
default="",
help="Comma-separated list of additional environment variables to pass to child SCons processes",
)
# Construction environment variables
vars = Variables(GetOption("optionfile"), ARGUMENTS)
vars.AddVariables(
BoolVariable(
"VERBOSE",
help="Print full commands",
default=False,
),
BoolVariable(
"FORCE",
help="Force target action (for supported targets)",
default=False,
),
BoolVariable(
"DEBUG",
help="Enable debug build",
default=True,
),
BoolVariable(
"LIB_DEBUG",
help="Enable debug build for libraries",
default=False,
),
BoolVariable(
"COMPACT",
help="Optimize for size",
default=False,
),
EnumVariable(
"TARGET_HW",
help="Hardware target",
default="7",
allowed_values=[
"7",
"18",
],
),
(
"DIST_SUFFIX",
"Suffix for binaries in build output for dist targets",
"local",
),
(
"UPDATE_VERSION_STRING",
"Version string for updater package",
"${DIST_SUFFIX}",
),
(
"FORCE_NO_DIRTY",
"Force disable dirty status of the build",
"",
),
(
"COPRO_CUBE_VERSION",
"Cube version",
"",
),
(
"COPRO_STACK_ADDR",
"Core2 Firmware address",
"0",
),
(
"COPRO_STACK_BIN",
"Core2 Firmware file name",
"",
),
(
"COPRO_DISCLAIMER",
"Value to pass to bundling script to confirm dangerous operations",
"",
),
PathVariable(
"COPRO_OB_DATA",
help="Path to OB reference data",
validator=PathVariable.PathIsFile,
default="",
),
PathVariable(
"COPRO_STACK_BIN_DIR",
help="Path to ST-provided stacks",
validator=PathVariable.PathIsDir,
default="",
),
PathVariable(
"COPRO_CUBE_DIR",
help="Path to Cube root",
validator=PathVariable.PathIsDir,
default="",
),
EnumVariable(
"COPRO_STACK_TYPE",
help="Core2 stack type",
default="ble_light",
allowed_values=[
"ble_full",
"ble_light",
"ble_basic",
],
),
PathVariable(
"SVD_FILE",
help="Path to SVD file",
validator=PathVariable.PathAccept,
default="",
),
PathVariable(
"OTHER_ELF",
help="Path to prebuilt ELF file to debug",
validator=PathVariable.PathAccept,
default="",
),
(
"FBT_TOOLCHAIN_VERSIONS",
"Whitelisted toolchain versions (leave empty for no check)",
tuple(),
),
(
"OPENOCD_OPTS",
"Options to pass to OpenOCD",
"",
),
(
"BLACKMAGIC",
"Blackmagic probe location",
"auto",
),
EnumVariable(
"SWD_TRANSPORT",
help="SWD interface adapter type",
default="auto",
allowed_values=[
"auto",
"cmsis-dap",
"stlink",
"blackmagic_usb",
"blackmagic_wifi",
],
),
(
"SWD_TRANSPORT_SERIAL",
"SWD interface adapter serial number",
"auto",
),
(
"UPDATE_SPLASH",
"Directory name with slideshow frames to render after installing update package",
"update_default",
),
(
"LOADER_AUTOSTART",
"Application name to automatically run on Flipper boot",
"",
),
(
"FIRMWARE_APPS",
"Map of (configuration_name->application_list)",
{
"default": (
# Svc
"basic_services",
# Apps
"main_apps",
"system_apps",
# Settings
"settings_apps",
),
},
),
(
"FIRMWARE_APP_SET",
"Application set to use from FIRMWARE_APPS",
"default",
),
(
"APPSRC",
"Application source directory for app to build & upload",
"",
),
# List of tuples (directory, add_to_global_include_path)
(
"APPDIRS",
"Directories to search for firmware components & external apps",
[
("applications", False),
("applications/services", True),
("applications/main", True),
("applications/settings", False),
("applications/system", False),
("applications/debug", False),
("applications/examples", False),
2023-06-18 13:44:45 +00:00
("applications/drivers", False),
("applications_user", False),
],
),
BoolVariable(
"PVSNOBROWSER",
help="Don't open browser after generating error repots",
default=False,
),
(
"FIRMWARE_ORIGIN",
"Firmware origin. 'Official' if follows upstream's API structure, otherwise fork name. "
" This will also create a C define FW_ORIGIN_<origin> so that "
" app can check what version it is being built for.",
"Official",
),
(
"FLIP_PORT",
"Full port name of Flipper to use, if multiple Flippers are connected",
"auto",
),
Improve vscode clangd experience (#2431) * Improve vscode clangd experience - Resolve and use absolute path for the toolchain. This allows clangd to use compile_commands.json file without running under fbtenv, simplifies setup for vscode clangd extension. As a side effect, a rebuild is needed to update compile_commands.json after moving the source tree. - Add the recommended default settings of the extension to settings.json. * Use build/latest for compile-commands-dir This makes it behave closer to c-cpp-properties. * Reformat crosscc.py This is a PEP-8 violation but black seems to enforce it * Bypass --query-driver This has some security implications as it grants clangd the ability to execute any executables anywhere while trying to probe a compiler based on CDB. However it's very hard to do this the safe and intended way without resorting to config generation due to reason listed in #2431. Besides that we already have workspace trust so what could go wrong? ;) * Add an option for vscode_dist to switch between clangd and cpptools This will install different extensions.json tuned for either clangd or cpptools based on user selection. It will also install c_cpp_properties.json when using cpptools since clangd doesn't use this file. The root .gitignore now also doesn't accidentally ignore everything under the .vscode directory. * Use absolute path for .vscode gitignore Turns out the previously used "relative" paths aren't even valid gitignore patterns and to actually do what it means one needs to use the absolute paths instead. * Handle variable parsing in commandline.scons commandline.scons is the place where all other command line parsing happens. Move LANG_SERVER variable parsing there and add a constraint to make the code more consistent. --------- Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: hedger <hedger@nanode.su>
2023-08-16 01:23:09 +00:00
EnumVariable(
"LANG_SERVER",
help="Language server type for vscode_dist.",
default="cpptools",
allowed_values=[
"cpptools",
"clangd",
],
),
)
Return("vars")