Improve uploading firmware to mbed-enabled mass storages

This commit is contained in:
Ivan Kravets
2015-03-13 00:02:31 +02:00
parent cd06f3ed43
commit f4c21be953
8 changed files with 47 additions and 38 deletions

View File

@@ -6,19 +6,10 @@
"""
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")))
@@ -73,7 +64,8 @@ AlwaysBuild(target_size)
#
if "mbed" in env.subst("$FRAMEWORK"):
upload = env.Alias(["upload", "uploadlazy"], target_firm, UploadToDisk)
upload = env.Alias(["upload", "uploadlazy"],
target_firm, env.UploadToDisk)
else:
upload = env.Alias(["upload", "uploadlazy"], target_firm, "$UPLOADCMD")
AlwaysBuild(upload)