Compare commits

...

56 Commits

Author SHA1 Message Date
6c2883ba3b Merge branch 'release/v2.2.0' 2015-07-01 18:03:43 +03:00
249b00df1a Version bump to 2.2.0 (issues #233, #238, #239, #240, #242, #243, #244, #245, #246) 2015-07-01 18:03:33 +03:00
3fcf0a1bda New boards; update packages for pre-built frameworks 2015-06-30 23:34:01 +03:00
c31f591ca0 Add new boards to ST STM32 & Nordic NRF51 platforms 2015-06-30 22:25:27 +03:00
c80fb5f4b3 Update Espressif platform // Resolve #245 2015-06-30 22:21:22 +03:00
218a978f6d Update PlatformIO slogan 2015-06-29 22:26:37 +03:00
f6aed63055 Specify full target anchor for images 2015-06-29 22:25:56 +03:00
a119e39ede Typos fix 2015-06-29 19:40:15 +03:00
94da243dad Disable .user file for Qt Creator (additional steps are explained in docs) // Resolve #244 2015-06-29 18:02:19 +03:00
244412daf1 Update IDE integration instructions for Qt Creator and VisualStudio 2015-06-29 17:59:47 +03:00
29d7137a3d Fix include paths without HOMEDRIVE for VisualStudio 2015-06-29 17:40:10 +03:00
9017cb1600 Fix access to env variable from qtmake 2015-06-29 16:44:37 +03:00
80b012c157 Fix incorrect "includes" for project generator 2015-06-29 16:36:02 +03:00
b80c525952 Improve docs for env's "target" option 2015-06-28 20:38:37 +03:00
1af6eba151 Rename "srcbuild_flags" env option to "src_build_flags" 2015-06-28 20:18:16 +03:00
e288499db9 Rename "install_libs" env option to "lib_install" 2015-06-28 20:16:43 +03:00
ebdbf79868 Rename "use_libs" env option to "lib_use" 2015-06-28 19:44:35 +03:00
776a2027fb Rename "ignore_libs" env option to "lib_ignore" 2015-06-28 19:31:28 +03:00
a928f4aa8f Rename "ldf_cyclic" env option to "lib_dfcyclic" 2015-06-28 19:20:31 +03:00
9c5f9b6e30 Improve embedded texts 2015-06-27 22:47:44 +03:00
ae4918bdb7 Fix relative path for includes when generating project for IDE // Resolve #243 2015-06-27 21:20:44 +03:00
a581ba9814 Fix project generator for Microsoft Visual Studio 2015-06-27 21:18:33 +03:00
31840bbc11 Update PlatformIO logo 2015-06-27 17:57:21 +03:00
53b005bbed Simplify installation process for development version 2015-06-27 15:18:51 +03:00
82864d38e2 Fix IDE project generator when board is specified // Resolve #242 2015-06-27 15:13:27 +03:00
43205b8cd5 Correct fs directory separator // Issue #240 2015-06-23 14:24:46 +03:00
e240e0ee32 Add to FAQ ARM toolchain issue with "error while loading shared libraries" 2015-06-22 18:45:20 +03:00
6c7e26412a Change source dir to "src" 2015-06-22 17:27:32 +03:00
3232ba6a6c Allow to exclude/include source files from build process using src_filter // Resolve #240 2015-06-22 15:06:39 +03:00
46461b0721 Merge branch 'hotfix/v2.1.2' into develop 2015-06-21 21:56:16 +03:00
90508dfd96 Merge branch 'hotfix/v2.1.2' 2015-06-21 21:51:38 +03:00
d8dba90f77 Fix broken link to SCons installer 2015-06-21 21:48:45 +03:00
829d5781a5 Allow to launch own extra script before firmware building/uploading processes // Resolve #239 2015-06-19 15:29:22 +03:00
8e95bfb464 Allow to specify own path to the linker script (ld) using build_flags option // Resolve #233 2015-06-19 13:43:30 +03:00
91563b01d2 Improve path validator 2015-06-19 00:10:50 +03:00
89e2f46e68 Update dependent test-lib 2015-06-19 00:10:17 +03:00
5f1f4a1b19 Bump to 2.2.0.dev0 2015-06-17 14:08:22 +03:00
4669dc7f16 Fix "stk500v2_command(): command failed" // Resolve #238 2015-06-17 13:35:10 +03:00
ca721d7262 Update dependent test-lib 2015-06-17 13:29:28 +03:00
14f84a49a6 Allow to specify library compatibility with the all platforms/frameworks using * symbol in library.json 2015-06-17 13:28:56 +03:00
4744f5afdc Merge pull request #235 from ctag/patch-1
Updated recommened platforms install command
2015-06-13 22:07:29 +02:00
3a48f1c40b Updated recommened platforms install
$ platformio install [platform]
The above line is obsolete, I've changed the recommendation to reflect this latest version of the program.
2015-06-12 23:47:17 -05:00
aea7121076 Merge branch 'release/v2.1.1' 2015-06-09 22:21:21 +03:00
50875ff74b Merge branch 'release/v2.1.1' into develop 2015-06-09 22:21:21 +03:00
dc13048254 Version bump to 2.1.1 (issues #229, #231, #232) 2015-06-09 22:20:53 +03:00
18145d2c1c Add OpenHub badge 2015-06-09 22:08:13 +03:00
f868c64d81 Automatically detect upload port using VID:PID board settings // Resolve #231 2015-06-08 23:02:05 +03:00
3b7ad2d333 Avoid "LibInstallDependencyError" when more then 1 library is found // Resolve #229 2015-06-06 16:41:00 +03:00
6732c7cb7c Better handling of user exceptions 2015-06-06 15:02:12 +03:00
7ba67582de Fix indention 2015-06-05 19:30:49 +03:00
35ae470196 Fix Windows Error 32 while cleanup pioenvs dir 2015-06-05 19:12:57 +03:00
fa339a8b70 Fix firmware verification for examples 2015-06-04 23:17:18 +03:00
43b27c138a Fix bad indentation 2015-06-04 23:15:28 +03:00
36cdbb8f0c Improv detection of build changes 2015-06-04 22:50:13 +03:00
8c331df105 Use direct path to LDScript 2015-06-04 21:24:19 +03:00
02d4efcfb5 Merge branch 'release/v2.1.0' into develop 2015-06-03 19:54:52 +03:00
47 changed files with 875 additions and 665 deletions

View File

@ -1,6 +1,51 @@
Release History
===============
2.2.0 (2015-07-01)
------------------
* Allowed to exclude/include source files from build process using
`src_filter <http://docs.platformio.org/en/latest/projectconf.html#src-filter>`__
(`issue #240 <https://github.com/platformio/platformio/issues/240>`_)
* Launch own extra script before firmware building/uploading processes
(`issue #239 <https://github.com/platformio/platformio/issues/239>`_)
* Specify own path to the linker script (ld) using
`build_flags <http://docs.platformio.org/en/latest/projectconf.html#build-flags>`__
option
(`issue #233 <https://github.com/platformio/platformio/issues/233>`_)
* Specify library compatibility with the all platforms/frameworks
using ``*`` symbol in
`library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`__
* Added support for new embedded boards: *ST 32L0538DISCOVERY and Delta DFCM-NNN40*
to `Framework mbed <http://docs.platformio.org/en/latest/frameworks/mbed.html>`__
* Updated packages for
`Framework Arduino (AVR, SAM, Espressif and Teensy cores <http://docs.platformio.org/en/latest/frameworks/arduino.html>`__,
`Framework mbed <http://docs.platformio.org/en/latest/frameworks/mbed.html>`__,
`Espressif ESP8266 SDK <http://docs.platformio.org/en/latest/platforms/espressif.html>`__
(`issue #246 <https://github.com/platformio/platformio/issues/246>`_)
* Fixed ``stk500v2_command(): command failed``
(`issue #238 <https://github.com/platformio/platformio/issues/238>`_)
* Fixed IDE project generator when board is specified
(`issue #242 <https://github.com/platformio/platformio/issues/242>`_)
* Fixed relative path for includes when generating project for IDE
(`issue #243 <https://github.com/platformio/platformio/issues/243>`_)
* Fixed ESP8266 native SDK exception
(`issue #245 <https://github.com/platformio/platformio/issues/245>`_)
2.1.2 (2015-06-21)
------------------
* Fixed broken link to SCons installer
2.1.1 (2015-06-09)
------------------
* Automatically detect upload port using VID:PID board settings
(`issue #231 <https://github.com/platformio/platformio/issues/231>`_)
* Improved detection of build changes
* Avoided ``LibInstallDependencyError`` when more then 1 library is found
(`issue #229 <https://github.com/platformio/platformio/issues/229>`_)
2.1.0 (2015-06-03)
------------------
@ -28,9 +73,8 @@ Release History
2.0.1 (2015-05-27)
------------------
* Handle new environment variables
* Handle new environment variable
`PLATFORMIO_BUILD_FLAGS <http://docs.platformio.org/en/latest/envvars.html#platformio-build-flags>`_
and `PLATFORMIO_LDF_CYCLIC <http://docs.platformio.org/en/latest/envvars.html#platformio-ldf-cyclic>`_
* Pass to API requests information about Continuous Integration system. This
information will be used by PlatformIO-API.
* Use ``include`` directories from toolchain when initialising project for IDE
@ -70,11 +114,11 @@ Release History
(`issue #192 <https://github.com/platformio/platformio/issues/192>`_)
* Control verbosity of `platformio run <http://docs.platformio.org/en/latest/userguide/cmd_run.html#cmdoption-platformio-run-v>`_ command via ``-v/--verbose`` option
* Add library dependencies for build environment using
`install_libs <http://docs.platformio.org/en/latest/projectconf.html#install-libs>`_
`lib_install <http://docs.platformio.org/en/latest/projectconf.html#lib-install>`_
option in ``platformio.ini``
(`issue #134 <https://github.com/platformio/platformio/issues/134>`_)
* Specify libraries which are compatible with build environment using
`use_libs <http://docs.platformio.org/en/latest/projectconf.html#use-libs>`_
`lib_use <http://docs.platformio.org/en/latest/projectconf.html#lib-use>`_
option in ``platformio.ini``
(`issue #148 <https://github.com/platformio/platformio/issues/148>`_)
* Add more boards to PlatformIO project with
@ -262,7 +306,7 @@ Release History
commands which allows to return the output in `JSON <http://en.wikipedia.org/wiki/JSON>`_ format
(`issue #42 <https://github.com/platformio/platformio/issues/42>`_)
* Allowed to ignore some libs from *Library Dependency Finder* via
`ignore_libs <http://docs.platformio.org/en/latest/projectconf.html#ignore-libs>`_ option
`lib_ignore <http://docs.platformio.org/en/latest/projectconf.html#lib-ignore>`_ option
* Improved `platformio run <http://docs.platformio.org/en/latest/userguide/cmd_run.html>`__
command: asynchronous output for build process, timing and detailed
information about environment configuration
@ -430,10 +474,10 @@ Release History
* Implemented `platformio serialports <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html>`_ command
* Allowed to put special build flags only for ``src`` files via
`srcbuild_flags <http://docs.platformio.org/en/latest/projectconf.html#srcbuild-flags>`_
`src_build_flags <http://docs.platformio.org/en/latest/projectconf.html#src_build-flags>`_
environment option
* Allowed to override some of settings via system environment variables
such as: ``PLATFORMIO_SRCBUILD_FLAGS`` and ``PLATFORMIO_ENVS_DIR``
such as: ``PLATFORMIO_SRC_BUILD_FLAGS`` and ``PLATFORMIO_ENVS_DIR``
* Added ``--upload-port`` option for `platformio run <http://docs.platformio.org/en/latest/userguide/cmd_run.html#cmdoption--upload-port>`__ command
* Implemented (especially for `SmartAnthill <http://docs.smartanthill.ikravets.com/>`_)
`platformio run -t uploadlazy <http://docs.platformio.org/en/latest/userguide/cmd_run.html>`_

View File

@ -28,6 +28,8 @@ 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://www.openhub.net/p/platformio/widgets/project_thin_badge.gif
:target: https://www.openhub.net/p/platformio
`Website + Library Search <http://platformio.org>`_ |
`Documentation <http://docs.platformio.org>`_ |
@ -36,15 +38,16 @@ PlatformIO
`Reddit <http://www.reddit.com/r/platformio/>`_ |
`Twitter <https://twitter.com/PlatformIO_Org>`_
*Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC,
Silicon Labs EFM32, ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed,
libOpenCM3, etc.*
.. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-logo.png
:target: http://platformio.org
`PlatformIO <http://platformio.org>`_ is a cross-platform code builder
and the missing library manager.
and the missing library manager (Ready for embedded development, IDE and
Continuous integration, Arduino and MBED compatible).
*Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC,
Silicon Labs EFM32, ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed,
libOpenCM3, etc.*
* `Get Started <http://platformio.org/#!/get-started>`_
* `Web 2.0 Library Search <http://platformio.org/#!/lib>`_
@ -79,11 +82,13 @@ Embedded Development. *Easier Than Ever.*
settings for most popular `Embedded Boards <http://platformio.org/#!/boards>`_.
* Colourful `command-line output <https://raw.githubusercontent.com/platformio/platformio/develop/examples/platformio-examples.png>`_
* Built-in `Serial Port Monitor <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`_
* Configurable `build -flags/-options <http://docs.platformio.org/en/latest/projectconf.html#build-flags>`_
* `IDE Integration <http://docs.platformio.org/en/latest/ide.html>`_ with
*Arduino, Eclipse, Energia, Qt Creator, Sublime Text, Vim, Visual Studio*
* `Continuous Integration <http://docs.platformio.org/en/latest/ci/index.html>`_
with *AppVeyor, Circle CI, Drone, Shippable, Travis CI*
* Built-in `Serial Port Monitor <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`_ and configurable
`build -flags/-options <http://docs.platformio.org/en/latest/projectconf.html#build-flags>`_
* Automatic **firmware uploading**
* Integration with `development environments (IDE) <http://docs.platformio.org/en/latest/ide.html>`_
* Ready for **Cloud Compiling** and `Continuous Integration <http://docs.platformio.org/en/latest/ci/index.html>`_
* Pre-built tool chains, frameworks for the popular `Hardware Platforms <http://platformio.org/#!/platforms>`_
.. image:: https://raw.githubusercontent.com/platformio/platformio-web/develop/app/images/platformio-embedded-development.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -70,19 +70,26 @@ PLATFORMIO_BUILD_FLAGS
Allows to set :ref:`projectconf` option :ref:`projectconf_build_flags`.
.. _envvar_PLATFORMIO_SRCBUILD_FLAGS:
.. _envvar_PLATFORMIO_SRC_BUILD_FLAGS:
PLATFORMIO_SRCBUILD_FLAGS
~~~~~~~~~~~~~~~~~~~~~~~~~
PLATFORMIO_SRC_BUILD_FLAGS
~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to set :ref:`projectconf` option :ref:`projectconf_srcbuild_flags`.
Allows to set :ref:`projectconf` option :ref:`projectconf_src_build_flags`.
.. _envvar_PLATFORMIO_LDF_CYCLIC:
.. _envvar_PLATFORMIO_SRC_FILTER:
PLATFORMIO_LDF_CYCLIC
PLATFORMIO_SRC_FILTER
~~~~~~~~~~~~~~~~~~~~~
Allows to set :ref:`projectconf` option :ref:`projectconf_ldf_cyclic`.
Allows to set :ref:`projectconf` option :ref:`projectconf_src_filter`.
.. _envvar_PLATFORMIO_EXTRA_SCRIPT:
PLATFORMIO_EXTRA_SCRIPT
~~~~~~~~~~~~~~~~~~~~~~~
Allows to set :ref:`projectconf` option :ref:`projectconf_extra_script`.
Settings
--------

View File

@ -100,3 +100,9 @@ Please upgrade *SetupTools* package:
# Then re-install PlatformIO
$ [sudo] pip uninstall platformio
$ [sudo] pip install platformio
ARM toolchain: ``cc1plus: error while loading shared libraries``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See related answers for
`error while loading shared libraries <https://github.com/platformio/platformio/issues?utf8=✓&q=error+while+loading+shared+libraries>`_.

View File

@ -59,6 +59,26 @@ CQ Publishing
- 64 Kb
- 10 Kb
Delta
~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``dfcm_nnn40``
- `Delta DFCM-NNN40 <https://developer.mbed.org/platforms/Delta-DFCM-NNN40/>`_
- NRF51822
- 32 MHz
- 256 Kb
- 32 Kb
Embedded Artists
~~~~~~~~~~~~~~~~
@ -345,11 +365,11 @@ ST
- 48 Kb
* - ``disco_f334c8``
- `ST 32F3348DISCOVERY <http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF260318>`_
- `ST 32F3348DISCOVERY <http://www.st.com/web/en/catalog/tools/PF260318>`_
- STM32F334C8T6
- 72 MHz
- 64 Kb
- 16 Kb
- 12 Kb
* - ``disco_f401vc``
- `ST 32F401CDISCOVERY <http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF259098>`_
@ -372,6 +392,13 @@ ST
- 2048 Kb
- 256 Kb
* - ``disco_l053c8``
- `ST 32L0538DISCOVERY <http://www.st.com/web/en/catalog/tools/PF260319>`_
- STM32L053C8T6
- 32 MHz
- 64 Kb
- 8 Kb
* - ``nucleo_f030r8``
- `ST Nucleo F030R8 <https://developer.mbed.org/platforms/ST-Nucleo-F030R8/>`_
- STM32F030R8T6

View File

@ -29,7 +29,7 @@ Integration
Project Generator
^^^^^^^^^^^^^^^^^
SSince PlatformIO 2.0 you can generate Eclipse compatible project using
Since PlatformIO 2.0 you can generate Eclipse compatible project using
:option:`platformio init --ide` command. Please choose board type using
:ref:`cmd_boards` command and run:
@ -52,4 +52,4 @@ Screenshot
----------
.. image:: ../_static/ide-platformio-eclipse.png
:target: http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using- eclipse-ideplatformio
:target: http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio

View File

@ -32,6 +32,11 @@ Since PlatformIO 2.0 you can generate Qt Creator compatible project using
Then import this project via ``File > New File or Project > Import Project``
and specify root directory where is located :ref:`projectconf`.
After import, we need to delete default build and clean steps and configure project with PlatformIO source code builder (click on Projects label on left menu or ``Ctrl+5`` shortcut):
.. image:: ../_static/ide-platformio-qtcreator-3.png
:target: http://docs.platformio.org/en/latest/_static/ide-platformio-qtcreator-3.png
Manual Integration
^^^^^^^^^^^^^^^^^^
@ -41,14 +46,16 @@ Setup New Project
First of all, let's create new project from Qt Creator Start Page: ``New Project`` or using ``Menu: File > New File or Project``, then select project with ``Empty Qt Project`` type (``Other Project > Empty Qt Project``), fill ``Name``, ``Create in``.
.. image:: ../_static/ide-platformio-qtcreator-1.png
:target: http://docs.platformio.org/en/latest/_static/ide-platformio-qtcreator-1.png
On the next steps select any available kit and click Finish button.
.. image:: ../_static/ide-platformio-qtcreator-2.png
Secondly, we need to configure project with PlatformIO source code builder (click on Projects label on left menu or ``Ctrl+5`` shortcut):
Secondly, we need to delete default build and clean steps and configure project with PlatformIO source code builder (click on Projects label on left menu or ``Ctrl+5`` shortcut):
.. image:: ../_static/ide-platformio-qtcreator-3.png
:target: http://docs.platformio.org/en/latest/_static/ide-platformio-qtcreator-3.png
Thirdly, change project file by adding path to directories with header files. Please edit project file to match the following contents:
@ -58,15 +65,14 @@ Thirdly, change project file by adding path to directories with header files. Pl
HOMEDIR += $$(USERPROFILE)
}
else {
HOMEDIR += $$(PWD)
HOMEDIR += $$(HOME)
}
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/framework-arduinoavr/cores/arduino"
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/toolchain-atmelavr/avr/include"
win32:INCLUDEPATH ~= s,/,\\,g
INCLUDEPATH += "$${HOMEDIR}/.platformio/packages/framework-arduinoavr/cores/arduino"
INCLUDEPATH += "$${HOMEDIR}/.platformio/packages/toolchain-atmelavr/avr/include"
.. image:: ../_static/ide-platformio-qtcreator-4.png
:target: http://docs.platformio.org/en/latest/_static/ide-platformio-qtcreator-4.png
First program in Qt Creator
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -77,6 +83,7 @@ Simple "Blink" project will consist from two files:
Let's create new text file named ``main.c`` using ``Menu: New File or Project > General > Text File``:
.. image:: ../_static/ide-platformio-qtcreator-5.png
:target: http://docs.platformio.org/en/latest/_static/ide-platformio-qtcreator-5.png
Copy the source code which is described below to file ``main.c``.
@ -101,6 +108,7 @@ Copy the source code which is described below to file ``main.c``.
3. Locate the project configuration file named ``platformio.ini`` at the root of the project directory and open it.
.. image:: ../_static/ide-platformio-qtcreator-6.png
:target: http://docs.platformio.org/en/latest/_static/ide-platformio-qtcreator-6.png
Edit the content to match the code described below.
@ -128,3 +136,5 @@ Conclusion
Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build > Build All``:
.. image:: ../_static/ide-platformio-qtcreator-7.png
:target: http://docs.platformio.org/en/latest/_static/ide-platformio-qtcreator-7.png

View File

@ -123,3 +123,4 @@ Conclusion
Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build > Build Solution``:
.. image:: ../_static/ide-vs-platformio-newproject-8.png
:target: http://docs.platformio.org/en/latest/_static/ide-vs-platformio-newproject-8.png

View File

@ -1,5 +1,8 @@
PlatformIO: A cross-platform code builder and the missing library manager
=========================================================================
PlatformIO is a cross-platform code builder and the missing library manager
===========================================================================
**Ready for embedded development, IDE and Continuous integration, Arduino and
MBED compatible**
*Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC,
Silicon Labs EFM32, ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed,
@ -27,11 +30,13 @@ Embedded Development. *Easier Than Ever.*
-----------------------------------------
* Colourful command-line output
* Built-in :ref:`Serial Port Monitor <cmd_serialports_monitor>`
* Configurable build :ref:`-flags/-options <projectconf_build_flags>`
* Integration with :ref:`development environments (IDE) <ide>`
* Ready for Cloud Compiling and :ref:`ci`
* Pre-built tool chains, :ref:`frameworks` for the popular Hardware Platforms
* :ref:`IDE Integration <ide>` with *Arduino, Eclipse, Energia, Qt Creator,
Sublime Text, Vim, Visual Studio*
* :ref:`ci` with *AppVeyor, Circle CI, Drone, Shippable, Travis CI*
* Built-in :ref:`Serial Port Monitor <cmd_serialports_monitor>` and
configurable build :ref:`-flags/-options <projectconf_build_flags>`
* Pre-built tool chains, :ref:`frameworks` for the
:ref:`Development Platforms <platforms>`
Smart Code Builder. *Fast and Reliable.*
----------------------------------------

View File

@ -122,18 +122,12 @@ Development Version
.. warning::
We don't recommend to use ``develop`` version in production.
1. If you had have already installed PlatformIO, please uninstall it:
.. code-block:: bash
$ pip uninstall platformio
2. Install the latest PlatformIO from the ``develop`` branch:
Install the latest PlatformIO from the ``develop`` branch:
.. code-block:: bash
$ pip install https://github.com/platformio/platformio/archive/develop.zip
If you want to be up-to-date with the latest ``develop`` version of PlatformIO,
then you need to perform step #2 each time if you see the new commits in
`PlatformIO GitHub repository <https://github.com/platformio/platformio/commits/develop>`_.
then you need to re-install PlatformIO each time if you see the new commits in
`PlatformIO GitHub repository (branch: develop) <https://github.com/platformio/platformio/commits/develop>`_.

View File

@ -249,6 +249,12 @@ patterns.
A list with compatible frameworks. The available framework types are defined in
the :ref:`platforms` section.
If the library is compatible with the all frameworks, then you can use ``*``
symbol:
.. code-block:: javascript
"frameworks": "*"
.. _libjson_platforms:
@ -260,6 +266,13 @@ the :ref:`platforms` section.
A list with compatible platforms. The available platform types are
defined in :ref:`platforms` section.
If the library is compatible with the all platforms, then you can use ``*``
symbol:
.. code-block:: javascript
"platforms": "*"
.. _libjson_dependencies:

View File

@ -49,6 +49,26 @@ Boards
* For more detailed ``board`` information please scroll tables below by
horizontal.
Delta
~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``dfcm_nnn40``
- `Delta DFCM-NNN40 <https://developer.mbed.org/platforms/Delta-DFCM-NNN40/>`_
- NRF51822
- 32 MHz
- 256 Kb
- 32 Kb
JKSoft
~~~~~~

View File

@ -142,11 +142,11 @@ ST
- 48 Kb
* - ``disco_f334c8``
- `ST 32F3348DISCOVERY <http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF260318>`_
- `ST 32F3348DISCOVERY <http://www.st.com/web/en/catalog/tools/PF260318>`_
- STM32F334C8T6
- 72 MHz
- 64 Kb
- 16 Kb
- 12 Kb
* - ``disco_f401vc``
- `ST 32F401CDISCOVERY <http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF259098>`_
@ -169,6 +169,13 @@ ST
- 2048 Kb
- 256 Kb
* - ``disco_l053c8``
- `ST 32L0538DISCOVERY <http://www.st.com/web/en/catalog/tools/PF260319>`_
- STM32L053C8T6
- 32 MHz
- 64 Kb
- 8 Kb
* - ``disco_l152rb``
- `ST STM32LDISCOVERY <http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF258515>`_
- STM32L152RBT6

View File

@ -145,7 +145,8 @@ need to specify ``board_mcu``, ``board_f_cpu``, ``upload_protocol`` or
``upload_speed`` options. Just define a ``board`` type and *PlatformIO* will
pre-fill options described above with appropriate values.
You can find the ``board`` type in *Boards* section of each :ref:`platforms`.
You can find the ``board`` type in *Boards* section of each :ref:`platforms` or
using `PlatformIO Embedded Boards Explorer <http://platformio.org/#!/boards>`_.
``board_mcu``
@ -198,20 +199,6 @@ A protocol that "uploader" tool uses to talk to the board.
A connection speed (`baud rate <http://en.wikipedia.org/wiki/Baud>`_)
which "uploader" tool uses when sending firmware to board.
``targets``
^^^^^^^^^^^
A list with targets which will be processed by :ref:`cmd_run` command by
default. You can enter more then one target separated with "space".
When no targets are defined, *PlatformIO* will build only sources by default.
.. note::
This option is useful to enable "auto-uploading" after building operation
(``targets = upload``).
.. _projectconf_build_flags:
``build_flags``
@ -226,10 +213,6 @@ processes:
* - Format
- Scope
- Description
* - ``-Wp,option``
- CPPFLAGS
- Bypass the compiler driver and pass *option* directly through to the
preprocessor
* - ``-D name``
- CPPDEFINES
- Predefine *name* as a macro, with definition 1.
@ -241,6 +224,10 @@ processes:
- CPPDEFINES
- Cancel any previous definition of *name*, either built in or provided
with a ``-D`` option.
* - ``-Wp,option``
- CPPFLAGS
- Bypass the compiler driver and pass *option* directly through to the
preprocessor
* - ``-Wall``
- CCFLAGS
- Turns on all optional warnings which are desirable for normal code.
@ -254,10 +241,18 @@ processes:
- CCFLAGS
- Process *file* as if ``#include "file"`` appeared as the first line of
the primary source file.
* - ``-Idir``
- CPPPATH
- Add the directory *dir* to the list of directories to be searched
for header files.
* - ``-Wa,option``
- ASFLAGS, CCFLAGS
- Pass *option* as an option to the assembler. If *option* contains
commas, it is split into multiple options at the commas.
* - ``-Wl,option``
- LINKFLAGS
- Pass *option* as an option to the linker. If *option* contains
commas, it is split into multiple options at the commas.
* - ``-llibrary``
- LIBS
- Search the *library* named library when linking
@ -265,10 +260,6 @@ processes:
- LIBPATH
- Add directory *dir* to the list of directories to be searched for
``-l``.
* - ``-Idir``
- CPPPATH
- Add the directory *dir* to the list of directories to be searched
for header files.
This option can be set by global environment variable
:ref:`envvar_PLATFORMIO_BUILD_FLAGS`.
@ -278,11 +269,14 @@ Example:
.. code-block:: ini
[env:specific_defines]
build_flags = -O2 -Dfoo -Dbar=1
build_flags = -Dfoo -Dbar=1
[env:specific_inclibs]
build_flags = -I/opt/include -L/opt/lib -lfoo
[env:specific_ld_script]
build_flags = -Wl,-T/path/to/ld_script.ld
For more detailed information about available flags/options go to:
@ -300,20 +294,42 @@ For more detailed information about available flags/options go to:
* `Options for Directory Search
<https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html>`_
.. _projectconf_srcbuild_flags:
.. _projectconf_src_build_flags:
``srcbuild_flags``
^^^^^^^^^^^^^^^^^^
``src_build_flags``
^^^^^^^^^^^^^^^^^^^
An option ``srcbuild_flags`` has the same behaviour like ``build_flags``
An option ``src_build_flags`` has the same behaviour like ``build_flags``
but will be applied only for the project source code from
:ref:`projectconf_pio_src_dir` directory.
This option can be set by global environment variable
:ref:`envvar_PLATFORMIO_SRCBUILD_FLAGS`.
:ref:`envvar_PLATFORMIO_SRC_BUILD_FLAGS`.
``install_libs``
^^^^^^^^^^^^^^^^
.. _projectconf_src_filter:
``src_filter``
^^^^^^^^^^^^^^
This option allows to specify which source files should be included/excluded
from build process. Filter supports 2 templates:
* ``+<PATH>`` include template
* ``-<PATH>`` exclude template
``PATH`` MAST BE related from :ref:`projectconf_pio_src_dir`. All patterns will
be applied in theirs order.
`GLOB Patterns <http://en.wikipedia.org/wiki/Glob_(programming)>`_ are allowed.
By default, ``src_filter`` is predefined to
``+<*> -<.git/> -<svn/> -<examples/>``, 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
:ref:`envvar_PLATFORMIO_SRC_FILTER`.
``lib_install``
^^^^^^^^^^^^^^^
Specify dependent libraries which should be installed before environment
process. The only library IDs are allowed. Multiple libraries can be passed
@ -323,43 +339,41 @@ You can obtain library IDs using :ref:`cmd_lib_search` command.
Example:
.. code-block:: ini
.. code-block:: ini
[env:depends_on_some_libs]
install_libs = 1,13,19
lib_install = 1,13,19
``use_libs``
^^^^^^^^^^^^
``lib_use``
^^^^^^^^^^^
Specify libraries which should be used by ``Library Dependency Finder (LDF)`` with
the highest priority.
Example:
.. code-block:: ini
.. code-block:: ini
[env:libs_with_highest_priority]
use_libs = OneWire_ID1
lib_use = OneWire_ID1,SPI
``ignore_libs``
^^^^^^^^^^^^^^^
``lib_ignore``
^^^^^^^^^^^^^^
Specify libraries which should be ignored by ``Library Dependency Finder (LDF)``
Example:
.. code-block:: ini
.. code-block:: ini
[env:ignore_some_libs]
ignore_libs = SPI,EngduinoV3_ID123
lib_ignore = SPI,EngduinoV3_ID123
.. _projectconf_ldf_cyclic:
``ldf_cyclic``
^^^^^^^^^^^^^^
``lib_dfcyclic``
^^^^^^^^^^^^^^^^
Control cyclic (recursive) behaviour for ``Library Dependency Finder (LDF)``.
By default, this option is turned OFF (``ldf_cyclic=False``) and means, that
By default, this option is turned OFF (``lib_dfcyclic=False``) and means, that
``LDF`` will find only libraries which are included in source files from the
project :ref:`projectconf_pio_src_dir`.
@ -367,16 +381,76 @@ If you want to enable cyclic (recursive, nested) search, please set this option
to ``True``. Founded library will be treated like a new source files and
``LDF`` will search dependencies for it.
This option can be set by global environment variable
:ref:`envvar_PLATFORMIO_LDF_CYCLIC`.
Example:
.. code-block:: ini
.. code-block:: ini
[env:libs_with_enabled_ldf_cyclic]
ldf_cyclic = True
lib_dfcyclic = True
.. _projectconf_extra_script:
``extra_script``
^^^^^^^^^^^^^^^^
Allows to launch extra script using `SCons <http://www.scons.org>`_ software
construction tool. For more details please follow to "Construction Environments"
section of
`SCons documentation <http://www.scons.org/doc/production/HTML/scons-user.html#chap-environments>`_.
This option can be set by global environment variable
:ref:`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
``extra_script.py``:
.. code-block:: python
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
env.Replace(UPLOADHEXCMD='"$UPLOADER" --uploader --flags')
# uncomment line below to see environment variables
# print env.Dump()
See built-in examples of `PlatformIO build scripts <https://github.com/platformio/platformio/tree/develop/platformio/builder/scripts>`_.
``targets``
^^^^^^^^^^^
A list with targets which will be processed by :ref:`cmd_run` command by
default. You can enter more then one target separated with "space".
Pre-built targets:
* ``clean`` delete compiled object files, libraries and firmware binaries
* ``upload`` enable "auto-uploading" for embedded platforms after building
operation
* ``envdump`` dump current build environment
**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:

View File

@ -1,14 +1,15 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
VERSION = (2, 1, 0)
VERSION = (2, 2, 0)
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"
__description__ = ("A cross-platform code builder and the missing library "
"manager (Atmel AVR & SAM, Espressif, Freescale Kinetis, "
"Nordic nRF51, NXP LPC, Silicon Labs EFM32, ST STM32, "
"TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc)")
__description__ = (
"Cross-platform code builder and the missing library manager "
"(Ready for embedded development, IDE and Continuous integration, "
"Arduino and MBED compatible)"
)
__url__ = "http://platformio.org"
__author__ = "Ivan Kravets"

View File

@ -41,10 +41,10 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
def _handle_obsolate_command(name):
if name in ("install", "list", "search", "show", "uninstall"):
click.secho(
"Warning! `platformio %s` command is obsoleted and will be "
"Warning! `platformio %s` command is deprecated and will be "
"removed in the next release! Please use "
"`platformio platforms %s` instead." % (name, name),
fg="red"
fg="yellow"
)
from platformio.commands import platforms
return getattr(platforms, "platforms_" + name)

View File

@ -126,5 +126,21 @@
},
"url": "http://developer.mbed.org/platforms/Seeed-Tiny-BLE/",
"vendor": "SeeedStudio"
},
"dfcm_nnn40": {
"build": {
"f_cpu": "32000000L",
"cpu": "cortex-m0",
"mcu": "nrf51822"
},
"frameworks": ["mbed"],
"name": "Delta DFCM-NNN40",
"platform": "nordicnrf51",
"upload": {
"maximum_ram_size": 32768,
"maximum_size": 262144
},
"url": "https://developer.mbed.org/platforms/Delta-DFCM-NNN40/",
"vendor": "Delta"
}
}
}

