Merge branch 'release/v2.3.4'

This commit is contained in:
Ivan Kravets
2015-10-13 18:40:46 +01:00
32 changed files with 360 additions and 190 deletions

View File

@ -4,6 +4,24 @@ Release History
PlatformIO 2.0 PlatformIO 2.0
-------------- --------------
2.3.4 (2015-10-13)
~~~~~~~~~~~~~~~~~~
* Full support of `CLion IDE <http://docs.platformio.org/en/latest/ide/clion.html>`_
including code auto-completion
(`issue #132 <https://github.com/platformio/platformio/issues/132>`_)
* PlatformIO `command completion in Terminal <http://docs.platformio.org/en/latest/faq.html#command-completion-in-terminal>`_ for ``bash`` and ``zsh``
* Added support for ubIQio Ardhat board
(`pull #302 <https://github.com/platformio/platformio/pull/302>`_)
* Install SCons automatically and avoid ``error: option --single-version-externally-managed not recognized``
(`issue #279 <https://github.com/platformio/platformio/issues/279>`_)
* Use Teensy CLI Loader for upload of .hex files on Mac OS X
(`issue #306 <https://github.com/platformio/platformio/issues/306>`_)
* Fixed missing `framework-mbed <http://docs.platformio.org/en/latest/frameworks/mbed.html>`_
package for `teensy <http://docs.platformio.org/en/latest/platforms/teensy.html>`_
platform
(`issue #305 <https://github.com/platformio/platformio/issues/305>`_)
2.3.3 (2015-10-02) 2.3.3 (2015-10-02)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@ -31,12 +31,13 @@ PlatformIO
`Home & Demo <http://platformio.org>`_ | `Home & Demo <http://platformio.org>`_ |
`Project Examples <https://github.com/platformio/platformio/tree/develop/examples>`_ | `Project Examples <https://github.com/platformio/platformio/tree/develop/examples>`_ |
`Code <https://github.com/platformio/platformio>`_ | `Source Code <https://github.com/platformio>`_ |
`Documentation <http://docs.platformio.org>`_ || `Documentation <http://docs.platformio.org>`_ ||
`Blog <http://www.ikravets.com/category/computer-life/platformio>`_ | `Blog <http://www.ikravets.com/category/computer-life/platformio>`_ |
`Reddit <http://www.reddit.com/r/platformio/>`_ | `Twitter <https://twitter.com/PlatformIO_Org>`_ |
`Hackaday <https://hackaday.io/project/7980-platformio>`_ |
`Facebook <https://www.facebook.com/platformio>`_ | `Facebook <https://www.facebook.com/platformio>`_ |
`Twitter <https://twitter.com/PlatformIO_Org>`_ `Reddit <http://www.reddit.com/r/platformio/>`_
.. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-logo.png .. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-logo.png
:target: http://platformio.org :target: http://platformio.org

View File

