Merge branch 'develop' into feature/platformio-30

* develop: (27 commits)
  Update boards list
  Add Arduino M0 as a separate board
  Update history
  Update microchippic32 platform and boards
  Fix PyLint warning
  Keep user changes for ".gitignore" file when re-generate/update project data
  Documented uploading of EEPROM data
  Push 2.11.1.dev1
  Automatically install dependent upload tools // Issue #472
  Split source files to HEADERS and SOURCES when generate project for Qt Creator IDE // Resolve #713
  Improve project generator for CLion IDE
  Fix missing trailing ``\`` for the source files list when generate project for Qt Creator IDE // Resolve #711
  * Fix missed ``--boot`` flag for the firmware uploader for ATSAM3X8E Cortex-M3 MCU based boards (Arduino Due, etc) // Resolve #710
  Initial support for Arduino M0/Tian boards // Issue #472
  Update project template for Qt Creator // Issue #711
  Fix missed --boot flag for sam3x uploader // Issue # 710
  Auto-remove project cache when PlatformIO is upgraded
  Version bump to 2.11.0 (issues #472, #520, #614, #620, #685, #698, #699)
  Update history
  Update espressif platform according to the new framework version
This commit is contained in:
Ivan Kravets
2016-07-06 15:04:30 +03:00
18 changed files with 448 additions and 85 deletions

View File

@ -25,9 +25,38 @@ PlatformIO 3.0
PlatformIO 2.0
--------------
2.10.4 (2016-06-??)
2.11.1 (2016-??-??)
~~~~~~~~~~~~~~~~~~~
* Added support for Microchip chipKIT Lenny board
* Updated Microchip PIC32 Arduino framework to v1.2.1
* Documented `uploading of EEPROM data <http://docs.platformio.org/en/latest/platforms/atmelavr.html#upload-eeprom-data>`__
(from EEMEM directive)
* Improved project generator for `CLion IDE <http://docs.platformio.org/en/latest/ide/clion.html>`__
* Auto-remove project cache when PlatformIO is upgraded
* Keep user changes for ``.gitignore`` file when re-generate/update project data
* Fixed missed ``--boot`` flag for the firmware uploader for ATSAM3X8E
Cortex-M3 MCU based boards (Arduino Due, etc)
(`issue #710 <https://github.com/platformio/platformio/issues/710>`_)
* Fixed missing trailing ``\`` for the source files list when generate project
for `Qt Creator IDE <http://docs.platformio.org/en/latest/ide/qtcreator.html>`__
(`issue #711 <https://github.com/platformio/platformio/issues/711>`_)
* Split source files to ``HEADERS`` and ``SOURCES`` when generate project
for `Qt Creator IDE <http://docs.platformio.org/en/latest/ide/qtcreator.html>`__
(`issue #713 <https://github.com/platformio/platformio/issues/713>`_)
2.11.0 (2016-06-28)
~~~~~~~~~~~~~~~~~~~
* New ESP8266-based boards: Generic ESP8285 Module, Phoenix 1.0 & 2.0, WifInfo
* Added support for Arduino M0 Pro board
(`issue #472 <https://github.com/platformio/platformio/issues/472>`_)
* Added support for Arduino MKR1000 board
(`issue #620 <https://github.com/platformio/platformio/issues/620>`_)
* Added support for Adafruit Feather M0, SparkFun SAMD21 and SparkFun SAMD21
Mini Breakout boards
(`issue #520 <https://github.com/platformio/platformio/issues/520>`_)
* Updated Arduino ESP8266 core for Espressif platform to 2.3.0
* Better removing unnecessary flags using ``build_unflags`` option
(`issue #698 <https://github.com/platformio/platformio/issues/698>`_)
* Fixed issue with ``platformio init --ide`` command for Python 2.6

View File

@ -198,8 +198,9 @@ Contributing
6. Make changes to code, documentation, etc.
7. Lint source code ``tox -e lint``
8. Run the tests ``tox -e py27``
9. Commit changes to your forked repository
10. Submit a Pull Request on GitHub.
9. Build documentation ``tox -e docs`` (creates a directory _build under docs where you can find the html)
10. Commit changes to your forked repository
11. Submit a Pull Request on GitHub.
Licence
-------

View File

@ -23,6 +23,10 @@ Here are recent articles about PlatformIO:
2016
^^^^
* Jun 14, 2016 - **Glyn Hudson** - `OpenEnergyMonitor Part 2/3: Firmware Continuous Test & Build <https://blog.openenergymonitor.org/2016/06/auto-build-continuous-test-firmware/>`_
* Jun 13, 2016 - **Daniel Eichhorn** - `New Weather Station Demo on Github <http://blog.squix.org/2016/06/new-weather-station-demo-on-github.html>`_
* Jun 12, 2016 - **Glyn Hudson** - `OpenEnergyMonitor Part 1/3: PlatformIO open-source embedded development ecosystem <https://blog.openenergymonitor.org/2016/06/platformio/>`_
* Jun 12, 2016 - **Uli Wolf** - `Nutzung von PlatformIO im Atom Editor zur Entwicklung von Arduino Code (Use PlatformIO and Atom Editor to develop Arduino code, German) <https://wolf-u.li/5668/nutzung-von-platform-io-im-atom-editor-zur-entwicklung-von-arduino-code/>`_
* Jun 3, 2016 - **Daniel Eichhorn** - `ESP8266: Continuous Delivery Pipeline Push To Production <http://blog.squix.org/2016/06/esp8266-continuous-delivery-pipeline-push-to-production.html>`_
* May 30, 2016 - **Ron Moerman** - `IoT Development with PlatformIO <https://electronicsworkbench.io/blog/platformio>`_
* May 29, 2016 - **Chris Synan** - `Reverse Engineer RF Remote Controller for IoT! <http://www.instructables.com/id/Reverse-Engineer-RF-Remote-Controller-for-IoT/?ALLSTEPS>`_

View File

@ -92,6 +92,13 @@ Adafruit
- Flash
- RAM
* - ``adafruit_feather_m0_usb``
- `Adafruit Feather M0 <https://www.adafruit.com/product/2772>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``bluefruitmicro``
- `Adafruit Bluefruit Micro <https://www.adafruit.com/products/2661>`_
- ATMEGA32U4
@ -377,6 +384,34 @@ Arduino
- 32 Kb
- 2 Kb
* - ``mkr1000USB``
- `Arduino MKR1000 <https://www.arduino.cc/en/Main/ArduinoMKR1000>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``mzeroUSB``
- `Arduino M0 <http://www.arduino.org/products/boards/arduino-m0>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``mzeropro``
- `Arduino M0 Pro (Programming Port) <http://www.arduino.org/products/boards/arduino-m0-pro>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``mzeroproUSB``
- `Arduino M0 Pro (Native USB Port) <http://www.arduino.org/products/boards/arduino-m0-pro>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``nanoatmega168``
- `Arduino Nano ATmega168 <http://www.arduino.org/products/boards/4-arduino-boards/arduino-nano>`_
- ATMEGA168
@ -433,6 +468,13 @@ Arduino
- 32 Kb
- 2.5 Kb
* - ``tian``
- `Arduino Tian <http://www.arduino.org/products/boards/arduino-tian>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``uno``
- `Arduino Uno <http://www.arduino.org/products/boards/4-arduino-boards/arduino-uno>`_
- ATMEGA328P
@ -802,6 +844,13 @@ Espressif
- 4096 Kb
- 80 Kb
* - ``esp8285``
- `Generic ESP8285 Module <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 448 Kb
- 80 Kb
* - ``esp_wroom_02``
- `ESP-WROOM-02 <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
@ -809,6 +858,27 @@ Espressif
- 4096 Kb
- 50 Kb
* - ``phoenix_v1``
- `Phoenix 1.0 <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 1024 Kb
- 80 Kb
* - ``phoenix_v2``
- `Phoenix 2.0 <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 1024 Kb
- 80 Kb
* - ``wifinfo``
- `WifInfo <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 448 Kb
- 80 Kb
Fubarino
~~~~~~~~
@ -1563,6 +1633,20 @@ SparkFun
- 32 Kb
- 2 Kb
* - ``sparkfun_samd21_dev_usb``
- `SparkFun SAMD21 Dev Breakout <https://www.sparkfun.com/products/13672>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``sparkfun_samd21_mini_usb``
- `SparkFun SAMD21 Mini Breakout <https://www.sparkfun.com/products/13664>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``thing``
- `SparkFun ESP8266 Thing <https://www.sparkfun.com/products/13231>`_
- ESP8266
@ -1780,6 +1864,26 @@ Wicked Device
- 128 Kb
- 16 Kb
chipKIT
~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``lenny``
- `chipKIT Lenny <http://chipkit.net/tag/lenny/>`_
- 32MX270F256D
- 40 MHz
- 128 Kb
- 32 Kb
element14
~~~~~~~~~

View File

@ -43,10 +43,11 @@ command and generate project via :option:`platformio init --ide` command:
Then:
1. Import this project via ``Menu: File > Import Project``
1. Place source files (``*.c, *.cpp, *.h, *.ino, etc.``) to ``src`` directory
2. Import this project via ``Menu: File > Import Project``
and specify root directory where is located :ref:`projectconf`
2. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``)
3. Build project (*DO NOT RUN*): ``Menu: Run > Build``.
3. Open source file from ``src`` directory
4. Build project (*DO NOT RUN*): ``Menu: Run > Build``.
There are 6 predefined targets for building (*NOT FOR RUNNING*, see marks on
the screenshot below):
@ -63,22 +64,6 @@ the screenshot below):
after generating process wont be reflected in IDE. To fix it you
need to reinitialize project using :ref:`cmd_init` (repeat it).
.. warning::
PlatformIO generates empty project by default and **code auto-completion
will not work!** To enable auto-completion please choose one of:
* 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-examples/tree/develop/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>`_.
Articles / Manuals
------------------

View File

@ -20,6 +20,9 @@ source code structure. The only one requirement is library's manifest file -
:ref:`library_config`. It can be located inside your library or in the another
location where |PIOAPICR| will have *HTTP* access.
Updates to existing libraries are done every 24 hours. In case a more urgent
update is required, you can post a request on PlatformIO `community <https://community.platformio.org/>`_.
.. contents::
Source Code Location
@ -152,6 +155,12 @@ to :ref:`install <cmd_lib_install>` it.
Examples
--------
Command:
.. code-block:: bash
$ platformio lib register http://my.example.com/library.json
* `GitHub + fixed release <http://platformio.org/lib/show/552/ACNoblex>`_
* `Dependencies by author and framework <http://platformio.org/lib/show/3/PID-AutoTune>`_
* `Multiple libraries in the one repository <https://github.com/jrowberg/i2cdevlib/tree/master/Arduino>`_

