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")))
|
||||
@@ -49,7 +40,7 @@ AlwaysBuild(target_size)
|
||||
# Target: Upload by default .bin file
|
||||
#
|
||||
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_firm, UploadToDisk)
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_firm, env.UploadToDisk)
|
||||
AlwaysBuild(upload)
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user