Minor fixes; full support of Windows

This commit is contained in:
Ivan Kravets
2014-06-11 21:31:36 +03:00
parent f5e452aaaf
commit bd3e0a9075
10 changed files with 29 additions and 14 deletions

View File

@@ -4,6 +4,7 @@ board_mcu = atmega168
board_f_cpu = 16000000L board_f_cpu = 16000000L
upload_port = /dev/tty.SLAB_USBtoUART upload_port = /dev/tty.SLAB_USBtoUART
; upload_port = COM3
upload_protocol = arduino upload_protocol = arduino
upload_speed = 19200 upload_speed = 19200

View File

@@ -51,7 +51,7 @@ if not isdir(env['PLATFORMIOHOME_DIR']):
"`platformio install` command") "`platformio install` command")
elif not isdir(env.subst("$PLATFORM_DIR")): elif not isdir(env.subst("$PLATFORM_DIR")):
Exit("An '%s' platform hasn't been installed yet. Please use " Exit("An '%s' platform hasn't been installed yet. Please use "
"`platformio install %s` command" % (env['PLATFORM'].upper(), "`platformio install %s` command" % (env['PLATFORM'],
env['PLATFORM'])) env['PLATFORM']))
SConscriptChdir(0) SConscriptChdir(0)

View File

@@ -15,7 +15,7 @@ env = DefaultEnvironment()
env.Replace( env.Replace(
AR="avr-ar", AR="avr-ar",
AS="avr-as", AS="avr-gcc",
CC="avr-gcc", CC="avr-gcc",
CXX="avr-g++", CXX="avr-g++",
OBJCOPY="avr-objcopy", OBJCOPY="avr-objcopy",

View File

@@ -11,11 +11,13 @@ from os.path import join
from SCons.Script import (AlwaysBuild, Builder, Default, DefaultEnvironment, from SCons.Script import (AlwaysBuild, Builder, Default, DefaultEnvironment,
SConscript, SConscriptChdir) SConscript, SConscriptChdir)
from platformio.util import get_system
env = DefaultEnvironment() env = DefaultEnvironment()
env.Replace( env.Replace(
AR="msp430-ar", AR="msp430-ar",
AS="msp430-as", AS="msp430-gcc",
CC="msp430-gcc", CC="msp430-gcc",
CXX="msp430-g++", CXX="msp430-g++",
OBJCOPY="msp430-objcopy", OBJCOPY="msp430-objcopy",
@@ -49,7 +51,7 @@ env.Replace(
UPLOADER=join("$PLATFORMTOOLS_DIR", "mspdebug", "mspdebug"), UPLOADER=join("$PLATFORMTOOLS_DIR", "mspdebug", "mspdebug"),
UPLOADERFLAGS=[ UPLOADERFLAGS=[
"$UPLOAD_PROTOCOL", "$UPLOAD_PROTOCOL" if get_system() != "windows32" else "tilib",
"--force-reset" "--force-reset"
], ],
UPLOADCMD='$UPLOADER $UPLOADERFLAGS "prog $SOURCES"' UPLOADCMD='$UPLOADER $UPLOADERFLAGS "prog $SOURCES"'

View File

@@ -15,7 +15,7 @@ env = DefaultEnvironment()
env.Replace( env.Replace(
AR="arm-none-eabi-ar", AR="arm-none-eabi-ar",
AS="arm-none-eabi-as", AS="arm-none-eabi-gcc",
CC="arm-none-eabi-gcc", CC="arm-none-eabi-gcc",
CXX="arm-none-eabi-g++", CXX="arm-none-eabi-g++",
OBJCOPY="arm-none-eabi-objcopy", OBJCOPY="arm-none-eabi-objcopy",
@@ -25,7 +25,7 @@ env.Replace(
ASFLAGS=[ ASFLAGS=[
"-g", # include debugging info (so errors include line numbers) "-g", # include debugging info (so errors include line numbers)
"-x", "-assembler-with-cpp", "-x", "assembler-with-cpp",
"-Wall", "-Wall",
"-mthumb", "-mthumb",
"-mcpu=cortex-m4", "-mcpu=cortex-m4",

View File

@@ -65,14 +65,20 @@ class FileDownloader(object):
if not sha1: if not sha1:
return return
dlsha1 = None
try: try:
res = check_output(["shasum", self._destination]) res = check_output(["sha1sum", self._destination])
dlsha1 = res[:40]
except OSError:
try:
res = check_output(["shasum", "-a", "1", self._destination])
dlsha1 = res[:40] dlsha1 = res[:40]
if sha1 != dlsha1:
raise FDSHASumMismatch(dlsha1, self._fname, sha1)
except OSError: except OSError:
pass pass
if dlsha1 and sha1 != dlsha1:
raise FDSHASumMismatch(dlsha1, self._fname, sha1)
def _preserve_filemtime(self, lmdate): def _preserve_filemtime(self, lmdate):
timedata = parsedate_tz(lmdate) timedata = parsedate_tz(lmdate)
lmtime = mktime(timedata[:9]) lmtime = mktime(timedata[:9])

View File

@@ -10,7 +10,7 @@ class TitivaPlatform(BasePlatform):
PACKAGES = { PACKAGES = {
"toolchain-titiva": { "toolchain-gccarmnoneeabi": {
"path": join("tools", "toolchain"), "path": join("tools", "toolchain"),
"default": True "default": True
}, },
@@ -22,7 +22,7 @@ class TitivaPlatform(BasePlatform):
"framework-energiativa": { "framework-energiativa": {
"path": join("frameworks", "energia"), "path": join("frameworks", "energia"),
"default": False "default": True
} }
} }

View File

@@ -44,6 +44,7 @@ def change_filemtime(path, time):
def exec_command(args): def exec_command(args):
p = Popen(args, stdout=PIPE, stderr=PIPE) use_shell = get_system() == "windows32"
p = Popen(args, stdout=PIPE, stderr=PIPE, shell=use_shell)
out, err = p.communicate() out, err = p.communicate()
return dict(out=out.strip(), err=err.strip()) return dict(out=out.strip(), err=err.strip())

View File

@@ -17,6 +17,7 @@ setup(
license=__license__, license=__license__,
install_requires=[ install_requires=[
"click", "click",
"colorama",
"pyserial", "pyserial",
"requests", "requests",
# "SCons" # "SCons"

View File

@@ -1,5 +1,7 @@
[tox] [tox]
envlist = develop, lint # toxworkdir = /tmp/.tox
# toxworkdir = C:\Users\User\Downloads\.tox
envlist = lint
[testenv] [testenv]
envlogdir = /tmp/toxlogdir envlogdir = /tmp/toxlogdir
@@ -12,6 +14,8 @@ usedevelop = True
deps = deps =
isort isort
flake8 flake8
commands =
pip install --egg scons
[testenv:lint] [testenv:lint]
deps = deps =