View File

@ -43,16 +43,6 @@ Packages
* - ``tool-micronucleus``
- `Micronucleus <https://github.com/micronucleus/micronucleus>`_
.. warning::
**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).
**Windows Users:** Please check that you have correctly installed USB
driver from board manufacturer
Frameworks
----------
.. list-table::

View File

@ -95,6 +95,13 @@ Configuration for the programmers:
upload_port = SERIAL_PORT_HERE
upload_speed = 19200
Upload EEPROM data
------------------
To upload EEPROM data (from EEMEM directive) you need to use ``uploadeep``
target instead ``upload`` for :option:`platformio run --target` command.
For example, ``platformio run -t uploadeep``.
Articles
--------

View File

@ -28,23 +28,26 @@ Packages
* - Name
- Contents
* - ``framework-mbed``
- `mbed Framework <http://mbed.org>`_
* - ``toolchain-gccarmnoneeabi``
- `gcc-arm-embedded <https://launchpad.net/gcc-arm-embedded>`_, `GDB <http://www.gnu.org/software/gdb/>`_
* - ``framework-arduinosam``
- `Arduino Wiring-based Framework (SAM Core, 1.6) <http://arduino.cc/en/Reference/HomePage>`_
* - ``ldscripts``
- `Linker Scripts <https://sourceware.org/binutils/docs/ld/Scripts.html>`_
* - ``framework-simba``
- `Simba Framework <https://github.com/eerimoq/simba>`_
* - ``tool-openocd``
- `OpenOCD <http://openocd.org>`_
* - ``framework-mbed``
- `mbed Framework <http://mbed.org>`_
* - ``ldscripts``
- `Linker Scripts <https://sourceware.org/binutils/docs/ld/Scripts.html>`_
* - ``tool-avrdude``
- `AVRDUDE <http://www.nongnu.org/avrdude/>`_
* - ``tool-bossac``
- `BOSSA CLI <https://sourceforge.net/projects/b-o-s-s-a/>`_
@ -85,6 +88,26 @@ Boards
* For more detailed ``board`` information please scroll tables below by
horizontal.
Adafruit
~~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``adafruit_feather_m0_usb``
- `Adafruit Feather M0 <https://www.adafruit.com/product/2772>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
Arduino
~~~~~~~
@ -112,6 +135,41 @@ Arduino
- 512 Kb
- 32 Kb
* - ``mkr1000USB``
- `Arduino MKR1000 <https://www.arduino.cc/en/Main/ArduinoMKR1000>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``mzeroUSB``
- `Arduino M0 <http://www.arduino.org/products/boards/arduino-m0>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``mzeropro``
- `Arduino M0 Pro (Programming Port) <http://www.arduino.org/products/boards/arduino-m0-pro>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``mzeroproUSB``
- `Arduino M0 Pro (Native USB Port) <http://www.arduino.org/products/boards/arduino-m0-pro>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``tian``
- `Arduino Tian <http://www.arduino.org/products/boards/arduino-tian>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``zero``
- `Arduino Zero (Programming Port) <https://www.arduino.cc/en/Main/ArduinoBoardZero>`_
- SAMD21G18A
@ -206,3 +264,30 @@ SainSmart
- 84 MHz
- 512 Kb
- 32 Kb
SparkFun
~~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``sparkfun_samd21_dev_usb``
- `SparkFun SAMD21 Dev Breakout <https://www.sparkfun.com/products/13672>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``sparkfun_samd21_mini_usb``
- `SparkFun SAMD21 Mini Breakout <https://www.sparkfun.com/products/13664>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb

