fbt: initial blackmagic support (#1362)
* fbt: added separate script for Windows env setup; moved flash targets from firmware.scons to SConstruct; added Blackmagic support with automatic probe port resolution; added apps.c rebuild on any manifest.fam changes; fixed simultaneous flash & debug ops * fbt: added networked BlackmagicResolver mode; added `get_blackmagic` target for IDE integration * fbt: cleanup * fbt: docs update; fixed blackmagic lookup on certain usb hubs * fbt: removed explicit python serial port import * fbt: cleanup * fbt: raising exception on multiple serial blackmagic probes
This commit is contained in:
@@ -54,20 +54,20 @@ def AddFwProject(env, base_env, fw_type, fw_env_key):
|
||||
return project_env
|
||||
|
||||
|
||||
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}" '
|
||||
'-ex "compare-sections"',
|
||||
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"),
|
||||
**kw,
|
||||
)
|
||||
if force_flash:
|
||||
env.Depends(debug_target, targetenv["FW_FLASH"])
|
||||
|
||||
return debug_target
|
||||
env.Alias(targetenv.subst("${FIRMWARE_BUILD_CFG}_flash"), openocd_target)
|
||||
return openocd_target
|
||||
|
||||
|
||||
def DistCommand(env, name, source, **kw):
|
||||
@@ -85,8 +85,9 @@ def DistCommand(env, name, source, **kw):
|
||||
|
||||
def generate(env):
|
||||
env.AddMethod(AddFwProject)
|
||||
env.AddMethod(AddDebugTarget)
|
||||
env.AddMethod(DistCommand)
|
||||
env.AddMethod(AddOpenOCDFlashTarget)
|
||||
|
||||
env.SetDefault(
|
||||
COPRO_MCU_FAMILY="STM32WB5x",
|
||||
)
|
||||
|
Reference in New Issue
Block a user