Fix firmware uploading for "nordicrf51" development platform // Resolve #316

This commit is contained in:
Ivan Kravets
2015-11-02 23:03:05 +02:00
parent 96f4667755
commit 306b0a2f62
3 changed files with 11 additions and 6 deletions

View File

@ -18,7 +18,9 @@ PlatformIO 2.0
* Fixed handling of upload port when ``board`` option is not specified in
`platformio.ini <http://docs.platformio.org/en/latest/projectconf.html>`__
(`issue #313 <https://github.com/platformio/platformio/issues/313>`_)
* Fixed firmware uploading for `nordicrf51 <http://docs.platformio.org/en/latest/platforms/nordicnrf51.html>`__
development platform
(`issue #316 <https://github.com/platformio/platformio/issues/316>`_)
2.3.4 (2015-10-13)
~~~~~~~~~~~~~~~~~~

View File

@ -25,9 +25,9 @@ target_elf = env.BuildProgram()
#
if "uploadlazy" in COMMAND_LINE_TARGETS:
target_firm = join("$BUILD_DIR", "firmware.bin")
target_firm = join("$BUILD_DIR", "firmware.hex")
else:
target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
target_firm = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
#
# Target: Print binary size

View File

@ -1,7 +1,7 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os.path import join
from os.path import join, isfile
from shutil import copyfile
from time import sleep
@ -95,8 +95,11 @@ def AutodetectUploadPort(env):
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"))
for ext in ("bin", "hex"):
fpath = join(env.subst("$BUILD_DIR"), "firmware.%s" % ext)
if not isfile(fpath):
continue
copyfile(fpath, join(env.subst("$UPLOAD_PORT"), "firmware.%s" % ext))
print ("Firmware has been successfully uploaded.\n"
"Please restart your board.")