View File

@ -78,6 +78,13 @@ Adafruit
- Flash
- RAM
* - ``adafruit_feather_m0_usb``
- `Adafruit Feather M0 <https://www.adafruit.com/product/2772>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``bluefruitmicro``
- `Adafruit Bluefruit Micro <https://www.adafruit.com/products/2661>`_
- ATMEGA32U4
@ -363,6 +370,34 @@ Arduino
- 32 Kb
- 2 Kb
* - ``mkr1000USB``
- `Arduino MKR1000 <https://www.arduino.cc/en/Main/ArduinoMKR1000>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``mzeroUSB``
- `Arduino M0 <http://www.arduino.org/products/boards/arduino-m0>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``mzeropro``
- `Arduino M0 Pro (Programming Port) <http://www.arduino.org/products/boards/arduino-m0-pro>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``mzeroproUSB``
- `Arduino M0 Pro (Native USB Port) <http://www.arduino.org/products/boards/arduino-m0-pro>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``nanoatmega168``
- `Arduino Nano ATmega168 <http://www.arduino.org/products/boards/4-arduino-boards/arduino-nano>`_
- ATMEGA168
@ -419,6 +454,13 @@ Arduino
- 32 Kb
- 2.5 Kb
* - ``tian``
- `Arduino Tian <http://www.arduino.org/products/boards/arduino-tian>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``uno``
- `Arduino Uno <http://www.arduino.org/products/boards/4-arduino-boards/arduino-uno>`_
- ATMEGA328P
@ -957,6 +999,13 @@ Espressif
- 4096 Kb
- 80 Kb
* - ``esp8285``
- `Generic ESP8285 Module <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 448 Kb
- 80 Kb
* - ``esp_wroom_02``
- `ESP-WROOM-02 <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
@ -964,6 +1013,27 @@ Espressif
- 4096 Kb
- 50 Kb
* - ``phoenix_v1``
- `Phoenix 1.0 <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 1024 Kb
- 80 Kb
* - ``phoenix_v2``
- `Phoenix 2.0 <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 1024 Kb
- 80 Kb
* - ``wifinfo``
- `WifInfo <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 448 Kb
- 80 Kb
Freescale
~~~~~~~~~
@ -2322,6 +2392,20 @@ SparkFun
- 32 Kb
- 2 Kb
* - ``sparkfun_samd21_dev_usb``
- `SparkFun SAMD21 Dev Breakout <https://www.sparkfun.com/products/13672>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``sparkfun_samd21_mini_usb``
- `SparkFun SAMD21 Mini Breakout <https://www.sparkfun.com/products/13664>`_
- SAMD21G18A
- 48 MHz
- 256 Kb
- 32 Kb
* - ``thing``
- `SparkFun ESP8266 Thing <https://www.sparkfun.com/products/13231>`_
- ESP8266
@ -2663,6 +2747,26 @@ Wicked Device
- 128 Kb
- 16 Kb
chipKIT
~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``lenny``
- `chipKIT Lenny <http://chipkit.net/tag/lenny/>`_
- 32MX270F256D
- 40 MHz
- 128 Kb
- 32 Kb
element14
~~~~~~~~~

