forked from platformio/platformio-core
Improve uploading firmware to mbed-enabled mass storages
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user