View File

@ -390,5 +390,37 @@
},
"url": "http://docs.armstrap.org/en/latest/hardware-overview.html",
"vendor": "Armstrap"
},
"disco_l053c8": {
"build": {
"f_cpu": "32000000L",
"cpu": "cortex-m0plus",
"mcu": "stm32l053c8t6"
},
"frameworks": ["mbed"],
"name": "ST 32L0538DISCOVERY",
"platform": "ststm32",
"upload": {
"maximum_ram_size": 8192,
"maximum_size": 65536
},
"url": "http://www.st.com/web/en/catalog/tools/PF260319",
"vendor": "ST"
},
"disco_f334c8": {
"build": {
"f_cpu": "72000000L",
"cpu": "cortex-m4",
"mcu": "stm32f334c8t6"
},
"frameworks": ["mbed"],
"name": "ST 32F3348DISCOVERY",
"platform": "ststm32",
"upload": {
"maximum_ram_size": 12288,
"maximum_size": 65536
},
"url": "http://www.st.com/web/en/catalog/tools/PF260318",
"vendor": "ST"
}
}
}

View File

@ -11,11 +11,13 @@ except ImportError:
break
from platformio import util
from os.path import join
import json
from os import getenv
from os.path import isfile, join
from time import time
from SCons.Script import (DefaultEnvironment, Exit, SConscript,
SConscriptChdir, Variables)
from SCons.Script import (COMMAND_LINE_TARGETS, DefaultEnvironment, Exit,
SConscript, SConscriptChdir, Variables)
from platformio.exception import UnknownBoard
@ -25,6 +27,7 @@ from platformio.exception import UnknownBoard
commonvars = Variables(None)
commonvars.AddVariables(
("BUILD_SCRIPT",),
("EXTRA_SCRIPT",),
("PIOENV",),
("PLATFORM",),
@ -35,10 +38,11 @@ commonvars.AddVariables(
# options
("FRAMEWORK",),
("BUILD_FLAGS",),
("SRCBUILD_FLAGS",),
("IGNORE_LIBS",),
("USE_LIBS",),
("LDF_CYCLIC",),
("SRC_BUILD_FLAGS",),
("SRC_FILTER",),
("LIB_DFCYCLIC",),
("LIB_IGNORE",),
("LIB_USE",),
# board options
("BOARD",),
@ -54,7 +58,7 @@ commonvars.AddVariables(
DefaultEnvironment(
tools=[
"gcc", "g++", "as", "ar", "gnulink",
"platformio", "pioupload", "pioar"
"platformio", "pioupload", "pioar", "piomisc"
],
toolpath=[join("$PIOBUILDER_DIR", "tools")],
variables=commonvars,
@ -63,6 +67,7 @@ DefaultEnvironment(
PIOHOME_DIR=util.get_home_dir(),
PROJECT_DIR=util.get_project_dir(),
PROJECTLIB_DIR=util.get_projectlib_dir(),
PROJECTSRC_DIR=util.get_projectsrc_dir(),
PIOENVS_DIR=util.get_pioenvs_dir(),
@ -70,8 +75,9 @@ DefaultEnvironment(
PIOPACKAGES_DIR=join("$PIOHOME_DIR", "packages"),
BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"),
BUILDSRC_DIR=join("$BUILD_DIR", "src"),
LIBSOURCE_DIRS=[
join("$PROJECT_DIR", "lib"),
"$PROJECTLIB_DIR",
util.get_lib_dir(),
join("$PLATFORMFW_DIR", "libraries")
]
@ -97,9 +103,11 @@ if "BOARD" in env:
UPLOAD_SPEED="${BOARD_OPTIONS['upload'].get('speed', None)}")
if "ldscript" in env.get("BOARD_OPTIONS", {}).get("build", {}):
env.Replace(
LDSCRIPT_PATH=join(
"$PIOHOME_DIR", "packages", "ldscripts",
"${BOARD_OPTIONS['build']['ldscript']}"
LDSCRIPT_PATH=(
env['BOARD_OPTIONS']['build']['ldscript']
if isfile(env['BOARD_OPTIONS']['build']['ldscript'])
else join("$PIOHOME_DIR", "packages", "ldscripts",
"${BOARD_OPTIONS['build']['ldscript']}")
)
)
@ -110,8 +118,10 @@ if "BOARD" in env:
env.get("BOARD_OPTIONS", {}).get("platform")))
if "IGNORE_LIBS" in env:
env['IGNORE_LIBS'] = [l.strip() for l in env['IGNORE_LIBS'].split(",")]
for opt in ("LIB_IGNORE", "LIB_USE"):
if opt not in env:
continue
env[opt] = [l.strip() for l in env[opt].split(",") if l.strip()]
env.PrependENVPath(
"PATH",
@ -120,3 +130,14 @@ env.PrependENVPath(
SConscriptChdir(0)
SConscript(env.subst("$BUILD_SCRIPT"))
if getenv("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT", None)):
SConscript(getenv("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT")))
if "envdump" in COMMAND_LINE_TARGETS:
print env.Dump()
Exit()
if "idedata" in COMMAND_LINE_TARGETS:
print json.dumps(env.DumpIDEData())
Exit()

View File

@ -30,7 +30,10 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
env.Replace(UPLOAD_SPEED=None)
if env.subst("$UPLOAD_SPEED"):
env.Append(UPLOADERFLAGS=["-b", "$UPLOAD_SPEED"])
env.Append(UPLOADERFLAGS=[
"-b", "$UPLOAD_SPEED",
"-D"
])
if not upload_options.get("require_upload_port", False):
return

View File

@ -77,7 +77,7 @@ env.Replace(
"-cp", "$UPLOAD_PORT",
"-ca", "0x00000",
"-cf", "${SOURCES[0]}",
"-ca", "0x10000",
"-ca", "0x40000" if "FRAMEWORK" not in env else "0x10000",
"-cf", "${SOURCES[1]}"
],
UPLOADCMD='$UPLOADER $UPLOADERFLAGS'
@ -140,7 +140,8 @@ if "uploadlazy" in COMMAND_LINE_TARGETS:
else:
target_firm = env.ElfToBin(
[join("$BUILD_DIR", "firmware_00000"),
join("$BUILD_DIR", "firmware_10000")], target_elf)
join("$BUILD_DIR", "firmware_%s" %
("40000" if "FRAMEWORK" not in env else "10000"))], target_elf)
#

View File

@ -32,9 +32,6 @@ env.Replace(
)
MBED_VARIANTS = {
"stm32f3discovery": "DISCO_F303VC",
"stm32f4discovery": "DISCO_F407VG",
"stm32f429discovery": "DISCO_F429ZI",
"blueboard_lpc11u24": "LPC11U24",
"dipcortexm0": "LPC11U24",
"seeeduinoArchPro": "ARCH_PRO",
@ -54,7 +51,8 @@ MBED_VARIANTS = {
"frdm_kl05z": "KL05Z",
"frdm_k20d50m": "K20D50M",
"frdm_k22f": "K22F",
"teensy31": "TEENSY3_1"
"teensy31": "TEENSY3_1",
"dfcm_nnn40": "DELTA_DFCM_NNN40"
}
MBED_LIBS_MAP = {

View File

@ -38,10 +38,7 @@ env.Append(
envsafe = env.Clone()
envsafe.Append(
CPPPATH=[
join("$BUILD_DIR", "src")
],
CPPPATH=["$BUILDSRC_DIR"],
CPPDEFINES=[
"USE_STDPERIPH_DRIVER"
]
@ -52,22 +49,22 @@ envsafe.Append(
#
extra_flags = env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags")
ignore_files = []
src_filter_patterns = ["+<*>"]
if "STM32F40_41xxx" in extra_flags:
ignore_files += ["stm32f4xx_fmc.c"]
src_filter_patterns += ["-<stm32f4xx_fmc.c>"]
if "STM32F427_437xx" in extra_flags:
ignore_files += ["stm32f4xx_fsmc.c"]
src_filter_patterns += ["-<stm32f4xx_fsmc.c>"]
elif "STM32F303xC" in extra_flags:
ignore_files += ["stm32f30x_hrtim.c"]
src_filter_patterns += ["-<stm32f30x_hrtim.c>"]
elif "STM32L1XX_MD" in extra_flags:
ignore_files += ["stm32l1xx_flash_ramfunc.c"]
src_filter_patterns += ["-<stm32l1xx_flash_ramfunc.c>"]
libs = []
libs.append(envsafe.BuildLibrary(
join("$BUILD_DIR", "FrameworkSPL"),
join("$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}", "variants",
"${BOARD_OPTIONS['build']['variant']}", "src"),
ignore_files
src_filter=" ".join(src_filter_patterns)
))
env.Append(LIBS=libs)

View File

@ -0,0 +1,167 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import atexit
import re
from glob import glob
from os import remove
from os.path import basename, join
class InoToCPPConverter(object):
PROTOTYPE_RE = re.compile(
r"""^(
(\s*[a-z_\d]+){1,2} # return type
(\s+[a-z_\d]+\s*) # name of prototype
\([a-z_,\.\*\&\[\]\s\d]*\) # arguments
)\s*\{ # must end with {
""",
re.X | re.M | re.I
)
DETECTMAIN_RE = re.compile(r"void\s+(setup|loop)\s*\(", re.M | re.I)
STRIPCOMMENTS_RE = re.compile(r"(/\*.*?\*/|(^|\s+)//[^\r\n]*$)",
re.M | re.S)
def __init__(self, nodes):
self.nodes = nodes
def is_main_node(self, contents):
return self.DETECTMAIN_RE.search(contents)
@staticmethod
def _replace_comments_callback(match):
if "\n" in match.group(1):
return "\n" * match.group(1).count("\n")
else:
return " "
def _parse_prototypes(self, contents):
prototypes = []
reserved_keywords = set(["if", "else", "while"])
for item in self.PROTOTYPE_RE.findall(contents):
if set([item[1].strip(), item[2].strip()]) & reserved_keywords:
continue
prototypes.append(item[0])
return prototypes
def append_prototypes(self, fname, contents, prototypes):
contents = self.STRIPCOMMENTS_RE.sub(self._replace_comments_callback,
contents)
result = []
is_appended = False
linenum = 0
for line in contents.splitlines():
linenum += 1
line = line.strip()
if not is_appended and line and not line.startswith("#"):
is_appended = True
result.append("%s;" % ";\n".join(prototypes))
result.append('#line %d "%s"' % (linenum, fname))
result.append(line)
return result
def convert(self):
prototypes = []
data = []
for node in self.nodes:
ino_contents = node.get_text_contents()
prototypes += self._parse_prototypes(ino_contents)
item = (basename(node.get_path()), ino_contents)
if self.is_main_node(ino_contents):
data = [item] + data
else:
data.append(item)
if not data:
return None
result = ["#include <Arduino.h>"]
is_first = True
for name, contents in data:
if is_first and prototypes:
result += self.append_prototypes(name, contents, prototypes)
else:
result.append('#line 1 "%s"' % name)
result.append(contents)
is_first = False
return "\n".join(result)
def ConvertInoToCpp(env):
def delete_tmpcpp_file(file_):
remove(file_)
ino_nodes = (env.Glob(join("$PROJECTSRC_DIR", "*.ino")) +
env.Glob(join("$PROJECTSRC_DIR", "*.pde")))
c = InoToCPPConverter(ino_nodes)
data = c.convert()
if not data:
return
tmpcpp_file = join(env.subst("$PROJECTSRC_DIR"), "tmp_ino_to.cpp")
with open(tmpcpp_file, "w") as f:
f.write(data)
atexit.register(delete_tmpcpp_file, tmpcpp_file)
def DumpIDEData(env):
data = {
"defines": [],
"includes": []
}
# 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))
# 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 exists(_):
return True
def generate(env):
env.AddMethod(ConvertInoToCpp)
env.AddMethod(DumpIDEData)
return env

View File

@ -69,18 +69,25 @@ def AutodetectUploadPort(env):
if (not item['name'] or
not any([l in item['name'].lower() for l in msdlabels])):
continue
print "Auto-detected UPLOAD_PORT/DISK: %s" % item['disk']
env.Replace(UPLOAD_PORT=item['disk'])
break
else:
board_build_opts = env.get("BOARD_OPTIONS", {}).get("build", {})
board_hwid = ("%s:%s" % (
board_build_opts.get("vid"),
board_build_opts.get("pid")
)).replace("0x", "")
for item in get_serialports():
if "VID:PID" not in item['hwid']:
continue
print "Auto-detected UPLOAD_PORT: %s" % item['port']
env.Replace(UPLOAD_PORT=item['port'])
break
if board_hwid in item['hwid']:
break
if "UPLOAD_PORT" not in env:
if "UPLOAD_PORT" in env:
print "Auto-detected UPLOAD_PORT/DISK: %s" % env['UPLOAD_PORT']
else:
Exit("Error: Please specify `upload_port` for environment or use "
"global `--upload-port` option.\n"
"For the some development platforms it can be USB flash drive\n")

View File

@ -1,20 +1,24 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import atexit
import json
import re
from glob import glob
from os import getenv, listdir, remove, sep, walk
from os import getenv, listdir, sep, walk
from os.path import basename, dirname, isdir, isfile, join, normpath
from SCons.Script import (COMMAND_LINE_TARGETS, DefaultEnvironment, Exit,
SConscript, SConscriptChdir)
from SCons.Script import 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([
"+<*>", "-<.git%s>" % sep, "-<svn%s>" % sep, "-<examples%s>" % sep
])
def BuildFirmware(env):
# fix ASM handling under non-casitive OS
@ -27,49 +31,41 @@ def BuildFirmware(env):
env.ProcessFlags()
env.BuildFramework()
firmenv = env.Clone()
vdirs = firmenv.VariantDirRecursive(
join("$BUILD_DIR", "src"), "$PROJECTSRC_DIR", duplicate=False)
# build dependent libs
deplibs = firmenv.BuildDependentLibraries("$PROJECTSRC_DIR")
deplibs = env.BuildDependentLibraries("$PROJECTSRC_DIR")
# append specified LD_SCRIPT
if "LDSCRIPT_PATH" in firmenv:
firmenv.Append(
LINKFLAGS=["-T", "$LDSCRIPT_PATH"]
if ("LDSCRIPT_PATH" in env and
not any(["-Wl,-T" in f for f in env['LINKFLAGS']])):
env.Append(
LINKFLAGS=["-Wl,-T", "$LDSCRIPT_PATH"]
)
# enable "cyclic reference" for linker
firmenv.Prepend(
env.Prepend(
_LIBFLAGS="-Wl,--start-group "
)
firmenv.Append(
env.Append(
_LIBFLAGS=" -Wl,--end-group"
)
# Handle SRCBUILD_FLAGS
if getenv("PLATFORMIO_SRCBUILD_FLAGS", None):
firmenv.MergeFlags(getenv("PLATFORMIO_SRCBUILD_FLAGS"))
if "SRCBUILD_FLAGS" in env:
firmenv.MergeFlags(env['SRCBUILD_FLAGS'])
# 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'])
firmenv.Append(
env.Append(
CPPDEFINES=["PLATFORMIO={0:02d}{1:02d}{2:02d}".format(
*pioversion_to_intstr())]
)
if "envdump" in COMMAND_LINE_TARGETS:
print env.Dump()
Exit()
if "idedata" in COMMAND_LINE_TARGETS:
print json.dumps(env.DumpIDEData())
Exit()
return firmenv.Program(
return env.Program(
join("$BUILD_DIR", "firmware"),
[firmenv.GlobCXXFiles(vdir) for vdir in vdirs],
env.LookupSources(
"$BUILDSRC_DIR", "$PROJECTSRC_DIR", duplicate=False,
src_filter=getenv("PLATFORMIO_SRC_FILTER",
env.get("SRC_FILTER", None))),
LIBS=env.get("LIBS", []) + deplibs,
LIBPATH=env.get("LIBPATH", []) + ["$BUILD_DIR"],
PROGSUFFIX=".elf"
@ -95,13 +91,13 @@ def ProcessFlags(env):
env.Append(_CPPDEFFLAGS=" %s" % " ".join(undefines))
def GlobCXXFiles(env, path):
files = []
for suff in ["c", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"]:
_list = env.Glob(join(path, "*.%s" % suff))
if _list:
files += _list
return files
def IsFileWithExt(env, file_, ext): # pylint: disable=W0613
if basename(file_).startswith("."):
return False
for e in ext:
if file_.endswith(".%s" % e):
return True
return False
def VariantDirWrap(env, variant_dir, src_dir, duplicate=True):
@ -109,20 +105,53 @@ def VariantDirWrap(env, variant_dir, src_dir, duplicate=True):
env.VariantDir(variant_dir, src_dir, duplicate)
def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True,
ignore_pattern=None):
if not ignore_pattern:
ignore_pattern = (".git", ".svn")
def LookupSources(env, variant_dir, src_dir, duplicate=True, src_filter=None):
SRC_FILTER_PATTERNS_RE = re.compile(r"(\+|\-)<([^>]+)>")
def _append_build_item(items, item, src_dir):
if env.IsFileWithExt(item, SRC_BUILD_EXT + SRC_HEADER_EXT):
items.add(item.replace(src_dir + sep, ""))
def _match_sources(src_dir, src_filter):
matches = set()
# correct fs directory separator
src_filter = src_filter.replace("/", sep).replace("\\", sep)
for (action, pattern) in SRC_FILTER_PATTERNS_RE.findall(src_filter):
items = set()
for item in glob(join(src_dir, pattern)):
if isdir(item):
for root, _, files in walk(item, followlinks=True):
for f in files:
_append_build_item(items, join(root, f), src_dir)
else:
_append_build_item(items, item, src_dir)
if action == "+":
matches |= items
else:
matches -= items
return sorted(list(matches))
sources = []
variants = []
src_dir = env.subst(src_dir)
for root, _, _ in walk(src_dir, followlinks=True):
_src_dir = root
_var_dir = variant_dir + root.replace(src_dir, "")
if any([s in _var_dir.lower() for s in ignore_pattern]):
continue
env.VariantDirWrap(_var_dir, _src_dir, duplicate)
variants.append(_var_dir)
return variants
if src_dir.endswith(sep):
src_dir = src_dir[:-1]
for item in _match_sources(src_dir, src_filter or SRC_DEFAULT_FILTER):
_reldir = dirname(item)
_src_dir = join(src_dir, _reldir) if _reldir else src_dir
_var_dir = join(variant_dir, _reldir) if _reldir else variant_dir
if _var_dir not in variants:
variants.append(_var_dir)
env.VariantDirWrap(_var_dir, _src_dir, duplicate)
if env.IsFileWithExt(item, SRC_BUILD_EXT):
sources.append(env.File(join(_var_dir, basename(item))))
return sources
def BuildFramework(env):
@ -135,7 +164,6 @@ def BuildFramework(env):
for f in env['FRAMEWORK'].split(","):
framework = f.strip().lower()
if framework in env.get("BOARD_OPTIONS", {}).get("frameworks"):
SConscriptChdir(0)
SConscript(
env.subst(join("$PIOBUILDER_DIR", "scripts", "frameworks",
"%s.py" % framework))
@ -145,18 +173,11 @@ def BuildFramework(env):
framework)
def BuildLibrary(env, variant_dir, library_dir, ignore_files=None):
def BuildLibrary(env, variant_dir, src_dir, src_filter=None):
lib = env.Clone()
vdirs = lib.VariantDirRecursive(
variant_dir, library_dir, ignore_pattern=(".git", ".svn", "examples"))
srcfiles = []
for vdir in vdirs:
for item in lib.GlobCXXFiles(vdir):
if not ignore_files or item.name not in ignore_files:
srcfiles.append(item)
return lib.Library(
lib.subst(variant_dir),
srcfiles
lib.LookupSources(variant_dir, src_dir, src_filter=src_filter)
)
@ -165,8 +186,6 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
INCLUDES_RE = re.compile(
r"^\s*#include\s+(\<|\")([^\>\"\']+)(?:\>|\")", re.M)
LIBSOURCE_DIRS = [env.subst(d) for d in env.get("LIBSOURCE_DIRS", [])]
USE_LIBS = [l.strip() for l in env.get("USE_LIBS", "").split(",")
if l.strip()]
# start internal prototypes
@ -207,7 +226,7 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
if not isdir(lsd_dir):
continue
for ld in USE_LIBS + sorted(listdir(lsd_dir)):
for ld in env.get("LIB_USE", []) + sorted(listdir(lsd_dir)):
if not isdir(join(lsd_dir, ld)):
continue
@ -220,7 +239,7 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
lib_name = basename(lib_dir)
# ignore user's specified libs
if "IGNORE_LIBS" in env and lib_name in env['IGNORE_LIBS']:
if lib_name in env.get("LIB_IGNORE", []):
continue
if not isfile(inc_path):
@ -250,10 +269,10 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
return result
def _process_src_dir(state, src_dir):
for root, _, _ in walk(src_dir, followlinks=True):
for node in (env.GlobCXXFiles(root) +
env.Glob(join(root, "*.h"))):
state = _parse_includes(state, node)
for root, _, files in walk(src_dir, followlinks=True):
for f in files:
if env.IsFileWithExt(f, SRC_BUILD_EXT + SRC_HEADER_EXT):
state = _parse_includes(state, env.File(join(root, f)))
return state
def _parse_includes(state, node):
@ -279,8 +298,7 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
_lib_dir))
state['libs'].add(_lib_dir)
if getenv("PLATFORMIO_LDF_CYCLIC",
env.subst("$LDF_CYCLIC")).lower() == "true":
if env.subst("$LIB_DFCYCLIC").lower() == "true":
state = _process_src_dir(state, _lib_dir)
return state
@ -306,151 +324,6 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
return libs
class InoToCPPConverter(object):
PROTOTYPE_RE = re.compile(
r"""^(
(\s*[a-z_\d]+){1,2} # return type
(\s+[a-z_\d]+\s*) # name of prototype
\([a-z_,\.\*\&\[\]\s\d]*\) # arguments
)\s*\{ # must end with {
""",
re.X | re.M | re.I
)
DETECTMAIN_RE = re.compile(r"void\s+(setup|loop)\s*\(", re.M | re.I)
STRIPCOMMENTS_RE = re.compile(r"(/\*.*?\*/|(^|\s+)//[^\r\n]*$)",
re.M | re.S)
def __init__(self, nodes):
self.nodes = nodes
def is_main_node(self, contents):
return self.DETECTMAIN_RE.search(contents)
@staticmethod
def _replace_comments_callback(match):
if "\n" in match.group(1):
return "\n" * match.group(1).count("\n")
else:
return " "
def _parse_prototypes(self, contents):
prototypes = []
reserved_keywords = set(["if", "else", "while"])
for item in self.PROTOTYPE_RE.findall(contents):
if set([item[1].strip(), item[2].strip()]) & reserved_keywords:
continue
prototypes.append(item[0])
return prototypes
def append_prototypes(self, fname, contents, prototypes):
contents = self.STRIPCOMMENTS_RE.sub(self._replace_comments_callback,
contents)
result = []
is_appended = False
linenum = 0
for line in contents.splitlines():
linenum += 1
line = line.strip()
if not is_appended and line and not line.startswith("#"):
is_appended = True
result.append("%s;" % ";\n".join(prototypes))
result.append('#line %d "%s"' % (linenum, fname))
result.append(line)
return result
def convert(self):
prototypes = []
data = []
for node in self.nodes:
ino_contents = node.get_text_contents()
prototypes += self._parse_prototypes(ino_contents)
item = (basename(node.get_path()), ino_contents)
if self.is_main_node(ino_contents):
data = [item] + data
else:
data.append(item)
if not data:
return None
result = ["#include <Arduino.h>"]
is_first = True
for name, contents in data:
if is_first and prototypes:
result += self.append_prototypes(name, contents, prototypes)
else:
result.append('#line 1 "%s"' % name)
result.append(contents)
is_first = False
return "\n".join(result)
def ConvertInoToCpp(env):
def delete_tmpcpp_file(file_):
remove(file_)
ino_nodes = (env.Glob(join("$PROJECTSRC_DIR", "*.ino")) +
env.Glob(join("$PROJECTSRC_DIR", "*.pde")))
c = InoToCPPConverter(ino_nodes)
data = c.convert()
if not data:
return
tmpcpp_file = join(env.subst("$PROJECTSRC_DIR"), "tmp_ino_to.cpp")
with open(tmpcpp_file, "w") as f:
f.write(data)
atexit.register(delete_tmpcpp_file, tmpcpp_file)
def DumpIDEData(env):
data = {
"defines": [],
"includes": []
}
# includes from framework and libs
for item in env.get("VARIANT_DIRS", []):
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", []):
data['defines'].append(env.subst(item))
# 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 exists(_):
return True
@ -458,12 +331,10 @@ def exists(_):
def generate(env):
env.AddMethod(BuildFirmware)
env.AddMethod(ProcessFlags)
env.AddMethod(GlobCXXFiles)
env.AddMethod(IsFileWithExt)
env.AddMethod(VariantDirWrap)
env.AddMethod(VariantDirRecursive)
env.AddMethod(LookupSources)
env.AddMethod(BuildFramework)
env.AddMethod(BuildLibrary)
env.AddMethod(BuildDependentLibraries)
env.AddMethod(ConvertInoToCpp)
env.AddMethod(DumpIDEData)
return env

View File

@ -4,7 +4,7 @@
import stat
from glob import glob
from os import chmod, getenv, makedirs, remove
from os.path import abspath, basename, isdir, isfile, join
from os.path import abspath, basename, expanduser, isdir, isfile, join
from shutil import copyfile, copytree, rmtree
from tempfile import mkdtemp
@ -19,8 +19,12 @@ from platformio.util import get_boards
def validate_path(ctx, param, value): # pylint: disable=W0613
invalid_path = None
for p in value:
if not glob(p):
value = list(value)
for i, p in enumerate(value):
if p.startswith("~"):
value[i] = expanduser(p)
value[i] = abspath(value[i])
if not glob(value[i]):
invalid_path = p
break
try:
@ -109,7 +113,6 @@ def _copy_contents(dst_dir, contents):
}
for path in contents:
path = abspath(path)
if isdir(path):
items['dirs'].add(path)
elif isfile(path):

View File

@ -86,7 +86,7 @@ def cli(project_dir, board, ide, disable_auto_uploading, env_prefix):
project_file, board, disable_auto_uploading, env_prefix)
if ide:
pg = ProjectGenerator(project_dir, ide)
pg = ProjectGenerator(project_dir, ide, board[0] if board else None)
pg.generate()
click.secho(

View File

@ -142,8 +142,23 @@ def lib_install_dependency(ctx, data):
query.append('+"%s"' % data[key])
result = get_api_result("/lib/search", dict(query=" ".join(query)))
assert result['total'] == 1
ctx.invoke(lib_install, libid=[result['items'][0]['id']])
assert result['total'] > 0
if result['total'] == 1 or not app.get_setting("enable_prompts"):
ctx.invoke(lib_install, libid=[result['items'][0]['id']])
else:
click.secho(
"Conflict: More then one dependent libraries have been found "
"by request %s:" % json.dumps(data), fg="red")
echo_liblist_header()
for item in result['items']:
echo_liblist_item(item)
deplib_id = click.prompt(
"Please choose one dependent library ID",
type=click.Choice([str(i['id']) for i in result['items']]))
ctx.invoke(lib_install, libid=[int(deplib_id)])
@cli.command("uninstall", short_help="Uninstall libraries")

View File

@ -2,8 +2,9 @@
# See LICENSE for details.
from datetime import datetime
from os import getcwd
from os.path import getmtime, isdir, join
from hashlib import sha1
from os import getcwd, makedirs, walk
from os.path import getmtime, isdir, isfile, join
from shutil import rmtree
from time import time
@ -38,12 +39,8 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
if unknown:
raise exception.UnknownEnvNames(", ".join(unknown))
# remove ".pioenvs" if project config is modified
_pioenvs_dir = util.get_pioenvs_dir()
if (isdir(_pioenvs_dir) and
getmtime(join(util.get_project_dir(), "platformio.ini")) >
getmtime(_pioenvs_dir)):
rmtree(_pioenvs_dir)
# clean obsolete .pioenvs dir
_clean_pioenvs_dir()
results = []
for section in config.sections():
@ -76,11 +73,19 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
class EnvironmentProcessor(object):
RENAMED_OPTIONS = {
"INSTALL_LIBS": "LIB_INSTALL",
"IGNORE_LIBS": "LIB_IGNORE",
"USE_LIBS": "LIB_USE",
"LDF_CYCLIC": "LIB_DFCYCLIC",
"SRCBUILD_FLAGS": "SRC_BUILD_FLAGS"
}
def __init__(self, cmd_ctx, name, options, # pylint: disable=R0913
targets, upload_port, verbose):
self.cmd_ctx = cmd_ctx
self.name = name
self.options = options
self.options = self._validate_options(options)
self.targets = targets
self.upload_port = upload_port
self.verbose_level = int(verbose)
@ -111,6 +116,23 @@ class EnvironmentProcessor(object):
return not is_error
def _validate_options(self, options):
result = {}
for k, v in options.items():
_k = k.upper()
# process obsolete options
if _k in self.RENAMED_OPTIONS:
click.secho(
"Warning! `%s` option is deprecated and will be "
"removed in the next release! Please use "
"`%s` instead." % (
k, self.RENAMED_OPTIONS[_k].lower()),
fg="yellow"
)
k = self.RENAMED_OPTIONS[_k].lower()
result[k] = v
return result
def _get_build_variables(self):
variables = ["PIOENV=" + self.name]
if self.upload_port:
@ -119,7 +141,7 @@ class EnvironmentProcessor(object):
k = k.upper()
if k == "TARGETS" or (k == "UPLOAD_PORT" and self.upload_port):
continue
variables.append("%s=%s" % (k.upper(), v))
variables.append("%s=%s" % (k, v))
return variables
def _get_build_targets(self):
@ -142,8 +164,8 @@ class EnvironmentProcessor(object):
# install platform and libs dependencies
_autoinstall_platform(self.cmd_ctx, platform)
if "install_libs" in self.options:
_autoinstall_libs(self.cmd_ctx, self.options['install_libs'])
if "lib_install" in self.options:
_autoinstall_libs(self.cmd_ctx, self.options['lib_install'])
p = PlatformFactory.newPlatform(platform)
return p.run(build_vars, build_targets, self.verbose_level)
@ -176,3 +198,41 @@ def _autoinstall_libs(ctx, libids_list):
", ".join([str(i) for i in not_intalled_libs])
)):
ctx.invoke(cmd_lib_install, libid=not_intalled_libs)
def _clean_pioenvs_dir():
pioenvs_dir = util.get_pioenvs_dir()
structhash_file = join(pioenvs_dir, "structure.hash")
proj_hash = calculate_project_hash()
# if project's config is modified
if (isdir(pioenvs_dir) and
getmtime(join(util.get_project_dir(), "platformio.ini")) >
getmtime(pioenvs_dir)):
rmtree(pioenvs_dir)
# check project structure
if isdir(pioenvs_dir) and isfile(structhash_file):
with open(structhash_file) as f:
if f.read() == proj_hash:
return
rmtree(pioenvs_dir)
if not isdir(pioenvs_dir):
makedirs(pioenvs_dir)
with open(structhash_file, "w") as f:
f.write(proj_hash)
def calculate_project_hash():
structure = []
for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()):
if not isdir(d):
continue
for root, _, files in walk(d):
for f in files:
path = join(root, f)
if not any([s in path for s in (".git", ".svn")]):
structure.append(path)
return sha1(",".join(sorted(structure))).hexdigest() if structure else ""

View File

@ -30,7 +30,7 @@ class UnknownPlatform(PlatformioException):
class PlatformNotInstalledYet(PlatformioException):
MESSAGE = ("The platform '%s' has not been installed yet. "
"Use `platformio install` command")
"Use `platformio platforms install` command")
class UnknownCLICommand(PlatformioException):

View File

@ -4,7 +4,7 @@
import json
from glob import glob
from os import listdir, walk
from os.path import basename, isdir, join
from os.path import abspath, basename, expanduser, isdir, join, relpath
import bottle
@ -13,9 +13,10 @@ from platformio import util
class ProjectGenerator(object):
def __init__(self, project_dir, ide):
def __init__(self, project_dir, ide, board=None):
self.project_dir = project_dir
self.ide = ide
self.board = board
self._tplvars = {}
self._gather_tplvars()
@ -26,6 +27,7 @@ class ProjectGenerator(object):
return sorted([d for d in listdir(tpls_dir)
if isdir(join(tpls_dir, d))])
@util.memoized
def get_project_env(self):
data = {"env_name": "PlatformIO"}
with util.cd(self.project_dir):
@ -33,9 +35,11 @@ class ProjectGenerator(object):
for section in config.sections():
if not section.startswith("env:"):
continue
data['env_name'] = section[4:]
data = {"env_name": section[4:]}
for k, v in config.items(section):
data[k] = v
if self.board and self.board == data.get("board"):
break
return data
@util.memoized
@ -63,12 +67,12 @@ class ProjectGenerator(object):
def get_project_name(self):
return basename(self.project_dir)
@staticmethod
def get_srcfiles():
def get_srcfiles(self):
result = []
for root, _, files in walk(util.get_projectsrc_dir()):
for f in files:
result.append(join(root, f))
with util.cd(self.project_dir):
for root, _, files in walk(util.get_projectsrc_dir()):
for f in files:
result.append(relpath(join(root, f)))
return result
def get_tpls(self):
@ -99,5 +103,6 @@ class ProjectGenerator(object):
"defines": (build_data['defines']
if build_data and "defines" in build_data else []),
"srcfiles": self.get_srcfiles(),
"user_home_dir": abspath(expanduser("~")),
"project_dir": self.project_dir
})

View File

@ -24,8 +24,12 @@
<tool id="org.eclipse.cdt.build.core.settings.holder.1624502120" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.239157887" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
% for include in includes:
% if include.startswith(user_home_dir):
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
% else:
<listOptionValue builtIn="false" value="{{include}}"/>
% end
% end
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.922107295" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
% for define in defines:
@ -37,8 +41,12 @@
<tool id="org.eclipse.cdt.build.core.settings.holder.54121539" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1096940598" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
% for include in includes:
% if include.startswith(user_home_dir):
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
% else:
<listOptionValue builtIn="false" value="{{include}}"/>
% end
% end
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1198905600" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
% for define in defines:
@ -50,8 +58,12 @@
<tool id="org.eclipse.cdt.build.core.settings.holder.1310559623" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.41298875" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
% for include in includes:
% if include.startswith(user_home_dir):
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
% else:
<listOptionValue builtIn="false" value="{{include}}"/>
% end
% end
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.884639970" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
% for define in defines:

View File

@ -2,14 +2,16 @@ win32 {
HOMEDIR += $$(USERPROFILE)
}
else {
HOMEDIR += $$(PWD)
HOMEDIR += $$(HOME)
}
% for include in includes:
% if include.startswith(user_home_dir):
INCLUDEPATH += "$${HOMEDIR}{{include.replace(user_home_dir, "")}}"
% else:
INCLUDEPATH += "{{include}}"
% end
win32:INCLUDEPATH ~= s,/,\\,g
% end
% for define in defines:
DEFINES += "{{define}}"

View File

@ -1,231 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.2.2, 2015-05-07T12:57:08. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{00248b6a-4380-4f03-8dea-a03053177907}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">{{project_name}}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">{{project_name}}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.53.win32_mingw482_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">{{project_dir}}</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">--force run</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Command">platformio</value>
<value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{buildDir}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Process Step</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">--force run --target clean</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Command">platformio</value>
<value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{buildDir}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Process Step</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">{{project_dir}}</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">--force run</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Command">platformio</value>
<value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{buildDir}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Process Step</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">--force run --target clean</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Command">platformio</value>
<value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{buildDir}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Process Step</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">platformio</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:{{project_dir}}/platformio.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">platformio.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">16</value>
</data>
<data>
<variable>Version</variable>
<value type="int">16</value>
</data>
</qtcreator>

View File

@ -3,27 +3,27 @@
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;ino;pde</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Source Files\src">
<UniqueIdentifier>{cad450ef-1a84-42d4-a5b5-a1736b8833d3}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="readme.txt" />
</ItemGroup>
<ItemGroup>
<None Include="platformio.ini" />
<None Include="src\blink.pde">
<Filter>Source Files\src</Filter>
</None>
</ItemGroup>
% for file in srcfiles:
<ItemGroup>
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
<ClInclude Include="{{file}}">
<Filter>Header Files</Filter>
</ClInclude>
% else:
<ClCompile Include="{{file}}">
<Filter>Source Files</Filter>
</ClCompile>
%end
</ItemGroup>
% end
</Project>

View File

@ -39,26 +39,33 @@
<NMakeBuildCommandLine>platformio --force run</NMakeBuildCommandLine>
<NMakeCleanCommandLine>platformio --force run --target clean</NMakeCleanCommandLine>
<NMakePreprocessorDefinitions>{{";".join(defines)}}</NMakePreprocessorDefinitions>
<NMakeIncludeSearchPath>{{";".join(includes)}}</NMakeIncludeSearchPath>
<NMakeIncludeSearchPath>{{";".join(["$(HOMEDRIVE)$(HOMEPATH)%s" % i.replace(user_home_dir, "") if i.startswith(user_home_dir) else i for i in includes])}}</NMakeIncludeSearchPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<NMakeBuildCommandLine>platformio run</NMakeBuildCommandLine>
<NMakeCleanCommandLine>platformio run --target clean</NMakeCleanCommandLine>
<NMakePreprocessorDefinitions>{";".join(defines)}}</NMakePreprocessorDefinitions>
<NMakeIncludeSearchPath>{{";".join(includes)}}</NMakeIncludeSearchPath>
<NMakeIncludeSearchPath>{{";".join(["$(HOMEDRIVE)$(HOMEPATH)%s" % i.replace(user_home_dir, "") if i.startswith(user_home_dir) else i for i in includes])}}</NMakeIncludeSearchPath>
</PropertyGroup>
<ItemDefinitionGroup>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="readme.txt" />
</ItemGroup>
<ItemGroup>
<None Include="platformio.ini" />
% for file in srcfiles:
<None Include="{{file}}" />
% end
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ItemGroup>
<None Include="platformio.ini" />
</ItemGroup>
% for file in srcfiles:
<ItemGroup>
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
<ClInclude Include="{{file}}">
<Filter>Header Files</Filter>
</ClInclude>
% else:
<ClCompile Include="{{file}}">
<Filter>Source Files</Filter>
</ClCompile>
%end
</ItemGroup>
% end
</Project>

View File

@ -86,7 +86,7 @@ class Upgrader(object):
def _upgrade_to_0_9_0(self, ctx): # pylint: disable=R0201
prev_platforms = []
# remove platform's folder (obsoleted package structure)
# remove platform's folder (obsolete package structure)
for name in PlatformFactory.get_platforms().keys():
pdir = join(get_home_dir(), name)
if not isdir(pdir):

View File

@ -12,7 +12,7 @@ from time import time
import click
import requests
from platformio import __version__, app, util
from platformio import __version__, app, exception, util
class TelemetryBase(object):
@ -219,9 +219,11 @@ def on_event(category, action, label=None, value=None, screen_name=None):
def on_exception(e):
if isinstance(e, exception.AbortedByUser):
return
mp = MeasurementProtocol()
mp['exd'] = "%s: %s" % (type(e).__name__, e)
mp['exf'] = 1
mp['exf'] = int(not isinstance(e, exception.PlatformioException))
mp.send("exception")

View File

@ -167,6 +167,10 @@ def get_projectsrc_dir():
)
def get_projectlib_dir():
return join(get_project_dir(), "lib")
def get_pioenvs_dir():
return _get_projconf_option_dir(
"envs_dir",
@ -263,9 +267,7 @@ def get_logicaldisks():
def get_request_defheaders():
return {"User-Agent": "PlatformIO/%s CI/%d %s" % (
__version__,
1 if is_ci() else 0,
requests.utils.default_user_agent()
__version__, int(is_ci()), requests.utils.default_user_agent()
)}

View File

@ -101,7 +101,8 @@ def main():
("Installing PlatformIO and dependencies", install_pypi_packages, [
[["setuptools"], ["platformio"], [
"--egg",
"http://sourceforge.net/projects/scons/files/latest/download"
"http://sourceforge.net/projects/platformio-storage/files/"
"scons.zip/download"
]]
])
]

View File

@ -50,7 +50,10 @@ setup(
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Compilers"
],
keywords=("builder library manager atmel avr sam espressif esp freescale "
"kinetis nordic nrf51 nxp lpc silicon labs efm32 st stm32 ti "
"msp430 tiva teensy arduino mbed libopencm3")
keywords=(
"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"
)
)

View File

@ -38,6 +38,8 @@ def test_run(platformio_setup, pioproject_dir):
# check .elf file
pioenvs_dir = join(pioproject_dir, ".pioenvs")
for item in listdir(pioenvs_dir):
if not isdir(item):
continue
assert isfile(join(pioenvs_dir, item, "firmware.elf"))
# check .hex or .bin files
firmwares = []

View File

@ -11,7 +11,7 @@ deps =
isort
flake8
commands =
pip install --egg http://sourceforge.net/projects/scons/files/latest/download
pip install --egg http://sourceforge.net/projects/platformio-storage/files/scons.zip/download
[testenv:docs]
basepython = python2.7
@ -48,5 +48,5 @@ passenv = *
deps = pytest
commands =
{envpython} --version
pip install --egg http://sourceforge.net/projects/scons/files/latest/download
pip install --egg http://sourceforge.net/projects/platformio-storage/files/scons.zip/download
py.test -v --basetemp="{envtmpdir}" tests