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

@@ -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}"),
]