forked from platformio/platformio-core
Fix firmware uploading to Arduino/Genuino 101 // Resolve #695
This commit is contained in:
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -23,6 +23,14 @@ from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||
|
||||
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",
|
||||
@ -178,7 +186,7 @@ AlwaysBuild(target_size)
|
||||
#
|
||||
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_firm,
|
||||
[env.AutodetectUploadPort, "$UPLOADCMD"])
|
||||
[env.AutodetectUploadPort, BeforeUpload, "$UPLOADCMD"])
|
||||
AlwaysBuild(upload)
|
||||
|
||||
#
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user