unleashed-firmware/site_scons/site_tools/openocd.py
hedger b3767d143f
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>
2022-07-01 01:06:12 +09:00

46 lines
981 B
Python

from SCons.Builder import Builder
from SCons.Action import Action
from SCons.Defaults import Touch
import SCons
__OPENOCD_BIN = "openocd"
_oocd_action = Action(
"${OPENOCD} ${OPENOCD_OPTS} ${OPENOCD_COMMAND}",
"${OPENOCDCOMSTR}",
)
def generate(env):
env.SetDefault(
OPENOCD=__OPENOCD_BIN,
OPENOCD_OPTS="",
OPENOCD_COMMAND="",
OPENOCDCOM="${OPENOCD} ${OPENOCD_OPTS} ${OPENOCD_COMMAND}",
OPENOCDCOMSTR="",
)
env.Append(
BUILDERS={
"OpenOCDFlash": Builder(
action=[
_oocd_action,
Touch("${TARGET}"),
],
suffix=".flash",
src_suffix=".bin",
),
}
)
def exists(env):
try:
return env["OPENOCD"]
except KeyError:
pass
if openocd := env.WhereIs(__OPENOCD_BIN):
return openocd
raise SCons.Errors.StopError("Could not detect openocd")