mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-13 13:09:49 +04:00
Merge branch 'ofw-dev' into dev
This commit is contained in:
@@ -38,7 +38,7 @@ from SCons.Tool.cxx import CXXSuffixes
|
||||
from SCons.Tool.cc import CSuffixes
|
||||
from SCons.Tool.asm import ASSuffixes, ASPPSuffixes
|
||||
|
||||
# TODO: Is there a better way to do this than this global? Right now this exists so that the
|
||||
# TODO FL-3542: Is there a better way to do this than this global? Right now this exists so that the
|
||||
# emitter we add can record all of the things it emits, so that the scanner for the top level
|
||||
# compilation database can access the complete list, and also so that the writer has easy
|
||||
# access to write all of the files. But it seems clunky. How can the emitter and the scanner
|
||||
@@ -91,7 +91,7 @@ def make_emit_compilation_DB_entry(comstr):
|
||||
__COMPILATIONDB_ENV=env,
|
||||
)
|
||||
|
||||
# TODO: Technically, these next two lines should not be required: it should be fine to
|
||||
# TODO FL-3541: Technically, these next two lines should not be required: it should be fine to
|
||||
# cache the entries. However, they don't seem to update properly. Since they are quick
|
||||
# to re-generate disable caching and sidestep this problem.
|
||||
env.AlwaysBuild(entry)
|
||||
|
||||
@@ -21,7 +21,7 @@ def generate(env, **kw):
|
||||
FBT_DEBUG_DIR="${FBT_SCRIPT_DIR}/debug",
|
||||
)
|
||||
|
||||
if (adapter_serial := env.subst("$OPENOCD_ADAPTER_SERIAL")) != "auto":
|
||||
if (adapter_serial := env.subst("$SWD_TRANSPORT_SERIAL")) != "auto":
|
||||
env.Append(
|
||||
OPENOCD_OPTS=[
|
||||
"-c",
|
||||
|
||||
@@ -52,22 +52,16 @@ def AddFwProject(env, base_env, fw_type, fw_env_key):
|
||||
return project_env
|
||||
|
||||
|
||||
def AddOpenOCDFlashTarget(env, targetenv, **kw):
|
||||
openocd_target = env.OpenOCDFlash(
|
||||
"#build/oocd-${BUILD_CFG}-flash.flag",
|
||||
targetenv["FW_BIN"],
|
||||
OPENOCD_COMMAND=[
|
||||
"-c",
|
||||
"program ${SOURCE.posix} reset exit ${BASE_ADDRESS}",
|
||||
],
|
||||
BUILD_CFG=targetenv.subst("$FIRMWARE_BUILD_CFG"),
|
||||
BASE_ADDRESS=targetenv.subst("$IMAGE_BASE_ADDRESS"),
|
||||
def AddFwFlashTarget(env, targetenv, **kw):
|
||||
fwflash_target = env.FwFlash(
|
||||
"#build/flash.flag",
|
||||
targetenv["FW_ELF"],
|
||||
**kw,
|
||||
)
|
||||
env.Alias(targetenv.subst("${FIRMWARE_BUILD_CFG}_flash"), openocd_target)
|
||||
env.Alias(targetenv.subst("${FIRMWARE_BUILD_CFG}_flash"), fwflash_target)
|
||||
if env["FORCE"]:
|
||||
env.AlwaysBuild(openocd_target)
|
||||
return openocd_target
|
||||
env.AlwaysBuild(fwflash_target)
|
||||
return fwflash_target
|
||||
|
||||
|
||||
def AddJFlashTarget(env, targetenv, **kw):
|
||||
@@ -115,7 +109,7 @@ def generate(env):
|
||||
env.SetDefault(COPROCOMSTR="\tCOPRO\t${TARGET}")
|
||||
env.AddMethod(AddFwProject)
|
||||
env.AddMethod(DistCommand)
|
||||
env.AddMethod(AddOpenOCDFlashTarget)
|
||||
env.AddMethod(AddFwFlashTarget)
|
||||
env.AddMethod(GetProjectDirName)
|
||||
env.AddMethod(AddJFlashTarget)
|
||||
env.AddMethod(AddUsbFlashTarget)
|
||||
@@ -125,30 +119,53 @@ def generate(env):
|
||||
SELFUPDATE_SCRIPT="${FBT_SCRIPT_DIR}/selfupdate.py",
|
||||
DIST_SCRIPT="${FBT_SCRIPT_DIR}/sconsdist.py",
|
||||
COPRO_ASSETS_SCRIPT="${FBT_SCRIPT_DIR}/assets.py",
|
||||
FW_FLASH_SCRIPT="${FBT_SCRIPT_DIR}/fwflash.py",
|
||||
)
|
||||
|
||||
env.Append(
|
||||
BUILDERS={
|
||||
"FwFlash": Builder(
|
||||
action=[
|
||||
[
|
||||
"${PYTHON3}",
|
||||
"${FW_FLASH_SCRIPT}",
|
||||
"-d" if env["VERBOSE"] else "",
|
||||
"--interface=${SWD_TRANSPORT}",
|
||||
"--serial=${SWD_TRANSPORT_SERIAL}",
|
||||
"${SOURCE}",
|
||||
],
|
||||
Touch("${TARGET}"),
|
||||
]
|
||||
),
|
||||
"UsbInstall": Builder(
|
||||
action=[
|
||||
Action(
|
||||
'${PYTHON3} "${SELFUPDATE_SCRIPT}" -p ${FLIP_PORT} ${UPDATE_BUNDLE_DIR}/update.fuf'
|
||||
),
|
||||
[
|
||||
"${PYTHON3}",
|
||||
"${SELFUPDATE_SCRIPT}",
|
||||
"-p",
|
||||
"${FLIP_PORT}",
|
||||
"${UPDATE_BUNDLE_DIR}/update.fuf",
|
||||
],
|
||||
Touch("${TARGET}"),
|
||||
]
|
||||
),
|
||||
"CoproBuilder": Builder(
|
||||
action=Action(
|
||||
[
|
||||
'${PYTHON3} "${COPRO_ASSETS_SCRIPT}" '
|
||||
"copro ${COPRO_CUBE_DIR} "
|
||||
"${TARGET} ${COPRO_MCU_FAMILY} "
|
||||
"--cube_ver=${COPRO_CUBE_VERSION} "
|
||||
"--stack_type=${COPRO_STACK_TYPE} "
|
||||
'--stack_file="${COPRO_STACK_BIN}" '
|
||||
"--stack_addr=${COPRO_STACK_ADDR} ",
|
||||
[
|
||||
"${PYTHON3}",
|
||||
"${COPRO_ASSETS_SCRIPT}",
|
||||
"copro",
|
||||
"${COPRO_CUBE_DIR}",
|
||||
"${TARGET}",
|
||||
"${COPRO_MCU_FAMILY}",
|
||||
"--cube_ver=${COPRO_CUBE_VERSION}",
|
||||
"--stack_type=${COPRO_STACK_TYPE}",
|
||||
"--stack_file=${COPRO_STACK_BIN}",
|
||||
"--stack_addr=${COPRO_STACK_ADDR}",
|
||||
]
|
||||
],
|
||||
"$COPROCOMSTR",
|
||||
"${COPROCOMSTR}",
|
||||
)
|
||||
),
|
||||
}
|
||||
|
||||
@@ -53,6 +53,11 @@ class AppBuilder:
|
||||
FAP_SRC_DIR=self.app._appdir,
|
||||
FAP_WORK_DIR=self.app_work_dir,
|
||||
)
|
||||
self.app_env.Append(
|
||||
CPPDEFINES=[
|
||||
("FAP_VERSION", f'"{".".join(map(str, self.app.fap_version))}"')
|
||||
],
|
||||
)
|
||||
self.app_env.VariantDir(self.app_work_dir, self.app._appdir, duplicate=False)
|
||||
|
||||
def _build_external_files(self):
|
||||
|
||||
@@ -16,8 +16,8 @@ Firmware & apps:
|
||||
|
||||
|
||||
Flashing & debugging:
|
||||
flash, flash_blackmagic, jflash:
|
||||
Flash firmware to target using debug probe
|
||||
flash, jflash:
|
||||
Flash firmware to target using SWD probe. See also SWD_TRANSPORT, SWD_TRANSPORT_SERIAL
|
||||
flash_usb, flash_usb_full:
|
||||
Install firmware using self-update package
|
||||
debug, debug_other, blackmagic:
|
||||
|
||||
Reference in New Issue
Block a user