@ -24,13 +24,14 @@ between team members, regardless of operating system they prefer to work with.
Beyond that, PlatformIO can be run not only on commonly used desktops/laptops Beyond that, PlatformIO can be run not only on commonly used desktops/laptops
but also on the servers without X Window System. While PlatformIO itself is a but also on the servers without X Window System. While PlatformIO itself is a
console application, it can be used in combination with one's favorite console application, it can be used in combination with one's favorite
:ref:`ide` or text editor such as :ref:`ide_arduino`, :ref:`ide_eclipse`, :ref:`ide` or text editor such as :ref:`ide_arduino`, :ref:`ide_atom`,
:ref:`ide_visualstudio`, :ref:`ide_vim`, :ref:`ide_sublimetext`, etc. :ref:`ide_clion`, :ref:`ide_eclipse`, :ref:`ide_qtcreator`,
:ref:`ide_sublimetext`, :ref:`ide_vim`, :ref:`ide_visualstudio`, etc.
Alright, so PlatformIO can run on different operating systems. But more Alright, so PlatformIO can run on different operating systems. But more
importantly, from development perspective at least, is a list of supported importantly, from development perspective at least, is a list of supported
boards and MCUs. To keep things short: PlatformIO supports over 100 boards and MCUs. To keep things short: PlatformIO supports over 150+
:ref:`Embedded Boards <platforms>` and all major `Embedded Boards <http://platformio.org/#!/boards>`_ and all major
:ref:`Development Platforms <platforms>`. :ref:`Development Platforms <platforms>`.
PlatformIO allows users to: PlatformIO allows users to:
@ -55,6 +56,34 @@ the project developed using PlatformIO is as follows:
* Users develop code and PlatformIO makes sure that it is compiled, prepared * Users develop code and PlatformIO makes sure that it is compiled, prepared
and uploaded to all the boards of interest. and uploaded to all the boards of interest.
Command completion in Terminal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bash completion
'''''''''''''''
Bash completion support will complete subcommands and parameters. To enable
Bash completion for `platformio` subcommands you need to put into your `.bashrc`:
.. code-block:: bash
eval "$(_PLATFORMIO_COMPLETE=source platformio)"
ZSH completion
''''''''''''''
To enable ``zsh`` completion please run these commands:
.. code-block:: bash
autoload bashcompinit && bashcompinit
eval "$(_PLATFORMIO_COMPLETE=source platformio)"
.. note::
For permanent command completion you need to place commands above to
``~/.bashrc`` or ``~/.zshrc`` file.
.. _faq_troubleshooting: .. _faq_troubleshooting:
Troubleshooting Troubleshooting
@ -75,6 +104,9 @@ Try these solutions:
[sudo] pip uninstall scons [sudo] pip uninstall scons
[sudo] pip install scons [sudo] pip install scons
# if you have "error: option --single-version-externally-managed not recognized", then
[sudo] pip install --egg scons
2. Install PlatformIO using :ref:`installation_installer_script`. 2. Install PlatformIO using :ref:`installation_installer_script`.
.. _faq_troubleshooting_sconssingverextmanaged: .. _faq_troubleshooting_sconssingverextmanaged:

View File

@ -476,7 +476,7 @@ Espressif
* - ``esp01`` * - ``esp01``
- `Espressif ESP8266 board <https://nurdspace.nl/ESP8266>`_ - `Espressif ESP8266 board <https://nurdspace.nl/ESP8266>`_
- ESP8266 - ESP8266
- 80 MHz - 40 MHz
- 512 Kb - 512 Kb
- 32 Kb - 32 Kb
@ -976,3 +976,23 @@ Wicked Device
- 16 MHz - 16 MHz
- 128 Kb - 128 Kb
- 16 Kb - 16 Kb
ubIQio
~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``ardhat``
- `ubIQio Ardhat <http://ardhat.com>`_
- ATMEGA328P
- 16 MHz
- 32 Kb
- 2 Kb

View File

@ -31,6 +31,9 @@ Platforms
* - :ref:`platform_ststm32` * - :ref:`platform_ststm32`
- The STM32 family of 32-bit Flash MCUs based on the ARM Cortex-M processor is designed to offer new degrees of freedom to MCU users. It offers a 32-bit product range that combines very high performance, real-time capabilities, digital signal processing, and low-power, low-voltage operation, while maintaining full integration and ease of development. - The STM32 family of 32-bit Flash MCUs based on the ARM Cortex-M processor is designed to offer new degrees of freedom to MCU users. It offers a 32-bit product range that combines very high performance, real-time capabilities, digital signal processing, and low-power, low-voltage operation, while maintaining full integration and ease of development.
* - :ref:`platform_teensy`
- Teensy is a complete USB-based microcontroller development system, in a very small footprint, capable of implementing many types of projects. All programming is done via the USB port. No special programmer is needed, only a standard "Mini-B" USB cable and a PC or Macintosh with a USB port.
Boards Boards
------ ------

View File

@ -47,11 +47,19 @@ There are 3 predefined targets for building:
* ``PLATFORMIO_CLEAN`` - clean compiled objects and etc. * ``PLATFORMIO_CLEAN`` - clean compiled objects and etc.
.. warning:: .. warning::
CLion is still in the development stage, so some of the features (like, PlatformIO generates empty project by default and **code auto-completion
auto-complete) probably will not work with PlatformIO. See will not work!** To enable auto-completion please choose one of:
`CLion issue #CPP-3977 <https://youtrack.jetbrains.com/issue/CPP-3977>`_.
Active discussion located in * Add source files ``*.c, *.cpp, etc`` to ``src`` directory and re-initialize
project with command above
* Manually correct ``add_executable`` command in ``CMakeLists.txt`` file
(will be created in project directory after initialization).
``*.ino`` file isn't acceptable for ``add_executable`` command. You should
convert it manually to ``*.cpp``. See `project example <https://github.com/platformio/platformio/tree/develop/examples/ide/clion>`_.
More info `CLion issue #CPP-3977 <https://youtrack.jetbrains.com/issue/CPP-3977>`_.
Active discussion is located in
`PlatformIO issue #132 <https://github.com/platformio/platformio/issues/132>`_. `PlatformIO issue #132 <https://github.com/platformio/platformio/issues/132>`_.
Screenshot Screenshot

View File

@ -18,9 +18,10 @@ libOpenCM3, etc.*
* `Source Code <https://github.com/platformio/platformio>`_ | * `Source Code <https://github.com/platformio/platformio>`_ |
`Issues <https://github.com/platformio/platformio/issues>`_ `Issues <https://github.com/platformio/platformio/issues>`_
* `Blog <http://www.ikravets.com/category/computer-life/platformio>`_ | * `Blog <http://www.ikravets.com/category/computer-life/platformio>`_ |
`Reddit <http://www.reddit.com/r/platformio/>`_ | `Twitter <https://twitter.com/PlatformIO_Org>`_ |
`Hackaday <https://hackaday.io/project/7980-platformio>`_ |
`Facebook <https://www.facebook.com/platformio>`_ | `Facebook <https://www.facebook.com/platformio>`_ |
`Twitter <https://twitter.com/PlatformIO_Org>`_ `Reddit <http://www.reddit.com/r/platformio/>`_
You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO* You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO*
has pre-built different development platforms and pre-configured settings for has pre-built different development platforms and pre-configured settings for

View File

@ -872,3 +872,23 @@ Wicked Device
- 16 MHz - 16 MHz
- 128 Kb - 128 Kb
- 16 Kb - 16 Kb
ubIQio
~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``ardhat``
- `ubIQio Ardhat <http://ardhat.com>`_
- ATMEGA328P
- 16 MHz
- 32 Kb
- 2 Kb

View File

@ -77,6 +77,6 @@ Espressif
* - ``esp01`` * - ``esp01``
- `Espressif ESP8266 board <https://nurdspace.nl/ESP8266>`_ - `Espressif ESP8266 board <https://nurdspace.nl/ESP8266>`_
- ESP8266 - ESP8266
- 80 MHz - 40 MHz
- 512 Kb - 512 Kb
- 32 Kb - 32 Kb

View File

@ -17,21 +17,24 @@ Packages
* - Name * - Name
- Contents - Contents
* - ``framework-arduinoteensy``
- `Arduino Wiring-based Framework <http://arduino.cc/en/Reference/HomePage>`_
* - ``tool-teensy``
- `Teensy Loader <https://www.pjrc.com/teensy/loader.html>`_
* - ``toolchain-gccarmnoneeabi``
- `gcc-arm-embedded <https://launchpad.net/gcc-arm-embedded>`_, `GDB <http://www.gnu.org/software/gdb/>`_
* - ``framework-mbed``
- `mbed Framework <http://mbed.org>`_
* - ``toolchain-atmelavr`` * - ``toolchain-atmelavr``
- `avr-gcc <https://gcc.gnu.org/wiki/avr-gcc>`_, `GDB <http://www.gnu.org/software/gdb/>`_, `AVaRICE <http://avarice.sourceforge.net/>`_, `SimulAVR <http://www.nongnu.org/simulavr/>`_ - `avr-gcc <https://gcc.gnu.org/wiki/avr-gcc>`_, `GDB <http://www.gnu.org/software/gdb/>`_, `AVaRICE <http://avarice.sourceforge.net/>`_, `SimulAVR <http://www.nongnu.org/simulavr/>`_
* - ``ldscripts`` * - ``ldscripts``
- `Linker Scripts <https://sourceware.org/binutils/docs/ld/Scripts.html>`_ - `Linker Scripts <https://sourceware.org/binutils/docs/ld/Scripts.html>`_
* - ``framework-arduinoteensy``
- `Arduino Wiring-based Framework <http://arduino.cc/en/Reference/HomePage>`_
* - ``toolchain-gccarmnoneeabi``
- `gcc-arm-embedded <https://launchpad.net/gcc-arm-embedded>`_, `GDB <http://www.gnu.org/software/gdb/>`_
* - ``tool-teensy``
- `Teensy Loader <https://www.pjrc.com/teensy/loader.html>`_
.. warning:: .. warning::
**Linux Users:** Don't forget to install "udev" rules file **Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file). `99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
@ -52,6 +55,9 @@ Frameworks
* - :ref:`framework_arduino` * - :ref:`framework_arduino`
- Arduino Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences. - Arduino Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences.
* - :ref:`framework_mbed`
- The mbed framework The mbed SDK has been designed to provide enough hardware abstraction to be intuitive and concise, yet powerful enough to build complex projects. It is built on the low-level ARM CMSIS APIs, allowing you to code down to the metal if needed. In addition to RTOS, USB and Networking libraries, a cookbook of hundreds of reusable peripheral and module libraries have been built on top of the SDK by the mbed Developer Community.
Boards Boards
------ ------

View File

@ -28,7 +28,7 @@ Quickstart
The next files/directories will be created in *** The next files/directories will be created in ***
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here src - Put your source files here
lib - Put here project specific (private) libraries lib - Put here project specific (private) libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!
@ -37,7 +37,7 @@ Quickstart
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board `platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files) `platformio run --target clean` - clean project (remove compiled files)
Put your source code ``*.h, *.c, *.cpp or *.ino`` files to ``src`` directory. Put your source files ``*.h, *.c, *.cpp or *.ino`` to ``src`` directory.
4. Process the project's environments. 4. Process the project's environments.

View File

@ -22,7 +22,7 @@ Initialize new PlatformIO based project.
This command will create: This command will create:
* :ref:`projectconf` * :ref:`projectconf`
* ``src`` - a source directory. Put your source code here * ``src`` - a source directory. Put your source files here
* ``lib`` - a directory for the project specific (private) libraries. * ``lib`` - a directory for the project specific (private) libraries.
PlatformIO will compile them to static libraries and link to executable file PlatformIO will compile them to static libraries and link to executable file
@ -94,7 +94,7 @@ Examples
The next files/directories will be created in *** The next files/directories will be created in ***
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here src - Put your source files here
lib - Put here project specific (private) libraries lib - Put here project specific (private) libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!
@ -112,7 +112,7 @@ Examples
The next files/directories will be created in *** The next files/directories will be created in ***
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here src - Put your source files here
lib - Put here project specific (private) libraries lib - Put here project specific (private) libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!
@ -136,7 +136,7 @@ Examples
The next files/directories will be created in *** The next files/directories will be created in ***
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here src - Put your source files here
lib - Put here project specific (private) libraries lib - Put here project specific (private) libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!

View File

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4"> <module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$" />
<sourceFolder url="file://$MODULE_DIR$/CMakeLists.txt" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>

View File

@ -2,13 +2,13 @@
<project version="4"> <project version="4">
<component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true"> <component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true">
<generated> <generated>
<config projectName="PlatformIO" targetName="DEBUG" /> <config projectName="clion" targetName="PLATFORMIO_CLEAN" />
<config projectName="PlatformIO" targetName="PLATFORMIO_RUN" /> <config projectName="clion" targetName="PLATFORMIO_RUN" />
<config projectName="PlatformIO" targetName="PlatformIO" /> <config projectName="clion" targetName="PLATFORMIO" />
<config projectName="PlatformIO" targetName="PLATFORMIO_UPLOAD" /> <config projectName="clion" targetName="clion" />
<config projectName="PlatformIO" targetName="PLATFORMIO_CLEAN" /> <config projectName="clion" targetName="DEBUG" />
<config projectName="PlatformIO" targetName="PLATFORMIO_BUILD" /> <config projectName="clion" targetName="PLATFORMIO_BUILD" />
<config projectName="PlatformIO" targetName="PLATFORMIO" /> <config projectName="clion" targetName="PLATFORMIO_UPLOAD" />
</generated> </generated>
</component> </component>
<component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true"> <component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true">
@ -33,25 +33,25 @@
</component> </component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" /> <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager"> <component name="FavoritesManager">
<favorites_list name="PlatformIO" /> <favorites_list name="clion" />
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf> <leaf>
<file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="true"> <file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/CMakeLists.txt"> <entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.45302013"> <state vertical-scroll-proportion="0.15758981">
<caret line="18" column="20" selection-start-line="18" selection-start-column="20" selection-end-line="18" selection-end-column="20" /> <caret line="8" column="49" selection-start-line="8" selection-start-column="49" selection-end-line="8" selection-end-column="49" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="blink.cpp" pinned="false" current-in-tab="false"> <file leaf-file-name="src/blink.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/blink.cpp"> <entry file="file://$PROJECT_DIR/$src/blink.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="0.0">
<caret line="0" column="13" selection-start-line="0" selection-start-column="13" selection-end-line="0" selection-end-column="13" /> <caret line="24" column="4" selection-start-line="24" selection-start-column="4" selection-end-line="24" selection-end-column="4" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -67,8 +67,8 @@
<order /> <order />
</component> </component>
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="162" /> <option name="x" value="252" />
<option name="y" value="23" /> <option name="y" value="21" />
<option name="width" value="1400" /> <option name="width" value="1400" />
<option name="height" value="1000" /> <option name="height" value="1000" />
</component> </component>
@ -116,13 +116,13 @@
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="clion" /> <option name="myItemId" value="clion" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" /> <option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </PATH>
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="clion" /> <option name="myItemId" value="clion" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" /> <option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
</PATH_ELEMENT> </PATH_ELEMENT>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="clion" /> <option name="myItemId" value="clion" />
@ -132,7 +132,7 @@
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="clion" /> <option name="myItemId" value="clion" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" /> <option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
</PATH_ELEMENT> </PATH_ELEMENT>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="clion" /> <option name="myItemId" value="clion" />
@ -155,8 +155,8 @@
<property name="restartRequiresConfirmation" value="true" /> <property name="restartRequiresConfirmation" value="true" />
<property name="FullScreen" value="false" /> <property name="FullScreen" value="false" />
</component> </component>
<component name="RunManager" selected="Application.PLATFORMIO_CLEAN"> <component name="RunManager" selected="Application.PLATFORMIO_BUILD">
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="PlatformIO" TARGET_NAME="PlatformIO" CONFIG_NAME="Debug"> <configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="clion" CONFIG_NAME="Debug">
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
@ -173,15 +173,15 @@
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
<configuration default="false" name="PLATFORMIO_BUILD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="PlatformIO" TARGET_NAME="PLATFORMIO_BUILD" CONFIG_NAME="Debug"> <configuration default="false" name="PLATFORMIO_BUILD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_BUILD" CONFIG_NAME="Debug">
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
<configuration default="false" name="PLATFORMIO_CLEAN" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="PlatformIO" TARGET_NAME="PLATFORMIO_CLEAN" CONFIG_NAME="Debug"> <configuration default="false" name="PLATFORMIO_CLEAN" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_CLEAN" CONFIG_NAME="Debug">
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
<configuration default="false" name="PLATFORMIO_UPLOAD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="PlatformIO" TARGET_NAME="PLATFORMIO_UPLOAD" CONFIG_NAME="Debug"> <configuration default="false" name="PLATFORMIO_UPLOAD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_UPLOAD" CONFIG_NAME="Debug">
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
@ -206,27 +206,27 @@
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="162" y="23" width="1400" height="1000" extended-state="0" /> <frame x="252" y="21" width="1400" height="1000" extended-state="0" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32975295" sideWeight="0.53684974" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.4631503" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.4631503" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32996634" sideWeight="0.53684974" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout> </layout>
</component> </component>
<component name="Vcs.Log.UiProperties"> <component name="Vcs.Log.UiProperties">
@ -240,35 +240,12 @@
<component name="VcsContentAnnotationSettings"> <component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" /> <option name="myLimit" value="2678400000" />
</component> </component>
<component name="VcsManagerConfiguration">
<ignored-roots>
<path value="$PROJECT_DIR$/../../.." />
</ignored-roots>
</component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
<option name="time" value="4" /> <option name="time" value="4" />
</breakpoint-manager> </breakpoint-manager>
<watches-manager /> <watches-manager />
</component> </component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/blink.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="13" selection-start-line="0" selection-start-column="13" selection-end-line="0" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.45302013">
<caret line="18" column="20" selection-start-line="18" selection-start-column="20" selection-end-line="18" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
</component>
<component name="masterDetails"> <component name="masterDetails">
<states> <states>
<state key="ScopeChooserConfigurable.UI"> <state key="ScopeChooserConfigurable.UI">

View File

@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.2) cmake_minimum_required(VERSION 3.2)
project(PlatformIO) project(clion)
set(PLATFORMIO_CMD platformio) set(ENV{PATH} "/Volumes/SOFT/Projects/GitHub/platformio/origin/.tox/develop/bin:/usr/local/opt/pyenv/shims:/Users/ikravets/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin")
set(PLATFORMIO_CMD "/Volumes/SOFT/Projects/GitHub/platformio/origin/.tox/develop/bin/platformio")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduinoavr/variants/standard") include_directories("$ENV{HOME}/.platformio/packages/framework-arduinoavr/variants/standard")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduinoavr/cores/arduino") include_directories("$ENV{HOME}/.platformio/packages/framework-arduinoavr/cores/arduino")
@ -14,7 +15,7 @@ add_definitions(-DF_CPU=16000000L)
add_definitions(-DARDUINO_ARCH_AVR) add_definitions(-DARDUINO_ARCH_AVR)
add_definitions(-DARDUINO_AVR_UNO) add_definitions(-DARDUINO_AVR_UNO)
add_definitions(-DARDUINO=10605) add_definitions(-DARDUINO=10605)
add_definitions(-DPLATFORMIO=020300) add_definitions(-DPLATFORMIO=020304)
add_definitions(-D__AVR_ATmega328P__) add_definitions(-D__AVR_ATmega328P__)
add_custom_target( add_custom_target(
@ -33,4 +34,6 @@ add_custom_target(
PLATFORMIO_CLEAN ALL PLATFORMIO_CLEAN ALL
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
add_executable(clion src/blink.cpp)

View File

@ -1,7 +1,7 @@
# Copyright (C) Ivan Kravets <me@ikravets.com> # Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details. # See LICENSE for details.
VERSION = (2, 3, 3) VERSION = (2, 3, 4)
__version__ = ".".join([str(s) for s in VERSION]) __version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio" __title__ = "platformio"

View File

@ -1,4 +1,26 @@
{ {
"ardhat": {
"build": {
"core": "arduino",
"extra_flags": "-DARDUINO_ARCH_AVR -DAVR_ARDHAT",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "standard"
},
"frameworks": ["arduino"],
"name": "ubIQio Ardhat",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 32256,
"protocol": "arduino",
"require_upload_port" : true,
"speed": 115200
},
"url": "http://ardhat.com",
"vendor": "ubIQio"
},
"raspduino": { "raspduino": {
"build": { "build": {
"core": "arduino", "core": "arduino",

View File

@ -65,7 +65,7 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913
click.style(project_dir, fg="cyan")) click.style(project_dir, fg="cyan"))
click.echo("%s - Project Configuration File. |-> PLEASE EDIT ME <-|" % click.echo("%s - Project Configuration File. |-> PLEASE EDIT ME <-|" %
click.style("platformio.ini", fg="cyan")) click.style("platformio.ini", fg="cyan"))
click.echo("%s - Put your source code here" % click.echo("%s - Put your source files here" %
click.style("src", fg="cyan")) click.style("src", fg="cyan"))
click.echo("%s - Put here project specific (private) libraries" % click.echo("%s - Put here project specific (private) libraries" %
click.style("lib", fg="cyan")) click.style("lib", fg="cyan"))

View File

@ -36,13 +36,19 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
if not config.sections(): if not config.sections():
raise exception.ProjectEnvsNotAvailable() raise exception.ProjectEnvsNotAvailable()
unknown = set(environment) - set([s[4:] for s in config.sections()]) known = set([s[4:] for s in config.sections()
if s.startswith("env:")])
unknown = set(environment) - known
if unknown: if unknown:
raise exception.UnknownEnvNames(", ".join(unknown)) raise exception.UnknownEnvNames(
", ".join(unknown), ", ".join(known))
# clean obsolete .pioenvs dir # clean obsolete .pioenvs dir
if not disable_auto_clean: if not disable_auto_clean:
_clean_pioenvs_dir() try:
_clean_pioenvs_dir(util.get_pioenvs_dir())
except Exception:
raise exception.CleanPioenvsDirError(util.get_pioenvs_dir())
results = [] results = []
for section in config.sections(): for section in config.sections():
@ -221,8 +227,7 @@ def _autoinstall_libs(ctx, libids_list):
ctx.invoke(cmd_lib_install, libid=not_intalled_libs) ctx.invoke(cmd_lib_install, libid=not_intalled_libs)
def _clean_pioenvs_dir(): def _clean_pioenvs_dir(pioenvs_dir):
pioenvs_dir = util.get_pioenvs_dir()
structhash_file = join(pioenvs_dir, "structure.hash") structhash_file = join(pioenvs_dir, "structure.hash")
proj_hash = calculate_project_hash() proj_hash = calculate_project_hash()

View File

@ -33,14 +33,14 @@ class UnknownPlatform(PlatformioException):
class PlatformNotInstalledYet(PlatformioException): class PlatformNotInstalledYet(PlatformioException):
MESSAGE = ("The platform '%s' has not been installed yet. " MESSAGE = "The platform '%s' has not been installed yet. "\
"Use `platformio platforms install` command") "Use `platformio platforms install` command"
class UnknownCLICommand(PlatformioException): class UnknownCLICommand(PlatformioException):
MESSAGE = ("Unknown command '%s'. Please use `platformio --help`" MESSAGE = "Unknown command '%s'. Please use `platformio --help`"\
" to see all available commands") " to see all available commands"
class UnknownBoard(PlatformioException): class UnknownBoard(PlatformioException):
@ -75,14 +75,14 @@ class FDUnrecognizedStatusCode(PlatformioException):
class FDSizeMismatch(PlatformioException): class FDSizeMismatch(PlatformioException):
MESSAGE = ("The size (%d bytes) of downloaded file '%s' " MESSAGE = "The size (%d bytes) of downloaded file '%s' "\
"is not equal to remote size (%d bytes)") "is not equal to remote size (%d bytes)"
class FDSHASumMismatch(PlatformioException): class FDSHASumMismatch(PlatformioException):
MESSAGE = ("The 'sha1' sum '%s' of downloaded file '%s' " MESSAGE = "The 'sha1' sum '%s' of downloaded file '%s' "\
"is not equal to remote '%s'") "is not equal to remote '%s'"
class NotPlatformProject(PlatformioException): class NotPlatformProject(PlatformioException):
@ -104,17 +104,23 @@ class UnsupportedArchiveType(PlatformioException):
class ProjectEnvsNotAvailable(PlatformioException): class ProjectEnvsNotAvailable(PlatformioException):
MESSAGE = "Please setup environments in `platformio.ini` file." MESSAGE = "Please setup environments in `platformio.ini` file"
class InvalidEnvName(PlatformioException): class InvalidEnvName(PlatformioException):
MESSAGE = "Invalid environment '%s'. The name must start " "with 'env:'." MESSAGE = "Invalid environment '%s'. The name must start with 'env:'"
class UnknownEnvNames(PlatformioException): class UnknownEnvNames(PlatformioException):
MESSAGE = "Unknown environment names '%s'." MESSAGE = "Unknown environment names '%s'. Valid names are '%s'"
class CleanPioenvsDirError(PlatformioException):
MESSAGE = "Can not remove temporary directory `%s`. "\
"Please remove it manually"
class GetSerialPortsError(PlatformioException): class GetSerialPortsError(PlatformioException):
@ -124,7 +130,7 @@ class GetSerialPortsError(PlatformioException):
class GetLatestVersionError(PlatformioException): class GetLatestVersionError(PlatformioException):
MESSAGE = "Can't retrieve the latest PlatformIO version" MESSAGE = "Can not retrieve the latest PlatformIO version"
class APIRequestError(PlatformioException): class APIRequestError(PlatformioException):
@ -173,36 +179,28 @@ class UpgraderFailed(PlatformioException):
class CIBuildEnvsEmpty(PlatformioException): class CIBuildEnvsEmpty(PlatformioException):
MESSAGE = ( MESSAGE = "Can't find PlatformIO build environments.\n"\
"Can't find PlatformIO build environments.\nPlease specify `--board` " "Please specify `--board` or path to `platformio.ini` with "\
"or path to `platformio.ini` with predefined environments using " "predefined environments using `--project-conf` option"
"`--project-conf` option"
)
class SConsNotInstalled(PlatformioException): class SConsNotInstalled(PlatformioException):
MESSAGE = ( MESSAGE = "The PlatformIO and `scons` aren't installed properly. "\
"The PlatformIO and `scons` aren't installed properly. " "More details in FAQ/Troubleshooting section: "\
"More details in FAQ/Troubleshooting section: "
"http://docs.platformio.org/en/latest/faq.html" "http://docs.platformio.org/en/latest/faq.html"
)
class PlatformioUpgradeError(PlatformioException): class PlatformioUpgradeError(PlatformioException):
MESSAGE = ( MESSAGE = "%s \n\n"\
"%s \n\n" "1. Please report this issue here: "\
"1. Please report this issue here: " "https://github.com/platformio/platformio/issues \n"\
"https://github.com/platformio/platformio/issues \n" "2. Try different installation/upgrading steps: "\
"2. Try different installation/upgrading steps: "
"http://docs.platformio.org/en/latest/installation.html" "http://docs.platformio.org/en/latest/installation.html"
)
class CygwinEnvDetected(PlatformioException): class CygwinEnvDetected(PlatformioException):
MESSAGE = ( MESSAGE = "PlatformIO does not work within Cygwin environment. "\
"PlatformIO does not work within Cygwin environment. "
"Use native Terminal instead." "Use native Terminal instead."
)

View File

@ -7,6 +7,7 @@ import re
from os.path import abspath, basename, expanduser, isdir, join, relpath from os.path import abspath, basename, expanduser, isdir, join, relpath
import bottle import bottle
import click
from platformio import util from platformio import util
@ -72,7 +73,7 @@ class ProjectGenerator(object):
def get_project_name(self): def get_project_name(self):
return basename(self.project_dir) return basename(self.project_dir)
def get_srcfiles(self): def get_src_files(self):
result = [] result = []
with util.cd(self.project_dir): with util.cd(self.project_dir):
for root, _, files in os.walk(util.get_projectsrc_dir()): for root, _, files in os.walk(util.get_projectsrc_dir()):
@ -80,6 +81,14 @@ class ProjectGenerator(object):
result.append(relpath(join(root, f))) result.append(relpath(join(root, f)))
return result return result
@staticmethod
def get_main_src_file(src_files):
for f in src_files:
for ext in ("c", "cpp"):
if f.endswith(".%s" % ext):
return f
return None
def get_tpls(self): def get_tpls(self):
tpls = [] tpls = []
tpls_dir = join(util.get_source_dir(), "ide", "tpls", self.ide) tpls_dir = join(util.get_source_dir(), "ide", "tpls", self.ide)
@ -112,11 +121,23 @@ class ProjectGenerator(object):
return bottle.template(content, **self._tplvars) return bottle.template(content, **self._tplvars)
def _gather_tplvars(self): def _gather_tplvars(self):
src_files = self.get_src_files()
main_src_file = self.get_main_src_file(src_files)
if not main_src_file and self.ide == "clion":
click.secho(
"Warning! Can not find main source file (*.c, *.cpp). So, "
"code auto-completion is disabled. Please add source files "
"to `src` directory and re-initialize project or edit "
"`CMakeLists.txt` file manually (`add_executable` command).",
fg="yellow")
self._tplvars.update(self.get_project_env()) self._tplvars.update(self.get_project_env())
self._tplvars.update(self.get_project_build_data()) self._tplvars.update(self.get_project_build_data())
self._tplvars.update({ self._tplvars.update({
"project_name": self.get_project_name(), "project_name": self.get_project_name(),
"srcfiles": self.get_srcfiles(), "src_files": src_files,
"main_src_file": main_src_file,
"user_home_dir": abspath(expanduser("~")), "user_home_dir": abspath(expanduser("~")),
"project_dir": self.project_dir, "project_dir": self.project_dir,
"systype": util.get_systype(), "systype": util.get_systype(),

View File

@ -47,7 +47,7 @@
</provider> </provider>
</entry> </entry>
</file> </file>
% for file in srcfiles: % for file in src_files:
<file leaf-file-name="{{file}}" pinned="false" current-in-tab="false"> <file leaf-file-name="{{file}}" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR/${{file}}"> <entry file="file://$PROJECT_DIR/${{file}}">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">

View File

@ -8,7 +8,7 @@ set(PLATFORMIO_CMD "{{platformio_path}}")
% if include.startswith(user_home_dir): % if include.startswith(user_home_dir):
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}") include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
% else: % else:
include_directories("{{include}}") include_directories("{{include.replace("\\", "/")}}")
% end % end
% end % end
@ -32,4 +32,14 @@ add_custom_target(
PLATFORMIO_CLEAN ALL PLATFORMIO_CLEAN ALL
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
% if main_src_file:
add_executable({{project_name}} {{main_src_file}})
% else:
#
# To enable code auto-completion, please specify path
# to main source file (*.c, *.cpp) and uncomment line below
#
# add_executable({{project_name}} src/main_change_me.cpp)
% end

View File

@ -21,6 +21,6 @@ OTHER_FILES += \
platformio.ini platformio.ini
SOURCES += \ SOURCES += \
% for file in srcfiles: % for file in src_files:
{{file}} {{file}}
% end % end

View File

@ -13,7 +13,7 @@
<ItemGroup> <ItemGroup>
<None Include="platformio.ini" /> <None Include="platformio.ini" />
</ItemGroup> </ItemGroup>
% for file in srcfiles: % for file in src_files:
<ItemGroup> <ItemGroup>
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]): % if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
<ClInclude Include="{{file}}"> <ClInclude Include="{{file}}">

View File

@ -58,7 +58,7 @@
<ItemGroup> <ItemGroup>
<None Include="platformio.ini" /> <None Include="platformio.ini" />
</ItemGroup> </ItemGroup>
% for file in srcfiles: % for file in src_files:
<ItemGroup> <ItemGroup>
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]): % if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
<ClInclude Include="{{file}}"> <ClInclude Include="{{file}}">

View File

@ -184,10 +184,12 @@ def check_platformio_upgrade():
click.echo("") click.echo("")
click.echo("*" * terminal_width) click.echo("*" * terminal_width)
click.secho("There is a new version %s of PlatformIO available.\n" click.secho("There is a new version %s of PlatformIO available.\n"
"Please upgrade it via " % latest_version, "Please upgrade it via `" % latest_version,
fg="yellow", nl=False) fg="yellow", nl=False)
click.secho("platformio upgrade", fg="cyan", nl=False) click.secho("platformio upgrade", fg="cyan", nl=False)
click.secho(" command.\nChanges: ", fg="yellow", nl=False) click.secho("` or `", fg="yellow", nl=False)
click.secho("pip install -U platformio", fg="cyan", nl=False)
click.secho("` command.\nChanges: ", fg="yellow", nl=False)
click.secho("http://docs.platformio.org/en/latest/history.html", click.secho("http://docs.platformio.org/en/latest/history.html",
fg="cyan") fg="cyan")
click.echo("*" * terminal_width) click.echo("*" * terminal_width)

View File

@ -3,8 +3,6 @@
import os import os
import re import re
import sys
from glob import glob
from imp import load_source from imp import load_source
from os.path import isdir, isfile, join from os.path import isdir, isfile, join
@ -374,7 +372,7 @@ class BasePlatform(object):
self._found_error = False self._found_error = False
try: try:
# test that SCons is installed correctly # test that SCons is installed correctly
assert self.test_scons() assert util.test_scons()
result = util.exec_command( result = util.exec_command(
[ [
@ -397,39 +395,6 @@ class BasePlatform(object):
return result return result
@staticmethod
def test_scons():
try:
r = util.exec_command(["scons", "--version"])
if "ImportError: No module named SCons.Script" in r['err']:
_PYTHONPATH = []
for p in sys.path:
if not p.endswith("-packages"):
continue
for item in glob(join(p, "scons*")):
if isdir(join(item, "SCons")) and item not in sys.path:
_PYTHONPATH.append(item)
sys.path.insert(0, item)
if _PYTHONPATH:
_PYTHONPATH = str(os.pathsep).join(_PYTHONPATH)
if os.getenv("PYTHONPATH"):
os.environ['PYTHONPATH'] += os.pathsep + _PYTHONPATH
else:
os.environ['PYTHONPATH'] = _PYTHONPATH
r = util.exec_command(["scons", "--version"])
assert r['returncode'] == 0
return True
except (OSError, AssertionError):
for p in sys.path:
try:
r = util.exec_command([join(p, "scons"), "--version"])
assert r['returncode'] == 0
os.environ['PATH'] += os.pathsep + p
return True
except (OSError, AssertionError):
pass
return False
def on_run_out(self, line): def on_run_out(self, line):
self._echo_line(line, level=3) self._echo_line(line, level=3)

View File

@ -35,6 +35,10 @@ class TeensyPlatform(BasePlatform):
"default": True "default": True
}, },
"framework-mbed": {
"default": True
},
"tool-teensy": { "tool-teensy": {
"alias": "uploader", "alias": "uploader",
"default": True "default": True

View File

@ -7,13 +7,13 @@ import json
import os import os
import re import re
import subprocess import subprocess
import sys
from glob import glob
from os.path import (abspath, basename, dirname, expanduser, isdir, isfile, from os.path import (abspath, basename, dirname, expanduser, isdir, isfile,
join, realpath) join, realpath)
from platform import system, uname from platform import system, uname
from threading import Thread from threading import Thread
import requests
from platformio import __apiurl__, __version__, exception from platformio import __apiurl__, __version__, exception
try: try:
@ -277,12 +277,14 @@ def get_logicaldisks():
def get_request_defheaders(): def get_request_defheaders():
import requests
return {"User-Agent": "PlatformIO/%s CI/%d %s" % ( return {"User-Agent": "PlatformIO/%s CI/%d %s" % (
__version__, int(is_ci()), requests.utils.default_user_agent() __version__, int(is_ci()), requests.utils.default_user_agent()
)} )}
def get_api_result(path, params=None, data=None): def get_api_result(path, params=None, data=None):
import requests
result = None result = None
r = None r = None
@ -312,6 +314,53 @@ def get_api_result(path, params=None, data=None):
return result return result
def test_scons():
try:
r = exec_command(["scons", "--version"])
if "ImportError: No module named SCons.Script" in r['err']:
_PYTHONPATH = []
for p in sys.path:
if not p.endswith("-packages"):
continue
for item in glob(join(p, "scons*")):
if isdir(join(item, "SCons")) and item not in sys.path:
_PYTHONPATH.append(item)
sys.path.insert(0, item)
if _PYTHONPATH:
_PYTHONPATH = str(os.pathsep).join(_PYTHONPATH)
if os.getenv("PYTHONPATH"):
os.environ['PYTHONPATH'] += os.pathsep + _PYTHONPATH
else:
os.environ['PYTHONPATH'] = _PYTHONPATH
r = exec_command(["scons", "--version"])
assert r['returncode'] == 0
return True
except (OSError, AssertionError):
for p in sys.path:
try:
r = exec_command([join(p, "scons"), "--version"])
assert r['returncode'] == 0
os.environ['PATH'] += os.pathsep + p
return True
except (OSError, AssertionError):
pass
return False
def install_scons():
r = exec_command(["pip", "install", "-U", "scons"])
if r['returncode'] != 0:
r = exec_command(["pip", "install", "--egg", "scons"])
return r['returncode'] == 0
def scons_in_pip():
r = exec_command(["pip", "list"])
if r['returncode'] != 0:
return False
return "scons (" in r['out'].lower()
@memoized @memoized
def _lookup_boards(): def _lookup_boards():
boards = {} boards = {}

View File

@ -3,5 +3,5 @@ click==5.1
colorama==0.3.3 colorama==0.3.3
lockfile==0.10.2 lockfile==0.10.2
pyserial==2.7 pyserial==2.7
requests==2.7.0 requests==2.8.0
scons==2.3.6 scons==2.3.6

View File

@ -6,7 +6,21 @@ from platform import system
from setuptools import find_packages, setup from setuptools import find_packages, setup
from platformio import (__author__, __description__, __email__, __license__, from platformio import (__author__, __description__, __email__, __license__,
__title__, __url__, __version__) __title__, __url__, __version__, util)
install_requires = [
"bottle",
"click>=3.2",
"lockfile>=0.9.1",
"pyserial<3",
"requests>=2.4.0"
]
if system() == "Windows":
install_requires.append("colorama")
if (not util.test_scons() and not util.install_scons()) or util.scons_in_pip():
install_requires.append("scons")
setup( setup(
name=__title__, name=__title__,
@ -17,14 +31,7 @@ setup(
author_email=__email__, author_email=__email__,
url=__url__, url=__url__,
license=__license__, license=__license__,
install_requires=[ install_requires=install_requires,
"bottle",
"click>=3.2",
"lockfile>=0.9.1",
"pyserial",
"requests>=2.4.0",
"SCons"
] + (["colorama"] if system() == "Windows" else []),
packages=find_packages(), packages=find_packages(),
package_data={ package_data={
"platformio": [ "platformio": [