Skip to content

Commit

Permalink
Fix firmware uploading to Arduino/Genuino 101 // Resolve #695
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Jun 15, 2016
1 parent cdcf075 commit 682e435
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion platformio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import sys

VERSION = (2, 10, "2.dev0")
VERSION = (2, 10, "2.dev1")
__version__ = ".".join([str(s) for s in VERSION])

__title__ = "platformio"
Expand Down
3 changes: 2 additions & 1 deletion platformio/boards/intel.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"maximum_ram_size": 81920,
"maximum_size": 155648,
"protocol": "script",
"require_upload_port" : true
"require_upload_port" : true,
"use_1200bps_touch": true
},
"url": "https://www.arduino.cc/en/Main/ArduinoBoard101",
"vendor": "Intel"
Expand Down
10 changes: 9 additions & 1 deletion platformio/builder/scripts/intel_arc32.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@

env = DefaultEnvironment()


def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621

if env.get("BOARD_OPTIONS", {}).get("upload", {}).get(
"use_1200bps_touch", False):
env.TouchSerialPort("$UPLOAD_PORT", 1200)


env.Replace(
AR="arc-elf32-ar",
AS="arc-elf32-as",
Expand Down Expand Up @@ -178,7 +186,7 @@
#

upload = env.Alias(["upload", "uploadlazy"], target_firm,
[env.AutodetectUploadPort, "$UPLOADCMD"])
[env.AutodetectUploadPort, BeforeUpload, "$UPLOADCMD"])
AlwaysBuild(upload)

#
Expand Down
6 changes: 4 additions & 2 deletions platformio/builder/tools/pioupload.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ def FlushSerialBuffer(env, port):


def TouchSerialPort(env, port, baudrate):
port = env.subst(port)
print "Forcing reset using %dbps open/close on port %s" % (baudrate, port)
if system() != "Windows":
try:
s = Serial(env.subst(port))
s = Serial(port)
s.close()
except: # pylint: disable=W0702
pass
s = Serial(port=env.subst(port), baudrate=baudrate)
s = Serial(port=port, baudrate=baudrate)
s.setDTR(False)
s.close()
sleep(0.4)
Expand Down

0 comments on commit 682e435

Please sign in to comment.