"$PROJECTDATA_DIR")
        env.NoCache(target_firm)
        AlwaysBuild(target_firm)
    else:
        target_firm = env.ElfToBin(join("$BUILD_DIR", "${PROGNAME}"),
                                   target_elf)

env.AddPlatformTarget("buildfs", target_firm, None, "Build Filesystem Image")
AlwaysBuild(env.Alias("nobuild", target_firm))
target_buildprog = env.Alias("buildprog", target_firm, target_firm)

# update max upload size based on CSV file
if env.get("PIOMAINPROG"):
    env.AddPreAction(
        "checkprogsize",
        env.VerboseAction(
            lambda source, target, env: _update_max_upload_size(env),
            "Retrieving maximum program size $SOURCES"))
# remove after PIO Core 3.6 release
elif set(["checkprogsize", "upload"]) & set(COMMAND_LINE_TARGETS):
    _update_max_upload_size(env)

#
# Target: Print binary size
#

target_size = env.AddPlatformTarget(
    "size",
    target_elf,
    env.VerboseAction("$SIZEPRINTCMD", "Calculating size $SOURCE"),
    "Program Size",
Beispiel #2
0
#!/bin/python

import subprocess
import socket
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()


def before_build_spiffs(source, target, env):
    env.Execute("gulp")


env.AddPreAction(".pioenvs/%s/spiffs.bin" % env['PIOENV'], before_build_spiffs)
Beispiel #3
0
##############################################################################

# Checking program size
if env.get("SIZETOOL") and "nobuild" not in COMMAND_LINE_TARGETS:
    env.Depends(["upload", "program"], "checkprogsize")
    # Replace platform's "size" target with our
    _new_targets = [t for t in DEFAULT_TARGETS if str(t) != "size"]
    Default(None)
    Default(_new_targets)
    Default("checkprogsize")

# Print configured protocols
env.AddPreAction(
    ["upload", "program"],
    env.VerboseAction(
        lambda source, target, env: env.PrintUploadInfo(),
        "Configuring upload protocol...",
    ),
)

AlwaysBuild(env.Alias("debug", DEFAULT_TARGETS))
AlwaysBuild(env.Alias("__test", DEFAULT_TARGETS))

##############################################################################

if "envdump" in COMMAND_LINE_TARGETS:
    click.echo(env.Dump())
    env.Exit(0)

if "idedata" in COMMAND_LINE_TARGETS:
    Import("projenv")
Import("env")

# Consider possible security implications associated with call module.
# from subprocess import call
from SCons.Script import DefaultEnvironment

# Version tagging action


def before_build(source, target, env):
    env.Append(PLATFORMIO_BUILD_FLAGS=[
        "-DTHX_REVISION=$(git describe --abbrev=4 --dirty --always --tags)"
    ])  # General options that are passed to the C and C++ compilers.

    #call(["SET", "PLATFORMIO_BUILD_FLAGS=\"-DTHX_REVISION=$(git describe --abbrev=4 --dirty --always --tags)\""])

    print "extra_script.py action > before_build"
    print env.Dump()
    print "Current build targets", map(str, BUILD_TARGETS)


env = DefaultEnvironment()
env.AddPreAction("buildprog", before_build)
env.Append(PLATFORMIO_BUILD_FLAGS=[
    "-DTHX_REVISION=$(git describe --abbrev=4 --dirty --always --tags)"
])  # General options that are passed to the C and C++ compilers.
print env.Dump()
Beispiel #5
0
import os
from SCons.Script import (AlwaysBuild, Builder, DefaultEnvironment, Exit,
                          Environment, Default, Glob, COMMAND_LINE_TARGETS,
                          GetOption)

env = DefaultEnvironment()

piopackages_dir = env.subst('$PLATFORMIO_SRC_DIR');

def before_build(source, target, env):
    print "# Before Build #"
    # Must store pinouts locally and move before each build to prevent overwrite
    # on update.
    print " > Moving Pinouts"
    os.rename("$PIO_SRC_DIR/../pins/m168pb16m/m168pb16m.h", "$PIO_SRC_DIR/../pins/m168pb16m.h")
    #~/.platformio/packages/framework-arduinoavr/variants/
    print "### > Pinouts Moved."

env.AddPreAction("upload", before_build)
env.AddPreAction("buildprog", before_build)
#!/bin/python

import sys

from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()


def before_upload(source, target, env):
    cmd = "bean program_sketch %s -n %s" % (source[0], env['UPLOAD_PORT'])
    env.Execute(cmd)
    sys.exit(0)


env.AddPreAction("upload", before_upload)
Beispiel #7
0
for file in glob.iglob('src/*.*'):
    print 'Copied file %s' % (file)
    shutil.copy2(file, "lib-dev/CMMC_Legend")


def before_upload(source, target, env):
    print "before_upload"


def after_upload(source, target, env):
    print "after_upload"
    # shutil.rmtree("lib-dev/CMMC_Utils")


def before_build(source, target, env):
    print "before_build"


def upload_fs(source, target, env):
    print "upload_fs"
    print source
    print target
    # print env.Dump()


print "Current build targets", map(str, BUILD_TARGETS)

env.AddPreAction("upload", before_upload)
env.AddPreAction("uploadfs", upload_fs)
env.AddPostAction("upload", after_upload)
env.AddPreAction("buildprog", before_build)
Beispiel #8
0
                if os.path.exists(file):
                    print file
                    gzFile(file)


# remove 'data' folder after upload
def after_uploadfs(source, target, env):
    print "after_uploadfs"
    rmtree(data)


env = DefaultEnvironment()
options = base64.b64decode(ARGUMENTS.get("CUSTOM_OPTION"))

# Set parameters from environment variables
data = env['PROJECT_DIR'] + "/data/"
www = env['PROJECT_DIR'] + "/www/"

# Show parameters
print data
print www
print options

# Only run when building & uploading SPIFFS image
#env.AddPreAction("buildfs", before_buildfs)
env.AddPreAction("$BUILD_DIR/spiffs.bin", before_buildfs)
env.AddPostAction("uploadfs", after_uploadfs)

#if 'SPIFFS_START' in env:
#   before_buildfs("","buildfs",env)