mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-18 19:01:47 +03:00
a1637e9216
* fbt: minimal USB flash mode; scripts: faster storage.py with larger chunks * fbt: fixed creation of temporary file nodes confusing scons * docs: removed refs to --with-updater * fbt: removed splashscreen from minimal update package * fbt: renamed dist arguments for consistency * docs: fixed updater_debug target * fbt: separate target for generating compilation_database.json without building the code. * fbt: added `jflash` target for programming over JLink probe; refactored usb flashing targets * fbt: building updater_app in unit_tests configuration * fbt: fixed reset behavior after flashing with J-Link * fbt: generating .map file for firmware binary & external apps * fbt/core: moved library contents before apps code Co-authored-by: あく <alleteam@gmail.com>
77 lines
2.1 KiB
Python
77 lines
2.1 KiB
Python
from SCons.Builder import Builder
|
|
from SCons.Action import Action
|
|
from SCons.Warnings import warn, WarningOnByDefault
|
|
import SCons
|
|
import os.path
|
|
|
|
from fbt.appmanifest import (
|
|
FlipperAppType,
|
|
AppManager,
|
|
ApplicationsCGenerator,
|
|
FlipperManifestException,
|
|
)
|
|
|
|
# Adding objects for application management to env
|
|
# AppManager env["APPMGR"] - loads all manifests; manages list of known apps
|
|
# AppBuildset env["APPBUILD"] - contains subset of apps, filtered for current config
|
|
|
|
|
|
def LoadApplicationManifests(env):
|
|
appmgr = env["APPMGR"] = AppManager()
|
|
for entry in env.Glob("#/applications/*", ondisk=True, source=True):
|
|
if isinstance(entry, SCons.Node.FS.Dir) and not str(entry).startswith("."):
|
|
try:
|
|
appmgr.load_manifest(
|
|
os.path.join(entry.abspath, "application.fam"), entry.name
|
|
)
|
|
except FlipperManifestException as e:
|
|
warn(WarningOnByDefault, str(e))
|
|
|
|
|
|
def PrepareApplicationsBuild(env):
|
|
env["APPBUILD"] = env["APPMGR"].filter_apps(env["APPS"])
|
|
env["APPBUILD_DUMP"] = env.Action(
|
|
DumpApplicationConfig,
|
|
"\tINFO\t",
|
|
)
|
|
|
|
|
|
def DumpApplicationConfig(target, source, env):
|
|
print(f"Loaded {len(env['APPMGR'].known_apps)} app definitions.")
|
|
print("Firmware modules configuration:")
|
|
for apptype in FlipperAppType:
|
|
app_sublist = env["APPBUILD"].get_apps_of_type(apptype)
|
|
if app_sublist:
|
|
print(
|
|
f"{apptype.value}:\n\t",
|
|
", ".join(app.appid for app in app_sublist),
|
|
)
|
|
|
|
|
|
def build_apps_c(target, source, env):
|
|
target_file_name = target[0].path
|
|
|
|
gen = ApplicationsCGenerator(env["APPBUILD"])
|
|
with open(target_file_name, "w") as file:
|
|
file.write(gen.generate())
|
|
|
|
|
|
def generate(env):
|
|
env.AddMethod(LoadApplicationManifests)
|
|
env.AddMethod(PrepareApplicationsBuild)
|
|
|
|
env.Append(
|
|
BUILDERS={
|
|
"ApplicationsC": Builder(
|
|
action=Action(
|
|
build_apps_c,
|
|
"${APPSCOMSTR}",
|
|
),
|
|
),
|
|
}
|
|
)
|
|
|
|
|
|
def exists(env):
|
|
return True
|