Navigation Menu

Skip to content

Commit

Permalink
Fix firmware uploading for "nordicrf51" development platform // Resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Nov 2, 2015
1 parent 96f4667 commit 306b0a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion HISTORY.rst
Expand Up @@ -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)
~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 2 additions & 2 deletions platformio/builder/scripts/nordicnrf51.py
Expand Up @@ -25,9 +25,9 @@
#

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
Expand Down
9 changes: 6 additions & 3 deletions platformio/builder/tools/pioupload.py
@@ -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

Expand Down Expand Up @@ -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.")

Expand Down

0 comments on commit 306b0a2

Please sign in to comment.