View File

@ -210,6 +210,13 @@ Espressif
- 4096 Kb
- 80 Kb
* - ``esp8285``
- `Generic ESP8285 Module <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 448 Kb
- 80 Kb
* - ``esp_wroom_02``
- `ESP-WROOM-02 <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
@ -217,6 +224,27 @@ Espressif
- 4096 Kb
- 50 Kb
* - ``phoenix_v1``
- `Phoenix 1.0 <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 1024 Kb
- 80 Kb
* - ``phoenix_v2``
- `Phoenix 2.0 <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 1024 Kb
- 80 Kb
* - ``wifinfo``
- `WifInfo <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`_
- ESP8266
- 80 MHz
- 448 Kb
- 80 Kb
NodeMCU
~~~~~~~

View File

@ -240,6 +240,7 @@ Using Arduino Framework with Staging version
Articles
--------
* Jun 13, 2016 - **Daniel Eichhorn** - `New Weather Station Demo on Github <http://blog.squix.org/2016/06/new-weather-station-demo-on-github.html>`_
* Jun 3, 2016 - **Daniel Eichhorn** - `ESP8266: Continuous Delivery Pipeline Push To Production <http://blog.squix.org/2016/06/esp8266-continuous-delivery-pipeline-push-to-production.html>`_
* May 29, 2016 - **Chris Synan** - `Reverse Engineer RF Remote Controller for IoT! <http://www.instructables.com/id/Reverse-Engineer-RF-Remote-Controller-for-IoT/?ALLSTEPS>`_
* May 22, 2016 - **Pedro Minatel** - `Estação meteorológica com ESP8266 (Weather station with ESP8266, Portuguese) <http://pedrominatel.com.br/esp8266/estacao-meteorologica-com-esp8266/>`_

