diff --git a/HISTORY.rst b/HISTORY.rst index 50a7cea1..28c99fe6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -18,7 +18,9 @@ PlatformIO 2.0 * Fixed handling of upload port when ``board`` option is not specified in `platformio.ini `__ (`issue #313 `_) - +* Fixed firmware uploading for `nordicrf51 `__ + development platform + (`issue #316 `_) 2.3.4 (2015-10-13) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/scripts/nordicnrf51.py b/platformio/builder/scripts/nordicnrf51.py index caed2f55..0abdf698 100644 --- a/platformio/builder/scripts/nordicnrf51.py +++ b/platformio/builder/scripts/nordicnrf51.py @@ -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 diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 4a416c09..bb606d5e 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # 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.")