diff --git a/.gitignore b/.gitignore index 16d27c1b..dfcb0c78 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .tox docs/_build dist +build diff --git a/HISTORY.rst b/HISTORY.rst index adf1d2a5..7741e375 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,14 +1,39 @@ -Release History -=============== +Release Notes +============= PlatformIO 2.0 -------------- +2.8.0 (2016-01-29) +~~~~~~~~~~~~~~~~~~ + +* `PlatformIO IDE `_ for + Atom + (`issue #470 `_) +* Added ``pio`` command line alias for ``platformio`` command + (`issue #447 `_) +* Added SPL-Framework support for Nucleo F401RE board + (`issue #453 `_) +* Added ``upload_resetmethod`` option to `Project Configuration File platformio.ini `__ + and allowed to `change default upload reset method `_ + for Espressif development platform + (`issue #444 `_) +* Allowed to force output of color ANSI-codes or to disable progress bar even + if the output is a ``pipe`` (not a ``tty``) using `Environment variables `__ + (`issue #465 `_) +* Set 1Mb SPIFFS for Espressif boards by default + (`issue #458 `_) +* Exclude ``test*`` folder by default from build process +* Generate project for IDEs with information about installed libraries +* Fixed builder for mbed framework and ST STM32 platform + + 2.7.1 (2016-01-06) ~~~~~~~~~~~~~~~~~~ * Initial support for Arduino Zero board (`issue #356 `_) +* Added support for completions to Atom text editor using ``.clang_complete`` * Generate default targets for `supported IDE `__ (CLion, Eclipse IDE, Emacs, Sublime Text, VIM): Build, Clean, Upload, Upload SPIFFS image, Upload using Programmer, Update installed diff --git a/README.rst b/README.rst index 43359b50..d6dd9473 100644 --- a/README.rst +++ b/README.rst @@ -28,6 +28,10 @@ PlatformIO .. image:: https://badges.gitter.im/Join%20Chat.svg :alt: Join the chat at https://gitter.im/platformio/platformio :target: https://gitter.im/platformio/platformio +.. image:: https://img.shields.io/donate/PlatformIO.png?color=yellow + :alt: Donate for PlatformIO.Org + :target: https://www.liqpay.com/api/3/checkout?data=eyJ2ZXJzaW9uIjozLCJhY3Rpb24iOiJwYXlkb25hdGUiLCJwdWJsaWNfa2V5IjoiaTc0NzkxMDA2NjIxIiwiYW1vdW50IjoiMSIsImN1cnJlbmN5IjoiVVNEIiwiZGVzY3JpcHRpb24iOiJEb25hdGlvbiBmb3IgUGxhdGZvcm1JTy5PcmciLCJ0eXBlIjoiZG9uYXRlIiwibGFuZ3VhZ2UiOiJlbiJ9&signature=XYvETjqlpoFhoFtxUJlF6hQyS7Y%3D + `Home & Demo `_ | `Project Examples `_ | @@ -75,7 +79,7 @@ libOpenCM3, etc.* * `IDE Integration `_ * `Articles about us `_ * `FAQ `_ -* `Release History `_ +* `Release Notes `_ Use whenever. *Run everywhere.* ------------------------------- @@ -93,7 +97,7 @@ settings for most popular `Embedded Boards `_. * Colourful `command-line output `_ * `IDE Integration `_ with - *Arduino, Eclipse, Emacs, Energia, Qt Creator, Sublime Text, Vim, Visual Studio* + *Arduino, Atom, Eclipse, Emacs, Energia, Qt Creator, Sublime Text, Vim, Visual Studio* * Cloud compiling and `Continuous Integration `_ with *AppVeyor, Circle CI, Drone, Shippable, Travis CI* * Built-in `Serial Port Monitor `_ and configurable @@ -171,6 +175,7 @@ Frameworks: * `Energia `_ * `SPL `_ * `mbed `_ +* `WiringPi `_ For further details, please refer to `What is PlatformIO? `_ diff --git a/docs/_static/extra.css b/docs/_static/extra.css index b4848bff..edf97bb8 100644 --- a/docs/_static/extra.css +++ b/docs/_static/extra.css @@ -35,10 +35,10 @@ nav { display: block !important; } body { - padding-top: 50px; + padding-top: 100px; } .wy-nav-side { - top: 50px; + top: 100px; } .container { @@ -253,3 +253,26 @@ nav { .navbar-header .navbar-brand { color: #e0e0e0; } + +/* Misc */ + +.top-banner { + display: block; + padding: 10px 20px; + font-weight: bold; + font-size: 14px; + color: #fff; + text-align: center; + background-color: #0275d8; +} + +.top-banner:hover { + color: #fff; + text-decoration: none; + background-color: #025ebb; +} + +.top-banner:visited { + color: #fff; + text-decoration: none; +} diff --git a/docs/_static/ide-atom-platformio-menu-item.png b/docs/_static/ide-atom-platformio-menu-item.png new file mode 100644 index 00000000..43141631 Binary files /dev/null and b/docs/_static/ide-atom-platformio-menu-item.png differ diff --git a/docs/_static/ide-atom-platformio.png b/docs/_static/ide-atom-platformio.png new file mode 100644 index 00000000..b4764138 Binary files /dev/null and b/docs/_static/ide-atom-platformio.png differ diff --git a/docs/articles.rst b/docs/articles.rst index 52b89ce4..265f6041 100644 --- a/docs/articles.rst +++ b/docs/articles.rst @@ -23,6 +23,9 @@ Here are recent articles about PlatformIO: 2016 ^^^^ +* Jan 24, 2016 - **Sergey Prilukin** - `How to use IntelliJ IDEA to develop and upload software for micro controllers like Arduino `_ +* Jan 16, 2016 - **Dani Eichhorn** - `ESP8266 Arduino IDE Alternative: PlatformIO `_ +* Jan 11, 2016 - **David Mills, Ph.D.** - `STM NUCLEOF401RE TIMER IO `_ * Jan 05, 2016 - **Julien Rodrigues** - `Internet Of Things: The IDE scandal `_ 2015 diff --git a/docs/envvars.rst b/docs/envvars.rst index d2d4f244..f46784bd 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -34,10 +34,20 @@ operations/commands. PlatformIO handles ``CI`` variable which is setup by `Continuous Integration `_ (Travis, Circle and etc.) systems. -Currently, PlatformIO uses it to disable prompts. +PlatformIO uses it to disable prompts and progress bars. In other words, +``CI=true`` automatically setup :envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS` to +``false`` and :envvar:`PLATFORMIO_DISABLE_PROGRESSBAR` to ``true``. -In other words, ``CI=true`` automatically setup -:envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS=false `. +.. envvar:: PLATFORMIO_FORCE_COLOR + +Force to output color ANSI-codes even if the output is a ``pipe`` (not a ``tty``). +The possible values are ``true`` and ``false``. Default is ``PLATFORMIO_FORCE_COLOR=false``. + +.. envvar:: PLATFORMIO_DISABLE_PROGRESSBAR + +Disable progress bar for package/library downloader and uploader. This is +useful when calling PlatformIO from subprocess and output is a ``pipe`` (not a ``tty``). +The possible values are ``true`` and ``false``. Default is ``PLATFORMIO_DISABLE_PROGRESSBAR=false``. .. envvar:: PLATFORMIO_HOME_DIR diff --git a/docs/faq.rst b/docs/faq.rst index 9658ec74..05e995b4 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -79,6 +79,7 @@ Bash completion for `platformio` subcommands you need to put into your `.bashrc` .. code-block:: bash eval "$(_PLATFORMIO_COMPLETE=source platformio)" + eval "$(_PLATFORMIO_COMPLETE=source pio)" ZSH completion '''''''''''''' @@ -89,6 +90,7 @@ To enable ``zsh`` completion please run these commands: autoload bashcompinit && bashcompinit eval "$(_PLATFORMIO_COMPLETE=source platformio)" + eval "$(_PLATFORMIO_COMPLETE=source pio)" .. note:: diff --git a/docs/frameworks/arduino.rst b/docs/frameworks/arduino.rst index 3e4ac33c..5645ddd1 100644 --- a/docs/frameworks/arduino.rst +++ b/docs/frameworks/arduino.rst @@ -214,14 +214,14 @@ Arduino * - ``due`` - `Arduino Due (Programming Port) `_ - - AT91SAM3X8E + - SAM3X8E - 84 MHz - 512 Kb - 32 Kb * - ``dueUSB`` - `Arduino Due (USB Native Port) `_ - - AT91SAM3X8E + - SAM3X8E - 84 MHz - 512 Kb - 32 Kb @@ -380,6 +380,20 @@ Arduino - 32 Kb - 2.5 Kb + * - ``zero`` + - `Arduino Zero (Programming Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``zeroUSB`` + - `Arduino Zero (USB Native Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + BQ ~~ @@ -693,7 +707,7 @@ NodeMCU - RAM * - ``nodemcu`` - - `NodeMCU 0.9 & 1.0 `_ + - `NodeMCU 0.9 / 1.0 `_ - ESP8266 - 80 MHz - 4096 Kb @@ -1073,7 +1087,7 @@ Teensy - 16 Kb * - ``teensy31`` - - `Teensy 3.1 `_ + - `Teensy 3.1 / 3.2 `_ - MK20DX256 - 72 MHz - 256 Kb diff --git a/docs/frameworks/cmsis_extra.rst b/docs/frameworks/cmsis_extra.rst index 7394366e..1ab45803 100644 --- a/docs/frameworks/cmsis_extra.rst +++ b/docs/frameworks/cmsis_extra.rst @@ -9,6 +9,13 @@ See the License for the specific language governing permissions and limitations under the License. +Articles +-------- + +* Jan 11, 2016 - **David Mills, Ph.D.** - `STM NUCLEOF401RE TIMER IO `_ + +See more :ref:`articles`. + Examples -------- diff --git a/docs/frameworks/mbed.rst b/docs/frameworks/mbed.rst index d67ad290..0419ad82 100644 --- a/docs/frameworks/mbed.rst +++ b/docs/frameworks/mbed.rst @@ -716,7 +716,7 @@ Teensy - RAM * - ``teensy31`` - - `Teensy 3.1 `_ + - `Teensy 3.1 / 3.2 `_ - MK20DX256 - 72 MHz - 256 Kb diff --git a/docs/frameworks/spl.rst b/docs/frameworks/spl.rst index cae62d7b..72cf9706 100644 --- a/docs/frameworks/spl.rst +++ b/docs/frameworks/spl.rst @@ -106,4 +106,11 @@ ST - 128 Kb - 16 Kb + * - ``nucleo_f401re`` + - `ST Nucleo F401RE `_ + - STM32F401RET6 + - 84 MHz + - 512 Kb + - 96 Kb + .. include:: spl_extra.rst diff --git a/docs/ide.rst b/docs/ide.rst index 54c69373..741e480e 100644 --- a/docs/ide.rst +++ b/docs/ide.rst @@ -17,8 +17,8 @@ IDE Integration .. toctree:: :maxdepth: 2 - ide/arduino ide/atom + ide/arduino ide/clion ide/eclipse ide/emacs diff --git a/docs/ide/atom.rst b/docs/ide/atom.rst index 424c1e55..97ec1982 100644 --- a/docs/ide/atom.rst +++ b/docs/ide/atom.rst @@ -11,47 +11,143 @@ .. _ide_atom: -Atom -==== +PlatformIO IDE for Atom +======================= -`Atom `_ is a text editor that's modern, approachable, +PlatformIO IDE for `Atom `_ is the missing integrated +development environment which provides comprehensive facilities +for IoT development: + +* Cross-platform builder without external dependencies to the system + software: + + - 200+ embedded boards + - 15+ development platforms + - 10+ frameworks + +* C/C++ Intelligent code completion +* C/C++ Smart code linter +* Library Manager for the hundreds popular libraries +* Built-in Terminal with :ref:`PlatformIO CLI ` (``pio``, ``platformio``) + +Atom is a source code editor that's modern, approachable, yet hackable to the core—a tool you can customize to do anything but also use productively without ever touching a config file. -This software can be used with: +.. warning:: -* all available :ref:`platforms` -* all available :ref:`frameworks` - -Refer to the `Atom Documentation `_ -page for more detailed information. + PlatformIO IDE is **in beta testing**. Please report all issues to + `PlatformIO IDE issues tracker `_. .. contents:: -Integration ------------ +Requirements +------------ -Using `Atom Packages `_ -please install `platomformio `_ package. +The only one requirement is `Python Interpreter `_. +PlatformIO is written in Python and works on Mac OS X, Linux, Windows OS and +ARM-based credit-card sized computers (Raspberry Pi, BeagleBone, CubieBoard). -Articles / Manuals ------------------- +Installation +------------ -* Jul 20, 2015 - **Eli Fatsi** - `Arduino Development in Atom Editor `_ +:Python: -See more :ref:`articles`. + Python is installed on Mac OS X and Linux OS by default. The only **Windows Users** + should install it manually. Please `Download the latest Python 2.7.x `_ + and install it. **DON'T FORGET** to select ``Add python.exe to Path`` feature on the + "Customize" stage, otherwise ``python`` command will not be available. -Screenshot +:Atom: Download and install `Atom `_ source code editor + +:PlatformIO IDE: + + Install `platformio-ide `_ package + using: + + - **Mac OS X**: ``Menu: Atom > Preferences > Install`` + - **Windows**: ``Menu: File > Settings > Install`` + - **Linux**: ``Menu: Edit > Preferences > Install`` + +User Guide ---------- -Building -^^^^^^^^ +.. image:: ../_static/ide-atom-platformio.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio.png -.. image:: ../_static/ide-platformio-atom-1.gif - :target: https://atom.io/packages/platomformio +Menu item ``PlatformIO`` +~~~~~~~~~~~~~~~~~~~~~~~~ -Uploading -^^^^^^^^^ +`platformio-ide `_ package adds to Atom +new menu item named ``Menu: PlatformIO`` (after ``Menu: Help`` item). -.. image:: ../_static/ide-platformio-atom-2.gif - :target: https://atom.io/packages/platomformio +.. image:: ../_static/ide-atom-platformio-menu-item.png + +Building / Uploading / etc. +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* ``cmd-alt-b`` / ``ctrl-alt-b`` / ``f9`` builds project without auto-uploading. +* ``cmd-alt-u`` / ``ctrl-alt-u`` builds and uploads (if no errors). +* ``cmd-alt-c`` / ``ctrl-alt-c`` cleans compiled objects. +* ``cmd-alt-t`` / ``ctrl-alt-t`` / ``f7`` run other targets (Upload using Programmer, Upload SPIFFS image, Update platforms and libraries). +* ``cmd-alt-g`` / ``ctrl-alt-g`` / ``f4`` cycles through causes of build error. +* ``cmd-alt-h`` / ``ctrl-alt-h`` / ``shift-f4`` goes to the first build error. +* ``cmd-alt-v`` / ``ctrl-alt-v`` / ``f8`` toggles the build panel. +* ``escape`` terminates build / closes the build window. + +More details `Atom Build package `_. + +Code completion +~~~~~~~~~~~~~~~ + +PlatformIO IDE uses `clang `_ for the code completion. +To check that ``clang`` is available in your system, please open +Terminal and run ``clang --version``. If ``clang`` is not installed, then install it: + +- **Mac OS X**: Install the latest Xcode along with the latest Command Line Tools + (they are installed automatically when you run ``clang`` in Terminal for the + first time, or manually by running ``xcode-select --install`` +- **Windows**: Download the latest `Clang for Windows `_. + Please select "Add LLVM to the system PATH" option on the installation step. +- **Linux**: Using package managers: ``apt-get install clang`` or ``yum install clang``. +- **Other Systems**: Download the latest `Clang for the other systems `_. + +.. warning:: + The libraries which are added, installed or used in the project + after initializing process will not be reflected in code completion. To fix + it you need to reinitialize project using ``Menu: PlatformIO > Initialize new Project (or update existing)``. + +Code linter +~~~~~~~~~~~ + +PlatformIO IDE uses PlatformIO's pre-built GCC toolchains for code linting. You +can customize it in ``.gcc-flags.json`` which will be generated for the selected +board in the project directory using +``Menu: PlatformIO > Initialize new Project (or update existing)``. + +.. warning:: + The libraries which are added, installed or used in the project + after initializing process will not be reflected in code linter. To fix + it you need to reinitialize project using ``Menu: PlatformIO > Initialize new Project (or update existing)``. + +Install Shell Commands +~~~~~~~~~~~~~~~~~~~~~~ + +To install ``platformio`` and ``pio`` shell commands please use ``Menu: +PlatformIO > Install Shell Commands``. It will allow you to call PlatformIO from +other process, terminals and etc. + +Serial Monitor +~~~~~~~~~~~~~~ + +Serial Monitor was temporary disabled in PlatformIO IDE 0.2.1. See +`issue #17 `_. + +Temporary solution is to ``Menu: PlatformIO > Install Shell Commands`` and use +:ref:`cmd_serialports_monitor` from system Terminal application (not built-in in +PlatformIO IDE). + +Known issues +~~~~~~~~~~~~ + +* Built-in Terminal doesn't support ``STDIN`` interaction diff --git a/docs/installation.rst b/docs/installation.rst index 6a593987..1dfe407c 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -20,6 +20,13 @@ computers (`Raspberry Pi `_, `BeagleBone `_, `CubieBoard `_). +.. note:: + We are glad to announce official :ref:`ide_atom` which provides + comprehensive facilities for IoT development: built-in PlatformIO CLI tool, + Terminal and other instruments. + + Try :ref:`ide_atom` for free now! + .. contents:: System requirements diff --git a/docs/librarymanager/config.rst b/docs/librarymanager/config.rst index 945f9e15..b157cc2e 100644 --- a/docs/librarymanager/config.rst +++ b/docs/librarymanager/config.rst @@ -138,7 +138,13 @@ Examples: *Required* if :ref:`libjson_downloadurl` field is not defined | Type: ``Object`` -The repository in which the source code can be found. +The repository in which the source code can be found. The field consists for the +next items: + +* ``type`` +* ``url`` +* ``branch`` if is not specified, default branch will be used. This field will + be ignored if tag/release exists with the value of :ref:`libjson_version`. Example: @@ -158,22 +164,46 @@ Example: *Required* if :ref:`libjson_repository` field is not defined | Type: ``String`` | Max. Length: 20 -A version of the current library source code. +A version of the current library source code. Can contain a-z, digits, dots or +dash. `Semantic Versioning `_ IS RECOMMENDED. -* Can contain a-z, digits, dots or dash. -* `Semantic Versioning `_ IS RECOMMENDED. +:Case 1: -If :ref:`libjson_version` field is not defined and :ref:`libjson_repository` -field is defined, then |PIOAPICR| will use the -`CVS ` revision from -the latest commit as "current version". For example, ``13`` (*SVN*) or first -10 chars of *SHA* digest ``e4564b7da4`` (*Git*). + :ref:`libjson_version` and :ref:`libjson_repository` fields are defined. + The :ref:`libjson_repository` is hosted on GitHub or Bitbucket. -If :ref:`libjson_version` and :ref:`libjson_repository` fields are defined, -then :ref:`libjson_version` has HIGHER PRIORITY. We recommend to use -:ref:`libjson_version` field and specify the real release version. In other -case, users will receive updates for library with each new commit to -:ref:`libjson_repository`. + |PIOAPICR| will lookup for release tag named as value of :ref:`libjson_version` + or with ``v`` prefix (you do not need to pass this ``v`` prefix to the + :ref:`libjson_version` field). + +:Case 2: + + :ref:`libjson_version` and :ref:`libjson_repository` fields are defined + and :ref:`libjson_repository` does not contain tag/release with value of + :ref:`libjson_version`. + + |PIOAPICR| will use the latest source code from :ref:`libjson_repository` + and link it with specified :ref:`libjson_version`. If :ref:`libjson_repository` + ``branch`` is not specified, then default branch will be used. + Also, if you push new commits to :ref:`libjson_repository` + and do not update :ref:`libjson_version` field, the library will not be + updated until you change the :ref:`libjson_version`. + +:Case 3: + + :ref:`libjson_version` field is not defined and :ref:`libjson_repository` + field is defined. + + |PIOAPICR| will use the + `CVS `_ revision from + the latest commit as "current version". For example, ``13`` (*SVN*) or first + 10 chars of *SHA* digest ``e4564b7da4`` (*Git*). If :ref:`libjson_repository` + ``branch`` is not specified, then default branch will be used. + + We recommend to use :ref:`libjson_version` field and specify the real release + version and make appropriate target in the :ref:`libjson_repository`. In other + case, users will receive updates for library with each new commit to + :ref:`libjson_repository`. .. note:: |PIOAPICR| updates library only if: @@ -201,6 +231,11 @@ Example: It is the *HTTP URL* to the archived source code of library. It should end with the type of archive (``.zip`` or ``.tar.gz``). +.. note:: + + :ref:`libjson_downloadurl` has higher priority than + :ref:`libjson_repository`. + Example with fixed release/tag on GitHub: .. code-block:: javascript @@ -372,6 +407,9 @@ A list of example patterns. This field is predefined with default value: .. code-block:: javascript "examples": [ + "[Ee]xamples/*/*.c", + "[Ee]xamples/*/*.cpp", + "[Ee]xamples/*/*.h", "[Ee]xamples/*/*.ino", "[Ee]xamples/*/*.pde" ] diff --git a/docs/platforms/atmelsam.rst b/docs/platforms/atmelsam.rst index 8b7b62ce..053f2b67 100644 --- a/docs/platforms/atmelsam.rst +++ b/docs/platforms/atmelsam.rst @@ -34,6 +34,9 @@ Packages * - ``ldscripts`` - `Linker Scripts `_ + * - ``tool-openocd`` + - `OpenOCD `_ + * - ``toolchain-gccarmnoneeabi`` - `gcc-arm-embedded `_, `GDB `_ @@ -84,18 +87,32 @@ Arduino * - ``due`` - `Arduino Due (Programming Port) `_ - - AT91SAM3X8E + - SAM3X8E - 84 MHz - 512 Kb - 32 Kb * - ``dueUSB`` - `Arduino Due (USB Native Port) `_ - - AT91SAM3X8E + - SAM3X8E - 84 MHz - 512 Kb - 32 Kb + * - ``zero`` + - `Arduino Zero (Programming Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``zeroUSB`` + - `Arduino Zero (USB Native Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + Atmel ~~~~~ diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index c20cdf37..90fea1c7 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -119,6 +119,9 @@ Packages * - ``tool-mspdebug`` - `MSPDebug `_ + * - ``tool-openocd`` + - `OpenOCD `_ + * - ``tool-rfdloader`` - `rfdloader `_ diff --git a/docs/platforms/espressif.rst b/docs/platforms/espressif.rst index 32de397f..200263f0 100644 --- a/docs/platforms/espressif.rst +++ b/docs/platforms/espressif.rst @@ -163,7 +163,7 @@ NodeMCU - RAM * - ``nodemcu`` - - `NodeMCU 0.9 & 1.0 `_ + - `NodeMCU 0.9 / 1.0 `_ - ESP8266 - 80 MHz - 4096 Kb diff --git a/docs/platforms/espressif_extra.rst b/docs/platforms/espressif_extra.rst index 11c52dc8..2b6d3c88 100644 --- a/docs/platforms/espressif_extra.rst +++ b/docs/platforms/espressif_extra.rst @@ -23,6 +23,19 @@ from :ref:`projectconf` upload_speed = 9600 +Custom Reset Method +------------------- + +See :ref:`projectconf_upload_resetmethod` option from :ref:`projectconf` + +.. code-block:: ini + + [env:esp12e] + platform = espressif + framework = arduino + board = esp12e + upload_resetmethod = ck + .. _platform_espressif_customflash: Custom Flash Size @@ -96,7 +109,6 @@ There are 2 options: .. code-block:: ini [env:myenv] - ... upload_port = IP_ADDRESS_HERE or mDNS_NAME.local For example, @@ -164,6 +176,7 @@ Demo Articles -------- +* Jan 16, 2016 - **Dani Eichhorn** - `ESP8266 Arduino IDE Alternative: PlatformIO `_ * Dec 22, 2015 - **Jan Penninkhof** - `Over-the-Air ESP8266 programming using PlatformIO `_ * Dec 01, 2015 - **Tateno Yuichi** - `ESP8266 を CUI で開発する (Develop a ESP8266 in CUI, Japanese) `_ diff --git a/docs/platforms/teensy.rst b/docs/platforms/teensy.rst index 2cf02492..45e1d1c5 100644 --- a/docs/platforms/teensy.rst +++ b/docs/platforms/teensy.rst @@ -113,7 +113,7 @@ Teensy - 16 Kb * - ``teensy31`` - - `Teensy 3.1 `_ + - `Teensy 3.1 / 3.2 `_ - MK20DX256 - 72 MHz - 256 Kb diff --git a/docs/projectconf.rst b/docs/projectconf.rst index bb541a10..d026b33c 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -25,8 +25,8 @@ The sections and their allowable values are described below. .. contents:: -[platformio] ------------- +Section ``[platformio]`` +------------------------ A ``platformio`` section is used for overriding default configuration options @@ -130,9 +130,11 @@ project. This option can be overridden by global environment variable :envvar:`PLATFORMIO_DATA_DIR`. -[env:NAME] ---------- +Section ``[env:NAME]`` +---------------------- + A section with ``env:`` prefix is used to define virtual environment with specific options that will be processed with :ref:`cmd_run` command. You can define unlimited numbers of environments. @@ -145,8 +147,8 @@ Each environment must have unique ``NAME``. The valid chars for ``NAME`` are For example, ``[env:hello_world]``. -Options -~~~~~~~ +General options +~~~~~~~~~~~~~~~ .. _projectconf_env_platform: @@ -165,7 +167,6 @@ Options The multiple frameworks are allowed, split them with comma ``,`` separator. - .. _projectconf_env_board: ``board`` @@ -180,6 +181,9 @@ You can find the ``board`` type in *Boards* section of each :ref:`platforms` or using `PlatformIO Embedded Boards Explorer `_. +Board options +~~~~~~~~~~~~~ + ``board_mcu`` ^^^^^^^^^^^^^ @@ -201,43 +205,12 @@ format of this option is ``C-like long integer`` value with ``L`` suffix. The 1 Hertz is equal to ``1L``, then 16 Mhz (Mega Hertz) is equal to ``16000000L``. The full list of ``board_f_cpu`` for the popular embedded platforms you can -find in *Boards* section of :ref:`platforms`. See "Frequency" column. +find in *Boards* section of :ref:`platforms`. See "Frequency" column. You can +overclock a board by specifying a ``board_f_cpu`` value other than the default. -``upload_port`` -^^^^^^^^^^^^^^^ - -This option is used by "uploader" tool when sending firmware to board via -``upload_port``. For example, - -* ``/dev/ttyUSB0`` - Unix-based OS -* ``COM3`` - Windows OS -* ``192.168.0.13`` - IP address when using OTA - -If ``upload_port`` isn't specified, then *PlatformIO* will try to detect it -automatically. - -To print all available serial ports use :ref:`cmd_serialports` command. - - -``upload_protocol`` -^^^^^^^^^^^^^^^^^^^ - -A protocol that "uploader" tool uses to talk to the board. - -.. _projectconf_upload_speed: - -``upload_speed`` -^^^^^^^^^^^^^^^^ - -A connection speed (`baud rate `_) -which "uploader" tool uses when sending firmware to board. - -``upload_flags`` -^^^^^^^^^^^^^^^^ - -Extra flags for uploader. Will be added to the end of uploader command. If you -need to override uploader command or base flags please use :ref:`projectconf_extra_script`. +Building options +~~~~~~~~~~~~~~~~ .. _projectconf_build_flags: @@ -362,12 +335,129 @@ be applied in theirs order. `GLOB Patterns `_ are allowed. By default, ``src_filter`` is predefined to -``+<*> -<.git/> - -``, which means "includes ALL files, then +``+<*> -<.git/> - -``, which means "includes ALL files, then exclude ``.git`` and ``svn`` repository folders and exclude ``examples`` folder. This option can be set by global environment variable :envvar:`PLATFORMIO_SRC_FILTER`. +.. _projectconf_extra_script: + +``extra_script`` +^^^^^^^^^^^^^^^^ + +Allows to launch extra script using `SCons `_ software +construction tool. For more details please follow to "Construction Environments" +section of +`SCons documentation `_. + +This option can be set by global environment variable +:envvar:`PLATFORMIO_EXTRA_SCRIPT`. + +Example, specify own upload command for :ref:`platform_atmelavr`: + +``platformio.ini``: + +.. code-block:: ini + + [env:env_with_specific_extra_script] + platform = atmelavr + extra_script = /path/to/extra_script.py + custom_option = hello + +``extra_script.py``: + +.. code-block:: python + + from SCons.Script import DefaultEnvironment + + env = DefaultEnvironment() + + env.Replace(UPLOADHEXCMD='"$UPLOADER" ${ARGUMENTS.get("custom_option")} --uploader --flags') + + # uncomment line below to see environment variables + # print env.Dump() + # print ARGUMENTS + + +* see built-in examples of `PlatformIO build scripts `_. +* take a look at the multiple snippets/answers for the user questions: + + - `#462 Split C/C++ build flags `_ + - `#365 Extra configuration for ESP8266 uploader `_ + - `#351 Specific reset method for ESP8266 `_ + - `#247 Specific options for avrdude `_. + +``targets`` +^^^^^^^^^^^ + +A list with targets which will be processed by :ref:`cmd_run` command by +default. You can enter more than one target separated with "space". + +The list with available targets is located in :option:`platformio run --target`. + +**Tip!** You can use these targets like an option to +:option:`platformio run --target` command. For example: + +.. code-block:: bash + + # clean project + platformio run -t clean + + # dump curent build environment + platformio run --target envdump + +When no targets are defined, *PlatformIO* will build only sources by default. + + +Uploading options +~~~~~~~~~~~~~~~~~ + +``upload_port`` +^^^^^^^^^^^^^^^ + +This option is used by "uploader" tool when sending firmware to board via +``upload_port``. For example, + +* ``/dev/ttyUSB0`` - Unix-based OS +* ``COM3`` - Windows OS +* ``192.168.0.13`` - IP address when using OTA + +If ``upload_port`` isn't specified, then *PlatformIO* will try to detect it +automatically. + +To print all available serial ports use :ref:`cmd_serialports` command. + +``upload_protocol`` +^^^^^^^^^^^^^^^^^^^ + +A protocol that "uploader" tool uses to talk to the board. + +.. _projectconf_upload_speed: + +``upload_speed`` +^^^^^^^^^^^^^^^^ + +A connection speed (`baud rate `_) +which "uploader" tool uses when sending firmware to board. + +``upload_flags`` +^^^^^^^^^^^^^^^^ + +Extra flags for uploader. Will be added to the end of uploader command. If you +need to override uploader command or base flags please use :ref:`projectconf_extra_script`. + +.. _projectconf_upload_resetmethod: + +``upload_resetmethod`` +^^^^^^^^^^^^^^^^^^^^^^ + +Specify reset method for "uploader" tool. This option isn't available for all +development platforms. The only :ref:`platform_espressif` supports it. + +Library options +~~~~~~~~~~~~~~~ + ``lib_install`` ^^^^^^^^^^^^^^^ @@ -428,72 +518,7 @@ Example: [env:libs_with_enabled_ldf_cyclic] lib_dfcyclic = True -.. _projectconf_extra_script: - -``extra_script`` -^^^^^^^^^^^^^^^^ - -Allows to launch extra script using `SCons `_ software -construction tool. For more details please follow to "Construction Environments" -section of -`SCons documentation `_. - -This option can be set by global environment variable -:envvar:`PLATFORMIO_EXTRA_SCRIPT`. - -Example, specify own upload command for :ref:`platform_atmelavr`: - -``platformio.ini``: - -.. code-block:: ini - - [env:env_with_specific_extra_script] - platform = atmelavr - extra_script = /path/to/extra_script.py - custom_option = hello - -``extra_script.py``: - -.. code-block:: python - - from SCons.Script import DefaultEnvironment - - env = DefaultEnvironment() - - env.Replace(UPLOADHEXCMD='"$UPLOADER" ${ARGUMENTS.get("custom_option")} --uploader --flags') - - # uncomment line below to see environment variables - # print env.Dump() - # print ARGUMENTS - - -* see built-in examples of `PlatformIO build scripts `_. -* take a look at the multiple snippets/answers for the user questions: - `#365 `_, - `#351 `_, - `#236 `_, - `#247 `_ - -``targets`` -^^^^^^^^^^^ - -A list with targets which will be processed by :ref:`cmd_run` command by -default. You can enter more than one target separated with "space". - -The list with available targets is located in :option:`platformio run --target`. - -**Tip!** You can use these targets like an option to -:option:`platformio run --target` command. For example: - -.. code-block:: bash - - # clean project - platformio run -t clean - - # dump curent build environment - platformio run --target envdump - -When no targets are defined, *PlatformIO* will build only sources by default. +----------- .. _projectconf_examples: @@ -551,8 +576,8 @@ Examples upload_protocol = usbasp upload_flags = -Pusb -B5 -Then upload firmware using :option:`platformio run --target program`. To use -other programmers see :ref:`atmelavr_upload_via_programmer`. +Then upload firmware using target ``program`` for :option:`platformio run --target`. +command. To use other programmers see :ref:`atmelavr_upload_via_programmer`. 4. :ref:`platform_ststm32`: Upload firmware using GDB script ``upload.gdb``, diff --git a/docs/userguide/cmd_settings.rst b/docs/userguide/cmd_settings.rst index 835ad70a..ff5640d0 100644 --- a/docs/userguide/cmd_settings.rst +++ b/docs/userguide/cmd_settings.rst @@ -148,7 +148,7 @@ Examples check_libraries_interval 7 Check for the library updates interval (days) check_platformio_interval 3 Check for the new PlatformIO interval (days) check_platforms_interval 7 Check for the platform updates interval (days) - enable_prompts Yes Can PlatformIO communicate with you via prompts: propose to install platforms which aren't installed yet, paginate over library search results and etc.)? ATTENTION!!! If you call PlatformIO like subprocess, please disable prompts to avoid blocking (Yes/No) + enable_prompts Yes Can PlatformIO communicate with you via prompts ... enable_telemetry Yes Telemetry service (Yes/No) diff --git a/docs/userguide/cmd_upgrade.rst b/docs/userguide/cmd_upgrade.rst index 98f2dfe3..d0b1ebce 100644 --- a/docs/userguide/cmd_upgrade.rst +++ b/docs/userguide/cmd_upgrade.rst @@ -36,7 +36,7 @@ Examples .. code-block:: bash $ platformio upgrade - You're up-to-date! + You are up-to-date! PlatformIO x.x.x is currently the newest version available. # If you have problem with permissions try: diff --git a/docs/userguide/index.rst b/docs/userguide/index.rst index 7b4f8997..d447a775 100644 --- a/docs/userguide/index.rst +++ b/docs/userguide/index.rst @@ -22,6 +22,9 @@ Usage .. code-block:: bash platformio [OPTIONS] COMMAND + pio [OPTIONS] COMMAND + + # "pio" is the alias of "platformio" command Options ------- diff --git a/examples/atmelavr-and-arduino/adafruit-blink/lib/readme.txt b/examples/atmelavr-and-arduino/adafruit-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/atmelavr-and-arduino/adafruit-blink/lib/readme.txt +++ b/examples/atmelavr-and-arduino/adafruit-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/atmelavr-and-arduino/arduino-external-libs/lib/readme.txt b/examples/atmelavr-and-arduino/arduino-external-libs/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/atmelavr-and-arduino/arduino-external-libs/lib/readme.txt +++ b/examples/atmelavr-and-arduino/arduino-external-libs/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/atmelavr-and-arduino/arduino-internal-libs/lib/readme.txt b/examples/atmelavr-and-arduino/arduino-internal-libs/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/atmelavr-and-arduino/arduino-internal-libs/lib/readme.txt +++ b/examples/atmelavr-and-arduino/arduino-internal-libs/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/atmelavr-and-arduino/arduino-own-src_dir/lib/readme.txt b/examples/atmelavr-and-arduino/arduino-own-src_dir/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/atmelavr-and-arduino/arduino-own-src_dir/lib/readme.txt +++ b/examples/atmelavr-and-arduino/arduino-own-src_dir/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/atmelavr-and-arduino/atmelavr-native-blink/lib/readme.txt b/examples/atmelavr-and-arduino/atmelavr-native-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/atmelavr-and-arduino/atmelavr-native-blink/lib/readme.txt +++ b/examples/atmelavr-and-arduino/atmelavr-native-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/atmelavr-and-arduino/digitstump-mouse/lib/readme.txt b/examples/atmelavr-and-arduino/digitstump-mouse/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/atmelavr-and-arduino/digitstump-mouse/lib/readme.txt +++ b/examples/atmelavr-and-arduino/digitstump-mouse/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/atmelavr-and-arduino/engduino-magnetometer/lib/readme.txt b/examples/atmelavr-and-arduino/engduino-magnetometer/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/atmelavr-and-arduino/engduino-magnetometer/lib/readme.txt +++ b/examples/atmelavr-and-arduino/engduino-magnetometer/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/atmelavr-and-arduino/engduino-magnetometer/platformio.ini b/examples/atmelavr-and-arduino/engduino-magnetometer/platformio.ini index fcd5f14e..c75d3321 100644 --- a/examples/atmelavr-and-arduino/engduino-magnetometer/platformio.ini +++ b/examples/atmelavr-and-arduino/engduino-magnetometer/platformio.ini @@ -21,3 +21,4 @@ platform = atmelavr framework = arduino board = engduinov3 +lib_install = 574 diff --git a/examples/atmelavr-and-arduino/panstamp-blink/lib/readme.txt b/examples/atmelavr-and-arduino/panstamp-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/atmelavr-and-arduino/panstamp-blink/lib/readme.txt +++ b/examples/atmelavr-and-arduino/panstamp-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/desktop/hello-world/lib/readme.txt b/examples/desktop/hello-world/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/desktop/hello-world/lib/readme.txt +++ b/examples/desktop/hello-world/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/espressif/esp8266-native/lib/readme.txt b/examples/espressif/esp8266-native/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/espressif/esp8266-native/lib/readme.txt +++ b/examples/espressif/esp8266-native/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/espressif/esp8266-webserver/lib/readme.txt b/examples/espressif/esp8266-webserver/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/espressif/esp8266-webserver/lib/readme.txt +++ b/examples/espressif/esp8266-webserver/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/espressif/esp8266-wifiscan/lib/readme.txt b/examples/espressif/esp8266-wifiscan/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/espressif/esp8266-wifiscan/lib/readme.txt +++ b/examples/espressif/esp8266-wifiscan/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/ide/clion/lib/readme.txt b/examples/ide/clion/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/ide/clion/lib/readme.txt +++ b/examples/ide/clion/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/ide/eclipse/lib/readme.txt b/examples/ide/eclipse/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/ide/eclipse/lib/readme.txt +++ b/examples/ide/eclipse/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/ide/qtcreator/lib/readme.txt b/examples/ide/qtcreator/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/ide/qtcreator/lib/readme.txt +++ b/examples/ide/qtcreator/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/ide/sublimetext/lib/readme.txt b/examples/ide/sublimetext/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/ide/sublimetext/lib/readme.txt +++ b/examples/ide/sublimetext/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/ide/visualstudio/lib/readme.txt b/examples/ide/visualstudio/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/ide/visualstudio/lib/readme.txt +++ b/examples/ide/visualstudio/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/mbed/mbed-blink/lib/readme.txt b/examples/mbed/mbed-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/mbed/mbed-blink/lib/readme.txt +++ b/examples/mbed/mbed-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/mbed/mbed-dsp/lib/readme.txt b/examples/mbed/mbed-dsp/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/mbed/mbed-dsp/lib/readme.txt +++ b/examples/mbed/mbed-dsp/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/mbed/mbed-http-client/lib/readme.txt b/examples/mbed/mbed-http-client/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/mbed/mbed-http-client/lib/readme.txt +++ b/examples/mbed/mbed-http-client/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/mbed/mbed-rtos/lib/readme.txt b/examples/mbed/mbed-rtos/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/mbed/mbed-rtos/lib/readme.txt +++ b/examples/mbed/mbed-rtos/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/mbed/mbed-serial/lib/readme.txt b/examples/mbed/mbed-serial/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/mbed/mbed-serial/lib/readme.txt +++ b/examples/mbed/mbed-serial/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/nordicnrf51/rfduino-ibeacon/lib/readme.txt b/examples/nordicnrf51/rfduino-ibeacon/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/nordicnrf51/rfduino-ibeacon/lib/readme.txt +++ b/examples/nordicnrf51/rfduino-ibeacon/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/raspberrypi/wiringpi-blink/lib/readme.txt b/examples/raspberrypi/wiringpi-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/raspberrypi/wiringpi-blink/lib/readme.txt +++ b/examples/raspberrypi/wiringpi-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/raspberrypi/wiringpi-serial/lib/readme.txt b/examples/raspberrypi/wiringpi-serial/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/raspberrypi/wiringpi-serial/lib/readme.txt +++ b/examples/raspberrypi/wiringpi-serial/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/stm32/stm32-cmsis-blink/lib/readme.txt b/examples/stm32/stm32-cmsis-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/stm32/stm32-cmsis-blink/lib/readme.txt +++ b/examples/stm32/stm32-cmsis-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/stm32/stm32-opencm3-blink/lib/readme.txt b/examples/stm32/stm32-opencm3-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/stm32/stm32-opencm3-blink/lib/readme.txt +++ b/examples/stm32/stm32-opencm3-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/stm32/stm32-spl-blink/lib/readme.txt b/examples/stm32/stm32-spl-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/stm32/stm32-spl-blink/lib/readme.txt +++ b/examples/stm32/stm32-spl-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/teensy/teensy-hid-usb-mouse/lib/readme.txt b/examples/teensy/teensy-hid-usb-mouse/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/teensy/teensy-hid-usb-mouse/lib/readme.txt +++ b/examples/teensy/teensy-hid-usb-mouse/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/teensy/teensy-internal-libs/lib/readme.txt b/examples/teensy/teensy-internal-libs/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/teensy/teensy-internal-libs/lib/readme.txt +++ b/examples/teensy/teensy-internal-libs/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/timsp430/panstamp-blink/lib/readme.txt b/examples/timsp430/panstamp-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/timsp430/panstamp-blink/lib/readme.txt +++ b/examples/timsp430/panstamp-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/timsp430/timsp430-energia-blink/lib/readme.txt b/examples/timsp430/timsp430-energia-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/timsp430/timsp430-energia-blink/lib/readme.txt +++ b/examples/timsp430/timsp430-energia-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/timsp430/timsp430-native-blink/lib/readme.txt b/examples/timsp430/timsp430-native-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/timsp430/timsp430-native-blink/lib/readme.txt +++ b/examples/timsp430/timsp430-native-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/titiva/titiva-energia-blink/lib/readme.txt b/examples/titiva/titiva-energia-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/titiva/titiva-energia-blink/lib/readme.txt +++ b/examples/titiva/titiva-energia-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/titiva/titiva-native-blink/lib/readme.txt b/examples/titiva/titiva-native-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/titiva/titiva-native-blink/lib/readme.txt +++ b/examples/titiva/titiva-native-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/titiva/titiva-opencm3-blink/lib/readme.txt b/examples/titiva/titiva-opencm3-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/titiva/titiva-opencm3-blink/lib/readme.txt +++ b/examples/titiva/titiva-opencm3-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/examples/wiring-blink/.gitignore b/examples/wiring-blink/.gitignore index e90612ed..5402c188 100644 --- a/examples/wiring-blink/.gitignore +++ b/examples/wiring-blink/.gitignore @@ -1 +1,3 @@ -.pioenvs \ No newline at end of file +.pioenvs +.clang_complete +.gcc-flags.json diff --git a/examples/wiring-blink/lib/readme.txt b/examples/wiring-blink/lib/readme.txt index b06c9408..607a92af 100644 --- a/examples/wiring-blink/lib/readme.txt +++ b/examples/wiring-blink/lib/readme.txt @@ -5,7 +5,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/platformio/__init__.py b/platformio/__init__.py index 35d08ccc..72df4174 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 7, 1) +VERSION = (2, 8, 0) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/__main__.py b/platformio/__main__.py index a5670711..c553e8f6 100644 --- a/platformio/__main__.py +++ b/platformio/__main__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from os import listdir +from os import getenv, listdir from os.path import join from platform import system from sys import exit as sys_exit @@ -71,6 +71,8 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904 @click.option("--caller", "-c", help="Caller ID (service).") @click.pass_context def cli(ctx, force, caller): + if not caller and getenv("PLATFORMIO_CALLER"): + caller = getenv("PLATFORMIO_CALLER") maintenance.on_platformio_start(ctx, force, caller) @@ -94,6 +96,14 @@ def main(): "Invalid installation of Python `requests` package`. See " "< https://github.com/platformio/platformio/issues/252 >") + # handle PLATFORMIO_FORCE_COLOR + if str(getenv("PLATFORMIO_FORCE_COLOR", "")).lower() == "true": + try: + # pylint: disable=protected-access + click._compat.isatty = lambda stream: True + except: # pylint: disable=bare-except + pass + cli(None, None, None) except Exception as e: # pylint: disable=W0703 if not isinstance(e, exception.ReturnErrorCode): diff --git a/platformio/app.py b/platformio/app.py index 8707f6cd..3a6ae6cb 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -183,3 +183,7 @@ def get_session_var(name, default=None): def set_session_var(name, value): assert name in SESSION_VARS SESSION_VARS[name] = value + + +def is_disabled_progressbar(): + return is_ci() or getenv("PLATFORMIO_DISABLE_PROGRESSBAR") == "true" diff --git a/platformio/boards/espressif.json b/platformio/boards/espressif.json index 5bef69e7..63a250eb 100644 --- a/platformio/boards/espressif.json +++ b/platformio/boards/espressif.json @@ -50,7 +50,7 @@ "core": "esp8266", "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12", "f_cpu": "80000000L", - "ldscript": "esp8266.flash.4m.ld", + "ldscript": "esp8266.flash.4m1m.ld", "mcu": "esp8266", "variant": "nodemcu" }, @@ -73,7 +73,7 @@ "core": "esp8266", "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12", "f_cpu": "80000000L", - "ldscript": "esp8266.flash.4m.ld", + "ldscript": "esp8266.flash.4m1m.ld", "mcu": "esp8266", "variant": "nodemcu" }, @@ -96,7 +96,7 @@ "core": "esp8266", "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12", "f_cpu": "80000000L", - "ldscript": "esp8266.flash.4m.ld", + "ldscript": "esp8266.flash.4m1m.ld", "mcu": "esp8266", "variant": "adafruit" }, @@ -165,7 +165,7 @@ "core": "esp8266", "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP210", "f_cpu": "80000000L", - "ldscript": "esp8266.flash.4m.ld", + "ldscript": "esp8266.flash.4m1m.ld", "mcu": "esp8266", "variant": "generic" }, @@ -188,7 +188,7 @@ "core": "esp8266", "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12", "f_cpu": "80000000L", - "ldscript": "esp8266.flash.4m.ld", + "ldscript": "esp8266.flash.4m1m.ld", "mcu": "esp8266", "variant": "d1" }, @@ -211,7 +211,7 @@ "core": "esp8266", "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12", "f_cpu": "80000000L", - "ldscript": "esp8266.flash.4m.ld", + "ldscript": "esp8266.flash.4m1m.ld", "mcu": "esp8266", "variant": "d1_mini" }, diff --git a/platformio/boards/nxplpc.json b/platformio/boards/nxplpc.json index e368bc35..f85f5302 100644 --- a/platformio/boards/nxplpc.json +++ b/platformio/boards/nxplpc.json @@ -89,7 +89,7 @@ "name": "SeeedStudio Seeeduino-Arch-Pro", "platform": "nxplpc", "upload": { - "maximum_ram_size": 32768, + "maximum_ram_size": 65536, "maximum_size": 524288 }, "url": "https://developer.mbed.org/platforms/Seeeduino-Arch-Pro/", diff --git a/platformio/boards/ststm32.json b/platformio/boards/ststm32.json index 272c1286..a2746070 100644 --- a/platformio/boards/ststm32.json +++ b/platformio/boards/ststm32.json @@ -273,14 +273,14 @@ "nucleo_f401re": { "build": { "core": "stm32", - "extra_flags": "-DSTM32F4 -DSTM32F401xE", + "extra_flags": "-DSTM32F4 -DSTM32F401xE -DSTM32F40_41xxx", "f_cpu": "84000000L", "ldscript": "stm32f401xe.ld", "cpu": "cortex-m4", "mcu": "stm32f401ret6", "variant": "stm32f401xe" }, - "frameworks": ["cmsis", "mbed"], + "frameworks": ["mbed", "cmsis", "spl"], "name": "ST Nucleo F401RE", "platform": "ststm32", "upload": { diff --git a/platformio/builder/main.py b/platformio/builder/main.py index fd092324..96428dbd 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -56,7 +56,8 @@ commonvars.AddVariables( ("UPLOAD_PORT",), ("UPLOAD_PROTOCOL",), ("UPLOAD_SPEED",), - ("UPLOAD_FLAGS",) + ("UPLOAD_FLAGS",), + ("UPLOAD_RESETMETHOD",) ) DefaultEnvironment( @@ -103,16 +104,16 @@ if "BOARD" in env: except UnknownBoard as e: env.Exit("Error: %s" % str(e)) - if "BOARD_MCU" not in env: - env.Replace(BOARD_MCU="${BOARD_OPTIONS['build']['mcu']}") - if "BOARD_F_CPU" not in env: - env.Replace(BOARD_F_CPU="${BOARD_OPTIONS['build']['f_cpu']}") - if "UPLOAD_PROTOCOL" not in env: - env.Replace( - UPLOAD_PROTOCOL="${BOARD_OPTIONS['upload'].get('protocol', None)}") - if "UPLOAD_SPEED" not in env: - env.Replace( - UPLOAD_SPEED="${BOARD_OPTIONS['upload'].get('speed', None)}") + for k in commonvars.keys(): + if (k in env or + not any([k.startswith("BOARD_"), k.startswith("UPLOAD_")])): + continue + _opt, _val = k.lower().split("_", 1) + if _opt == "board": + _opt = "build" + if _val in env['BOARD_OPTIONS'][_opt]: + env.Replace(**{k: "${BOARD_OPTIONS['%s']['%s']}" % (_opt, _val)}) + if "ldscript" in env.get("BOARD_OPTIONS", {}).get("build", {}): env.Replace( LDSCRIPT_PATH="${BOARD_OPTIONS['build']['ldscript']}" diff --git a/platformio/builder/scripts/espressif.py b/platformio/builder/scripts/espressif.py index 05d498c0..80f1574f 100644 --- a/platformio/builder/scripts/espressif.py +++ b/platformio/builder/scripts/espressif.py @@ -42,10 +42,17 @@ def _get_flash_size(env): else "%dM" % (board_max_size / 1048576)) +def _get_board_f_cpu(env): + f_cpu = env.subst("$BOARD_F_CPU") + f_cpu = str(f_cpu).replace("L", "") + return int(int(f_cpu) / 1000000) + + env = DefaultEnvironment() env.Replace( __get_flash_size=_get_flash_size, + __get_board_f_cpu=_get_board_f_cpu, AR="xtensa-lx106-elf-ar", AS="xtensa-lx106-elf-as", @@ -108,7 +115,7 @@ env.Replace( UPLOADERFLAGS=[ "-vv", - "-cd", "${BOARD_OPTIONS['upload']['resetmethod']}", + "-cd", "$UPLOAD_RESETMETHOD", "-cb", "$UPLOAD_SPEED", "-cp", "$UPLOAD_PORT" ], @@ -143,7 +150,7 @@ env.Append( "eboot", "eboot.elf"), "-bo", "$TARGET", "-bm", "dio", - "-bf", "${BOARD_OPTIONS['build']['f_cpu'][:2]}", + "-bf", "${__get_board_f_cpu(__env__)}", "-bz", "${__get_flash_size(__env__)}", "-bs", ".text", "-bp", "4096", diff --git a/platformio/builder/scripts/frameworks/libopencm3.py b/platformio/builder/scripts/frameworks/libopencm3.py index 2ae27f72..e48e61a3 100644 --- a/platformio/builder/scripts/frameworks/libopencm3.py +++ b/platformio/builder/scripts/frameworks/libopencm3.py @@ -56,7 +56,6 @@ def find_ldscript(src_dir): elif isfile(join(src_dir, BOARD_BUILDOPTS['ldscript'])): ldscript = join(src_dir, BOARD_BUILDOPTS['ldscript']) - assert isfile(ldscript) return ldscript @@ -169,7 +168,8 @@ if BOARD_BUILDOPTS.get("core") == "stm32": root_dir = join(root_dir, BOARD_BUILDOPTS.get("variant")[5:7]) ldscript_path = find_ldscript(root_dir) -merge_ld_scripts(ldscript_path) +if ldscript_path: + merge_ld_scripts(ldscript_path) generate_nvic_files() # override ldscript by libopencm3 diff --git a/platformio/builder/scripts/frameworks/mbed.py b/platformio/builder/scripts/frameworks/mbed.py index e9a60d86..76903afd 100644 --- a/platformio/builder/scripts/frameworks/mbed.py +++ b/platformio/builder/scripts/frameworks/mbed.py @@ -195,20 +195,6 @@ def get_build_flags(data): return flags -def _mbed_whole_archive_hook(flags): - if (not isinstance(flags, list) or - env.get("BOARD_OPTIONS", {}).get("platform") != "ststm32"): - return flags - - for pos, flag in enumerate(flags[:]): - if isinstance(flag, basestring): - continue - flags.insert(pos, "-Wl,-whole-archive") - flags.insert(pos + 2, "-Wl,-no-whole-archive") - - return flags - - board_type = env.subst("$BOARD") variant = MBED_VARIANTS[ board_type] if board_type in MBED_VARIANTS else board_type.upper() @@ -219,8 +205,6 @@ build_flags = get_build_flags(eixdata) variant_dir = join("$PLATFORMFW_DIR", "variant", variant) env.Replace( - _mbed_whole_archive_hook=_mbed_whole_archive_hook, - _LIBFLAGS="${_mbed_whole_archive_hook(%s)}" % env.get("_LIBFLAGS")[2:-1], CPPFLAGS=build_flags.get("CPPFLAGS", []), CFLAGS=build_flags.get("CFLAGS", []), CXXFLAGS=build_flags.get("CXXFLAGS", []), @@ -267,7 +251,7 @@ libs.append(env.Library( for f in eixdata.get("OBJFILES", [])] )) -env.Append(LIBS=libs) +env.Prepend(LIBS=libs) for _libname, _libdata in get_used_mbedlibs().iteritems(): for _libar in _libdata['ar']: diff --git a/platformio/builder/scripts/frameworks/spl.py b/platformio/builder/scripts/frameworks/spl.py index 1e74eae3..e521ae9f 100644 --- a/platformio/builder/scripts/frameworks/spl.py +++ b/platformio/builder/scripts/frameworks/spl.py @@ -23,7 +23,7 @@ directly with the registers. http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743?sc=stm32embeddedsoftware """ -from os.path import join +from os.path import isfile, join from SCons.Script import DefaultEnvironment @@ -70,6 +70,23 @@ envsafe.Append( # Target: Build SPL Library # +# use mbed ldscript with bootloader section +ldscript = env.get("BOARD_OPTIONS", {}).get("build", {}).get("ldscript") +if not isfile(join(env.subst("$PIOPACKAGES_DIR"), "ldscripts", ldscript)): + if "mbed" in env.get("BOARD_OPTIONS", {}).get("frameworks", {}): + env.Append( + LINKFLAGS=[ + '-Wl,-T"%s"' % + join( + "$PIOPACKAGES_DIR", "framework-mbed", "variant", + env.subst("$BOARD").upper(), "mbed", + "TARGET_%s" % env.subst( + "$BOARD").upper(), "TOOLCHAIN_GCC_ARM", + "%s.ld" % ldscript.upper()[:-3] + ) + ] + ) + extra_flags = env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags") src_filter_patterns = ["+<*>"] if "STM32F40_41xxx" in extra_flags: diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 01f70265..352c3ff5 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -17,8 +17,8 @@ from __future__ import absolute_import import atexit import re from glob import glob -from os import environ, remove -from os.path import basename, isfile, join +from os import environ, listdir, remove +from os.path import basename, isdir, isfile, join from platformio.util import exec_command, where_is_program @@ -114,7 +114,10 @@ class InoToCPPConverter(object): def ConvertInoToCpp(env): def delete_tmpcpp_file(file_): - remove(file_) + try: + remove(file_) + except WindowsError: # pylint: disable=undefined-variable + pass ino_nodes = (env.Glob(join("$PROJECTSRC_DIR", "*.ino")) + env.Glob(join("$PROJECTSRC_DIR", "*.pde"))) @@ -133,46 +136,88 @@ def ConvertInoToCpp(env): def DumpIDEData(env): - data = { - "defines": [], - "includes": [], + + BOARD_CORE = env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") + + def get_includes(): + includes = [] + # includes from used framework and libs + for item in env.get("VARIANT_DIRS", []): + if "$BUILDSRC_DIR" in item[0]: + continue + includes.append(env.subst(item[1])) + + # custom includes + for item in env.get("CPPPATH", []): + if item.startswith("$BUILD_DIR"): + continue + includes.append(env.subst(item)) + + # installed libs + for d in env.get("LIBSOURCE_DIRS", []): + lsd_dir = env.subst(d) + _append_lib_includes(lsd_dir, includes) + + # includes from toolchain + toolchain_dir = env.subst( + join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN")) + toolchain_incglobs = [ + join(toolchain_dir, "*", "include*"), + join(toolchain_dir, "lib", "gcc", "*", "*", "include*") + ] + for g in toolchain_incglobs: + includes.extend(glob(g)) + + return includes + + def _append_lib_includes(libs_dir, includes): + if not isdir(libs_dir): + return + for name in env.get("LIB_USE", []) + sorted(listdir(libs_dir)): + if not isdir(join(libs_dir, name)): + continue + # ignore user's specified libs + if name in env.get("LIB_IGNORE", []): + continue + if name == "__cores__": + if isdir(join(libs_dir, name, BOARD_CORE)): + _append_lib_includes( + join(libs_dir, name, BOARD_CORE), includes) + return + + include = ( + join(libs_dir, name, "src") + if isdir(join(libs_dir, name, "src")) + else join(libs_dir, name) + ) + if include not in includes: + includes.append(include) + + def get_defines(): + defines = [] + # global symbols + for item in env.get("CPPDEFINES", []): + if isinstance(item, list): + item = "=".join(item) + defines.append(env.subst(item).replace('\\"', '"')) + + # special symbol for Atmel AVR MCU + board = env.get("BOARD_OPTIONS", {}) + if board and board['platform'] == "atmelavr": + defines.append( + "__AVR_%s__" % board['build']['mcu'].upper() + .replace("ATMEGA", "ATmega") + .replace("ATTINY", "ATtiny") + ) + return defines + + return { + "defines": get_defines(), + "includes": get_includes(), "cxx_path": where_is_program( env.subst("$CXX"), env.subst("${ENV['PATH']}")) } - # includes from framework and libs - for item in env.get("VARIANT_DIRS", []): - if "$BUILDSRC_DIR" in item[0]: - continue - data['includes'].append(env.subst(item[1])) - - # includes from toolchain - toolchain_dir = env.subst( - join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN")) - toolchain_incglobs = [ - join(toolchain_dir, "*", "include*"), - join(toolchain_dir, "lib", "gcc", "*", "*", "include*") - ] - for g in toolchain_incglobs: - data['includes'].extend(glob(g)) - - # global symbols - for item in env.get("CPPDEFINES", []): - if isinstance(item, list): - item = "=".join(item) - data['defines'].append(env.subst(item).replace('\\"', '"')) - - # special symbol for Atmel AVR MCU - board = env.get("BOARD_OPTIONS", {}) - if board and board['platform'] == "atmelavr": - data['defines'].append( - "__AVR_%s__" % board['build']['mcu'].upper() - .replace("ATMEGA", "ATmega") - .replace("ATTINY", "ATtiny") - ) - - return data - def GetCompilerType(env): try: diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index f6cc28b4..c526f2e3 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -19,14 +19,16 @@ from glob import glob from os import getenv, listdir, sep, walk from os.path import basename, dirname, isdir, isfile, join, normpath, realpath -from platformio.util import pioversion_to_intstr from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, 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([ - "+<*>", "-<.git%s>" % sep, "-" % sep, "-" % sep + "+<*>", "-<.git%s>" % sep, "-" % sep, "-" % sep, + "-" % sep ]) @@ -81,12 +83,18 @@ def BuildProgram(env): LIBPATH=["$BUILD_DIR"] ) + sources = env.LookupSources( + "$BUILDSRC_DIR", "$PROJECTSRC_DIR", duplicate=False, + src_filter=getenv("PLATFORMIO_SRC_FILTER", env.get("SRC_FILTER"))) + + if not sources: + env.Exit( + "Error: Nothing to build. Please put your source code files " + "to '%s' folder" % env.subst("$PROJECTSRC_DIR")) + 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"))) + sources ) diff --git a/platformio/commands/boards.py b/platformio/commands/boards.py index ac4911bf..0ccdfa6f 100644 --- a/platformio/commands/boards.py +++ b/platformio/commands/boards.py @@ -61,16 +61,16 @@ def cli(query, json_output): # pylint: disable=R0912 flash_size = "" if "maximum_size" in data.get("upload", None): flash_size = int(data['upload']['maximum_size']) - flash_size = "%dKb" % (flash_size / 1024) + flash_size = "%dkB" % (flash_size / 1024) ram_size = "" if "maximum_ram_size" in data.get("upload", None): ram_size = int(data['upload']['maximum_ram_size']) if ram_size >= 1024: if ram_size % 1024: - ram_size = "%.1fKb" % (ram_size / 1024.0) + ram_size = "%.1fkB" % (ram_size / 1024.0) else: - ram_size = "%dKb" % (ram_size / 1024) + ram_size = "%dkB" % (ram_size / 1024) else: ram_size = "%dB" % ram_size diff --git a/platformio/commands/init.py b/platformio/commands/init.py index f07d2992..f53a80e8 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -191,7 +191,7 @@ PlatformIO will compile them to static libraries and link to executable file. The source code of each library should be placed in separate directory, like "lib/private_lib/[here are source files]". -For example, see how can be organised `Foo` and `Bar` libraries: +For example, see how can be organized `Foo` and `Bar` libraries: |--lib | |--Bar diff --git a/platformio/commands/run.py b/platformio/commands/run.py index a097ebd0..0159de87 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -56,8 +56,13 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914 if not disable_auto_clean: try: _clean_pioenvs_dir(util.get_pioenvs_dir()) - except Exception: - raise exception.CleanPioenvsDirError(util.get_pioenvs_dir()) + except: # pylint: disable=bare-except + click.secho( + "Can not remove temporary directory `%s`. Please remove " + "`.pioenvs` directory from the project manually to avoid " + "build issues" % util.get_pioenvs_dir(), + fg="yellow" + ) results = [] for section in config.sections(): diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index 83520fc2..894e8182 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -34,9 +34,17 @@ def cli(): click.secho("Please wait while upgrading PlatformIO ...", fg="yellow") + to_develop = False + try: + from pkg_resources import parse_version + to_develop = parse_version(last) < parse_version(__version__) + except ImportError: + pass + cmds = ( - [os.path.normpath(sys.executable), - "-m", "pip", "install", "--upgrade", "platformio"], + ["pip", "install", "--upgrade", + "https://github.com/platformio/platformio/archive/develop.zip" + if to_develop else "platformio"], ["platformio", "--version"] ) @@ -44,19 +52,21 @@ def cli(): r = None try: for cmd in cmds: + cmd = [os.path.normpath(sys.executable), "-m"] + cmd r = None r = util.exec_command(cmd) # try pip with disabled cache - if r['returncode'] != 0 and cmd[0] != "platformio": + if r['returncode'] != 0 and cmd[2] == "pip": cmd.insert(3, "--no-cache-dir") r = util.exec_command(cmd) assert r['returncode'] == 0 - assert last in r['out'].strip() + assert "version" in r['out'] + actual_version = r['out'].strip().split("version", 1)[1].strip() click.secho( - "PlatformIO has been successfully upgraded to %s" % last, - fg="green") + "PlatformIO has been successfully upgraded to %s" % + actual_version, fg="green") click.echo("Release notes: ", nl=False) click.secho("http://docs.platformio.org/en/latest/history.html", fg="cyan") diff --git a/platformio/downloader.py b/platformio/downloader.py index a64c1a5f..25e409ae 100644 --- a/platformio/downloader.py +++ b/platformio/downloader.py @@ -20,7 +20,7 @@ from time import mktime import click import requests -from platformio import util +from platformio import app, util from platformio.exception import (FDSHASumMismatch, FDSizeMismatch, FDUnrecognizedStatusCode) @@ -63,7 +63,7 @@ class FileDownloader(object): f = open(self._destination, "wb") chunks = int(ceil(self.get_size() / float(self.CHUNK_SIZE))) - if util.is_ci(): + if app.is_disabled_progressbar(): click.echo("Downloading...") for _ in range(0, chunks): f.write(next(itercontent)) diff --git a/platformio/exception.py b/platformio/exception.py index ad18aefb..78059eb2 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -129,12 +129,6 @@ class UnknownEnvNames(PlatformioException): MESSAGE = "Unknown environment names '{0}'. Valid names are '{1}'" -class CleanPioenvsDirError(PlatformioException): - - MESSAGE = "Can not remove temporary directory `{0}`. "\ - "Please remove it manually" - - class GetSerialPortsError(PlatformioException): MESSAGE = "No implementation for your platform ('{0}') available" diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 05ccafa2..2afd9d40 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -15,12 +15,14 @@ import json import os import re -from os.path import abspath, basename, expanduser, isdir, join, relpath +import sys +from os.path import (abspath, basename, expanduser, isdir, join, normpath, + relpath) import bottle -import click +import click # pylint: disable=wrong-import-order -from platformio import exception, util +from platformio import app, exception, util class ProjectGenerator(object): @@ -64,10 +66,12 @@ class ProjectGenerator(object): envdata = self.get_project_env() if "env_name" not in envdata: return data - result = util.exec_command( - ["platformio", "-f", "run", "-t", "idedata", - "-e", envdata['env_name'], "-d", self.project_dir] - ) + cmd = [normpath(sys.executable), "-m", "platformio", "-f"] + if app.get_session_var("caller_id"): + cmd.extend(["-c", app.get_session_var("caller_id")]) + cmd.extend(["run", "-t", "idedata", "-e", envdata['env_name']]) + cmd.extend(["-d", self.project_dir]) + result = util.exec_command(cmd) if result['returncode'] != 0 or '"includes":' not in result['out']: raise exception.PlatformioException( diff --git a/platformio/ide/tpls/atom/.gcc-flags.json.tpl b/platformio/ide/tpls/atom/.gcc-flags.json.tpl new file mode 100644 index 00000000..3d613580 --- /dev/null +++ b/platformio/ide/tpls/atom/.gcc-flags.json.tpl @@ -0,0 +1,8 @@ +{ + "execPath": "{{ cxx_path.replace("\\", "/") }}", + "gccDefaultCFlags": "-Wall -Wno-cpp -fsyntax-only -D{{ ' -D'.join(defines) }}", + "gccDefaultCppFlags": "-Wall -Wno-cpp -fsyntax-only -D{{ ' -D'.join(defines) }}", + "gccErrorLimit": 15, + "gccIncludePaths": "{{ ','.join(includes).replace("\\", "/") }}", + "gccSuppressWarnings": false +} diff --git a/platformio/ide/tpls/atom/.gitignore.tpl b/platformio/ide/tpls/atom/.gitignore.tpl index 9984610a..5402c188 100644 --- a/platformio/ide/tpls/atom/.gitignore.tpl +++ b/platformio/ide/tpls/atom/.gitignore.tpl @@ -1,2 +1,3 @@ .pioenvs .clang_complete +.gcc-flags.json diff --git a/platformio/maintenance.py b/platformio/maintenance.py index f7e5a51f..c727e635 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -14,7 +14,7 @@ import re import struct -from os import remove +from os import getenv, remove from os.path import isdir, isfile, join from shutil import rmtree from time import time @@ -142,10 +142,17 @@ def after_upgrade(ctx): (click.style("follow", fg="cyan"), click.style("https://twitter.com/PlatformIO_Org", fg="cyan")) ) - click.echo("- %s it on GitHub! > %s" % ( + click.echo("- %s it on GitHub > %s" % ( click.style("star", fg="cyan"), click.style("https://github.com/platformio/platformio", fg="cyan") )) + + if not getenv("PLATFORMIO_IDE"): + click.echo("- %s PlatformIO IDE for IoT development > %s" % ( + click.style("try", fg="cyan"), + click.style("http://platformio.org/", fg="cyan") + )) + click.echo("*" * terminal_width) click.echo("") diff --git a/platformio/platforms/base.py b/platformio/platforms/base.py index 5a4718b7..734d4660 100644 --- a/platformio/platforms/base.py +++ b/platformio/platforms/base.py @@ -129,6 +129,9 @@ PLATFORM_PACKAGES = { "tool-bossac": [ ("BOSSA CLI", "https://sourceforge.net/projects/b-o-s-s-a/") ], + "tool-openocd": [ + ("OpenOCD", "http://openocd.org") + ], "tool-stlink": [ ("ST-Link", "https://github.com/texane/stlink") ], diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 4ab25564..cabda599 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -98,6 +98,8 @@ class MeasurementProtocol(TelemetryBase): dpdata.append("Click/%s" % click.__version__) if app.get_session_var("caller_id"): dpdata.append("Caller/%s" % app.get_session_var("caller_id")) + if getenv("PLATFORMIO_IDE"): + dpdata.append("IDE/%s" % getenv("PLATFORMIO_IDE")) self['an'] = " ".join(dpdata) def _prefill_custom_data(self): @@ -302,12 +304,15 @@ def on_exception(e): def _finalize(): timeout = 1000 # msec elapsed = 0 - while elapsed < timeout: - if not MPDataPusher().in_wait(): - break - sleep(0.2) - elapsed += 200 - backup_reports(MPDataPusher().get_items()) + try: + while elapsed < timeout: + if not MPDataPusher().in_wait(): + break + sleep(0.2) + elapsed += 200 + backup_reports(MPDataPusher().get_items()) + except KeyboardInterrupt: + pass def backup_reports(items): diff --git a/platformio/unpacker.py b/platformio/unpacker.py index f4ef32db..ab8955cd 100644 --- a/platformio/unpacker.py +++ b/platformio/unpacker.py @@ -20,7 +20,7 @@ from zipfile import ZipFile import click -from platformio import util +from platformio import app, util from platformio.exception import UnsupportedArchiveType @@ -92,7 +92,7 @@ class FileUnpacker(object): raise UnsupportedArchiveType(archpath) def start(self): - if util.is_ci(): + if app.is_disabled_progressbar(): click.echo("Unpacking...") for item in self._unpacker.get_items(): self._unpacker.extract_item(item, self._dest_dir) diff --git a/platformio/util.py b/platformio/util.py index 30ba686b..032f8d38 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -18,9 +18,9 @@ import json import os import re import subprocess +import sys from glob import glob -from os.path import (abspath, basename, dirname, expanduser, isdir, isfile, - join, realpath) +from os.path import abspath, basename, dirname, expanduser, isdir, isfile, join from platform import system, uname from threading import Thread @@ -175,7 +175,13 @@ def get_lib_dir(): def get_source_dir(): - return dirname(realpath(__file__)) + curpath = abspath(__file__) + if not isfile(curpath): + for p in sys.path: + if isfile(join(p, __file__)): + curpath = join(p, __file__) + break + return dirname(curpath) def get_project_dir(): @@ -266,8 +272,18 @@ def get_serialports(): from serial.tools.list_ports import comports except ImportError: raise exception.GetSerialPortsError(os.name) - result = [{"port": p, "description": d, "hwid": h} - for p, d, h in comports() if p] + + result = [] + for p, d, h in comports(): + if not p: + continue + if "windows" in get_systype(): + try: + d = unicode(d, errors="ignore") + except TypeError: + pass + result.append({"port": p, "description": d, "hwid": h}) + # fix for PySerial if not result and system() == "Darwin": for p in glob("/dev/tty.*"): @@ -326,7 +342,8 @@ def get_api_result(path, params=None, data=None): raise exception.APIRequestError(e) except requests.exceptions.ConnectionError: raise exception.APIRequestError( - "Could not connect to PlatformIO Registry Service") + "Could not connect to PlatformIO Registry Service. " + "Please try later.") except ValueError: raise exception.APIRequestError( "Invalid response: %s" % r.text.encode("utf-8")) diff --git a/setup.py b/setup.py index 6b4951ba..2e38c3d0 100644 --- a/setup.py +++ b/setup.py @@ -54,6 +54,7 @@ setup( }, entry_points={ "console_scripts": [ + "pio = platformio.__main__:main", "platformio = platformio.__main__:main" ] }, @@ -70,7 +71,7 @@ setup( "Topic :: Software Development :: Compilers" ], keywords=[ - "iot", "build tool", "compiler", "builder", "library manager", + "iot", "ide", "build", "compile", "library manager", "embedded", "ci", "continuous integration", "arduino", "mbed", "esp8266", "framework", "ide", "ide integration", "library.json", "make", "cmake", "makefile", "mk"