View File

@ -332,6 +332,26 @@ UBW32
- 512 Kb
- 128 Kb
chipKIT
~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``lenny``
- `chipKIT Lenny <http://chipkit.net/tag/lenny/>`_
- 32MX270F256D
- 40 MHz
- 128 Kb
- 32 Kb
element14
~~~~~~~~~

View File

@ -14,7 +14,7 @@
import sys
VERSION = (3, 0, "0.dev3")
VERSION = (3, 0, "0.dev4")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@ -21,7 +21,7 @@ from time import time
import click
from platformio import app, exception, telemetry, util
from platformio import __version__, app, exception, telemetry, util
from platformio.commands.lib import lib_install as cmd_lib_install
from platformio.commands.platform import \
platform_install as cmd_platform_install
@ -266,7 +266,7 @@ def check_project_envs(project_dir, environments):
def calculate_project_hash():
structure = []
structure = [__version__]
for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()):
if not isdir(d):
continue

View File

@ -16,11 +16,10 @@ import json
import os
import re
import sys
from os.path import (abspath, basename, expanduser, isdir, join, normpath,
relpath)
from os.path import (abspath, basename, expanduser, isdir, isfile, join,
normpath, relpath)
import bottle
import click # pylint: disable=wrong-import-order
from platformio import app, exception, util
@ -114,16 +113,18 @@ class ProjectGenerator(object):
return tpls
def generate(self):
for _relpath, _path in self.get_tpls():
tpl_dir = self.project_dir
if _relpath:
tpl_dir = join(self.project_dir, _relpath)
if not isdir(tpl_dir):
os.makedirs(tpl_dir)
for tpl_relpath, tpl_path in self.get_tpls():
dst_dir = self.project_dir
if tpl_relpath:
dst_dir = join(self.project_dir, tpl_relpath)
if not isdir(dst_dir):
os.makedirs(dst_dir)
file_name = basename(_path)[:-4]
with open(join(tpl_dir, file_name), "w") as f:
f.write(self._render_tpl(_path).encode("utf8"))
file_name = basename(tpl_path)[:-4]
self._merge_contents(
join(dst_dir, file_name),
self._render_tpl(tpl_path).encode("utf8")
)
def _render_tpl(self, tpl_path):
content = ""
@ -131,23 +132,29 @@ class ProjectGenerator(object):
content = f.read()
return bottle.template(content, **self._tplvars)
@staticmethod
def _merge_contents(dst_path, contents):
file_name = basename(dst_path)
# merge .gitignore
if file_name == ".gitignore" and isfile(dst_path):
contents = [l.strip() for l in contents.split("\n") if l.strip()]
with open(dst_path) as f:
for line in f.readlines():
line = line.strip()
if line and line not in contents:
contents.append(line)
contents = "\n".join(contents)
with open(dst_path, "w") as f:
f.write(contents)
def _gather_tplvars(self):
src_files = self.get_src_files()
if (not any([f.endswith((".c", ".cpp")) for f in src_files]) 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_build_data())
self._tplvars.update({
"project_name": self.get_project_name(),
"src_files": src_files,
"src_files": self.get_src_files(),
"user_home_dir": abspath(expanduser("~")),
"project_dir": self.project_dir,
"systype": util.get_systype(),

View File

@ -43,18 +43,5 @@ add_custom_target(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
% if src_files and any([f.endswith((".c", ".cpp")) for f in src_files]):
add_executable({{project_name}}
% for f in src_files:
% if f.endswith((".c", ".cpp")):
{{f.replace("\\", "/")}}
% end
% end
)
% 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
aux_source_directory(src SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})

View File

@ -17,10 +17,12 @@ INCLUDEPATH += "{{include}}"
DEFINES += "{{define}}"
% end
OTHER_FILES += \
platformio.ini
OTHER_FILES += platformio.ini
SOURCES += \
% for file in src_files:
{{file}}
% end
% for file in src_files:
% if file.endswith((".h", ".hpp")):
HEADERS += {{file}}
% else:
SOURCES += {{file}}
% end
% end