fbt: support for LOADER_AUTOSTART; post-build size stats (#1594)
* fbt: restored LOADER_AUTOSTART support * scripts: added fwsize.py wrapper for size command; fbt: changed size post-build stats to fwsize.py call * fbt: removed size wrapper * fbt: added stats for binary flash size in pages * fbt: hint on build options details * scripts: fixed fwsize.py for *nix
This commit is contained in:
@@ -174,6 +174,12 @@ vars.Add(
|
||||
default="update_default",
|
||||
)
|
||||
|
||||
vars.Add(
|
||||
"LOADER_AUTOSTART",
|
||||
help="Application name to automatically run on Flipper boot",
|
||||
default="",
|
||||
)
|
||||
|
||||
|
||||
vars.Add(
|
||||
"FIRMWARE_APPS",
|
||||
|
@@ -200,8 +200,9 @@ class ApplicationsCGenerator:
|
||||
FlipperAppType.STARTUP: ("FlipperOnStartHook", "FLIPPER_ON_SYSTEM_START"),
|
||||
}
|
||||
|
||||
def __init__(self, buildset: AppBuildset):
|
||||
def __init__(self, buildset: AppBuildset, autorun_app: str = ""):
|
||||
self.buildset = buildset
|
||||
self.autorun = autorun_app
|
||||
|
||||
def get_app_ep_forward(self, app: FlipperApplication):
|
||||
if app.apptype == FlipperAppType.STARTUP:
|
||||
@@ -219,7 +220,11 @@ class ApplicationsCGenerator:
|
||||
.flags = {'|'.join(f"FlipperApplicationFlag{flag}" for flag in app.flags)} }}"""
|
||||
|
||||
def generate(self):
|
||||
contents = ['#include "applications.h"', "#include <assets_icons.h>"]
|
||||
contents = [
|
||||
'#include "applications.h"',
|
||||
"#include <assets_icons.h>",
|
||||
f'const char* FLIPPER_AUTORUN_APP_NAME = "{self.autorun}";',
|
||||
]
|
||||
for apptype in self.APP_TYPE_MAP:
|
||||
contents.extend(
|
||||
map(self.get_app_ep_forward, self.buildset.get_apps_of_type(apptype))
|
||||
|
@@ -7,7 +7,6 @@ from SCons.Tool import gnulink
|
||||
import strip
|
||||
import gdb
|
||||
import objdump
|
||||
import size
|
||||
|
||||
from SCons.Action import _subproc
|
||||
import subprocess
|
||||
@@ -38,7 +37,7 @@ def _get_tool_version(env, tool):
|
||||
|
||||
|
||||
def generate(env, **kw):
|
||||
for orig_tool in (asm, gcc, gxx, ar, gnulink, strip, gdb, objdump, size):
|
||||
for orig_tool in (asm, gcc, gxx, ar, gnulink, strip, gdb, objdump):
|
||||
orig_tool.generate(env)
|
||||
env.SetDefault(
|
||||
TOOLCHAIN_PREFIX=kw.get("toolchain_prefix"),
|
||||
@@ -57,7 +56,6 @@ def generate(env, **kw):
|
||||
"GDB",
|
||||
"GDBPY",
|
||||
"OBJDUMP",
|
||||
"SIZE",
|
||||
],
|
||||
)
|
||||
# Call CC to check version
|
||||
|
@@ -51,7 +51,7 @@ def DumpApplicationConfig(target, source, env):
|
||||
def build_apps_c(target, source, env):
|
||||
target_file_name = target[0].path
|
||||
|
||||
gen = ApplicationsCGenerator(env["APPBUILD"])
|
||||
gen = ApplicationsCGenerator(env["APPBUILD"], env.subst("$LOADER_AUTOSTART"))
|
||||
with open(target_file_name, "w") as file:
|
||||
file.write(gen.generate())
|
||||
|
||||
|
@@ -1,24 +0,0 @@
|
||||
from SCons.Builder import Builder
|
||||
from SCons.Action import Action
|
||||
|
||||
|
||||
def generate(env):
|
||||
env.SetDefault(
|
||||
SIZE="size",
|
||||
SIZEFLAGS=[],
|
||||
SIZECOM="$SIZE $SIZEFLAGS $TARGETS",
|
||||
)
|
||||
env.Append(
|
||||
BUILDERS={
|
||||
"ELFSize": Builder(
|
||||
action=Action(
|
||||
"${SIZECOM}",
|
||||
"${SIZECOMSTR}",
|
||||
),
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def exists(env):
|
||||
return True
|
Reference in New Issue
Block a user