mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 04:34:43 +04:00
fbt fixes for mfbt pt2 (#1951)
* fbt: split sdk management code * scripts: fixed import handling * fbt: sdk: reformatted paths * scrips: dist: bundling libs as a build artifact * fbt: sdk: better path management * typo fix * fbt: sdk: minor path handling fixes * toolchain: fixed windows toolchain download * fbt: minor refactorin * fbt: moved sdk management code to extapps.scons * fbt: fixed sdk symbols header path; disabled -fstack-usage * fbt: changed pathing for .py scripts * fbt: changed SDK_HEADERS pathing; added libusb to SDK; added icon_i.h to SDK; added hw target to SDK meta * fbt: added libusb headers to SDK * picopass: include cleanup; api: added subghz/registry.h; api: added mbedtls to exported headers * picopass: fixed formatting * fbt: fixed COPRO_ASSETS_SCRIPT * sdk: added basic infrared apis * toolchain: added ufbt to list of legal fbtenv callers; updated error messages * fbt: changed manifest collection & icon processing code * fbt: simpler srcdir lookup * toolchain: path management fixes; fbt: fixes for fap private libs paths * scripts: toolchain: reworked download on Windows * toolchain: v17 * scripts: added colorlog for logging * Github: fix unit tests Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
Import("ENV", "fw_build_meta")
|
||||
|
||||
from SCons.Errors import UserError
|
||||
from SCons.Node import FS
|
||||
import itertools
|
||||
|
||||
from fbt_extra.util import (
|
||||
@@ -14,7 +15,6 @@ env = ENV.Clone(
|
||||
("compilation_db", {"COMPILATIONDB_COMSTR": "\tCDB\t${TARGET}"}),
|
||||
"fwbin",
|
||||
"fbt_apps",
|
||||
"fbt_sdk",
|
||||
],
|
||||
COMPILATIONDB_USE_ABSPATH=False,
|
||||
BUILD_DIR=fw_build_meta["build_dir"],
|
||||
@@ -112,7 +112,9 @@ lib_targets = env.BuildModules(
|
||||
|
||||
|
||||
# Now, env is fully set up with everything to build apps
|
||||
fwenv = env.Clone()
|
||||
fwenv = env.Clone(FW_ARTIFACTS=[])
|
||||
|
||||
fw_artifacts = fwenv["FW_ARTIFACTS"]
|
||||
|
||||
# Set up additional app-specific build flags
|
||||
SConscript("site_scons/firmwareopts.scons", exports={"ENV": fwenv})
|
||||
@@ -130,7 +132,14 @@ if extra_int_apps := GetOption("extra_int_apps"):
|
||||
if fwenv["FAP_EXAMPLES"]:
|
||||
fwenv.Append(APPDIRS=[("applications/examples", False)])
|
||||
|
||||
fwenv.LoadApplicationManifests()
|
||||
for app_dir, _ in env["APPDIRS"]:
|
||||
app_dir_node = env.Dir("#").Dir(app_dir)
|
||||
|
||||
for entry in app_dir_node.glob("*"):
|
||||
if isinstance(entry, FS.Dir) and not str(entry).startswith("."):
|
||||
fwenv.LoadAppManifest(entry)
|
||||
|
||||
|
||||
fwenv.PrepareApplicationsBuild()
|
||||
|
||||
# Build external apps
|
||||
@@ -138,6 +147,7 @@ if env["IS_BASE_FIRMWARE"]:
|
||||
extapps = fwenv["FW_EXTAPPS"] = SConscript(
|
||||
"site_scons/extapps.scons", exports={"ENV": fwenv}
|
||||
)
|
||||
fw_artifacts.append(extapps["sdk_tree"])
|
||||
|
||||
|
||||
# Add preprocessor definitions for current set of apps
|
||||
@@ -220,7 +230,10 @@ Depends(fwelf, lib_targets)
|
||||
AddPostAction(fwelf, fwenv["APPBUILD_DUMP"])
|
||||
AddPostAction(
|
||||
fwelf,
|
||||
Action('${PYTHON3} "${ROOT_DIR}/scripts/fwsize.py" elf ${TARGET}', "Firmware size"),
|
||||
Action(
|
||||
'${PYTHON3} "${BIN_SIZE_SCRIPT}" elf ${TARGET}',
|
||||
"Firmware size",
|
||||
),
|
||||
)
|
||||
|
||||
# Produce extra firmware files
|
||||
@@ -228,7 +241,7 @@ fwhex = fwenv["FW_HEX"] = fwenv.HEXBuilder("${FIRMWARE_BUILD_CFG}")
|
||||
fwbin = fwenv["FW_BIN"] = fwenv.BINBuilder("${FIRMWARE_BUILD_CFG}")
|
||||
AddPostAction(
|
||||
fwbin,
|
||||
Action('@${PYTHON3} "${ROOT_DIR}/scripts/fwsize.py" bin ${TARGET}'),
|
||||
Action('@${PYTHON3} "${BIN_SIZE_SCRIPT}" bin ${TARGET}'),
|
||||
)
|
||||
|
||||
fwdfu = fwenv["FW_DFU"] = fwenv.DFUBuilder("${FIRMWARE_BUILD_CFG}")
|
||||
@@ -238,12 +251,14 @@ fwdump = fwenv.ObjDump("${FIRMWARE_BUILD_CFG}")
|
||||
Alias(fwenv["FIRMWARE_BUILD_CFG"] + "_list", fwdump)
|
||||
|
||||
|
||||
fw_artifacts = fwenv["FW_ARTIFACTS"] = [
|
||||
fwhex,
|
||||
fwbin,
|
||||
fwdfu,
|
||||
fwenv["FW_VERSION_JSON"],
|
||||
]
|
||||
fw_artifacts.extend(
|
||||
[
|
||||
fwhex,
|
||||
fwbin,
|
||||
fwdfu,
|
||||
fwenv["FW_VERSION_JSON"],
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
fwcdb = fwenv.CompilationDatabase()
|
||||
@@ -272,34 +287,5 @@ if should_gen_cdb_and_link_dir(fwenv, BUILD_TARGETS):
|
||||
|
||||
Alias(fwenv["FIRMWARE_BUILD_CFG"] + "_all", fw_artifacts)
|
||||
|
||||
if fwenv["IS_BASE_FIRMWARE"]:
|
||||
sdk_source = fwenv.SDKPrebuilder(
|
||||
"sdk_origin",
|
||||
# Deps on root SDK headers and generated files
|
||||
(fwenv["SDK_HEADERS"], fwenv["FW_ASSETS_HEADERS"]),
|
||||
)
|
||||
# Extra deps on headers included in deeper levels
|
||||
Depends(sdk_source, fwenv.ProcessSdkDepends("sdk_origin.d"))
|
||||
|
||||
fwenv["SDK_DIR"] = fwenv.Dir("sdk")
|
||||
sdk_tree = fwenv.SDKTree(fwenv["SDK_DIR"], "sdk_origin")
|
||||
fw_artifacts.append(sdk_tree)
|
||||
# AlwaysBuild(sdk_tree)
|
||||
Alias("sdk_tree", sdk_tree)
|
||||
|
||||
sdk_apicheck = fwenv.SDKSymUpdater(fwenv["SDK_DEFINITION"], "sdk_origin")
|
||||
Precious(sdk_apicheck)
|
||||
NoClean(sdk_apicheck)
|
||||
AlwaysBuild(sdk_apicheck)
|
||||
Alias("sdk_check", sdk_apicheck)
|
||||
|
||||
sdk_apisyms = fwenv.SDKSymGenerator(
|
||||
"assets/compiled/symbols.h", fwenv["SDK_DEFINITION"]
|
||||
)
|
||||
Alias("api_syms", sdk_apisyms)
|
||||
|
||||
if fwenv["FORCE"]:
|
||||
fwenv.AlwaysBuild(sdk_source, sdk_tree, sdk_apicheck, sdk_apisyms)
|
||||
|
||||
|
||||
Return("fwenv")
|
||||
|
||||
Reference in New Issue
Block a user