本文整理汇总了Python中SCons.Script.DefaultEnvironment.get方法的典型用法代码示例。如果您正苦于以下问题:Python DefaultEnvironment.get方法的具体用法?Python DefaultEnvironment.get怎么用?Python DefaultEnvironment.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SCons.Script.DefaultEnvironment
的用法示例。
在下文中一共展示了DefaultEnvironment.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DefaultEnvironment
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
env.TouchSerialPort("$UPLOAD_PORT", 1200)
if upload_options.get("wait_for_upload_port", False):
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
# use only port name for BOSSA
if ("/" in env.subst("$UPLOAD_PORT") and
env.subst("$UPLOAD_PROTOCOL") == "sam-ba"):
env.Replace(UPLOAD_PORT=basename(env.subst("$UPLOAD_PORT")))
env = DefaultEnvironment()
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
BOARD_OPTIONS = env.get("BOARD_OPTIONS", {})
env.Append(
CCFLAGS=[
"--param", "max-inline-insns-single=500",
"-MMD"
],
CFLAGS=[
"-std=gnu11"
],
CXXFLAGS=[
"-std=gnu++11",
示例2: join
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
envsafe.Append(
CPPPATH=[
join("$BUILD_DIR", "src")
],
CPPDEFINES=[
"USE_STDPERIPH_DRIVER"
]
)
#
# Target: Build SPL Library
#
extra_flags = env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags")
ignore_files = []
if "STM32F40_41xxx" in extra_flags:
ignore_files += ["stm32f4xx_fmc.c"]
if "STM32F427_437xx" in extra_flags:
ignore_files += ["stm32f4xx_fsmc.c"]
elif "STM32F303xC" in extra_flags:
ignore_files += ["stm32f30x_hrtim.c"]
elif "STM32L1XX_MD" in extra_flags:
ignore_files += ["stm32l1xx_flash_ramfunc.c"]
libs = []
libs.append(envsafe.BuildLibrary(
join("$BUILD_DIR", "FrameworkSPL"),
join("$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}", "variants",
"${BOARD_OPTIONS['build']['variant']}", "src"),
示例3:
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
"-p", "3232",
"$UPLOAD_FLAGS"
],
UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE',
UPLOADOTACMD='"$PYTHONEXE" "$UPLOADEROTA" $UPLOADEROTAFLAGS -f $SOURCE',
SIZEPRINTCMD='$SIZETOOL -B -d $SOURCES',
PROGSUFFIX=".elf"
)
# Clone actual CCFLAGS to ASFLAGS
env.Append(
ASFLAGS=env.get("CCFLAGS", [])[:]
)
# Allow user to override via pre:script
if env.get("PROGNAME", "program") == "program":
env.Replace(PROGNAME="firmware")
#
# Framework and SDK specific configuration
#
env.Append(
BUILDERS=dict(
ElfToBin=Builder(
action=env.VerboseAction(" ".join([
'"$PYTHONEXE" "$OBJCOPY"',
示例4: str
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
try:
env.Replace(BOARD_OPTIONS=util.get_boards(env.subst("$BOARD")))
except UnknownBoard as e:
env.Exit("Error: %s" % str(e))
for k in commonvars.keys():
if (k in env or
not any([k.startswith("BOARD_"), k.startswith("UPLOAD_")])):
continue
_opt, _val = k.lower().split("_", 1)
if _opt == "board":
_opt = "build"
if _val in env['BOARD_OPTIONS'][_opt]:
env.Replace(**{k: "${BOARD_OPTIONS['%s']['%s']}" % (_opt, _val)})
if "ldscript" in env.get("BOARD_OPTIONS", {}).get("build", {}):
env.Replace(
LDSCRIPT_PATH="${BOARD_OPTIONS['build']['ldscript']}"
)
if env['PLATFORM'] != env.get("BOARD_OPTIONS", {}).get("platform"):
env.Exit(
"Error: '%s' platform doesn't support this board. "
"Use '%s' platform instead." % (
env['PLATFORM'], env.get("BOARD_OPTIONS", {}).get("platform")))
for opt in ("LIB_IGNORE", "LIB_USE"):
if opt not in env:
continue
env[opt] = [l.strip() for l in env[opt].split(",") if l.strip()]
示例5: DefaultEnvironment
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
Arduino Wiring-based Framework allows writing cross-platform software to
control devices attached to a wide range of Arduino boards to create all
kinds of creative coding, interactive objects, spaces or physical experiences.
http://arduino.cc/en/Reference/HomePage
"""
from os import listdir, walk
from os.path import isdir, isfile, join
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
BOARD_OPTS = env.get("BOARD_OPTIONS", {})
BOARD_BUILDOPTS = BOARD_OPTS.get("build", {})
BOARD_CORELIBDIRNAME = BOARD_BUILDOPTS.get("core")
#
# Determine framework directory
# based on development platform
#
PLATFORMFW_DIR = join("$PIOPACKAGES_DIR",
"framework-arduino${PLATFORM.replace('atmel', '')}")
if "digispark" in BOARD_BUILDOPTS.get("core"):
BOARD_CORELIBDIRNAME = "digispark"
PLATFORMFW_DIR = join(
"$PIOPACKAGES_DIR",
示例6: join
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
#
# Framework and SDK specific configuration
#
if "FRAMEWORK" in env:
env.Append(
LINKFLAGS=[
"-Wl,-wrap,system_restart_local",
"-Wl,-wrap,register_chipv6_phy"
]
)
# Handle uploading via OTA
ota_port = None
if env.get("UPLOAD_PORT"):
ota_port = re.match(
r"\"?((([0-9]{1,3}\.){3}[0-9]{1,3})|.+\.local)\"?$",
env.get("UPLOAD_PORT"))
if ota_port:
env.Replace(UPLOADCMD="$UPLOADOTACMD")
# Configure native SDK
else:
env.Append(
CPPPATH=[
join("$PIOPACKAGES_DIR", "sdk-esp8266", "include"),
"$PROJECTSRC_DIR"
],
LIBPATH=[join("$PIOPACKAGES_DIR", "sdk-esp8266", "lib")],
BUILDERS=dict(
示例7: DefaultEnvironment
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
env = DefaultEnvironment()
platform = env.PioPlatform()
BOARD_OPTS = env.BoardConfig()
BOARD_BUILDOPTS = BOARD_OPTS.get("build", {})
BOARD_CORELIBDIRNAME = "cosa"
BOARD_VARIANTLIBDIRNAME = string.replace(str(BOARD_BUILDOPTS.get("variant")), "/", os.sep)
# IMPORTANT: PlatformIO packages dir is expected to have the following folder:
# - framework-cosa (symlink to <Cosa project root>)
FRAMEWORK_DIR = platform.get_package_dir("framework-cosa")
TOOLCHAIN_DIR = platform.get_package_dir("toolchain-atmelavr")
PLATFORMFW_DIR = FRAMEWORK_DIR
lib_dirs = env.get("LIBSOURCE_DIRS")
project_lib_dir = util.get_projectlib_dir()
for _, subdirs, _ in walk(project_lib_dir):
# print("Adding project libraries:")
for dir in subdirs:
lib_dirs.append(join(project_lib_dir, dir))
# print(join(project_lib_dir, dir))
break
# Cosa
PLATFORMFW_LIBRARIES_DIR = join(PLATFORMFW_DIR, "libraries")
lib_dirs.append(PLATFORMFW_LIBRARIES_DIR)
lib_dirs.append(join(PLATFORMFW_DIR, "cores", BOARD_CORELIBDIRNAME))
lib_dirs.append(join(PLATFORMFW_DIR, "variants", BOARD_VARIANTLIBDIRNAME))
示例8:
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
LINKFLAGS=[
"-Os",
"-mmcu=$BOARD_MCU",
"-Wl,--gc-sections,--relax"
],
LIBS=["m"],
SIZEPRINTCMD='"$SIZETOOL" --mcu=$BOARD_MCU -C -d $SOURCES',
PROGNAME="firmware",
PROGSUFFIX=".elf"
)
env.Append(
ASFLAGS=env.get("CCFLAGS", [])[:],
BUILDERS=dict(
ElfToEep=Builder(
action=" ".join([
"$OBJCOPY",
"-O",
"ihex",
"-j",
".eeprom",
'--set-section-flags=.eeprom="alloc,load"',
"--no-change-warnings",
"--change-section-lma",
".eeprom=0",
"$SOURCES",
"$TARGET"]),
示例9: DefaultEnvironment
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
Arduino Wiring-based Framework allows writing cross-platform software to
control devices attached to a wide range of Arduino boards to create all
kinds of creative coding, interactive objects, spaces or physical experiences.
http://arduino.cc/en/Reference/HomePage
"""
from os.path import isdir, join
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
platform = env.PioPlatform()
board = env.BoardConfig()
build_mcu = env.get("BOARD_MCU", board.get("build.mcu", ""))
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinosam")
assert isdir(FRAMEWORK_DIR)
BUILD_CORE = board.get("build.core", "")
BUILD_SYSTEM = board.get("build.system", BUILD_CORE)
SYSTEM_DIR = join(FRAMEWORK_DIR, "system", BUILD_SYSTEM)
# USB flags
ARDUINO_USBDEFINES = [("ARDUINO", 10805)]
if "build.usb_product" in env.BoardConfig():
ARDUINO_USBDEFINES += [
("USB_VID", board.get("build.hwids")[0][0]),
("USB_PID", board.get("build.hwids")[0][1]),
("USB_PRODUCT", '\\"%s\\"' %
board.get("build.usb_product", "").replace('"', "")),
示例10: join
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
env.Append(
CPPPATH=[
join("$BUILD_DIR", "FrameworkCMSIS"),
join("$BUILD_DIR", "FrameworkCMSISCommon"),
join("$BUILD_DIR", "FrameworkCMSISVariant"),
]
)
envsafe = env.Clone()
#
# Target: Build Core Library
#
# use mbed ldscript with bootloader section
ldscript = env.get("BOARD_OPTIONS", {}).get("build", {}).get("ldscript")
if not isfile(join(env.subst("$PIOPACKAGES_DIR"), "ldscripts", ldscript)):
if "mbed" in env.get("BOARD_OPTIONS", {}).get("frameworks", {}):
env.Append(
LINKFLAGS=[
'-Wl,-T"%s"'
% join(
"$PIOPACKAGES_DIR",
"framework-mbed",
"variant",
env.subst("$BOARD").upper(),
"mbed",
"TARGET_%s" % env.subst("$BOARD").upper(),
"TOOLCHAIN_GCC_ARM",
"%s.ld" % ldscript.upper()[:-3],
)
示例11: int
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
UPLOADCMD='$UPLOADER $UPLOADERFLAGS -cf $SOURCE',
UPLOADOTACMD='"$PYTHONEXE" "$UPLOADEROTA" $UPLOADEROTAFLAGS -f $SOURCE',
#
# Misc
#
MKSPIFFSTOOL="mkspiffs",
SIZEPRINTCMD='$SIZETOOL -B -d $SOURCES',
PROGSUFFIX=".elf"
)
env.Append(
ASFLAGS=env.get("CCFLAGS", [])[:]
)
if int(ARGUMENTS.get("PIOVERBOSE", 0)):
env.Prepend(UPLOADERFLAGS=["-vv"])
# Allow user to override via pre:script
if env.get("PROGNAME", "program") == "program":
env.Replace(PROGNAME="firmware")
#
# Keep support for old LD Scripts
#
env.Replace(BUILD_FLAGS=[
f.replace("esp8266.flash", "eagle.flash") if "esp8266.flash" in f else f
示例12: ASFLAGS
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
],
LINKFLAGS=[
"-Os",
"-Wl,--gc-sections,--relax",
"-mthumb",
"-mcpu=%s" % env.BoardConfig().get("build.cpu"),
"--specs=nano.specs",
"--specs=nosys.specs"
],
LIBS=["c", "gcc", "m", "stdc++", "nosys"]
)
# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])
cpp_flags = env.Flatten(env.get("CPPDEFINES", []))
if "F103xC" in cpp_flags:
env.Append(CPPDEFINES=["STM32F103xE"])
elif "F103x8" in cpp_flags:
env.Append(CPPDEFINES=["STM32F103xB"])
env.Append(
CPPPATH=[
join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers", "CMSIS", "Include"),
join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers", "CMSIS", "Device",
"ST", MCU_FAMILY.upper() + "xx", "Include"),
示例13:
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
suffix=".bin"
)
)
)
if "FRAMEWORK" in env:
env.Append(
LINKFLAGS=[
"-Wl,-wrap,system_restart_local",
"-Wl,-wrap,register_chipv6_phy"
]
)
# Handle uploading via OTA
try:
if env.get("UPLOAD_PORT") and socket.inet_aton(env.get("UPLOAD_PORT")):
env.Replace(
UPLOADEROTA=join("$PLATFORMFW_DIR", "tools", "espota.py"),
UPLOADERFLAGS=[
"--debug",
"--progress",
"-i", "$UPLOAD_PORT",
"-f", "$SOURCE"
],
UPLOADCMD='"$UPLOADEROTA" $UPLOADERFLAGS'
)
except socket.error:
pass
# Configure native SDK
else:
示例14: join
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS -cf $SOURCE',
UPLOADOTACMD='"$PYTHONEXE" "$UPLOADEROTA" $UPLOADEROTAFLAGS -f $SOURCE',
#
# Misc
#
MKSPIFFSTOOL=join("$PIOPACKAGES_DIR", "tool-mkspiffs", "mkspiffs"),
SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES',
PROGNAME="firmware",
PROGSUFFIX=".elf"
)
env.Append(
ASFLAGS=env.get("CCFLAGS", [])[:],
BUILDERS=dict(
ElfToBin=Builder(
action=" ".join([
'"$OBJCOPY"',
"-eo",
'"%s"' % join("$PLATFORMFW_DIR", "bootloaders",
"eboot", "eboot.elf"),
"-bo", "$TARGET",
"-bm", "$BOARD_FLASH_MODE",
"-bf", "${__get_board_f_flash(__env__)}",
"-bz", "${__get_flash_size(__env__)}",
"-bs", ".text",
"-bp", "4096",
"-ec",
示例15: join
# 需要导入模块: from SCons.Script import DefaultEnvironment [as 别名]
# 或者: from SCons.Script.DefaultEnvironment import get [as 别名]
join("$BUILD_DIR", "FrameworkEnergiaVariant"),
join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}")
)
env.Append(
CPPDEFINES=[
"ARDUINO=101",
"ENERGIA=%d" % ENERGIA_VERSION
],
CPPPATH=[
join("$BUILD_DIR", "FrameworkEnergia"),
join("$BUILD_DIR", "FrameworkEnergiaVariant")
]
)
if env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "lm4f":
env.Append(
LINKFLAGS=["-Wl,--entry=ResetISR"]
)
#
# Target: Build Core Library
#
libs = []
libs.append(env.BuildLibrary(
join("$BUILD_DIR", "FrameworkEnergia"),
join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}")
))