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
# See the License for the specific language governing permissions and # limitations under the License. """ 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. """ from os import listdir from os.path import isdir, join from SCons.Script import DefaultEnvironment env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() FRAMEWORK_DIR = platform.get_package_dir("framework-arduinonordicnrf5") assert isdir(FRAMEWORK_DIR) env.Append( ASFLAGS=["-x", "assembler-with-cpp"], CFLAGS=["-std=gnu11"], CCFLAGS=[ "-Os", # optimize for size "-ffunction-sections", # place each function in its own section "-fdata-sections", "-Wall", "-mthumb",
# 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",
""" 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
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",
_rpi_sysgpio("/sys/class/gpio/gpio18/value", 0) _rpi_sysgpio("/sys/class/gpio/unexport", 18) else: if not upload_options.get("disable_flushing", False): env.FlushSerialBuffer("$UPLOAD_PORT") before_ports = [i['port'] for i in 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)) env = DefaultEnvironment() SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py"))) if "digispark" in env.get( "BOARD_OPTIONS", {}).get("build", {}).get("core", ""): env.Replace( UPLOADER=join("$PIOPACKAGES_DIR", "tool-micronucleus", "micronucleus"), UPLOADERFLAGS=[ "-c", "$UPLOAD_PROTOCOL", "--timeout", "60" ], UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES' ) else:
""" 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.PioPlatform() FRAMEWORK_DIR = platform.get_package_dir("framework-spl") assert isdir(FRAMEWORK_DIR) env.Append( CPPPATH=[ join(FRAMEWORK_DIR, env.BoardConfig().get("build.core"), "cmsis", "cores", env.BoardConfig().get("build.core")), join(FRAMEWORK_DIR, env.BoardConfig().get("build.core"), "cmsis", "variants", env.BoardConfig().get("build.variant")[0:7]), join(FRAMEWORK_DIR, env.BoardConfig().get("build.core"), "spl", "variants", env.BoardConfig().get("build.variant")[0:7], "inc"), join(FRAMEWORK_DIR, env.BoardConfig().get("build.core"), "spl", "variants", env.BoardConfig().get("build.variant")[0:7], "src")
""" 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",
before_ports = get_serialports() if bool(upload_options.get("use_1200bps_touch", False)): env.TouchSerialPort("$UPLOAD_PORT", 1200) if bool(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() platform = env.PioPlatform() board = env.BoardConfig() variant = board.get("build.variant", "") use_adafruit = board.get("build.bsp.name", "nrf5") == "adafruit" and "arduino" in env.get( "PIOFRAMEWORK", []) if use_adafruit: FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoadafruitnrf52") os_platform = sys.platform if os_platform == "win32": nrfutil_path = join(FRAMEWORK_DIR, "tools", "adafruit-nrfutil", os_platform, "adafruit-nrfutil.exe") elif os_platform == "darwin":
# # 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 NXP LPC 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"))) # # Target: Build executable and linkable firmware # target_elf = env.BuildProgram() # # Target: Build the .bin file # if "uploadlazy" in COMMAND_LINE_TARGETS: target_firm = join("$BUILD_DIR", "firmware.bin")
from os.path import isdir, join from SCons.Script import DefaultEnvironment env = DefaultEnvironment() FRAMEWORK_DIR = env.PioPlatform().get_package_dir( "framework-kendryte-freertos-sdk") assert FRAMEWORK_DIR and isdir(FRAMEWORK_DIR) TOOLCHAIN_DIR = env.PioPlatform().get_package_dir("toolchain-kendryte210") assert TOOLCHAIN_DIR and isdir(TOOLCHAIN_DIR) env.SConscript("_bare.py", exports="env") env.Replace( ASFLAGS=["-x", "assembler-with-cpp"], CCFLAGS=[ "-mcmodel=medany", "-mabi=lp64f", "-march=rv64imafc", "-fno-common", "-ffunction-sections", "-fdata-sections", "-fstrict-volatile-bitfields", "-ffast-math", "-fno-math-errno", "-fsingle-precision-constant", "-O2", "-ggdb", "-Wall", "-Werror=all", "-Wno-error=unused-function", "-Wno-error=unused-but-set-variable", "-Wno-error=unused-variable", "-Wno-error=deprecated-declarations", "-Wno-error=maybe-uninitialized", "-Wextra", "-Werror=frame-larger-than=65536", "-Wno-unused-parameter", "-Wno-unused-function", "-Wno-implicit-fallthrough", "-Wno-sign-compare", "-Wno-error=missing-braces", "-Wno-error=return-type", "-Wno-error=pointer-sign", "-Wno-missing-braces", "-Wno-strict-aliasing", "-Wno-implicit-fallthrough", "-Wno-missing-field-initializers",
env.FlushSerialBuffer("$UPLOAD_PORT") before_ports = [i['port'] for i in 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"))) env.Replace( UPLOADER=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_UPLOADER", "bossac"), UPLOADERFLAGS=[ "--info", "--port", "$UPLOAD_PORT", "--erase", "--write", "--verify", "--boot", "--reset" ], UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES'
""" 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. """ from os import listdir from os.path import isdir, join from SCons.Script import DefaultEnvironment import re env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() variant = board.get("build.variant") FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoadafruitnrf52") assert isdir(FRAMEWORK_DIR) CORE_DIR = join(FRAMEWORK_DIR, "cores", board.get("build.core")) assert isdir(CORE_DIR) NORDIC_DIR = join(CORE_DIR, "nordic") assert isdir(NORDIC_DIR) default_bsp_version = "0.18.0" default_softdevice_version = "6.1.1"
# Copyright (C) Ivan Kravets <*****@*****.**> # See LICENSE for details. """ Builder for Texas Instruments Tiva C Series ARM Cortex-M4 microcontrollers. """ from os.path import join from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default, DefaultEnvironment) env = DefaultEnvironment() env.Replace( AR="arm-none-eabi-ar", AS="arm-none-eabi-gcc", CC="arm-none-eabi-gcc", CXX="arm-none-eabi-g++", OBJCOPY="arm-none-eabi-objcopy", RANLIB="arm-none-eabi-ranlib", ARFLAGS=["rcs"], ASFLAGS=[ "-g", # include debugging info (so errors include line numbers) "-x", "assembler-with-cpp", "-Wall", "-mthumb", "-mcpu=cortex-m4", "-mfloat-abi=hard", "-mfpu=fpv4-sp-d16",
def __fetch_spiffs_size(target, source, env): fetch_spiffs_size(env) return (target, source) def _update_max_upload_size(env): ldsizes = _parse_ld_sizes(env.GetActualLDScript()) if ldsizes and "app_size" in ldsizes: env.BoardConfig().update("upload.maximum_size", ldsizes['app_size']) ######################################################## env = DefaultEnvironment() platform = env.PioPlatform() env.Replace( __get_flash_size=_get_flash_size, __get_board_f_flash=_get_board_f_flash, AR="xtensa-lx106-elf-ar", AS="xtensa-lx106-elf-as", CC="xtensa-lx106-elf-gcc", CXX="xtensa-lx106-elf-g++", GDB="xtensa-lx106-elf-gdb", OBJCOPY="xtensa-lx106-elf-objcopy", RANLIB="xtensa-lx106-elf-ranlib", SIZETOOL="xtensa-lx106-elf-size", ARFLAGS=["rc"],
# Copyright (C) Ivan Kravets <*****@*****.**> # 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"),
# # 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+).*",
import sys from os.path import join from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, DefaultEnvironment) join( r'C:\Users\sun\.platformio\packages\toolchain-riscv-none-gcc\riscv-embedded-gcc\8.2.0-2.2-20190521-0004\bin' ) #sys.path.append(FRAMEWORK_DIR+"\\bsp"+"\\k210") join(r'C:\Users\sun\.platformio\packages\platform-rt-thread\bsp\k210') sys.path.append( r'C:\Users\sun\.platformio\packages\platform-rt-thread\bsp\k210') env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() PREFIX = 'riscv-none-embed-' env.Replace( # toolchains CC=PREFIX + 'gcc', AR=PREFIX + 'ar', AS=PREFIX + 'gcc', GDB=PREFIX + 'gdb', CXX=PREFIX + 'g++', OBJCOPY=PREFIX + 'objcopy', RANLIB=PREFIX + 'ranlib', SIZETOOL=PREFIX + "size", ARFLAGS=["rcs"], SIZEPRINTCMD='$SIZETOOL -d $SOURCES', PROGSUFFIX=".elf")
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']}") )
# limitations under the License. """ WiringPi WiringPi is a GPIO access library written in C for the BCM2835 used in the Raspberry Pi. It's designed to be familiar to people who have used the Arduino "wiring" system. http://wiringpi.com """ from os.path import join from SCons.Script import DefaultEnvironment env = DefaultEnvironment() env.Replace( CPPFLAGS=["-O2", "-Wformat=2", "-Wall", "-Winline", "-pipe", "-fPIC"], LIBS=["pthread"]) env.Append(CPPDEFINES=["_GNU_SOURCE"], CPPPATH=[join("$BUILD_DIR", "FrameworkWiringPi")]) # # Target: Build Core Library # libs = [] libs.append( env.BuildLibrary(
# Copyright (C) Ivan Kravets <*****@*****.**> # 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['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"),
import os,shutil from SCons.Script import DefaultEnvironment from platformio import util env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32") assert os.path.isdir(FRAMEWORK_DIR) assert os.path.isdir("buildroot/share/PlatformIO/variants") mcu_type = board.get("build.mcu")[:-2] variant = board.get("build.variant") series = mcu_type[:7].upper() + "xx" variant_dir = os.path.join(FRAMEWORK_DIR, "variants", variant) source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant) assert os.path.isdir(source_dir) if not os.path.isdir(variant_dir): os.mkdir(variant_dir) for file_name in os.listdir(source_dir): full_file_name = os.path.join(source_dir, file_name) if os.path.isfile(full_file_name): shutil.copy(full_file_name, variant_dir)
def scons_patched_match_splitext(path, suffixes=None): """ Patch SCons Builder, append $OBJSUFFIX to the end of each target """ tokens = Util.splitext(path) if suffixes and tokens[1] and tokens[1] in suffixes: return (path, tokens[1]) return tokens Builder.match_splitext = scons_patched_match_splitext env = DefaultEnvironment() platform = env.PioPlatform() FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif8266") assert isdir(FRAMEWORK_DIR) env.Append( ASFLAGS=["-x", "assembler-with-cpp"], CFLAGS=[ "-std=gnu99", "-Wpointer-arith", "-Wno-implicit-function-declaration", "-Wl,-EL", "-fno-inline-functions",
env.subst("Could not find the `spiffs` section in the partitions " "table $PARTITIONS_TABLE_CSV\n")) env.Exit(1) return env["SPIFFS_START"] = _parse_size(spiffs['offset']) env["SPIFFS_SIZE"] = _parse_size(spiffs['size']) env["SPIFFS_PAGE"] = int("0x100", 16) env["SPIFFS_BLOCK"] = int("0x1000", 16) def __fetch_spiffs_size(target, source, env): fetch_spiffs_size(env) return (target, source) env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() mcu = board.get("build.mcu", "esp32") env.Replace( __get_board_f_flash=_get_board_f_flash, __get_board_flash_mode=_get_board_flash_mode, AR="xtensa-%s-elf-ar" % mcu, AS="xtensa-%s-elf-as" % mcu, CC="xtensa-%s-elf-gcc" % mcu, CXX="xtensa-%s-elf-g++" % mcu, GDB="xtensa-%s-elf-gdb" % mcu, OBJCOPY=join( platform.get_package_dir("tool-esptoolpy") or "", "esptool.py"), RANLIB="xtensa-%s-elf-ranlib" % mcu,
""" 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"
import sys from platform import system from os import makedirs from os.path import basename, isdir, join from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, DefaultEnvironment) env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() JN51PROG_DIR = platform.get_package_dir("tool-nxp-jn51prog") env.Replace( # 'BA2' Architecture AR="ba-elf-ar", AS="ba-elf-as", CC="ba-elf-gcc", CXX="ba-elf-g++", GDB="ba-elf-gdb", OBJCOPY="ba-elf-objcopy", RANLIB="ba-elf-ranlib", SIZETOOL="ba-elf-size", UPLOADER=join(JN51PROG_DIR, "JN51xxProgrammer.exe"), UPLOADERFLAGS=[ '--serial', '$UPLOAD_PORT', '--programbaud', '$UPLOAD_SPEED', #'--deviceconfig',
# # 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"))])
# # 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+).*", SIZEDATAREGEXP=r"^(?:\.data|\.bss|\.noinit)\s+(\d+).*", SIZECHECKCMD="$SIZETOOL -A -d $SOURCES",
# 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' ) #
from SCons.Script import Builder, DefaultEnvironment def scons_patched_match_splitext(path, suffixes=None): """ Patch SCons Builder, append $OBJSUFFIX to the end of each target """ tokens = Util.splitext(path) if suffixes and tokens[1] and tokens[1] in suffixes: return (path, tokens[1]) return tokens Builder.match_splitext = scons_patched_match_splitext env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() gzip_fw = board.get("build.gzip_fw", False) gzip_switch = [] FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif8266") assert isdir(FRAMEWORK_DIR) if gzip_fw: gzip_switch = ["--gzip", "PIO"] env.Append( ASFLAGS=["-x", "assembler-with-cpp"], # General options that are passed to the C compiler (C only; not C++)
""" 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(
before_ports = get_serialports() if bool(upload_options.get("use_1200bps_touch", False)): env.TouchSerialPort("$UPLOAD_PORT", 1200) if bool(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() platform = env.PioPlatform() board = env.BoardConfig() upload_protocol = env.subst("$UPLOAD_PROTOCOL") build_mcu = env.get("BOARD_MCU", board.get("build.mcu", "")) 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",
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",
""" Build script for simplez soft-processor on an FPGAs simplez-builder.py """ import os from os.path import join from SCons.Script import (AlwaysBuild, Builder, DefaultEnvironment, Glob, Default) # TARGET = 'prog.list' HOME = os.environ.get('HOME') LOCALBIN = join(HOME, '.local', 'bin') env = DefaultEnvironment() # print("PATH: {}".format(env['ENV']['PATH'])) env['ENV']['PYTHONPATH'] = '' # -- Get the local folder in which the simplez tools should be installed piopackages_dir = env.subst('$PIOPACKAGES_DIR') bin_dir = join(piopackages_dir, 'toolchain-simplez', 'bin') # -- Add the $HOME/.local/bin to the path # -- There are locate the tools when installed with pip3 env.PrependENVPath('PATH', LOCALBIN) # -- 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)
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")))
from SCons.Script import DefaultEnvironment import glob, shutil, os env = DefaultEnvironment() # uncomment line below to see environment variables # print env.Dump() # print ARGUMENTS # copyfile("src/MqttConnector.h", "tmp/MqttConnector/MqttConnector.h") # copyfile("src/MqttConnector.cpp", "tmp/MqttConnector/MqttConnector.cpp") print "BEING COPY FILES..." if not os.path.exists("pio_compile_here/MqttConnector"): os.makedirs("pio_compile_here/MqttConnector") for file in glob.iglob('src/*.*'): print 'Copied file %s' % (file) shutil.copy2(file, "pio_compile_here/MqttConnector")
""" 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",
# http://www.apache.org/licenses/LICENSE-2.0 # # 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 Linux Linux x64_64 / 64-bit """ from SCons.Script import AlwaysBuild, Default, DefaultEnvironment from platformio.util import get_systype env = DefaultEnvironment() env.Replace(_BINPREFIX="", AR="${_BINPREFIX}ar", AS="${_BINPREFIX}as", CC="${_BINPREFIX}gcc", CXX="${_BINPREFIX}g++", OBJCOPY="${_BINPREFIX}objcopy", RANLIB="${_BINPREFIX}ranlib", SIZETOOL="${_BINPREFIX}size", SIZEPRINTCMD='"$SIZETOOL" $SOURCES') if get_systype() == "darwin_x86_64": env.Replace(_BINPREFIX="x86_64-pc-linux-") #
# 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 Teensy boards """ from os.path import isfile, join from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, DefaultEnvironment, SConscript) env = DefaultEnvironment() if env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy": SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py"))) elif env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy3": SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) env.Append( LINKFLAGS=["-Wl,--defsym=__rtc_localtime=$UNIX_TIME"] ) env.Append( CPPDEFINES=[ "USB_SERIAL", "LAYOUT_US_ENGLISH" ],
_rpi_sysgpio("/sys/class/gpio/gpio18/value", 0) _rpi_sysgpio("/sys/class/gpio/unexport", 18) else: if not upload_options.get("disable_flushing", False): env.FlushSerialBuffer("$UPLOAD_PORT") before_ports = [i['port'] for i in 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)) env = DefaultEnvironment() SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py"))) env.Append(CFLAGS=["-std=gnu11"], CXXFLAGS=["-std=gnu++11"]) if "digispark" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("core", ""): env.Replace(UPLOADER=join("$PIOPACKAGES_DIR", "tool-micronucleus", "micronucleus"), UPLOADERFLAGS=["-c", "$UPLOAD_PROTOCOL", "--timeout", "60"], UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES') else: env.Replace( UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
board_max_size = int( env.get("BOARD_OPTIONS", {}).get("upload", {}).get("maximum_size", 0)) # check if user overrides LD Script match = re.search(r"\.flash\.(\d+)(m|k).*\.ld", env.GetActualLDScript()) if match: if match.group(2) == "k": board_max_size = int(match.group(1)) * 1024 elif match.group(2) == "m": board_max_size = int(match.group(1)) * 1024 * 1024 return ("%dK" % (board_max_size / 1024) if board_max_size < 1048576 else "%dM" % (board_max_size / 1048576)) env = DefaultEnvironment() env.Replace( __get_flash_size=_get_flash_size, AR="xtensa-lx106-elf-ar", AS="xtensa-lx106-elf-as", CC="xtensa-lx106-elf-gcc", CXX="xtensa-lx106-elf-g++", OBJCOPY="xtensa-lx106-elf-objcopy", RANLIB="xtensa-lx106-elf-ranlib", SIZETOOL="xtensa-lx106-elf-size", ARFLAGS=["rcs"], ASPPFLAGS=["-x", "assembler-with-cpp"],
# offset_and_rename.py # # - If 'build.offset' is provided, either by JSON or by the environment... # - Set linker flag LD_FLASH_OFFSET and relocate the VTAB based on 'build.offset'. # - Set linker flag LD_MAX_DATA_SIZE based on 'build.maximum_ram_size'. # - Define STM32_FLASH_SIZE from 'upload.maximum_size' for use by Flash-based EEPROM emulation. # # - For 'board_build.rename' add a post-action to rename the firmware file. # import os, sys, marlin Import("env") from SCons.Script import DefaultEnvironment board = DefaultEnvironment().BoardConfig() board_keys = board.get("build").keys() # # For build.offset define LD_FLASH_OFFSET, used by ldscript.ld # if 'offset' in board_keys: LD_FLASH_OFFSET = board.get("build.offset") marlin.relocate_vtab(LD_FLASH_OFFSET) # Flash size maximum_flash_size = int(board.get("upload.maximum_size") / 1024) marlin.replace_define('STM32_FLASH_SIZE', maximum_flash_size) # Get upload.maximum_ram_size (defined by /buildroot/share/PlatformIO/boards/VARIOUS.json)
""" 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 join from SCons.Script import DefaultEnvironment env = DefaultEnvironment() env.Replace( PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-spl") ) env.VariantDirWrap( join("$BUILD_DIR", "FrameworkCMSIS"), join("$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}", "cmsis", "cores", "${BOARD_OPTIONS['build']['core']}") ) env.VariantDirWrap( join("$BUILD_DIR", "FrameworkSPLInc"), join( "$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}", "spl",
_rpi_sysgpio("/sys/class/gpio/gpio%d/value" % pin_num, 0) _rpi_sysgpio("/sys/class/gpio/unexport", pin_num) else: if not upload_options.get("disable_flushing", False): 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)) env = DefaultEnvironment() env.Replace( AR="avr-gcc-ar", AS="avr-as", CC="avr-gcc", CXX="avr-g++", OBJCOPY="avr-objcopy", RANLIB="avr-gcc-ranlib", SIZETOOL="avr-size", ARFLAGS=["rcs"], ASFLAGS=["-x", "assembler-with-cpp"], CFLAGS=["-std=gnu11", "-fno-fat-lto-objects"], CCFLAGS=[ "-g", # include debugging info (so errors include line numbers) "-Os", # optimize for size
""" import os import string from __future__ import print_function from os import listdir, walk from os.path import isdir, isfile, join from SCons.Script import DefaultEnvironment from platformio import util 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")
from SCons.Script import DefaultEnvironment env = DefaultEnvironment() board_config = env.BoardConfig() env.Append( ASFLAGS=["-x", "assembler-with-cpp"], CCFLAGS=[ "-Os", "-fdata-sections", "-ffunction-sections", "-march=%s" % board_config.get("build.march"), ], CPPDEFINES=["__riscv__", "__pulp__"], LINKFLAGS=["-march=%s" % board_config.get("build.march"), "-nostartfiles"], LIBS=["gcc"], ) env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])
PIOBUILDER_DIR=join(util.get_source_dir(), "builder"), PIOPACKAGES_DIR=join("$PIOHOME_DIR", "packages"), BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"), BUILDSRC_DIR=join("$BUILD_DIR", "src"), LIBSOURCE_DIRS=[ "$PROJECTLIB_DIR", util.get_lib_dir(), join("$PLATFORMFW_DIR", "libraries") ], PYTHONEXE=normpath(sys.executable) ) env = DefaultEnvironment() env.Prepend(LIBPATH=[join("$PIOPACKAGES_DIR", "ldscripts")]) if "BOARD" in env: 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"
# You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # 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. from os.path import join from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, DefaultEnvironment) env = DefaultEnvironment() 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"], ASFLAGS=["-x", "assembler-with-cpp"],
from os.path import join from shutil import copyfile from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, DefaultEnvironment, SConscript) def UploadToDisk(target, source, env): # pylint: disable=W0613,W0621 env.AutodetectUploadPort() copyfile(join(env.subst("$BUILD_DIR"), "firmware.bin"), join(env.subst("$UPLOAD_PORT"), "firmware.bin")) print ("Firmware has been successfully uploaded.\n" "Please restart your board.") env = DefaultEnvironment() SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) # # Target: Build executable and linkable firmware # target_elf = env.BuildFirmware() # # Target: Build the .bin file # if "uploadlazy" in COMMAND_LINE_TARGETS: target_firm = join("$BUILD_DIR", "firmware.bin")
# 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. """ PULP SDK Runtime Environment for Parallel Ultra Low Power platform https://github.com/pulp-platform/pulp-runtime """ import os from SCons.Script import DefaultEnvironment env = DefaultEnvironment() platform = env.PioPlatform() RUNTIME_DIR = platform.get_package_dir("framework-pulp-runtime") assert os.path.isdir(RUNTIME_DIR) board_config = env.BoardConfig() env.SConscript("_bare.py") env.Append(ASPPFLAGS=[ "-DLANGUAGE_ASSEMBLY", "-include", "chips/pulpissimo/config.h", ], CCFLAGS=[
# 2) Build the upload command # 3) Exit and let upload tool do the work # # This script runs between completion of the library/dependencies installation and compilation. # # Will continue on if a COM port isn't found so that the compilation can be done. # import subprocess import os import sys from SCons.Script import DefaultEnvironment import platform current_OS = platform.system() env = DefaultEnvironment() build_type = os.environ.get("BUILD_TYPE", 'Not Set') if not(build_type == 'upload' or build_type == 'traceback' or build_type == 'Not Set') : env.Replace(UPLOAD_PROTOCOL = 'teensy-gui') # run normal Teensy2 scripts else: com_first = '' com_last = '' com_CDC = '' description_first = '' description_last = '' description_CDC = '' #
17xx parts, Atmel SAM3, Energy Micro EFM32 and others. http://www.libopencm3.org/wiki/Main_Page """ from __future__ import absolute_import import re from os import listdir, sep, walk from os.path import isdir, isfile, join, normpath from SCons.Script import DefaultEnvironment from platformio.util import exec_command env = DefaultEnvironment() FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-libopencm3") assert isdir(FRAMEWORK_DIR) def find_ldscript(src_dir): ldscript = None matches = [] for item in sorted(listdir(src_dir)): _path = join(src_dir, item) if not isfile(_path) or not item.endswith(".ld"): continue matches.append(_path) if len(matches) == 1:
""" 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 join from SCons.Script import DefaultEnvironment env = DefaultEnvironment() env.Replace( PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-spl") ) env.VariantDirWrap( join("$BUILD_DIR", "FrameworkSPLInc"), join("$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}", "variants", "${BOARD_OPTIONS['build']['variant']}", "inc") ) env.Append( CPPPATH=[ join("$BUILD_DIR", "FrameworkSPLInc"), join("$BUILD_DIR", "FrameworkSPL")
# WizIO 2018 Georgi Angelov # http://www.wizio.eu/ # https://github.com/Wiz-IO from SCons.Script import DefaultEnvironment env = DefaultEnvironment() print("Running teensy.py") platform = "teensy" module = platform + "-" + env.BoardConfig().get("build.core") m = __import__(module) globals()[module] = m m.dev_init(env, platform) #print( env.Dump() )
firmware library for various ARM Cortex-M0(+)/M3/M4 microcontrollers, including ST STM32, Ti Tiva and Stellaris, NXP LPC 11xx, 13xx, 15xx, 17xx parts, Atmel SAM3, Energy Micro EFM32 and others. http://www.libopencm3.org/wiki/Main_Page """ import re from os import listdir, sep, walk from os.path import isfile, join, normpath from SCons.Script import DefaultEnvironment from platformio.util import exec_command env = DefaultEnvironment() env.Replace( PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-libopencm3") ) BOARD_BUILDOPTS = env.get("BOARD_OPTIONS", {}).get("build", {}) def find_ldscript(src_dir): ldscript = None matches = [] for item in sorted(listdir(src_dir)): _path = join(src_dir, item) if not isfile(_path) or not item.endswith(".ld"): continue
""" 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://www.stm32duino.com """ from os import listdir from os.path import join from SCons.Script import DefaultEnvironment env = DefaultEnvironment() mcu = env.BoardConfig().get("build.mcu") variant = env.BoardConfig().get("build.variant") core_variant_dir = join(env.PioPlatform().get_package_dir( "framework-arduinoststm32"), "STM32", "variants") if variant in listdir(core_variant_dir): env.SConscript("arduino/stm32duino.py") elif variant == "elkrem": env.SConscript("arduino/elkrem.py") else: # STM32 legacy core supported families if "f1" in mcu: env.SConscript("arduino/maple/stm32f1.py") elif "f4" in mcu:
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") and env.subst("$UPLOAD_PROTOCOL") == "sam-ba"): env.Replace(UPLOAD_PORT=basename(env.subst("$UPLOAD_PORT"))) env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() upload_protocol = env.subst("$UPLOAD_PROTOCOL") build_mcu = env.get("BOARD_MCU", board.get("build.mcu", "")) 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",
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 """ # Extends: https://github.com/platformio/platform-espressif32/blob/develop/builder/main.py from os.path import isdir, join from SCons.Script import DefaultEnvironment env = DefaultEnvironment() platform = env.PioPlatform() FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") assert isdir(FRAMEWORK_DIR) env.Prepend( CPPDEFINES=[("ARDUINO", 10610), "ARDUINO_ARCH_ESP32"], CFLAGS=["-Wno-old-style-declaration"], CCFLAGS=[ "-Wno-error=deprecated-declarations", "-Wno-unused-parameter", "-Wno-sign-compare" ], CPPPATH=[ join(FRAMEWORK_DIR, "tools", "sdk", "include", "config"), join(FRAMEWORK_DIR, "tools", "sdk", "include", "bluedroid"),
""" 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://www.stm32duino.com """ from os.path import isdir, join from SCons.Script import DefaultEnvironment env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() FRAMEWORK_DIR = join(platform.get_package_dir( "framework-arduinoststm32"), "STM32F4") assert isdir(FRAMEWORK_DIR) # default configuration values error_led_port = "GPIOA" error_led_pin = 7 # remap board configuration values mcu_type = board.get("build.mcu")[:-2] if "stm32f407ve" in mcu_type: ldscript = "jtag.ld"
from SCons.Script import DefaultEnvironment def scons_patched_match_splitext(path, suffixes=None): """ Patch SCons Builder, append $OBJSUFFIX to the end of each target """ tokens = Util.splitext(path) if suffixes and tokens[1] and tokens[1] in suffixes: return (path, tokens[1]) return tokens Builder.match_splitext = scons_patched_match_splitext env = DefaultEnvironment() platform = env.PioPlatform() FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif8266") assert isdir(FRAMEWORK_DIR) env.Append( ASFLAGS=["-x", "assembler-with-cpp"], CFLAGS=[ "-std=gnu99", "-Wpointer-arith", "-Wno-implicit-function-declaration", "-Wl,-EL", "-fno-inline-functions", "-nostdlib" ], CCFLAGS=[ "-Os", # optimize for size "-mlongcalls", "-mtext-section-literals",