fbt: fixes (#1352)

* fbt: added --git-tasks; fixed typos
* fbt: fixed --extra-int-apps handling; scripts: moved storage.py & selfupdate.py to App() framework
* fbt: changed pseudo-builders to PhonyTargets with commands; added link to latest build dir as build/latest
* fbt: Restored old ep git handling
* fbt: dropped git tasks & dirlink.py
* fbt: removed extra quoting in fbt.cmd
* docs: added flash_usb to ReadMe.md

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger
2022-06-30 19:06:12 +03:00
committed by GitHub
parent 8632c77d68
commit b3767d143f
18 changed files with 312 additions and 263 deletions

View File

@@ -51,7 +51,10 @@ def generate(env):
env.Append(
BUILDERS={
"ApplicationsC": Builder(
action=Action(build_apps_c, "${APPSCOMSTR}"),
action=Action(
build_apps_c,
"${APPSCOMSTR}",
),
),
}
)

View File

@@ -46,17 +46,19 @@ def AddFwProject(env, base_env, fw_type, fw_env_key):
],
DIST_DEPENDS=[
project_env["FW_ARTIFACTS"],
project_env["LINK_DIR_CMD"],
],
)
env.Replace(DIST_DIR=get_variant_dirname(env))
return project_env
def AddDebugTarget(env, targetenv, force_flash=True):
pseudo_name = f"debug.{targetenv.subst('$FIRMWARE_BUILD_CFG')}.pseudo"
debug_target = env.GDBPy(
pseudo_name,
targetenv["FW_ELF"],
def AddDebugTarget(env, alias, targetenv, force_flash=True):
debug_target = env.PhonyTarget(
alias,
"$GDBPYCOM",
source=targetenv["FW_ELF"],
GDBPYOPTS='-ex "source debug/FreeRTOS/FreeRTOS.py" '
'-ex "source debug/PyCortexMDebug/PyCortexMDebug.py" '
'-ex "svd_load ${SVD_FILE}" '
@@ -64,28 +66,37 @@ def AddDebugTarget(env, targetenv, force_flash=True):
)
if force_flash:
env.Depends(debug_target, targetenv["FW_FLASH"])
env.Pseudo(pseudo_name)
env.AlwaysBuild(debug_target)
return debug_target
def DistCommand(env, name, source, **kw):
target = f"dist_{name}"
command = env.Command(
target,
source,
'@${PYTHON3} ${ROOT_DIR.abspath}/scripts/sconsdist.py copy -p ${DIST_PROJECTS} -s "${DIST_SUFFIX}" ${DIST_EXTRA}',
**kw,
)
env.Pseudo(target)
env.Alias(name, command)
return command
def generate(env):
env.AddMethod(AddFwProject)
env.AddMethod(AddDebugTarget)
env.AddMethod(DistCommand)
env.SetDefault(
COPRO_MCU_FAMILY="STM32WB5x",
)
env.Append(
BUILDERS={
"DistBuilder": Builder(
action=Action(
'@${PYTHON3} ${ROOT_DIR.abspath}/scripts/sconsdist.py copy -p ${DIST_PROJECTS} -s "${DIST_SUFFIX}" ${DIST_EXTRA}',
),
),
"UsbInstall": Builder(
action=[
Action(
"${PYTHON3} ${ROOT_DIR.abspath}/scripts/selfupdate.py install dist/${DIST_DIR}/f${TARGET_HW}-update-${DIST_SUFFIX}/update.fuf"
"${PYTHON3} ${ROOT_DIR.abspath}/scripts/selfupdate.py dist/${DIST_DIR}/f${TARGET_HW}-update-${DIST_SUFFIX}/update.fuf"
),
Touch("${TARGET}"),
]

View File

@@ -11,22 +11,6 @@ def generate(env):
GDBCOM="$GDB $GDBOPTS $SOURCES", # no $TARGET
GDBPYCOM="$GDBPY $GDBOPTS $GDBPYOPTS $SOURCES", # no $TARGET
)
env.Append(
BUILDERS={
"GDB": Builder(
action=Action(
"${GDBCOM}",
"${GDBCOMSTR}",
),
),
"GDBPy": Builder(
action=Action(
"${GDBPYCOM}",
"${GDBPYCOMSTR}",
),
),
}
)
def exists(env):

View File

@@ -7,7 +7,7 @@ __OPENOCD_BIN = "openocd"
_oocd_action = Action(
"${OPENOCD} ${OPENOCD_OPTS} ${OPENOCD_COMMAND}",
"${OOCDCOMSTR}",
"${OPENOCDCOMSTR}",
)
@@ -16,12 +16,13 @@ def generate(env):
OPENOCD=__OPENOCD_BIN,
OPENOCD_OPTS="",
OPENOCD_COMMAND="",
OOCDCOMSTR="",
OPENOCDCOM="${OPENOCD} ${OPENOCD_OPTS} ${OPENOCD_COMMAND}",
OPENOCDCOMSTR="",
)
env.Append(
BUILDERS={
"OOCDFlashCommand": Builder(
"OpenOCDFlash": Builder(
action=[
_oocd_action,
Touch("${TARGET}"),
@@ -29,9 +30,6 @@ def generate(env):
suffix=".flash",
src_suffix=".bin",
),
"OOCDCommand": Builder(
action=_oocd_action,
),
}
)

View File

@@ -29,9 +29,20 @@ def BuildModules(env, modules):
return result
def PhonyTarget(env, name, action, source=None, **kw):
if not source:
source = []
phony_name = "phony_" + name
env.Pseudo(phony_name)
return env.AlwaysBuild(
env.Alias(name, env.Command(phony_name, source, action, **kw))
)
def generate(env):
env.AddMethod(BuildModule)
env.AddMethod(BuildModules)
env.AddMethod(PhonyTarget)
def exists(env):