本文整理汇总了Python中SCons.Script.DefaultEnvironment类的典型用法代码示例。如果您正苦于以下问题:Python DefaultEnvironment类的具体用法?Python DefaultEnvironment怎么用?Python DefaultEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DefaultEnvironment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _FindPackagePath
def _FindPackagePath(env, optvar, globspec, defaultpath=None):
"""Check for a package installation path matching globspec."""
options = es_vars.GlobalVariables()
pdir = defaultpath
try:
pdir = os.environ[optvar]
except KeyError:
if not env:
env = DefaultEnvironment()
options.Update(env)
dirs = glob.glob(env.subst(globspec))
dirs.sort()
dirs.reverse()
for d in dirs:
if os.path.isdir(d):
pdir = d
break
return pdir
示例2: DefaultEnvironment
"""
Arduino
Arduino 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(
示例3: import
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Builder for Nordic nRF51 series ARM microcontrollers.
"""
from os.path import join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
DefaultEnvironment, SConscript)
env = DefaultEnvironment()
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
if env.subst("$BOARD") == "rfduino":
env.Append(
CCFLAGS=["-fno-builtin"],
LINKFLAGS=["--specs=nano.specs"]
)
env.Replace(
UPLOADER=join("$PIOPACKAGES_DIR", "tool-rfdloader", "rfdloader"),
UPLOADERFLAGS=["-q", '"$UPLOAD_PORT"'],
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES'
)
#
示例4: import
# limitations under the License.
import re
from os.path import join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
DefaultEnvironment)
def _get_board_f_flash(env):
frequency = env.subst("$BOARD_F_FLASH")
frequency = str(frequency).replace("L", "")
return str(int(int(frequency) / 1000000)) + "m"
env = DefaultEnvironment()
platform = env.PioPlatform()
env.Replace(
__get_board_f_flash=_get_board_f_flash,
AR="xtensa-esp32-elf-ar",
AS="xtensa-esp32-elf-as",
CC="xtensa-esp32-elf-gcc",
CXX="xtensa-esp32-elf-g++",
GDB="xtensa-esp32-elf-gdb",
OBJCOPY=join(
platform.get_package_dir("tool-esptoolpy") or "", "esptool.py"),
RANLIB="xtensa-esp32-elf-ranlib",
SIZETOOL="xtensa-esp32-elf-size",
示例5: LookupSources
#
# Backward compatibility with PlatformIO 2.0
#
platformio_tool.SRC_DEFAULT_FILTER = " ".join([
"+<*>", "-<.git%s>" % sep, "-<svn%s>" % sep,
"-<example%s>" % sep, "-<examples%s>" % sep,
"-<test%s>" % sep, "-<tests%s>" % sep
])
def LookupSources(env, variant_dir, src_dir, duplicate=True, src_filter=None):
return env.CollectBuildFiles(variant_dir, src_dir, src_filter, duplicate)
def VariantDirWrap(env, variant_dir, src_dir, duplicate=False):
env.VariantDir(variant_dir, src_dir, duplicate)
env = DefaultEnvironment()
env.AddMethod(LookupSources)
env.AddMethod(VariantDirWrap)
env.Replace(
PLATFORMFW_DIR=env.PioPlatform().get_package_dir("framework-simba")
)
SConscript(
[env.subst(join("$PLATFORMFW_DIR", "make", "platformio.sconscript"))])
示例6: import
"""
Build script for lattice ice40 FPGAs
latticeice40-builder.py
"""
import os
from os.path import join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
DefaultEnvironment, Environment, Exit, GetOption,
Glob)
env = DefaultEnvironment()
env.Replace(PROGNAME="hardware")
env.Append(SIMULNAME="simulation")
# -- Get the local folder in which the icestorm tools should be installed
piopackages_dir = env.subst('$PIOPACKAGES_DIR')
bin_dir = join(piopackages_dir, 'toolchain-icestorm', 'bin')
# -- Add this path to the PATH env variable. First the building tools will be
# -- searched in the local PATH. If they are not founde, the global ones will
# -- be executed (if installed)
env.PrependENVPath('PATH', bin_dir)
# -- Target name for synthesis
TARGET = join(env['BUILD_DIR'], env['PROGNAME'])
# -- Target name for simulation
# TARGET_SIM = join(env['PROJECT_DIR'], env['SIMULNAME'])
# -- Get a list of all the verilog files in the src folfer, in ASCII, with
示例7: DefaultEnvironment
"""
Arduino
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"
示例8: get_serialports
env.FlushSerialBuffer("$UPLOAD_PORT")
before_ports = get_serialports()
if upload_options.get("use_1200bps_touch", False):
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"):
env.Replace(UPLOAD_PORT=basename(env.subst("$UPLOAD_PORT")))
env = DefaultEnvironment()
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
if env.subst("$BOARD") == "zero":
env.Replace(
UPLOADER=join("$PIOPACKAGES_DIR", "tool-openocd", "bin", "openocd"),
UPLOADERFLAGS=[
"-d2",
"-s",
join(
"$PIOPACKAGES_DIR",
"tool-openocd", "share", "openocd", "scripts"),
"-f",
join(
"$PLATFORMFW_DIR", "variants",
示例9: DefaultEnvironment
Energia
Energia framework enables pretty much anyone to start easily creating
microcontroller-based projects and applications. Its easy-to-use libraries
and functions provide developers of all experience levels to start
blinking LEDs, buzzing buzzers and sensing sensors more quickly than ever
before.
http://energia.nu/reference/
"""
from os.path import join
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
env.Replace(
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-energia${PLATFORM[2:]}")
)
ENERGIA_VERSION = int(
open(join(env.subst("$PLATFORMFW_DIR"),
"version.txt")).read().replace(".", "").strip())
# include board variant
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkEnergiaVariant"),
join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}")
)
示例10: user
"""
SPL
The ST Standard Peripheral Library provides a set of functions for
handling the peripherals on the STM32 Cortex-M3 family.
The idea is to save the user (the new user, in particular) having to deal
directly with the registers.
http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743?sc=stm32embeddedsoftware
"""
from os.path import isdir, isfile, join
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
platform = env.DevPlatform()
FRAMEWORK_DIR = platform.get_package_dir("framework-dev")
assert isdir(FRAMEWORK_DIR)
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkCMSIS"),
join(FRAMEWORK_DIR, env.BoardConfig().get("build.core"),
"cmsis", "cores", env.BoardConfig().get("build.core"))
)
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkSPLInc"),
join(
FRAMEWORK_DIR, env.BoardConfig().get("build.core"), "spl",
示例11: import
"""
Builder for Microchip PIC32 microcontrollers
"""
from os.path import join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
DefaultEnvironment)
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
env.AutodetectUploadPort()
env.Prepend(UPLOADERFLAGS=["-d", '"$UPLOAD_PORT"'])
env = DefaultEnvironment()
env.Replace(
AR="pic32-ar",
AS="pic32-as",
CC="pic32-gcc",
CXX="pic32-g++",
OBJCOPY="pic32-objcopy",
RANLIB="pic32-ranlib",
SIZETOOL="pic32-size",
ARFLAGS=["rcs"],
ASFLAGS=[
"-g1",
"-O2",
示例12: join
PIOBUILDER_DIR=join(get_source_dir(), "builder"),
PROJECT_DIR=get_project_dir(),
PIOENVS_DIR=get_pioenvs_dir(),
PLATFORMIOHOME_DIR=get_home_dir(),
PLATFORM_DIR=join("$PLATFORMIOHOME_DIR", "$PLATFORM"),
PLATFORMFW_DIR=join("$PLATFORM_DIR", "frameworks", "$FRAMEWORK"),
PLATFORMTOOLS_DIR=join("$PLATFORM_DIR", "tools"),
BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"),
LIBSOURCE_DIRS=[
join("$PROJECT_DIR", "lib"),
get_lib_dir(),
join("$PLATFORMFW_DIR", "libraries"),
]
)
env = DefaultEnvironment()
if not isdir(env['PLATFORMIOHOME_DIR']):
Exit("You haven't installed any platforms yet. Please use "
"`platformio install` command")
elif not isdir(env.subst("$PLATFORM_DIR")):
Exit("An '%s' platform hasn't been installed yet. Please use "
"`platformio install %s` command" % (env['PLATFORM'],
env['PLATFORM']))
SConscriptChdir(0)
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "${PLATFORM}.py")))
示例13: import
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
from platform import system
from os import makedirs
from os.path import isdir, join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
DefaultEnvironment)
env = DefaultEnvironment()
platform = env.PioPlatform()
env.Replace(
AR="arm-none-eabi-ar",
AS="arm-none-eabi-as",
CC="arm-none-eabi-gcc",
CXX="arm-none-eabi-g++",
GDB="arm-none-eabi-gdb",
OBJCOPY="arm-none-eabi-objcopy",
RANLIB="arm-none-eabi-ranlib",
SIZETOOL="arm-none-eabi-size",
ARFLAGS=["rc"],
SIZEPROGREGEXP=r"^(?:\.text|\.data|\.rodata|\.text.align|\.ARM.exidx)\s+(\d+).*",
示例14: DefaultEnvironment
http://mbed.org/
"""
from __future__ import print_function
import re
import sys
import xml.etree.ElementTree as ElementTree
from binascii import crc32
from os import getenv, walk
from os.path import basename, isfile, join, normpath
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
BOARD_OPTS = env.get("BOARD_OPTIONS", {}).get("build", {})
env.Replace(
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-mbed")
)
MBED_VARIANTS = {
"blueboard_lpc11u24": "LPC11U24",
"dipcortexm0": "LPC11U24",
"seeeduinoArchPro": "ARCH_PRO",
"ubloxc027": "UBLOX_C027",
"lpc1114fn28": "LPC1114",
"lpc11u35": "LPC11U35_401",
"mbuino": "LPC11U24",
示例15: Copyright
# Copyright (C) Ivan Kravets <[email protected]>
# See LICENSE for details.
"""
Builder for ST STM32 Series ARM microcontrollers.
"""
import platform
from os.path import isfile, join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
DefaultEnvironment, Exit, SConscript)
env = DefaultEnvironment()
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
if env.subst("$UPLOAD_PROTOCOL") == "gdb":
if not isfile(join(env.subst("$PROJECT_DIR"), "upload.gdb")):
Exit(
"You are using GDB as firmware uploader. "
"Please specify upload commands in upload.gdb "
"file in project directory!"
)
env.Replace(
UPLOADER=join(
"$PIOPACKAGES_DIR", "toolchain-gccarmnoneeabi",
"bin", "arm-none-eabi-gdb"
),
UPLOADERFLAGS=[
join("$BUILD_DIR", "firmware.elf"),