diff --git a/.pylintrc b/.pylintrc index 5e3b1e69..bdf25c27 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,29 +1,9 @@ -[MASTER] - -# Specify a configuration file. -#rcfile= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Profiled execution. -profile=no - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Pickle collected data for later comparisons. -persistent=yes - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - - [MESSAGES CONTROL] +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED +confidence= + # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option # multiple time. See also the "--disable" option for examples. @@ -38,244 +18,6 @@ load-plugins= # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" -disable=C0103,C0111,E0611,F0401,I0011,R0801,R0903,R0922 +# disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating - -[REPORTS] - -# Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html. You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - -# Tells whether to display a full report or only the messages -reports=yes - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Add a comment according to your evaluation note. This is used by the global -# evaluation report (RP0004). -comment=no - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details -#msg-template= -msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg} - - -[BASIC] - -# Required attributes for module, separated by a comma -required-attributes= - -# List of builtins function names that should not be used, separated by a comma -bad-functions=map,filter,apply,input - -# Regular expression which should only match correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression which should only match correct module level names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression which should only match correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression which should only match correct function names -function-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct method names -method-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct attribute names in class -# bodies -class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Regular expression which should only match correct list comprehension / -# generator expression variable names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run,_ - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=__.*__ - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - - -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=80 - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=no - -# List of optional constructs for which whitespace checking is disabled -no-space-check=trailing-comma,dict-separator - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=4 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - -# Ignore imports when computing similarities. -ignore-imports=no - - -[TYPECHECK] - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# List of classes names for which member attributes should not be checked -# (useful for classes with attributes dynamically set). -ignored-classes=SQLObject - -# When zope mode is activated, add a predefined set of Zope acquired attributes -# to generated-members. -zope=no - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E0201 when accessed. Python regular -# expressions are accepted. -generated-members=REQUEST,acl_users,aq_parent - - -[VARIABLES] - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching the beginning of the name of dummy variables -# (i.e. not used). -dummy-variables-rgx=_$|dummy - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - - -[CLASSES] - -# List of interface methods to ignore, separated by a comma. This is used for -# instance to not check methods defines in Zope's Interface base class. -ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.* - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of branch for function / method body -max-branches=12 - -# Maximum number of statements in function / method body -max-statements=50 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - - -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,TERMIOS,Bastion,rexec - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception +disable=locally-disabled,missing-docstring,invalid-name,too-few-public-methods,redefined-variable-type,import-error,similarities,unsupported-membership-test,unsubscriptable-object,ungrouped-imports diff --git a/HISTORY.rst b/HISTORY.rst index 6ab8840d..652cbffd 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,25 @@ Release History PlatformIO 2.0 -------------- +2.4.0 (2015-12-01) +~~~~~~~~~~~~~~~~~~ + +* Added support for the new boards: Atmel ATSAMR21-XPRO, Atmel SAML21-XPRO-B, + Atmel SAMD21-XPRO, ST 32F469IDISCOVERY, ST 32L476GDISCOVERY, ST Nucleo F031K6, + ST Nucleo F042K6, ST Nucleo F303K8 and ST Nucleo L476RG +* Updated Arduino core for Espressif platform to 2.0.0 + (`issue #345 `_) +* Added to FAQ explanation of `Can not compile a library that compiles without issue + with Arduino IDE `_ + (`issue #331 `_) +* Fixed ESP-12E flash size + (`pull #333 `_) +* Fixed configuration for LowPowerLab MoteinoMEGA board + (`issue #335 `_) +* Fixed "LockFailed: failed to create appstate.json.lock" error for Windows +* Fixed relative include path for preprocessor using ``build_flags`` + (`issue #271 `_) + 2.3.5 (2015-11-18) ~~~~~~~~~~~~~~~~~~ diff --git a/README.rst b/README.rst index 5581be75..b637490f 100644 --- a/README.rst +++ b/README.rst @@ -32,7 +32,7 @@ PlatformIO `Home & Demo `_ | `Project Examples `_ | `Source Code `_ | -`Documentation `_ || +`Documentation `_ | `Blog `_ | `Twitter `_ | `Hackaday `_ | @@ -42,9 +42,20 @@ PlatformIO .. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-logo.png :target: http://platformio.org -`PlatformIO `_ is an open-source cross-platform code -builder and the missing library manager (Ready for embedded development, IDE -and Continuous integration, Arduino and MBED compatible). +`PlatformIO `_ is an open source ecosystem for IoT +development. Cross-platform code builder and library manager. Continuous and +IDE integration. Arduino and MBED compatible. Ready for Cloud compiling. + +* **Development Platforms** - Embedded and Desktop development platforms with + pre-built toolchains, debuggers, uploaders and frameworks which work under + popular host OS: Mac, Windows, Linux (+ARM) +* **Embedded Boards** - Rapid Embedded Programming, IDE and Continuous + Integration in a few steps with PlatformIO thanks to built-in project + generator for the most popular embedded boards and IDE +* **Library Manager** - Hundreds Popular Libraries are organized into single + Web 2.0 platform: list by categories, keywords, authors, compatible + platforms and frameworks; learn via examples; be up-to-date with the latest + version *Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC, Silicon Labs EFM32, ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed, @@ -66,15 +77,10 @@ libOpenCM3, etc.* * `FAQ `_ * `Release History `_ -You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO* -has pre-built different development platforms and pre-configured settings for -the most popular embedded boards. For further details, please -refer to `What is PlatformIO? `_ - Use whenever. *Run everywhere.* ------------------------------- *PlatformIO* is written in pure *Python* and **doesn't depend** on any -additional libraries/tools from an operation system. It allows you to use +additional libraries/tools from an operating system. It allows you to use *PlatformIO* beginning from *PC (Mac, Linux, Win)* and ending with credit-card sized computers (`Raspberry Pi `_, `BeagleBone `_, @@ -88,7 +94,7 @@ settings for most popular `Embedded Boards `_. * Colourful `command-line output `_ * `IDE Integration `_ with *Arduino, Eclipse, Energia, Qt Creator, Sublime Text, Vim, Visual Studio* -* `Continuous Integration `_ +* Cloud compiling and `Continuous Integration `_ with *AppVeyor, Circle CI, Drone, Shippable, Travis CI* * Built-in `Serial Port Monitor `_ and configurable `build -flags/-options `_ @@ -134,8 +140,8 @@ cross-platform substitute for the classic *Make* utility. Single source code. *Multiple platforms.* ----------------------------------------- -*PlatformIO* allows developer to compile the same code with different -development platforms using the *Only One Command* +*PlatformIO* allows the developer to compile the same code with different +development platforms using only *One Command* `platformio run `_. This happens due to `Project Configuration File (platformio.ini) `_ @@ -166,6 +172,7 @@ Frameworks: * `SPL `_ * `mbed `_ +For further details, please refer to `What is PlatformIO? `_ Licence ------- diff --git a/circle.yml b/circle.yml index a2ec6207..ccc55a3a 100644 --- a/circle.yml +++ b/circle.yml @@ -1,11 +1,6 @@ machine: python: version: 2.7 - environment: - TOX_ENV: docs - TOX_ENV: lint - TOX_ENV: py26 - TOX_ENV: py27 checkout: post: @@ -18,4 +13,4 @@ dependencies: test: override: - - tox -e $TOX_ENV + - tox -e py27 diff --git a/docs/_static/extra.css b/docs/_static/extra.css new file mode 100644 index 00000000..846e05d9 --- /dev/null +++ b/docs/_static/extra.css @@ -0,0 +1,254 @@ +/** + * Copyright 2014-2015 Ivan Kravets + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +header, +nav { + display: block; +} + +#pionav { + display: none; +} + +.container { + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} +@media (min-width: 768px) { + #pionav { + display: block !important; + } + body { + padding-top: 50px; + } + .wy-nav-side { + top: 50px; + } + .container { + width: 750px; + } +} +@media (min-width: 992px) { + .container { + width: 970px; + } +} +@media (min-width: 1200px) { + .container { + width: 1170px; + } +} +.container-fluid { + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} + +.container:before, +.container:after, +.container-fluid:before, +.container-fluid:after, +.nav:before, +.nav:after, +.navbar:before, +.navbar:after, +.navbar-header:before, +.navbar-header:after { + display: table; + content: " "; +} +.container:after, +.container-fluid:after, +.nav:after, +.navbar:after, +.navbar-header:after { + clear: both; +} + +.nav { + padding-left: 0; + margin-bottom: 0; + list-style: none; +} +.nav > li { + position: relative; + display: block; +} +.nav > li > a { + position: relative; + display: block; + padding: 10px 15px; +} +.nav > li > a:hover, +.nav > li > a:focus { + text-decoration: none; + background-color: #eee; +} +.nav > li > a > img { + max-width: none; +} + +.navbar { + position: relative; + min-height: 50px; + margin-bottom: 20px; + border: 1px solid transparent; +} +@media (min-width: 768px) { + .navbar { + border-radius: 4px; + } +} +@media (min-width: 768px) { + .navbar-header { + float: left; + } +} + +@media (min-width: 768px) { + .navbar-fixed-top { + padding-right: 0; + padding-left: 0; + } +} +.navbar-fixed-top { + max-height: 340px; +} +.container > .navbar-header, +.container-fluid > .navbar-header { + margin-right: -15px; + margin-left: -15px; +} +@media (min-width: 768px) { + .container > .navbar-header, + .container-fluid > .navbar-header { + margin-right: 0; + margin-left: 0; + } +} + +.navbar-fixed-top { + position: fixed; + right: 0; + left: 0; + z-index: 1030; +} +@media (min-width: 768px) { + .navbar-fixed-top { + border-radius: 0; + } +} +.navbar-fixed-top { + top: 0; + border-width: 0 0 1px; +} +.navbar-fixed-bottom { + bottom: 0; + margin-bottom: 0; + border-width: 1px 0 0; +} +.navbar-brand { + float: left; + height: 50px; + padding: 15px 15px; + font-size: 18px; + line-height: 20px; +} +.navbar-brand:hover, +.navbar-brand:focus { + text-decoration: none; +} +.navbar-brand > img { + display: block; +} +@media (min-width: 768px) { + .navbar > .container .navbar-brand, + .navbar > .container-fluid .navbar-brand { + margin-left: -15px; + } +} + +.navbar-nav { + margin: 7.5px -15px; +} +.navbar-nav > li > a { + padding-top: 10px; + padding-bottom: 10px; + line-height: 20px; +} +@media (min-width: 768px) { + .navbar-nav { + float: left; + margin: 0; + } + .navbar-nav > li { + float: left; + } + .navbar-nav > li > a { + padding-top: 15px; + padding-bottom: 15px; + } +} + +@media (min-width: 768px) { + .navbar-left { + float: left !important; + } + .navbar-right { + float: right !important; + margin-right: -15px; + } + .navbar-right ~ .navbar-right { + margin-right: 0; + } +} + +.navbar-inverse { + background-color: #222; + border-color: #080808; +} +.navbar-inverse .navbar-brand { + color: #9d9d9d; +} +.navbar-inverse .navbar-brand:hover, +.navbar-inverse .navbar-brand:focus { + color: #fff; + background-color: transparent; +} +.navbar-inverse .navbar-text { + color: #9d9d9d; +} +.navbar-inverse .navbar-nav > li > a { + color: #9d9d9d; +} +.navbar-inverse .navbar-nav > li > a:hover, +.navbar-inverse .navbar-nav > li > a:focus { + color: #fff; + background-color: transparent; +} +.navbar-inverse .navbar-nav > .active > a, +.navbar-inverse .navbar-nav > .active > a:hover, +.navbar-inverse .navbar-nav > .active > a:focus { + color: #fff; + background-color: #080808; +} + +.navbar-header .navbar-brand { + color: #e0e0e0; +} diff --git a/docs/_static/favicon.ico b/docs/_static/favicon.ico new file mode 100644 index 00000000..2dd9609c Binary files /dev/null and b/docs/_static/favicon.ico differ diff --git a/docs/_static/platformio-logo.png b/docs/_static/platformio-logo.png index 8cbe937a..a8b025d5 100644 Binary files a/docs/_static/platformio-logo.png and b/docs/_static/platformio-logo.png differ diff --git a/docs/_templates/footer.html b/docs/_templates/footer.html new file mode 100644 index 00000000..b10e6ac0 --- /dev/null +++ b/docs/_templates/footer.html @@ -0,0 +1,31 @@ +{% extends "!footer.html" %} + +{% block extrafooter %} + + +{{ super() }} +{% endblock %} diff --git a/docs/articles.rst b/docs/articles.rst index 26b5291e..8e2262a5 100644 --- a/docs/articles.rst +++ b/docs/articles.rst @@ -23,10 +23,14 @@ Here are recent articles about PlatformIO: 2015 ^^^^ +* Nov 29, 2015 - **Keith Hughes** - `Using PlatformIO for Embedded Projects `_ +* Nov 22, 2015 - **Michał Seroczyński** - `Using PlatformIO to get started with Arduino in CLion IDE `_ * Nov 09, 2015 - **ÁLvaro García Gómez** - `Programar con Arduino "The good way" (Programming with Arduino "The good way", Spanish) `_ * Nov 06, 2015 - **nocd5** - `PlatformIOでmbedをオフラインビルドしSTM32 Nucleoボードでmrubyを使う (Use mruby in the offline build for STM32 Nucleo board with mbed and PlatformIO, Japanese) `_ * Oct 18, 2015 - **Nico Coetzee** - `First Arduino I2C Experience with PlatformIO `_ +* Oct 01, 2015 - **Mistan** - `Compile and Upload Arduino Sketch with PlatformIO for Raspberry Pi Running Arch Linux `_ * Sep 01, 2015 - **Thomas P. Weldon, Ph.D.** - `Improvised MBED FRDM-K64F Eclipse/PlatformIO Setup and Software Installation `_ +* Aug 08, 2015 - **Josh Glendenning** - `Armstrap Eagle and PlatformIO `_ * Aug 01, 2015 - **Russell Davis** - `PlatformIO on the Raspberry Pi `_ * Jul 25, 2015 - **DinoTools** - `Erste Schritte mit PlatformIO (Getting Started with PlatformIO, German) `_ * Jul 20, 2015 - **Eli Fatsi** - `Arduino Development in Atom Editor `_ diff --git a/docs/ci/circleci.rst b/docs/ci/circleci.rst index 773d7769..dd87976c 100644 --- a/docs/ci/circleci.rst +++ b/docs/ci/circleci.rst @@ -37,49 +37,169 @@ different :ref:`platforms`. Integration ----------- -Put ``circle.yml`` to the root directory of the GitHub repository. +Please make sure to read Circle CI `Getting Started `_ +guide first. + +.. code-block:: yaml + + dependencies: + pre: + # Install the latest stable PlatformIO + - sudo pip install -U platformio + + test: + override: + - platformio ci path/to/test/file.c --board=TYPE_1 --board=TYPE_2 --board=TYPE_N + - platformio ci examples/file.ino --board=TYPE_1 --board=TYPE_2 --board=TYPE_N + - platformio ci path/to/test/directory --board=TYPE_1 --board=TYPE_2 --board=TYPE_N + + +For more details as for PlatformIO build process please look into :ref:`cmd_ci`. + +Project as a library +~~~~~~~~~~~~~~~~~~~~ + +When project is written as a library (where own examples or testing code use +it), please use ``--lib="."`` option for :ref:`cmd_ci` command + +.. code-block:: yaml + + script: + - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N + +Library dependecies +~~~~~~~~~~~~~~~~~~~ + +There 2 options to test source code with dependent libraries: + +Install dependent library using :ref:`librarymanager` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: yaml + + dependencies: + pre: + # Install the latest stable PlatformIO + - sudo pip install -U platformio + + # OneWire Library with ID=1 http://platformio.org/#!/lib/show/1/OneWire + - platformio lib install 1 + + test: + override: + - platformio ci path/to/test/file.c --board=TYPE_1 --board=TYPE_2 --board=TYPE_N + +Manually download dependent library and include in build process via ``--lib`` option +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: yaml + + dependencies: + pre: + # Install the latest stable PlatformIO + - sudo pip install -U platformio + + # download library to the temporary directory + - wget https://github.com/PaulStoffregen/OneWire/archive/master.zip -O /tmp/onewire_source.zip + - unzip /tmp/onewire_source.zip -d /tmp/ + + test: + override: + - platformio ci path/to/test/file.c --lib="/tmp/OneWire-master" --board=TYPE_1 --board=TYPE_2 --board=TYPE_N + +Custom Build Flags +~~~~~~~~~~~~~~~~~~ + +PlatformIO allows to specify own build flags using :envvar:`PLATFORMIO_BUILD_FLAGS` environment .. code-block:: yaml machine: environment: - PLATFORMIO_CI_SRC: path/to/source/file.c - PLATFORMIO_CI_SRC: path/to/source/file.ino - PLATFORMIO_CI_SRC: path/to/source/directory + PLATFORMIO_BUILD_FLAGS: -D SPECIFIC_MACROS -I/extra/inc - dependencies: - pre: - - sudo apt-get install python2.7-dev - - sudo python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)" + +For the more details, please follow to +:ref:`available build flags/options `. + + +Advanced configuration +~~~~~~~~~~~~~~~~~~~~~~ + +PlatformIO allows to configure multiple build environments for the single +source code using :ref:`projectconf`. + +Instead of ``--board`` option, please use :option:`platformio ci --project-conf` + +.. code-block:: yaml test: override: - - platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N - - -For more details as for PlatformIO build process please look into :ref:`cmd_ci` -command. + - platformio ci path/to/test/file.c --project-conf=/path/to/platoformio.ini Examples -------- -1. Integration for `USB_Host_Shield_2.0 `_ - project. The ``circle.yml`` configuration file: +1. Custom build flags .. code-block:: yaml - machine: - environment: - PLATFORMIO_CI_SRC: examples/Bluetooth/PS3SPP/PS3SPP.ino - PLATFORMIO_CI_SRC: examples/pl2303/pl2303_gps/pl2303_gps.ino - dependencies: + cache_directories: + - "~/.platformio" + pre: - - sudo apt-get install python2.7-dev - - sudo python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)" - - wget https://github.com/xxxajk/spi4teensy3/archive/master.zip -O /tmp/spi4teensy3.zip - - unzip /tmp/spi4teensy3.zip -d /tmp + - sudo pip install -U platformio + + # pre-install PlatformIO development platforms, they will be cached + - platformio platforms install atmelavr atmelsam teensy + + # + # Libraries from PlatformIO Library Registry: + # + # http://platformio.org/#!/lib/show/416/TinyGPS + # http://platformio.org/#!/lib/show/417/SPI4Teensy3 + - platformio lib install 416 417 test: override: - - platformio ci --lib="." --lib="/tmp/spi4teensy3-master" --board=uno --board=teensy31 --board=due + - platformio ci examples/acm/acm_terminal --board=uno --board=teensy31 --board=due --lib="." + - platformio ci examples/adk/adk_barcode --board=uno --board=teensy31 --board=due --lib="." + - platformio ci examples/adk/ArduinoBlinkLED --board=uno --board=teensy31 --board=due --lib="." + - platformio ci examples/adk/demokit_20 --board=uno --board=teensy31 --board=due --lib="." + # ... + - platformio ci examples/Xbox/XBOXUSB --board=uno --board=teensy31 --board=due --lib="." + +* Configuration file: https://github.com/ivankravets/USB_Host_Shield_2.0/blob/master/circle.yml +* Build History: https://circleci.com/gh/ivankravets/USB_Host_Shield_2.0/tree/master + +2. Dependency on external libraries + +.. code-block:: yaml + + dependencies: + pre: + # Install the latest stable PlatformIO + - sudo pip install -U platformio + + # download dependent libraries + - wget https://github.com/jcw/jeelib/archive/master.zip -O /tmp/jeelib.zip + - unzip /tmp/jeelib.zip -d /tmp + + - wget https://github.com/Rodot/Gamebuino/archive/master.zip -O /tmp/gamebuino.zip + - unzip /tmp/gamebuino.zip -d /tmp + + test: + override: + - platformio ci examples/backSoon/backSoon.ino --lib="." --lib="/tmp/jeelib-master" --lib="/tmp/Gamebuino-master/libraries/tinyFAT" --board=uno --board=megaatmega2560 + - platformio ci examples/etherNode/etherNode.ino --lib="." --lib="/tmp/jeelib-master" --lib="/tmp/Gamebuino-master/libraries/tinyFAT" --board=uno --board=megaatmega2560 + - platformio ci examples/getDHCPandDNS/getDHCPandDNS.ino --lib="." --lib="/tmp/jeelib-master" --lib="/tmp/Gamebuino-master/libraries/tinyFAT" --board=uno --board=megaatmega2560 + - platformio ci examples/getStaticIP/getStaticIP.ino --lib="." --lib="/tmp/jeelib-master" --lib="/tmp/Gamebuino-master/libraries/tinyFAT" --board=uno --board=megaatmega2560 + # ... + - platformio ci examples/twitter/twitter.ino --lib="." --lib="/tmp/jeelib-master" --lib="/tmp/Gamebuino-master/libraries/tinyFAT" --board=uno --board=megaatmega2560 + - platformio ci examples/udpClientSendOnly/udpClientSendOnly.ino --lib="." --lib="/tmp/jeelib-master" --lib="/tmp/Gamebuino-master/libraries/tinyFAT" --board=uno --board=megaatmega2560 + - platformio ci examples/udpListener/udpListener.ino --lib="." --lib="/tmp/jeelib-master" --lib="/tmp/Gamebuino-master/libraries/tinyFAT" --board=uno --board=megaatmega2560 + - platformio ci examples/webClient/webClient.ino --lib="." --lib="/tmp/jeelib-master" --lib="/tmp/Gamebuino-master/libraries/tinyFAT" --board=uno --board=megaatmega2560 + +* Configuration file: hhttps://github.com/ivankravets/ethercard/blob/master/circle.yaml +* Build History: https://circleci.com/gh/ivankravets/ethercard/tree/master diff --git a/docs/conf.py b/docs/conf.py index b499869d..f73c94ea 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -119,12 +119,12 @@ html_theme = 'default' # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +#html_logo = '_static/platformio-logo.png' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +html_favicon = '_static/favicon.ico' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -184,22 +184,22 @@ htmlhelp_basename = 'PlatformIOdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', + # The paper size ('letterpaper' or 'a4paper'). + #'papersize': 'letterpaper', -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', + # The font size ('10pt', '11pt' or '12pt'). + #'pointsize': '10pt', -# Additional stuff for the LaTeX preamble. -#'preamble': '', + # Additional stuff for the LaTeX preamble. + #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'PlatformIO.tex', u'PlatformIO Documentation', - u'Ivan Kravets', 'manual'), + ('index', 'PlatformIO.tex', u'PlatformIO Documentation', + u'Ivan Kravets', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -242,9 +242,9 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'PlatformIO', u'PlatformIO Documentation', - u'Ivan Kravets', 'PlatformIO', 'One line description of project.', - 'Miscellaneous'), + ('index', 'PlatformIO', u'PlatformIO Documentation', + u'Ivan Kravets', 'PlatformIO', 'One line description of project.', + 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. diff --git a/docs/faq.rst b/docs/faq.rst index 9a11def4..9a63ee97 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -24,8 +24,8 @@ General What is PlatformIO? ~~~~~~~~~~~~~~~~~~~ -`PlatformIO `_ is an open-source cross-platform code -builder and the missing library manager. +`PlatformIO `_ is an open source ecosystem for IoT +development. PlatformIO is independent from the platform, in which it is running. In fact, the only requirement is Python, which exists pretty much everywhere. What this @@ -132,25 +132,15 @@ Answered in `issue #279 `_. Answered in `issue #295 `_. -.. _faq_troubleshooting_pioblocksprompt: +Windows AttributeError: 'module' object has no attribute 'packages' +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' -PlatformIO blocks command execution using user prompt -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If you are going to run *PlatformIO* from **subprocess**, you **MUST -DISABLE** all prompts. It will allow you to avoid blocking. -There are a few options: - -- using :option:`platformio --force` option before each command -- using environment variable :envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS=No ` -- disable global setting ``enable_prompts`` via :ref:`cmd_settings` command -- masking under Continuous Integration system via environment variable - :envvar:`CI=true `. +Answered in `issue #252 `_. .. _faq_troubleshooting_pionotfoundinpath: Program ``platformio`` not found in PATH -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'''''''''''''''''''''''''''''''''''''''' Where is ``platformio`` binary installed? Run this command in Terminal @@ -173,18 +163,12 @@ programs to the ``bin`` directory which is included in ``$PATH``. For example, see `issue #272 `_. Windows UnicodeDecodeError: 'ascii' codec can't decode byte -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Answered in `issue #143 `_. -Serial does not work with panStampAVR board -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Answered in `issue #144 `_. - - -PlatformIO: command not found || An error ``pkg_resources.DistributionNotFound`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +PlatformIO: command not found || An error "pkg_resources.DistributionNotFound" +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Please upgrade *SetupTools* package: @@ -197,18 +181,45 @@ Please upgrade *SetupTools* package: [sudo] pip uninstall platformio [sudo] pip install platformio -Windows AttributeError: 'module' object has no attribute 'packages' -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Miscellaneous +~~~~~~~~~~~~~ -Answered in `issue #252 `_. +.. _faq_troubleshooting_pioblocksprompt: + +PlatformIO blocks command execution using user prompt +''''''''''''''''''''''''''''''''''''''''''''''''''''' + +If you are going to run *PlatformIO* from **subprocess**, you **MUST +DISABLE** all prompts. It will allow you to avoid blocking. +There are a few options: + +- using :option:`platformio --force` option before each command +- using environment variable :envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS=No ` +- disable global setting ``enable_prompts`` via :ref:`cmd_settings` command +- masking under Continuous Integration system via environment variable + :envvar:`CI=true `. + +Serial does not work with panStampAVR board +''''''''''''''''''''''''''''''''''''''''''' + +Answered in `issue #144 `_. + +Building +~~~~~~~~ + +Can not compile a library that compiles without issue with Arduino IDE +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +* `#298: Unable to use Souliss library `_ +* `#331: Unable to use MySensors library `_ ARM toolchain: cc1plus: error while loading shared libraries -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' See related answers for `error while loading shared libraries `_. Archlinux: libncurses.so.5: cannot open shared object file -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Answered in `issue #291 `_. diff --git a/docs/ide/vim.rst b/docs/ide/vim.rst index fd147487..d97d3912 100644 --- a/docs/ide/vim.rst +++ b/docs/ide/vim.rst @@ -56,6 +56,10 @@ Now, in VIM ``cd /path/to/this/project`` and press ``Ctrl+B`` or ``Cmd+B`` (Mac). *PlatformIO* should compile your source code from the ``src`` directory, make firmware and upload it. +.. note:: + If hotkey doesn't work for you, try to add this line + ``nnoremap :make`` to ``~/.vimrc`` + Screenshot ---------- diff --git a/docs/index.rst b/docs/index.rst index 4cf5c3f5..d393c262 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,18 +9,26 @@ See the License for the specific language governing permissions and limitations under the License. -PlatformIO is an open-source cross-platform code builder and the missing library manager -======================================================================================== +PlatformIO is an open source ecosystem for IoT development +========================================================== -**Ready for embedded development, IDE and Continuous integration, Arduino and -MBED compatible** +**Cross-platform code builder and library manager. Continuous and IDE +integration. Arduino and MBED compatible. Ready for Cloud compiling.** + +* **Development Platforms** - Embedded and Desktop development platforms with + pre-built toolchains, debuggers, uploaders and frameworks which work under + popular host OS: Mac, Windows, Linux (+ARM) +* **Embedded Boards** - Rapid Embedded Programming, IDE and Continuous + Integration in a few steps with PlatformIO thanks to built-in project + generator for the most popular embedded boards and IDE +* **Library Manager** - Hundreds Popular Libraries are organized into single + Web 2.0 platform: list by categories, keywords, authors, compatible + platforms and frameworks; learn via examples; be up-to-date with the latest + version *Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC, Silicon Labs EFM32, ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed, -libOpenCM3, etc.* - -.. image:: _static/platformio-logo.png - :target: http://platformio.org +libOpenCM3, etc.** * `Website `_ * `Web 2.0 Library Search `_ | @@ -34,18 +42,13 @@ libOpenCM3, etc.* `Facebook `_ | `Reddit `_ -You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO* -has pre-built different development platforms and pre-configured settings for -the most popular embedded boards. For further details, please -refer to :ref:`faq_what_is_platformio` - Embedded Development. *Easier Than Ever.* ----------------------------------------- * Colourful command-line output * :ref:`IDE Integration ` with *Arduino, Eclipse, Energia, Qt Creator, Sublime Text, Vim, Visual Studio* -* :ref:`ci` with *AppVeyor, Circle CI, Drone, Shippable, Travis CI* +* Cloud compiling and :ref:`ci` with *AppVeyor, Circle CI, Drone, Shippable, Travis CI* * Built-in :ref:`Serial Port Monitor ` and configurable build :ref:`-flags/-options ` * Pre-built tool chains, :ref:`frameworks` for the @@ -68,6 +71,7 @@ The Missing Library Manager. *It's here!* * Automatic library updating * It runs on Windows, Mac OS X, and Linux (+ARM). +For further details, please refer to :ref:`faq_what_is_platformio` Contents -------- diff --git a/docs/installation.rst b/docs/installation.rst index 02d0227c..0f45b4fe 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -38,7 +38,7 @@ application (Terminal): * Mac OS X / Linux – *Terminal* application * Windows – ``cmd.exe`` application. -Installation options +Installation Methods -------------------- .. warning:: @@ -47,10 +47,10 @@ Installation options **DON'T FORGET** to select ``Add python.exe to Path`` feature on the "Customize" stage. -Please *choose one of* the following installation options: +Please *choose ONE of* the following methods: -Python Package Manager -~~~~~~~~~~~~~~~~~~~~~~ +a) Python Package Manager +~~~~~~~~~~~~~~~~~~~~~~~~~ The latest stable version of PlatformIO may be installed/upgraded via `pip `_ as follows: @@ -74,8 +74,8 @@ a few options here: .. _installation_installer_script: -Installer Script -~~~~~~~~~~~~~~~~ +b) Installer Script +~~~~~~~~~~~~~~~~~~~ Super-Quick (Mac / Linux) ''''''''''''''''''''''''' @@ -114,8 +114,8 @@ On *Windows OS* it may look like: # run it C:\Python27\python.exe get-platformio.py -Full Guide -~~~~~~~~~~ +c) Full Guide +~~~~~~~~~~~~~ 1. Check a ``python`` version (only 2.6-2.7 is supported): @@ -144,8 +144,8 @@ For upgrading ``platformio`` to the latest version: pip install -U platformio -Development Version -~~~~~~~~~~~~~~~~~~~ +d) Development Version +~~~~~~~~~~~~~~~~~~~~~~ Install the latest PlatformIO from the ``develop`` branch: diff --git a/docs/platforms/creating_board.rst b/docs/platforms/creating_board.rst index 51dabba3..cfe19f14 100644 --- a/docs/platforms/creating_board.rst +++ b/docs/platforms/creating_board.rst @@ -11,8 +11,8 @@ .. _board_creating: -Creating Board -============== +Custom Board +============ *PlatformIO* has pre-built settings for the most popular embedded boards. This list is available: diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index 2eb22c8d..3f5a29d2 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -11,8 +11,8 @@ .. _platform_creating: -Creating Platform -================= +Custom Platform +=============== *PlatformIO* was developed like a tool which would build the same source code for the different development platforms via single command :ref:`cmd_run` diff --git a/docs/platforms/index.rst b/docs/platforms/index.rst index 2509b8c5..bb890287 100644 --- a/docs/platforms/index.rst +++ b/docs/platforms/index.rst @@ -52,8 +52,8 @@ Desktop linux_x86_64 windows_x86 -Own Platform/Board ------------------- +Custom Platform & Board +----------------------- .. toctree:: :maxdepth: 2 diff --git a/docs/projectconf.rst b/docs/projectconf.rst index ea1d5768..b259395f 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -530,6 +530,8 @@ Then upload firmware using :option:`platformio run --target program` board = armstrap_eagle512 upload_protocol = gdb +Also, take a look at this article `Armstrap Eagle and PlatformIO `_. + 5. :ref:`platform_ststm32`: Upload firmware using ST-Link instead mbed's media disk diff --git a/platformio/__init__.py b/platformio/__init__.py index 4c084e76..0ef276d8 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,14 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (2, 3, 5) +VERSION = (2, 4, 0) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" __description__ = ( - "An open-source cross-platform code builder and the missing library " - "manager (Ready for embedded development, IDE and Continuous integration, " - "Arduino and MBED compatible)" + "An open source ecosystem for IoT development. " + "Cross-platform code builder and library manager. " + "Continuous and IDE integration. " + "Arduino and MBED compatible. Ready for Cloud compiling." ) __url__ = "http://platformio.org" diff --git a/platformio/__main__.py b/platformio/__main__.py index b437e760..e5e35aee 100644 --- a/platformio/__main__.py +++ b/platformio/__main__.py @@ -103,6 +103,18 @@ def main(): error_str += str(e) else: error_str += format_exc() + error_str += """ +============================================================ + +An unexpected error occurred. Further steps: + +* Verify that you have the latest version of PlatformIO using + `platformio upgrade` command +* Report this problem to the developers + https://github.com/platformio/platformio/issues + +============================================================ +""" click.secho(error_str, fg="red", err=True) return 1 return 0 diff --git a/platformio/app.py b/platformio/app.py index 0fc162ee..8b2d9417 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -13,6 +13,7 @@ # limitations under the License. import json +from copy import deepcopy from os import environ, getenv from os.path import getmtime, isfile, join from time import time @@ -70,13 +71,14 @@ SESSION_VARS = { class State(object): - def __init__(self, path=None): + def __init__(self, path=None, lock=False): self.path = path + self.lock = lock if not self.path: self.path = join(get_home_dir(), "appstate.json") self._state = {} self._prev_state = {} - self._lock = None + self._lockfile = None def __enter__(self): try: @@ -86,7 +88,7 @@ class State(object): self._state = json.load(fp) except ValueError: self._state = {} - self._prev_state = self._state.copy() + self._prev_state = deepcopy(self._state) return self._state def __exit__(self, type_, value, traceback): @@ -99,17 +101,19 @@ class State(object): self._unlock_state_file() def _lock_state_file(self): - self._lock = LockFile(self.path) + if not self.lock: + return + self._lockfile = LockFile(self.path) - if (self._lock.is_locked() and - (time() - getmtime(self._lock.lock_file)) > 10): - self._lock.break_lock() + if (self._lockfile.is_locked() and + (time() - getmtime(self._lockfile.lock_file)) > 10): + self._lockfile.break_lock() - self._lock.acquire() + self._lockfile.acquire() def _unlock_state_file(self): - if self._lock: - self._lock.release() + if self._lockfile: + self._lockfile.release() def sanitize_setting(name, value): @@ -136,7 +140,7 @@ def get_state_item(name, default=None): def set_state_item(name, value): - with State() as data: + with State(lock=True) as data: data[name] = value @@ -159,14 +163,14 @@ def get_setting(name): def set_setting(name, value): - with State() as data: + with State(lock=True) as data: if "settings" not in data: data['settings'] = {} data['settings'][name] = sanitize_setting(name, value) def reset_settings(): - with State() as data: + with State(lock=True) as data: if "settings" in data: del data['settings'] diff --git a/platformio/boards/atmelsam.json b/platformio/boards/atmelsam.json new file mode 100644 index 00000000..bb2561ee --- /dev/null +++ b/platformio/boards/atmelsam.json @@ -0,0 +1,50 @@ +{ + "samr21_xpro": { + "build": { + "f_cpu": "48000000L", + "cpu": "cortex-m0plus", + "mcu": "atsamr21g18a" + }, + "frameworks": ["mbed"], + "name": "Atmel ATSAMR21-XPRO", + "platform": "atmelsam", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 262144 + }, + "url": "https://developer.mbed.org/platforms/SAMR21-XPRO/", + "vendor": "Atmel" + }, + "saml21_xpro_b": { + "build": { + "f_cpu": "48000000L", + "cpu": "cortex-m0plus", + "mcu": "atsaml21j18b" + }, + "frameworks": ["mbed"], + "name": "Atmel SAML21-XPRO-B", + "platform": "atmelsam", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 262144 + }, + "url": "https://developer.mbed.org/platforms/SAML21-XPRO/", + "vendor": "Atmel" + }, + "samd21_xpro": { + "build": { + "f_cpu": "48000000L", + "cpu": "cortex-m0plus", + "mcu": "atsamd21j18a" + }, + "frameworks": ["mbed"], + "name": "Atmel SAMD21-XPRO", + "platform": "atmelsam", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 262144 + }, + "url": "https://developer.mbed.org/platforms/SAMD21-XPRO/", + "vendor": "Atmel" + } +} diff --git a/platformio/boards/espressif.json b/platformio/boards/espressif.json index b42f129b..f2c4e3f5 100644 --- a/platformio/boards/espressif.json +++ b/platformio/boards/espressif.json @@ -3,7 +3,7 @@ "build": { "core": "esp8266", "extra_flags": "-DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DESP8266", - "f_cpu": "40000000L", + "f_cpu": "80000000L", "ldscript": "esp8266.flash.512k.ld", "mcu": "esp8266", "variant": "generic" @@ -35,7 +35,7 @@ "platform": "espressif", "upload": { "maximum_ram_size": 32768, - "maximum_size": 524288, + "maximum_size": 4194304, "protocol": "arduino", "require_upload_port" : true, "speed": 115200 diff --git a/platformio/boards/misc.json b/platformio/boards/misc.json index ed4fde29..a5080010 100644 --- a/platformio/boards/misc.json +++ b/platformio/boards/misc.json @@ -434,7 +434,7 @@ "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_MOTEINOMEGA", "f_cpu": "16000000L", "mcu": "atmega1284p", - "variant": "moteinoMega" + "variant": "moteinomega" }, "frameworks": ["arduino"], "name": "LowPowerLab MoteinoMEGA", diff --git a/platformio/boards/ststm32.json b/platformio/boards/ststm32.json index 4eef729d..cd5483a3 100644 --- a/platformio/boards/ststm32.json +++ b/platformio/boards/ststm32.json @@ -441,5 +441,101 @@ }, "url": "http://www.st.com/web/en/catalog/tools/PF260318", "vendor": "ST" + }, + "disco_f469ni": { + "build": { + "f_cpu": "180000000L", + "cpu": "cortex-m4", + "mcu": "stm32f469nih6" + }, + "frameworks": ["mbed"], + "name": "ST 32F469IDISCOVERY", + "platform": "ststm32", + "upload": { + "maximum_ram_size": 393216, + "maximum_size": 1048576 + }, + "url": "http://www.st.com/web/catalog/tools/FM116/CL1620/SC959/SS1532/LN1848/PF262395", + "vendor": "ST" + }, + "disco_l476vg": { + "build": { + "f_cpu": "80000000L", + "cpu": "cortex-m4", + "mcu": "stm32l476vgt6" + }, + "frameworks": ["mbed"], + "name": "ST 32L476GDISCOVERY", + "platform": "ststm32", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 1048576 + }, + "url": "http://www.st.com/web/catalog/tools/FM116/CL1620/SC959/SS1532/LN1848/PF261635", + "vendor": "ST" + }, + "nucleo_f031k6": { + "build": { + "f_cpu": "48000000L", + "cpu": "cortex-m0", + "mcu": "stm32f031k6t6" + }, + "frameworks": ["mbed"], + "name": "ST Nucleo F031K6", + "platform": "ststm32", + "upload": { + "maximum_ram_size": 4096, + "maximum_size": 32768 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F031K6/", + "vendor": "ST" + }, + "nucleo_f042k6": { + "build": { + "f_cpu": "48000000L", + "cpu": "cortex-m0", + "mcu": "stm32f042k6t6" + }, + "frameworks": ["mbed"], + "name": "ST Nucleo F042K6", + "platform": "ststm32", + "upload": { + "maximum_ram_size": 6144, + "maximum_size": 32768 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F042K6/", + "vendor": "ST" + }, + "nucleo_f303k8": { + "build": { + "f_cpu": "72000000L", + "cpu": "cortex-m4", + "mcu": "stm32f303k8t6" + }, + "frameworks": ["mbed"], + "name": "ST Nucleo F303K8", + "platform": "ststm32", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 65536 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F303K8/", + "vendor": "ST" + }, + "nucleo_l476rg": { + "build": { + "f_cpu": "80000000L", + "cpu": "cortex-m4", + "mcu": "stm32l476rgt6" + }, + "frameworks": ["mbed"], + "name": "ST Nucleo L476RG", + "platform": "ststm32", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 1048576 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-L476RG/", + "vendor": "ST" } } diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 7d61b529..5b45692e 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# pylint: disable=wrong-import-position,wrong-import-order,unused-import + try: from platformio import util except ImportError: @@ -29,7 +31,7 @@ except ImportError: sys.path.insert(0, _p) try: from platformio import util - import lockfile # NOQA pylint: disable=unused-import + import lockfile # NOQA break except ImportError: pass @@ -112,6 +114,12 @@ DefaultEnvironment( env = DefaultEnvironment() +# Append PlatformIO version +env.Append( + CPPDEFINES=["PLATFORMIO={0:02d}{1:02d}{2:02d}".format( + *util.pioversion_to_intstr())] +) + if "BOARD" in env: try: env.Replace(BOARD_OPTIONS=util.get_boards(env.subst("$BOARD"))) diff --git a/platformio/builder/scripts/espressif.py b/platformio/builder/scripts/espressif.py index fde0f7b6..49feea70 100644 --- a/platformio/builder/scripts/espressif.py +++ b/platformio/builder/scripts/espressif.py @@ -56,6 +56,8 @@ env.Replace( "-mtext-section-literals", "-falign-functions=4", "-U__STRICT_ANSI__", + "-ffunction-sections", + "-fdata-sections", "-MMD" # output dependancy info ], @@ -75,7 +77,8 @@ env.Replace( "-nostdlib", "-Wl,--no-check-sections", "-u", "call_user_start", - "-Wl,-static" + "-Wl,-static", + "-Wl,--gc-sections" ], SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES', @@ -103,6 +106,8 @@ if "FRAMEWORK" in env: ] ) +_board_max_rom = int( + env.get("BOARD_OPTIONS", {}).get("upload", {}).get("maximum_size", 0)) env.Append( BUILDERS=dict( ElfToBin=Builder( @@ -113,8 +118,9 @@ env.Append( "-bo", "$TARGET", "-bm", "dio", "-bf", "${BOARD_OPTIONS['build']['f_cpu'][:2]}", - "-bz", str(int(env.get("BOARD_OPTIONS", {}).get( - "upload", {}).get("maximum_size") / 1024)) + "K", + "-bz", + "%dK" % (_board_max_rom / 1024) if _board_max_rom < 1048576 + else "%dM" % (_board_max_rom / 1048576), "-bs", ".text", "-bp", "4096", "-ec", diff --git a/platformio/builder/scripts/frameworks/arduino.py b/platformio/builder/scripts/frameworks/arduino.py index b534f8ac..f6637e36 100644 --- a/platformio/builder/scripts/frameworks/arduino.py +++ b/platformio/builder/scripts/frameworks/arduino.py @@ -55,10 +55,10 @@ elif env.get("PLATFORM") == "timsp430": ) elif env.get("PLATFORM") == "espressif": env.Prepend( - CPPPATH=[join("$PLATFORMFW_DIR", "sdk", "include")], - LIBPATH=[join("$PLATFORMFW_DIR", "sdk", "lib")], + CPPPATH=[join("$PLATFORMFW_DIR", "tools", "sdk", "include")], + LIBPATH=[join("$PLATFORMFW_DIR", "tools", "sdk", "lib")], LIBS=["smartconfig", "pp", "main", "wpa", "lwip", - "net80211", "wps", "crypto", "phy", "hal", "gcc", "m"] + "net80211", "wps", "crypto", "phy", "hal", "axtls", "gcc", "m"] ) env.Replace(PLATFORMFW_DIR=PLATFORMFW_DIR) diff --git a/platformio/builder/scripts/frameworks/libopencm3.py b/platformio/builder/scripts/frameworks/libopencm3.py index 8255c442..c523b0d8 100644 --- a/platformio/builder/scripts/frameworks/libopencm3.py +++ b/platformio/builder/scripts/frameworks/libopencm3.py @@ -23,6 +23,8 @@ including ST STM32, Ti Tiva and Stellaris, NXP LPC 11xx, 13xx, 15xx, http://www.libopencm3.org/wiki/Main_Page """ +from __future__ import absolute_import + import re from os import listdir, sep, walk from os.path import isfile, join, normpath diff --git a/platformio/builder/scripts/frameworks/mbed.py b/platformio/builder/scripts/frameworks/mbed.py index fbd86801..be0e4da2 100644 --- a/platformio/builder/scripts/frameworks/mbed.py +++ b/platformio/builder/scripts/frameworks/mbed.py @@ -29,7 +29,7 @@ http://mbed.org/ import re import xml.etree.ElementTree as ElementTree from binascii import crc32 -from os import walk +from os import getenv, walk from os.path import basename, isfile, join, normpath from SCons.Script import DefaultEnvironment, Exit @@ -54,7 +54,7 @@ MBED_VARIANTS = { "seeedTinyBLE": "SEEED_TINY_BLE", "redBearLab": "RBLAB_NRF51822", "nrf51-dt": "NRF51_DK", - "redBearLabBLENano": "RBLAB_NRF51822", + "redBearLabBLENano": "RBLAB_BLENANO", "wallBotBLE": "NRF51822", "frdm_kl25z": "KL25Z", "frdm_kl46z": "KL46Z", @@ -63,7 +63,10 @@ MBED_VARIANTS = { "frdm_k20d50m": "K20D50M", "frdm_k22f": "K22F", "teensy31": "TEENSY3_1", - "dfcm_nnn40": "DELTA_DFCM_NNN40" + "dfcm_nnn40": "DELTA_DFCM_NNN40", + "samr21_xpro": "SAMR21G18A", + "saml21_xpro_b": "SAML21J18A", + "samd21_xpro": "SAMD21J18A" } MBED_LIBS_MAP = { @@ -223,7 +226,11 @@ env.Replace( ) # restore external build flags -env.ProcessFlags() +env.ProcessFlags([ + env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags"), + env.get("BUILD_FLAGS"), + getenv("PLATFORMIO_BUILD_FLAGS"), +]) # Hook for K64F and K22F if board_type in ("frdm_k22f", "frdm_k64f"): diff --git a/platformio/builder/scripts/frameworks/platformio.py b/platformio/builder/scripts/frameworks/platformio.py new file mode 100644 index 00000000..927001e7 --- /dev/null +++ b/platformio/builder/scripts/frameworks/platformio.py @@ -0,0 +1,61 @@ +# Copyright 2014-2015 Ivan Kravets +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +PlatformIO + +PlatformIO Framework is an open source light-weight framework with +high-level API for cross-platform embedded programming. It lies above popular +middleware (HAL, SDK) and leverages all its benefits. This approach allowed to +incorporate different development platforms ranging from 8-bits AVR to powerful +32-bit ARM into the one embedded ecosystem. + +http://platformio.org +""" + +from os.path import join + +from SCons.Script import DefaultEnvironment + +env = DefaultEnvironment() + +env.Replace( + PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-platformio") +) + +env.VariantDirWrap( + join("$BUILD_DIR", "FrameworkPlatformIO"), + join("$PLATFORMFW_DIR", "src", "api") +) + +env.Append( + CPPPATH=[ + join("$BUILD_DIR", "FrameworkCMSIS"), + join("$BUILD_DIR", "FrameworkCMSISVariant") + ] +) + +envsafe = env.Clone() + +# +# Target: Build Core Library +# + +libs = [] +libs.append(envsafe.BuildLibrary( + join("$BUILD_DIR", "FrameworkCMSISVariant"), + join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}") +)) + +env.Append(LIBS=libs) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 95e78e24..94743cec 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import absolute_import + import atexit import re from glob import glob diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 8bb33b9f..8fdeb40b 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from os.path import join, isfile +from __future__ import absolute_import + +from os.path import isfile, join from shutil import copyfile from time import sleep diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index c74ce530..790ea4ad 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -12,17 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import absolute_import + import re from glob import glob from os import getenv, listdir, sep, walk -from os.path import basename, dirname, isdir, isfile, join, normpath +from os.path import basename, dirname, isdir, isfile, join, normpath, realpath from SCons.Script import (COMMAND_LINE_TARGETS, DefaultEnvironment, Exit, SConscript) from SCons.Util import case_sensitive_suffixes -from platformio.util import pioversion_to_intstr - SRC_BUILD_EXT = ["c", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"] SRC_HEADER_EXT = ["h", "hpp"] SRC_DEFAULT_FILTER = " ".join([ @@ -39,8 +39,14 @@ def BuildProgram(env): ASCOM="$ASPPCOM" ) - env.ProcessFlags() - env.BuildFramework() + env.ProcessFlags([ + env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags"), + env.get("BUILD_FLAGS"), + getenv("PLATFORMIO_BUILD_FLAGS"), + ]) + + env.BuildFrameworks([ + f.lower().strip() for f in env.get("FRAMEWORK", "").split(",")]) # build dependent libs deplibs = env.BuildDependentLibraries("$PROJECTSRC_DIR") @@ -62,40 +68,35 @@ def BuildProgram(env): ) # Handle SRC_BUILD_FLAGS - if getenv("PLATFORMIO_SRC_BUILD_FLAGS", None): - env.MergeFlags(getenv("PLATFORMIO_SRC_BUILD_FLAGS")) - if "SRC_BUILD_FLAGS" in env: - env.MergeFlags(env['SRC_BUILD_FLAGS']) - - env.Append( - CPPDEFINES=["PLATFORMIO={0:02d}{1:02d}{2:02d}".format( - *pioversion_to_intstr())] - ) + env.ProcessFlags([ + env.get("SRC_BUILD_FLAGS", None), + getenv("PLATFORMIO_SRC_BUILD_FLAGS"), + ]) return env.Program( join("$BUILD_DIR", env.subst("$PROGNAME")), env.LookupSources( "$BUILDSRC_DIR", "$PROJECTSRC_DIR", duplicate=False, src_filter=getenv("PLATFORMIO_SRC_FILTER", - env.get("SRC_FILTER", None))), + env.get("SRC_FILTER"))), LIBS=env.get("LIBS", []) + deplibs, LIBPATH=env.get("LIBPATH", []) + ["$BUILD_DIR"] ) -def ProcessFlags(env): - if "extra_flags" in env.get("BOARD_OPTIONS", {}).get("build", {}): - env.MergeFlags(env.subst("${BOARD_OPTIONS['build']['extra_flags']}")) +def ProcessFlags(env, flags): + for f in flags: + if f: + env.MergeFlags(str(f)) - # Handle BUILD_FLAGS - if getenv("PLATFORMIO_BUILD_FLAGS", None): - env.MergeFlags(getenv("PLATFORMIO_BUILD_FLAGS")) - if "BUILD_FLAGS" in env: - env.MergeFlags(env['BUILD_FLAGS']) + # fix relative CPPPATH + for i, p in enumerate(env.get("CPPPATH", [])): + if isdir(p): + env['CPPPATH'][i] = realpath(p) # Cancel any previous definition of name, either built in or # provided with a -D option // Issue #191 - undefines = [f for f in env.get("CCFLAGS", []) if f.startswith("-U")] + undefines = [u for u in env.get("CCFLAGS", []) if u.startswith("-U")] if undefines: for undef in undefines: env['CCFLAGS'].remove(undef) @@ -165,23 +166,24 @@ def LookupSources(env, variant_dir, src_dir, duplicate=True, src_filter=None): return sources -def BuildFramework(env): - if "FRAMEWORK" not in env or "uploadlazy" in COMMAND_LINE_TARGETS: +def BuildFrameworks(env, frameworks): + if not frameworks or "uploadlazy" in COMMAND_LINE_TARGETS: return - if env['FRAMEWORK'].lower() in ("arduino", "energia"): - env.ConvertInoToCpp() + board_frameworks = env.get("BOARD_OPTIONS", {}).get("frameworks") + if frameworks == ["platformio"]: + if board_frameworks: + frameworks.insert(0, board_frameworks[0]) - for f in env['FRAMEWORK'].split(","): - framework = f.strip().lower() - if framework in env.get("BOARD_OPTIONS", {}).get("frameworks"): - SConscript( - env.subst(join("$PIOBUILDER_DIR", "scripts", "frameworks", - "%s.py" % framework)) - ) + for f in frameworks: + if f in ("arduino", "energia"): + env.ConvertInoToCpp() + + if f in board_frameworks: + SConscript(env.subst( + join("$PIOBUILDER_DIR", "scripts", "frameworks", "%s.py" % f))) else: - Exit("Error: This board doesn't support %s framework!" % - framework) + Exit("Error: This board doesn't support %s framework!" % f) def BuildLibrary(env, variant_dir, src_dir, src_filter=None): @@ -345,7 +347,7 @@ def generate(env): env.AddMethod(IsFileWithExt) env.AddMethod(VariantDirWrap) env.AddMethod(LookupSources) - env.AddMethod(BuildFramework) + env.AddMethod(BuildFrameworks) env.AddMethod(BuildLibrary) env.AddMethod(BuildDependentLibraries) return env diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 72c21737..883f2c9f 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -135,7 +135,7 @@ def lib_install(ctx, libid, version): except AssertionError: raise exception.LibInstallDependencyError(str(item)) - except exception.LibAlreadyInstalledError: + except exception.LibAlreadyInstalled: click.secho("Already installed", fg="yellow") diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index 438e5dc2..761644bb 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -56,9 +56,9 @@ def cli(): click.echo("Release notes: ", nl=False) click.secho("http://docs.platformio.org/en/latest/history.html", fg="cyan") - except (OSError, AssertionError) as e: + except Exception as e: # pylint: disable=W0703 if not r: - raise exception.PlatformioUpgradeError( + raise exception.UpgradeError( "\n".join([str(cmd), str(e)])) if ("Permission denied" in r['err'] and "windows" not in util.get_systype()): @@ -74,7 +74,7 @@ WARNING! Don't use `sudo` for the rest PlatformIO commands. """, fg="yellow", err=True) raise exception.ReturnErrorCode() else: - raise exception.PlatformioUpgradeError( + raise exception.UpgradeError( "\n".join([str(cmd), r['out'], r['err']])) diff --git a/platformio/exception.py b/platformio/exception.py index e0378083..74491f70 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -149,11 +149,11 @@ class APIRequestError(PlatformioException): MESSAGE = "[API] %s" -class LibAlreadyInstalledError(PlatformioException): +class LibAlreadyInstalled(PlatformioException): pass -class LibNotInstalledError(PlatformioException): +class LibNotInstalled(PlatformioException): MESSAGE = "Library #%d has not been installed yet" @@ -183,11 +183,6 @@ class InvalidSettingValue(PlatformioException): MESSAGE = "Invalid value '%s' for the setting '%s'" -class UpgraderFailed(PlatformioException): - - MESSAGE = "An error occurred while upgrading PlatformIO" - - class CIBuildEnvsEmpty(PlatformioException): MESSAGE = "Can't find PlatformIO build environments.\n"\ @@ -195,20 +190,20 @@ class CIBuildEnvsEmpty(PlatformioException): "predefined environments using `--project-conf` option" -class SConsNotInstalled(PlatformioException): +class SConsNotInstalledError(PlatformioException): MESSAGE = "The PlatformIO and `scons` aren't installed properly. "\ "More details in FAQ/Troubleshooting section: "\ "http://docs.platformio.org/en/latest/faq.html" -class PlatformioUpgradeError(PlatformioException): +class UpgradeError(PlatformioException): - MESSAGE = "%s \n\n"\ - "1. Please report this issue here: "\ - "https://github.com/platformio/platformio/issues \n"\ - "2. Try different installation/upgrading steps: "\ - "http://docs.platformio.org/en/latest/installation.html" + MESSAGE = """%s + +* Try different installation/upgrading steps: + http://docs.platformio.org/en/latest/installation.html +""" class CygwinEnvDetected(PlatformioException): diff --git a/platformio/libmanager.py b/platformio/libmanager.py index 0dbe0df0..cd0b57fa 100644 --- a/platformio/libmanager.py +++ b/platformio/libmanager.py @@ -21,7 +21,7 @@ from tempfile import gettempdir from platformio import telemetry, util from platformio.downloader import FileDownloader -from platformio.exception import LibAlreadyInstalledError, LibNotInstalledError +from platformio.exception import LibAlreadyInstalled, LibNotInstalled from platformio.unpacker import FileUnpacker @@ -73,17 +73,17 @@ class LibraryManager(object): for item in self.get_installed().values(): if "id" in item and item['id'] == id_: return item - raise LibNotInstalledError(id_) + raise LibNotInstalled(id_) def is_installed(self, id_): try: return int(self.get_info(id_)['id']) == id_ - except LibNotInstalledError: + except LibNotInstalled: return False def install(self, id_, version=None): if self.is_installed(id_): - raise LibAlreadyInstalledError() + raise LibAlreadyInstalled() dlinfo = util.get_api_result( "/lib/download/" + str(id_), @@ -120,4 +120,4 @@ class LibraryManager(object): label="#%d %s" % (id_, item['name']) ) return True - raise LibNotInstalledError(id_) + raise LibNotInstalled(id_) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index a60e90d9..dc5a2861 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -145,11 +145,6 @@ def after_upgrade(ctx): click.style("give", fg="cyan"), click.style("https://github.com/platformio/platformio", fg="cyan") )) - click.echo("- %s for the new features/issues on Bountysource > %s" % ( - click.style("vote", fg="cyan"), - click.style("https://www.bountysource.com/teams/platformio/issues", - fg="cyan") - )) click.echo("*" * terminal_width) click.echo("") @@ -171,7 +166,7 @@ def after_upgrade(ctx): telemetry.on_event(category="Auto", action="Upgrade", label="%s > %s" % (last_version, __version__)) else: - raise exception.UpgraderFailed() + raise exception.UpgradeError("Auto upgrading...") click.echo("") diff --git a/platformio/platforms/base.py b/platformio/platforms/base.py index 2fcaf8cd..c4488dd1 100644 --- a/platformio/platforms/base.py +++ b/platformio/platforms/base.py @@ -395,7 +395,7 @@ class BasePlatform(object): stderr=util.AsyncPipe(self.on_run_err) ) except (OSError, AssertionError): - raise exception.SConsNotInstalled() + raise exception.SConsNotInstalledError() assert "returncode" in result # if self._found_error: diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 17dccb38..43a501dd 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -291,7 +291,10 @@ def on_exception(e): return mp = MeasurementProtocol() mp['exd'] = "%s: %s" % (type(e).__name__, e) - mp['exf'] = int(not isinstance(e, exception.PlatformioException)) + mp['exf'] = int(any([ + not isinstance(e, exception.PlatformioException), + "Error" in e.__class__.__name__ + ])) mp.send("exception") diff --git a/platformio/unpacker.py b/platformio/unpacker.py index 80d66b9e..3cd15903 100644 --- a/platformio/unpacker.py +++ b/platformio/unpacker.py @@ -64,7 +64,7 @@ class ZIPArchive(ArchiveBase): def preserve_mtime(item, dest_dir): util.change_filemtime( join(dest_dir, item.filename), - mktime(list(item.date_time) + [0]*3) + mktime(list(item.date_time) + [0] * 3) ) def get_items(self): diff --git a/platformio/util.py b/platformio/util.py index 6f2001b5..4eefbecb 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -27,6 +27,7 @@ from threading import Thread from platformio import __apiurl__, __version__, exception +# pylint: disable=wrong-import-order try: from configparser import ConfigParser except ImportError: @@ -67,6 +68,7 @@ class AsyncPipe(Thread): class cd(object): + def __init__(self, new_path): self.new_path = new_path self.prev_path = os.getcwd() diff --git a/requirements.txt b/requirements.txt index 2207d695..2294e807 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ bottle==0.12.9 click==5.1 colorama==0.3.3 -lockfile==0.11.0 +lockfile==0.12.2 pyserial==2.7 requests==2.8.1 scons==2.4.1 diff --git a/setup.py b/setup.py index 8649b2e6..6696f001 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ from platformio import (__author__, __description__, __email__, __license__, install_requires = [ "bottle", - "click>=3.2", + "click>=3.2,<6", "lockfile>=0.9.1", "pyserial", "requests>=2.4.0" @@ -72,7 +72,7 @@ setup( "Topic :: Software Development :: Compilers" ], keywords=( - "builder library manager embedded development ide continuous " + "iot builder library manager embedded development ide continuous " "integration atmel avr sam espressif esp freescale kinetis nordic " "nrf51 nxp lpc silicon labs efm32 st stm32 ti msp430 tiva teensy " "arduino mbed libopencm3"