fbt: 'target' field for apps; lib debugging support (#1995)
* fbt: added 'target' field to application manifest * fbt: earlier pagination setup for gdb * fbt: added LIB_DEBUG flag * fbt: sdk: added SDK_MAP_FILE_SUBST
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
from SCons.Builder import Builder
|
||||
from SCons.Action import Action
|
||||
from SCons.Warnings import warn, WarningOnByDefault
|
||||
import SCons
|
||||
from ansi.color import fg
|
||||
|
||||
from fbt.appmanifest import (
|
||||
@@ -33,14 +32,12 @@ def LoadAppManifest(env, entry):
|
||||
|
||||
|
||||
def PrepareApplicationsBuild(env):
|
||||
appbuild = env["APPBUILD"] = env["APPMGR"].filter_apps(env["APPS"])
|
||||
appbuild = env["APPBUILD"] = env["APPMGR"].filter_apps(
|
||||
env["APPS"], env.subst("f${TARGET_HW}")
|
||||
)
|
||||
env.Append(
|
||||
SDK_HEADERS=appbuild.get_sdk_headers(),
|
||||
)
|
||||
env["APPBUILD_DUMP"] = env.Action(
|
||||
DumpApplicationConfig,
|
||||
"\tINFO\t",
|
||||
)
|
||||
|
||||
|
||||
def DumpApplicationConfig(target, source, env):
|
||||
@@ -68,6 +65,10 @@ def generate(env):
|
||||
env.AddMethod(PrepareApplicationsBuild)
|
||||
env.SetDefault(
|
||||
APPMGR=AppManager(),
|
||||
APPBUILD_DUMP=env.Action(
|
||||
DumpApplicationConfig,
|
||||
"\tINFO\t",
|
||||
),
|
||||
)
|
||||
|
||||
env.Append(
|
||||
|
@@ -41,12 +41,12 @@ def generate(env, **kw):
|
||||
"|openocd -c 'gdb_port pipe; log_output ${FBT_DEBUG_DIR}/openocd.log' ${[SINGLEQUOTEFUNC(OPENOCD_OPTS)]}"
|
||||
],
|
||||
GDBOPTS_BASE=[
|
||||
"-ex",
|
||||
"set pagination off",
|
||||
"-ex",
|
||||
"target extended-remote ${GDBREMOTE}",
|
||||
"-ex",
|
||||
"set confirm off",
|
||||
"-ex",
|
||||
"set pagination off",
|
||||
],
|
||||
GDBOPTS_BLACKMAGIC=[
|
||||
"-ex",
|
||||
|
@@ -14,6 +14,7 @@ import json
|
||||
|
||||
from fbt.sdk.collector import SdkCollector
|
||||
from fbt.sdk.cache import SdkCache
|
||||
from fbt.util import path_as_posix
|
||||
|
||||
|
||||
def ProcessSdkDepends(env, filename):
|
||||
@@ -52,6 +53,8 @@ def prebuild_sdk_create_origin_file(target, source, env):
|
||||
|
||||
|
||||
class SdkMeta:
|
||||
MAP_FILE_SUBST = "SDK_MAP_FILE_SUBST"
|
||||
|
||||
def __init__(self, env, tree_builder: "SdkTreeBuilder"):
|
||||
self.env = env
|
||||
self.treebuilder = tree_builder
|
||||
@@ -67,6 +70,7 @@ class SdkMeta:
|
||||
"linker_libs": self.env.subst("${LIBS}"),
|
||||
"app_ep_subst": self.env.subst("${APP_ENTRY}"),
|
||||
"sdk_path_subst": self.env.subst("${SDK_DIR_SUBST}"),
|
||||
"map_file_subst": self.MAP_FILE_SUBST,
|
||||
"hardware": self.env.subst("${TARGET_HW}"),
|
||||
}
|
||||
with open(json_manifest_path, "wt") as f:
|
||||
@@ -75,9 +79,9 @@ class SdkMeta:
|
||||
def _wrap_scons_vars(self, vars: str):
|
||||
expanded_vars = self.env.subst(
|
||||
vars,
|
||||
target=Entry("dummy"),
|
||||
target=Entry(self.MAP_FILE_SUBST),
|
||||
)
|
||||
return expanded_vars.replace("\\", "/")
|
||||
return path_as_posix(expanded_vars)
|
||||
|
||||
|
||||
class SdkTreeBuilder:
|
||||
@@ -142,13 +146,15 @@ class SdkTreeBuilder:
|
||||
meta.save_to(self.target[0].path)
|
||||
|
||||
def build_sdk_file_path(self, orig_path: str) -> str:
|
||||
return posixpath.normpath(
|
||||
posixpath.join(
|
||||
self.SDK_DIR_SUBST,
|
||||
self.target_sdk_dir_name,
|
||||
orig_path,
|
||||
return path_as_posix(
|
||||
posixpath.normpath(
|
||||
posixpath.join(
|
||||
self.SDK_DIR_SUBST,
|
||||
self.target_sdk_dir_name,
|
||||
orig_path,
|
||||
)
|
||||
)
|
||||
).replace("\\", "/")
|
||||
)
|
||||
|
||||
def emitter(self, target, source, env):
|
||||
target_folder = target[0]
|
||||
|
Reference in New Issue
Block a user