diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..3d714cae --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,51 @@ +What kind of issue is this? + +- [ ] Question. This issue tracker is not the place for questions. If you want to ask how to do + something, or to understand why something isn't working the way you expect it to, use + our technical chat https://gitter.im/platformio/platformio + +- [ ] Feature Request. Start by telling us what problem you’re trying to solve. Often a solution + already exists! Don’t send pull requests to implement new features without first getting our + support. Sometimes we leave features out on purpose to keep the project small. + +- [ ] PlatformIO IDE. All issues related to PlatformIO IDE should be reported to appropriate repository + https://github.com/platformio/platformio-atom-ide/issues + +- [ ] Bug report. If you’ve found a bug, please provide information below. + +------------------------------------------------------------------ + +### Configuration + +**Operating system**: + +**PlatformIO Version** (`platformio --version`): + +### Description of problem + + +#### Steps to Reproduce + +1. +2. +3. + +### Actual Results + + +### Expected Results + + +### If problems with PlatformIO Build System: + +**The content of `platformio.ini`:** +```ini +Insert here... +``` + +**Source file to reproduce issue:** +```cpp +Insert here... +``` + +### Additional info diff --git a/.travis.yml b/.travis.yml index 30cef265..d0f829cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,21 @@ language: python python: - - "2.7" + "2.7" env: - - TOX_ENV=docs - - TOX_ENV=lint - - TOX_ENV=py26 - - TOX_ENV=py27 + TOX_ENV=docs + TOX_ENV=lint + TOX_ENV=py26 + TOX_ENV=py27 install: - - pip install -U pip setuptools tox + pip install -U pip setuptools tox script: - - tox -e $TOX_ENV + tox -e $TOX_ENV + +notifications: + slack: + on_success: change + on_failure: always + secure: uEU56hHACLxq6iRRZ0JeAl/MPADqQWMZZAsZB9IOnXaRUd0Pa6lT2CicJXhVlsEEbNRqR2u5LbcQ4R0nvAKPjYgglDlDet4RfhP+YIqLX2v2dv3B5q8cITsKMUUediv4fybdO/nmvQSImq5nqRQQsXKAwTAJZooIwS3F5Dsg+eE= diff --git a/HISTORY.rst b/HISTORY.rst index 7c17f26c..5b57d8ce 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,39 @@ Release Notes PlatformIO 2.0 -------------- +2.8.5 (2016-03-07) +~~~~~~~~~~~~~~~~~~ + +* Project generator for `NetBeans IDE `__ + (`issue #541 `_) +* Created package for Homebrew Mac OS X Package Manager: ``brew install + platformio`` + (`issue #395 `_) +* Updated Arduino core for Espressif platform to 2.1.0 + (`issue #544 `_) +* Added support for the ESP8266 ESP-07 board to + `Espressif `__ + (`issue #527 `_) +* Improved handling of String-based ``CPPDEFINES`` passed to extra ``build_flags`` + (`issue #526 `_) +* Generate appropriate project for CLion IDE and CVS + (`issue #523 `_) +* Use ``src_dir`` directory from `Project Configuration File platformio.ini `__ + when initializing project otherwise create base ``src`` directory + (`issue #536 `_) +* Fixed issue with incorrect handling of user's build flags where the base flags + were passed after user's flags to GCC compiler + (`issue #528 `_) +* Fixed issue with Project Generator when optional build flags were passed using + system environment variables: `PLATFORMIO_BUILD_FLAGS `__ + or `PLATFORMIO_BUILD_SRC_FLAGS `__ +* Fixed invalid detecting of compiler type + (`issue #550 `_) +* Fixed issue with updating package which was deleted manually by user + (`issue #555 `_) +* Fixed incorrect parsing of GCC ``-include`` flag + (`issue #552 `_) + 2.8.4 (2016-02-17) ~~~~~~~~~~~~~~~~~~ @@ -21,7 +54,7 @@ PlatformIO 2.0 * Handle new environment variables `PLATFORMIO_UPLOAD_PORT `_ and `PLATFORMIO_UPLOAD_FLAGS `_ - (`IDE issue #518 `_) + (`issue #518 `_) * Fixed issue with ``CPPDEFINES`` which contain space and break PlatformIO IDE Linter (`IDE issue #34 `_) diff --git a/README.rst b/README.rst index 91502830..ca52aa95 100644 --- a/README.rst +++ b/README.rst @@ -22,10 +22,7 @@ PlatformIO .. image:: https://img.shields.io/pypi/dm/platformio.svg :target: https://pypi.python.org/pypi/platformio/ :alt: PyPi Downloads -.. image:: https://img.shields.io/sourceforge/dm/platformio-storage.svg - :target: https://sourceforge.net/projects/platformio-storage/ - :alt: Packages Downloads -.. image:: https://badges.gitter.im/Join%20Chat.svg +.. image:: https://img.shields.io/chat/on%20gitter.png :alt: Join the chat at https://gitter.im/platformio/platformio :target: https://gitter.im/platformio/platformio .. image:: https://img.shields.io/donate/PlatformIO.png?color=yellow @@ -40,6 +37,7 @@ PlatformIO `Twitter `_ | `Facebook `_ | `Hackaday `_ | +`Bintray `_ | `Donate `_ | `Contact Us `_ @@ -47,7 +45,7 @@ PlatformIO :target: http://platformio.org `PlatformIO `_ is an open source ecosystem for IoT -development. Cross-platform code builder and library manager. Continuous and +development. Cross-platform build system and library manager. Continuous and IDE integration. Arduino and MBED compatible. Ready for Cloud compiling. * **PlatformIO IDE** - The next generation integrated development environment for IoT. @@ -132,7 +130,7 @@ platforms which allows you to organize and have up-to-date external libraries. :target: http://platformio.org :alt: PlatformIO Library Manager Architecture -Smart Code Builder. *Fast and Reliable.* +Smart Build System. *Fast and Reliable.* ---------------------------------------- *PlatformIO Code Builder* is built-on a next-generation software construction tool named `SCons `_. Think of *SCons* as an improved, @@ -146,7 +144,7 @@ cross-platform substitute for the classic *Make* utility. .. image:: https://raw.githubusercontent.com/platformio/platformio-web/develop/app/images/platformio-scons-builder.png :target: http://platformio.org - :alt: PlatformIO Code Builder Architecture + :alt: PlatformIO Build System Architecture Single source code. *Multiple platforms.* ----------------------------------------- diff --git a/docs/_static/extra.css b/docs/_static/extra.css index e88d4b07..61bc0108 100644 --- a/docs/_static/extra.css +++ b/docs/_static/extra.css @@ -256,6 +256,20 @@ nav { /* Misc */ +.wy-side-scroll .wy-side-nav-search .icon, +.wy-side-scroll .wy-side-nav-search .version { + display: none; + visibility: none; +} + +.navbar-header .navbar-brand { + color: #e0e0e0; + background: url("../_static/platformio-logo-xs.png") no-repeat; + background-position: 5px 0; + padding-left: 50px; + font-weight: 500; +} + .top-banner { display: block; padding: 10px 20px; diff --git a/docs/_static/ide-atom-platformio-menu-item.png b/docs/_static/ide-atom-platformio-menu-item.png index 0409ffb1..faa93c61 100644 Binary files a/docs/_static/ide-atom-platformio-menu-item.png and b/docs/_static/ide-atom-platformio-menu-item.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-1.png b/docs/_static/ide-atom-platformio-quick-start-1.png new file mode 100644 index 00000000..751eaf90 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-1.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-10.png b/docs/_static/ide-atom-platformio-quick-start-10.png new file mode 100644 index 00000000..eb4622da Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-10.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-11.png b/docs/_static/ide-atom-platformio-quick-start-11.png new file mode 100644 index 00000000..d78b7ffe Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-11.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-12.png b/docs/_static/ide-atom-platformio-quick-start-12.png new file mode 100644 index 00000000..c4547985 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-12.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-13.png b/docs/_static/ide-atom-platformio-quick-start-13.png new file mode 100644 index 00000000..3b0c3168 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-13.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-14.png b/docs/_static/ide-atom-platformio-quick-start-14.png new file mode 100644 index 00000000..aa115346 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-14.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-2.png b/docs/_static/ide-atom-platformio-quick-start-2.png new file mode 100644 index 00000000..5b080247 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-2.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-3.png b/docs/_static/ide-atom-platformio-quick-start-3.png new file mode 100644 index 00000000..17b36cb9 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-3.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-4.png b/docs/_static/ide-atom-platformio-quick-start-4.png new file mode 100644 index 00000000..c335c423 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-4.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-5.png b/docs/_static/ide-atom-platformio-quick-start-5.png new file mode 100644 index 00000000..c553aa01 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-5.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-6.png b/docs/_static/ide-atom-platformio-quick-start-6.png new file mode 100644 index 00000000..ac7f78c2 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-6.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-7.png b/docs/_static/ide-atom-platformio-quick-start-7.png new file mode 100644 index 00000000..86ac8c36 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-7.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-8.png b/docs/_static/ide-atom-platformio-quick-start-8.png new file mode 100644 index 00000000..0b0c0713 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-8.png differ diff --git a/docs/_static/ide-atom-platformio-quick-start-9.png b/docs/_static/ide-atom-platformio-quick-start-9.png new file mode 100644 index 00000000..3c51f946 Binary files /dev/null and b/docs/_static/ide-atom-platformio-quick-start-9.png differ diff --git a/docs/_static/ide-atom-platformio-toolbar.png b/docs/_static/ide-atom-platformio-toolbar.png index 96d40be2..67e3e5a1 100644 Binary files a/docs/_static/ide-atom-platformio-toolbar.png and b/docs/_static/ide-atom-platformio-toolbar.png differ diff --git a/docs/_static/ide-platformio-arduino.png b/docs/_static/ide-platformio-arduino.png deleted file mode 100644 index 67d1e9e0..00000000 Binary files a/docs/_static/ide-platformio-arduino.png and /dev/null differ diff --git a/docs/_static/ide-platformio-emacs.png b/docs/_static/ide-platformio-emacs.png index e61bf76b..a1780a6b 100644 Binary files a/docs/_static/ide-platformio-emacs.png and b/docs/_static/ide-platformio-emacs.png differ diff --git a/docs/_static/ide-platformio-energia.png b/docs/_static/ide-platformio-energia.png deleted file mode 100644 index 877a6c53..00000000 Binary files a/docs/_static/ide-platformio-energia.png and /dev/null differ diff --git a/docs/_static/ide-platformio-netbeans.png b/docs/_static/ide-platformio-netbeans.png new file mode 100644 index 00000000..310b85cb Binary files /dev/null and b/docs/_static/ide-platformio-netbeans.png differ diff --git a/docs/_static/ide-vs-platformio-newproject-6.png b/docs/_static/ide-vs-platformio-newproject-6.png index fb51d40f..07a4d80a 100644 Binary files a/docs/_static/ide-vs-platformio-newproject-6.png and b/docs/_static/ide-vs-platformio-newproject-6.png differ diff --git a/docs/_static/ide-vs-platformio-newproject-8.png b/docs/_static/ide-vs-platformio-newproject-8.png index 708269ba..f3cb9e46 100644 Binary files a/docs/_static/ide-vs-platformio-newproject-8.png and b/docs/_static/ide-vs-platformio-newproject-8.png differ diff --git a/docs/_static/ide-vs-platformio-newproject-9.png b/docs/_static/ide-vs-platformio-newproject-9.png new file mode 100644 index 00000000..f6978e90 Binary files /dev/null and b/docs/_static/ide-vs-platformio-newproject-9.png differ diff --git a/docs/_static/platformio-logo-xs.png b/docs/_static/platformio-logo-xs.png new file mode 100644 index 00000000..9ac1f099 Binary files /dev/null and b/docs/_static/platformio-logo-xs.png differ diff --git a/docs/_templates/footer.html b/docs/_templates/footer.html index 65446636..24bc2f5d 100644 --- a/docs/_templates/footer.html +++ b/docs/_templates/footer.html @@ -12,15 +12,15 @@ diff --git a/docs/articles.rst b/docs/articles.rst index 265f6041..5cdd2564 100644 --- a/docs/articles.rst +++ b/docs/articles.rst @@ -23,6 +23,12 @@ Here are recent articles about PlatformIO: 2016 ^^^^ +* Mar 04, 2016 - **Ricardo Vega** - `Programa tu Arduino desde Atom (Program your Arduino from Atom, Spanish) `_ +* Feb 28, 2016 - **Alex Bloggt** - `PlatformIO vorgestellt (Introduction to PlatformIO IDE, German) `_ +* Feb 25, 2016 - **NutDIY** - `PlatformIO Blink On Nodemcu Dev Kit V1.0 (Thai) `_ +* Feb 23, 2016 - **Ptarmigan Labs** - `ESP8266 Over The Air updating – what are the options? `_ +* Feb 22, 2016 - **Grzegorz Hołdys** - `How to Integrate PlatformIO with Netbeans `_ +* Feb 19, 2016 - **Embedds** - `Develop easier with PlatformIO ecosystem `_ * Jan 24, 2016 - **Sergey Prilukin** - `How to use IntelliJ IDEA to develop and upload software for micro controllers like Arduino `_ * Jan 16, 2016 - **Dani Eichhorn** - `ESP8266 Arduino IDE Alternative: PlatformIO `_ * Jan 11, 2016 - **David Mills, Ph.D.** - `STM NUCLEOF401RE TIMER IO `_ @@ -58,14 +64,14 @@ Here are recent articles about PlatformIO: * May 17, 2015 - **S.S** - `コマンドラインでArduino開発 : vim + platformio (Arduino development at the command line: VIM + PlatformIO, Japanese) `_ * May 11, 2015 - **IT Hare** - `From Web Developer to Embedded One: Interview with Ivan Kravets, The Guy Behind PlatformIO. Part II `_ * May 4, 2015 - **IT Hare** - `From Web Developer to Embedded One: Interview with Ivan Kravets, The Guy Behind PlatformIO. Part I `_ -* April 17, 2015 - **Michael Ball** - `PlatformIO - A Cross-Platform Code Builder and Missing Library Manager `_ -* March 23, 2015 - **Atmel** - `Cross-board and cross-vendor embedded development with PlatformIO `_ -* March 22, 2015 - **Mark VandeWettering** - `Discovered a new tool for embedded development: PlatformIO `_ -* February 25, 2015 - **Hendrik Putzek** - `Use your favourite IDE together with Arduino `_ +* Apr 17, 2015 - **Michael Ball** - `PlatformIO - A Cross-Platform Code Builder and Missing Library Manager `_ +* Mar 23, 2015 - **Atmel** - `Cross-board and cross-vendor embedded development with PlatformIO `_ +* Mar 22, 2015 - **Mark VandeWettering** - `Discovered a new tool for embedded development: PlatformIO `_ +* Feb 25, 2015 - **Hendrik Putzek** - `Use your favourite IDE together with Arduino `_ 2014 ^^^^ -* October 7, 2014 - **Ivan Kravets, Ph.D.** - `Integration of PlatformIO library manager to Arduino and Energia IDEs `_ -* June 20, 2014 - **Ivan Kravets, Ph.D.** - `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO `_ -* June 17, 2014 - **Ivan Kravets, Ph.D.** - `How was PlatformIO born or why I love Python World `_ +* Oct 7, 2014 - **Ivan Kravets, Ph.D.** - `Integration of PlatformIO library manager to Arduino and Energia IDEs `_ +* Jun 20, 2014 - **Ivan Kravets, Ph.D.** - `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO `_ +* Jun 17, 2014 - **Ivan Kravets, Ph.D.** - `How was PlatformIO born or why I love Python World `_ diff --git a/docs/demo.rst b/docs/demo.rst index 9f3bcb87..b7487222 100644 --- a/docs/demo.rst +++ b/docs/demo.rst @@ -21,8 +21,8 @@ Project Examples Preconfigured demo projects are located in `PlatformIO GitHub `_ repository. -Wiring Blink ------------- +"Blink Project" +--------------- .. image:: _static/platformio-demo-wiring.gif diff --git a/docs/envvars.rst b/docs/envvars.rst index 7085bcf7..e9316c64 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -77,6 +77,20 @@ Building Allows to set :ref:`projectconf` option :ref:`projectconf_build_flags`. +Examples: + +.. code-block:: bash + + # Unix: + export PLATFORMIO_BUILD_FLAGS=-DFOO + export PLATFORMIO_BUILD_FLAGS="-DFOO -DBAR=1 -DFLOAT_VALUE=1.23457e+07" + export PLATFORMIO_BUILD_FLAGS="'-DWIFI_PASS=\"My password\"' '-DWIFI_SSID=\"My ssid name\"'" + + # Windows: + SET PLATFORMIO_BUILD_FLAGS=-DFOO + SET PLATFORMIO_BUILD_FLAGS=-DFOO -DBAR=1 -DFLOAT_VALUE=1.23457e+07 + SET PLATFORMIO_BUILD_FLAGS='-DWIFI_PASS="My password"' '-DWIFI_SSID="My ssid name"' + .. envvar:: PLATFORMIO_SRC_BUILD_FLAGS Allows to set :ref:`projectconf` option :ref:`projectconf_src_build_flags`. diff --git a/docs/faq.rst b/docs/faq.rst index 05e995b4..1c55f724 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -19,53 +19,11 @@ Frequently Asked Questions General ------- -.. _faq_what_is_platformio: - What is PlatformIO? ~~~~~~~~~~~~~~~~~~~ -`PlatformIO `_ is an open source ecosystem for IoT -development. +Please refer to :ref:`what_is_pio` -PlatformIO is independent from the platform, in which it is running. In fact, -the only requirement is Python, which exists pretty much everywhere. What this -means is that PlatformIO projects can be easily moved from one computer to -another, as well as that PlatformIO allows for the easy sharing of projects -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 -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 -:ref:`ide` or text editor such as :ref:`ide_arduino`, :ref:`ide_atom`, -: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 -importantly, from development perspective at least, is a list of supported -boards and MCUs. To keep things short: PlatformIO supports approximately 200 -`Embedded Boards `_ and all major -:ref:`Development Platforms `. - -PlatformIO allows users to: - -* Decide which operation system they want to run development process on. - You can even use one OS at home and another at work. -* Choose which editor to use for writing the code. It can be pretty simple - editor or powerful favorite :ref:`ide`. -* Focus on the code development, significantly simplifying support for the - :ref:`platforms` and MCUs. - - -How does it work? -~~~~~~~~~~~~~~~~~ - -Without going too deep into PlatformIO implementation details, work cycle of -the project developed using PlatformIO is as follows: - -* Users choose board(s) interested in :ref:`projectconf` -* Based on this list of boards, PlatformIO downloads required toolchains and - installs them automatically. -* Users develop code and PlatformIO makes sure that it is compiled, prepared - and uploaded to all the boards of interest. Command completion in Terminal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/frameworks/arduino.rst b/docs/frameworks/arduino.rst index 2ffb72e4..270dce86 100644 --- a/docs/frameworks/arduino.rst +++ b/docs/frameworks/arduino.rst @@ -13,7 +13,7 @@ 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 Wiring-based 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. For more detailed information please visit `vendor site `_. @@ -583,6 +583,13 @@ Espressif - 1024 Kb - 80 Kb + * - ``esp07`` + - `Espressif Generic ESP8266 ESP-07 `_ + - ESP8266 + - 80 MHz + - 4096 Kb + - 80 Kb + * - ``esp12e`` - `Espressif ESP8266 ESP-12E `_ - ESP8266 diff --git a/docs/frameworks/energia.rst b/docs/frameworks/energia.rst index 64a474ee..1ed32ca8 100644 --- a/docs/frameworks/energia.rst +++ b/docs/frameworks/energia.rst @@ -13,7 +13,7 @@ Framework ``energia`` ===================== -Energia framework enables pretty much anyone to start easily creating microcontroller-based projects and applications. Its easy-to-use libraries and functions provide developers of all experience levels to start blinking LEDs, buzzing buzzers and sensing sensors more quickly than ever before. +Energia Wiring-based framework enables pretty much anyone to start easily creating microcontroller-based projects and applications. Its easy-to-use libraries and functions provide developers of all experience levels to start blinking LEDs, buzzing buzzers and sensing sensors more quickly than ever before. For more detailed information please visit `vendor site `_. diff --git a/docs/ide.rst b/docs/ide.rst index 741e480e..f1041614 100644 --- a/docs/ide.rst +++ b/docs/ide.rst @@ -18,11 +18,10 @@ IDE Integration :maxdepth: 2 ide/atom - ide/arduino ide/clion ide/eclipse ide/emacs - ide/energia + ide/netbeans ide/qtcreator ide/sublimetext ide/vim diff --git a/docs/ide/_platformio_ide_extra.rst b/docs/ide/_platformio_ide_extra.rst new file mode 100644 index 00000000..2dc0bf3e --- /dev/null +++ b/docs/ide/_platformio_ide_extra.rst @@ -0,0 +1,31 @@ +.. Copyright 2014-2016 Ivan Kravets + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +.. note:: + We are proud to present our official `PlatformIO IDE `_ - + The next generation integrated development environment for IoT. + + * Cross-platform build system without external dependencies to the OS software: + + - 200+ embedded boards + - 15+ development platforms + - 10+ frameworks + + * C/C++ Intelligent code completion + * C/C++ Smart code linter for super-fast coding + * Library Manager for the hundreds popular libraries + * Multi-projects workflow with multiple panes + * Multiple panes + * Themes support with dark and light colors + * Serial Port Monitor + * Built-in Terminal with :ref:`PlatformIO CLI ` tool (``pio``, ``platformio``) + + `Install PlatformIO IDE `_. diff --git a/docs/ide/arduino.rst b/docs/ide/arduino.rst deleted file mode 100644 index 5c36da12..00000000 --- a/docs/ide/arduino.rst +++ /dev/null @@ -1,50 +0,0 @@ -.. Copyright 2014-2016 Ivan Kravets - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -.. _ide_arduino: - -Arduino -======= - -The open-source `Arduino Software (IDE) `_ -makes it easy to write code and upload it to the board. It runs on *Windows, -Mac OS X, and Linux*. The environment is written in *Java* and based on -*Processing* and other open-source software. - -This software can be used with: - -* :ref:`platform_atmelavr` -* :ref:`platform_atmelsam` -* :ref:`framework_arduino` - -Refer to the `Arduino Getting Started `_ -page for Installation instructions. - -.. contents:: - -Integration ------------ - -More detailed information is located in PlatformIO blog: -`Integration of PlatformIO library manager to Arduino IDE `_. - -Articles / Manuals ------------------- - -* `Integration of PlatformIO library manager to Arduino and Energia IDEs `_ - -See the full list with :ref:`articles`. - -Screenshot ----------- - -.. image:: ../_static/ide-platformio-arduino.png - :target: http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides diff --git a/docs/ide/atom.rst b/docs/ide/atom.rst index 2bc3e327..bcc57848 100644 --- a/docs/ide/atom.rst +++ b/docs/ide/atom.rst @@ -16,22 +16,21 @@ PlatformIO IDE for Atom PlatformIO IDE is the next generation integrated development environment for IoT: -* Cross-platform code builder without external dependencies to the system - software: +* Cross-platform build system without external dependencies to the OS software: - 200+ embedded boards - 15+ development platforms - 10+ frameworks -* C/C++ Intelligent code completion -* C/C++ Smart code linter for super-fast coding +* C/C++ Intelligent Code Completion +* C/C++ Smart Code Linter for rapid professional development * Library Manager for the hundreds popular libraries * Multi-projects workflow with multiple panes -* Multiple panes * Themes support with dark and light colors * Serial Port Monitor * Built-in Terminal with :ref:`PlatformIO CLI ` tool (``pio``, ``platformio``) + PlatformIO IDE is based on GitHub's `Atom `_ source code editor that's modern, approachable, yet hackable to the core; a tool you can customize to do anything but also use productively without ever touching a @@ -43,16 +42,34 @@ config file. Installation ------------ -1. Download and install Atom text editor +PlatformIO IDE is the next generation integrated development environment for IoT. +It's built on top of `GitHub's Atom "hackable" text editor `_. +If you have already Atom installed, please install `PlatformIO IDE for Atom package `_. - - `Download for Mac `_ - - `Download for Windows `_ - - `Download .deb `_ - - `Download .rpm `_ +Automatic Installation +~~~~~~~~~~~~~~~~~~~~~~ + +Please download PlatformIO IDE for Atom bundle with built-in auto installer +(be patient and let the installation complete) + +- `Download PlatformIO IDE for Windows `_ +- `Download PlatformIO IDE for Mac `_ +- `Download PlatformIO IDE .deb `_ +- `Download PlatformIO IDE .rpm `_ + +Manual Installation +~~~~~~~~~~~~~~~~~~~ + +1. Download and install the latest Atom text editor + + - `Download Atom for Mac `_ + - `Download Atom for Windows `_ + - `Download Atom .deb `_ + - `Download Atom .rpm `_ - `Other platforms `_ -2. Open Atom Package Manager and search for `platformio-ide `_ +2. Open Atom Package Manager and install `platformio-ide `_ Atom package - **Mac OS X**: ``Menu: Atom > Preferences > Install`` - **Windows**: ``Menu: File > Settings > Install`` @@ -60,11 +77,153 @@ Installation .. image:: ../_static/ide-atom-platformio-install.png + +.. _atom_ide_quickstart: + +Quick Start +----------- + +This tutorial introduces you to the basics of PlatformIO IDE workflow and shows +you a creation process of a simple "Blink" example. After finishing you will +have a general understanding of how to work with projects in the IDE. + +Launch +~~~~~~ + +After installation, you launch PlatformIO IDE by opening Atom. Once Atom is +open, PlatformIO IDE auto installer will continue to install dependent packages +and PlatformIO CLI. Please be patient and let the installation complete. In the +final result PlatformIO IDE will ask you to reload Atom window to apply +installed components. Please click on ``Reload Now``. After it PlatformIO IDE is +ready for using. Happy coding! + +Setting Up the Project +~~~~~~~~~~~~~~~~~~~~~~ + +1. To create a new project choose + ``Menu: PlatformIO > Initialize new Project or update existing`` or press + the corresponding icon in the PlatformIO toolbar as shown in the image below: + +.. image:: ../_static/ide-atom-platformio-quick-start-1.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-1.png + +2. In the "New Project Menu" choose desired boards (more than one board is + allowed) and select a project directory. Then press "Initialize" button: + +.. image:: ../_static/ide-atom-platformio-quick-start-2.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-2.png + +3. If everything is fine, you should see the success message and project tree + in the left panel: + +.. image:: ../_static/ide-atom-platformio-quick-start-3.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-3.png + +4. Now, let's create the first project source file: right-click on the folder + ``src`` and choose ``New File``: + +.. image:: ../_static/ide-atom-platformio-quick-start-4.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-4.png + +Enter filename ``main.cpp``: + +.. image:: ../_static/ide-atom-platformio-quick-start-5.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-5.png + +Copy the next source code to the just created file ``main.cpp``: + +.. code-block:: cpp + + /** + * Blink + * Turns on an LED on for one second, + * then off for one second, repeatedly. + */ + #include "Arduino.h" + + void setup() + { + // initialize LED digital pin as an output. + pinMode(LED_BUILTIN, OUTPUT); + } + + void loop() + { + // turn the LED on (HIGH is the voltage level) + digitalWrite(LED_BUILTIN, HIGH); + // wait for a second + delay(1000); + // turn the LED off by making the voltage LOW + digitalWrite(LED_BUILTIN, LOW); + // wait for a second + delay(1000); + } + +Process Project +~~~~~~~~~~~~~~~ + +PlatformIO IDE proposes different ways to process project (build, clean, +upload firmware, run other targets) using: + + - :ref:`atom_ide_platformio_toolbar` + - :ref:`atom_ide_platformio_menu` + - :ref:`ide_atom_building_targets` and hotkeys + +.. image:: ../_static/ide-atom-platformio-quick-start-6.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-6.png + +5. Run ``Build`` and you should see green "success" result in the building + panel: + +.. image:: ../_static/ide-atom-platformio-quick-start-7.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-7.png + +To upload firmware to the board run ``Upload``. + +6. What is more, you can run specific target or process project environment + using ``Menu: PlatformIO > Run other target...`` + or call targets list from the status bar (bottom, left corner): + +.. image:: ../_static/ide-atom-platformio-quick-start-8.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-8.png + +And select desired target: + +.. image:: ../_static/ide-atom-platformio-quick-start-9.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-9.png + +7. To run built-in terminal interface choose ``Menu: PlatformIO > Terminal`` or + press the corresponding icon in the PlatformIO toolbar: + +.. image:: ../_static/ide-atom-platformio-quick-start-10.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-10.png + +It provides you fast access to all set of powerful PlatformIO CLI commands: + +.. image:: ../_static/ide-atom-platformio-quick-start-11.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-11.png + +8. To run built-in "Serial Monitor" choose ``Menu: PlatformIO > Serial Monitor`` + or press the corresponding icon in the PlatformIO toolbar: + +.. image:: ../_static/ide-atom-platformio-quick-start-12.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-12.png + +It has several settings to adjust your connection: + +.. image:: ../_static/ide-atom-platformio-quick-start-13.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-13.png + +And allows you to communicate with your board in an easy way: + +.. image:: ../_static/ide-atom-platformio-quick-start-14.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-14.png + + User Guide ---------- -.. image:: ../_static/ide-atom-platformio.png - :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio.png +.. _atom_ide_platformio_menu: Menu item ``PlatformIO`` ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -74,10 +233,11 @@ new menu item named ``Menu: PlatformIO`` (after ``Menu: Help`` item). .. image:: ../_static/ide-atom-platformio-menu-item.png +.. _atom_ide_platformio_toolbar: + PlatformIO Toolbar ~~~~~~~~~~~~~~~~~~ - PlatformIO IDE Toolbar contains the quick access button to the popular commands. Each button contains hint (delay mouse on it). @@ -86,42 +246,19 @@ Each button contains hint (delay mouse on it). * PlatformIO: Build * PlatformIO: Upload * PlatformIO: Clean -* Toggle build panel * || -* New File +* Initialize new PlatformIO Project or update existing... * Add/Open Project Folder... * Find in Project... * || * Terminal +* Library Manager * Serial Ports * Serial Monitor * || * Settings * PlatformIO Documentation -.. _ide_atom_quickstart: - -Quickstart -~~~~~~~~~~ - -:Step 1: - - Create empty directory for the future project. Add it to PlatformIO IDE - using (folder) button on the Toolbar or ``Menu: File > Add Project - Folder...`` - -:Step 2: - - Initialize new PlatformIO based project using ``Menu: PlatformIO > - Initialize new Project (or update existing)`` and select boards. - Put your source code ``*.h, *.c, *.cpp, *.S, *.ino, etc``. files to ``src`` - directory. - -:Step 3: - - Process the project environments. More details :ref:`ide_atom_building_targets`. - - .. _ide_atom_building_targets: Building / Uploading / Targets @@ -138,10 +275,10 @@ Building / Uploading / Targets More details `Atom Build package `_. -Code completion -~~~~~~~~~~~~~~~ +Intelligent Code Autocompletion +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -PlatformIO IDE uses `clang `_ for the code completion. +PlatformIO IDE uses `clang `_ for the Intelligent Code Autocompletion. To check that ``clang`` is available in your system, please open Terminal and run ``clang --version``. If ``clang`` is not installed, then install it: @@ -158,13 +295,16 @@ Terminal and run ``clang --version``. If ``clang`` is not installed, then instal not be reflected in code linter. You need ``Menu: PlatformIO > Rebuild C/C++ Project Index (Autocomplete, Linter)``. -Code linter -~~~~~~~~~~~ +.. _ide_atom_smart_code_linter: -PlatformIO IDE uses PlatformIO's pre-built GCC toolchains for code linting. The -settings for Linter are located in ``.gcc-flags.json``. This file will be +Smart Code Linter +~~~~~~~~~~~~~~~~~ + +PlatformIO IDE uses PlatformIO's pre-built GCC toolchains for Smart Code Linter +and rapid professional development. +The configuration data are located in ``.gcc-flags.json``. This file will be automatically created and preconfigured when you initialize project using -``Menu: PlatformIO > Initialize new Project (or update existing)``. +``Menu: PlatformIO > Initialize new PlatformIO Project or update existing...``. .. warning:: The libraries which are added/installed after initializing process will @@ -175,7 +315,7 @@ automatically created and preconfigured when you initialize project using .. error:: If you have error like ``linter-gcc: Executable not found`` and ``"***/.platformio/packages/toolchain-atmelavr/bin/avr-g++" not found`` - please ``Menu: PlatformIO > Initialize new Project (or update existing)``. + please ``Menu: PlatformIO > Initialize new PlatformIO Project or update existing...``. Install Shell Commands ~~~~~~~~~~~~~~~~~~~~~~ @@ -185,6 +325,101 @@ PlatformIO > Install Shell Commands``. It will allow you to call PlatformIO from other process, terminal and etc. Known issues -~~~~~~~~~~~~ +------------ -* Built-in Terminal doesn't support ``STDIN`` interaction +Smart Code Linter is disabled for Arduino files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:ref:`ide_atom_smart_code_linter` is disabled by default for Arduino files +(``*.ino`` and ``.pde``) because they are not valid C/C++ based +source files: + +1. Missing includes such as ``#include `` +2. Function declarations are omitted. + +There are two solutions: + +.. contents:: + :local: + +.. _ide_atom_knownissues_sclarduino_manually: + +Convert Arduino file to C++ manually +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For example, we have the next ``Demo.ino`` file: + +.. code-block:: cpp + + void function setup () { + someFunction(13); + } + + void function loop() { + delay(1000); + } + + void someFunction(int num) { + } + +Let's convert it to ``Demo.cpp``: + +1. Add ``#include `` at the top of the source file +2. Declare each custom function (excluding built-in, such as ``setup`` and ``loop``) + before it will be called. + +The final ``Demo.cpp``: + +.. code-block:: cpp + + #include + + void someFunction(int num); + + void function setup () { + someFunction(13); + } + + void function loop() { + delay(1000); + } + + void someFunction(int num) { + } + +Force Arduino file as C++ +^^^^^^^^^^^^^^^^^^^^^^^^^ + +To force Smart Code Linter to use Arduino files as C++ please + +1. Open ``.gcc-flags.json`` file from the Initialized/Imported project and add + ``-x c++`` flag at the beginning of the value of ``gccDefaultCppFlags`` field: + +.. code-block:: json + + { + "execPath": "...", + "gccDefaultCFlags": "...", + "gccDefaultCppFlags": "-x c++ -fsyntax-only ...", + "gccErrorLimit": 15, + "gccIncludePaths": "...", + "gccSuppressWarnings": false + } + +2. Perform all steps from :ref:`ide_atom_knownissues_sclarduino_manually` + (without renaming to ``.cpp``). + +Articles / Manuals +------------------ + +* Feb 28, 2016 - **Alex Bloggt** - `PlatformIO vorgestellt (Introduction to PlatformIO IDE, German) `_ +* Mar 04, 2016 - **Ricardo Vega** - `Programa tu Arduino desde Atom (Program your Arduino from Atom, Spanish) `_ +* Feb 25, 2016 - **NutDIY** - `PlatformIO Blink On Nodemcu Dev Kit V1.0 (Thai) `_ + +See a full list with :ref:`articles`. + +Screenshot +---------- + +.. image:: ../_static/ide-atom-platformio.png + :target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio.png diff --git a/docs/ide/clion.rst b/docs/ide/clion.rst index 4ab28138..5f8fcf51 100644 --- a/docs/ide/clion.rst +++ b/docs/ide/clion.rst @@ -20,12 +20,7 @@ initial version will support the GCC and Clang compilers and GDB debugger. Clion includes such features as a smart editor, code quality assurance, automated refactorings, project manager, integrated version control systems. -This software can be used with: - -* all available :ref:`platforms` -* all available :ref:`frameworks` - -Refer to the `CDT Documentation `_ +Refer to the `CLion Documentation `_ page for more detailed information. .. contents:: diff --git a/docs/ide/eclipse.rst b/docs/ide/eclipse.rst index 006cf97a..f84f39b9 100644 --- a/docs/ide/eclipse.rst +++ b/docs/ide/eclipse.rst @@ -24,11 +24,6 @@ with syntax highlighting, folding and hyperlink navigation, source code refactoring and code generation, visual debugging tools, including memory, registers, and disassembly viewers. -This software can be used with: - -* all available :ref:`platforms` -* all available :ref:`frameworks` - Refer to the `CDT Documentation `_ page for more detailed information. diff --git a/docs/ide/emacs.rst b/docs/ide/emacs.rst index 5e1e19c4..7f420da6 100644 --- a/docs/ide/emacs.rst +++ b/docs/ide/emacs.rst @@ -19,12 +19,6 @@ an interpreter for Emacs Lisp, a dialect of the `Lisp programming language `_ with extensions to support text editing. - -This software can be used with: - -* all available :ref:`platforms` -* all available :ref:`frameworks` - Refer to the `Emacs Documentation `_ page for more detailed information. diff --git a/docs/ide/energia.rst b/docs/ide/energia.rst deleted file mode 100644 index 0fd91280..00000000 --- a/docs/ide/energia.rst +++ /dev/null @@ -1,50 +0,0 @@ -.. Copyright 2014-2016 Ivan Kravets - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -.. _ide_energia: - -Energia -======= - -The open-source `Energia Software (IDE) `_ -makes it easy to write code and upload it to the board. It runs on *Windows, -Mac OS X, and Linux*. The environment is written in *Java* and based on -*Processing* and other open-source software. - -This software can be used with: - -* :ref:`platform_timsp430` -* :ref:`platform_titiva` -* :ref:`framework_energia` - -Refer to the `Energia Getting Started `_ -page for Installation instructions. - -.. contents:: - -Integration ------------ - -More detailed information is located in PlatformIO blog: -`Integration of PlatformIO library manager to Energia IDE `_. - -Articles / Manuals ------------------- - -* `Integration of PlatformIO library manager to Arduino and Energia IDEs `_ - -See the full list with :ref:`articles`. - -Screenshot ------------ - -.. image:: ../_static/ide-platformio-energia.png - :target: http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides diff --git a/docs/ide/netbeans.rst b/docs/ide/netbeans.rst new file mode 100644 index 00000000..4a0d75b5 --- /dev/null +++ b/docs/ide/netbeans.rst @@ -0,0 +1,66 @@ +.. Copyright 2014-2016 Ivan Kravets + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +.. _ide_netbeans: + +NetBeans +======== + +NetBeans is a Java-based integrated development environment (IDE). It provides +out-of-the-box code analyzers and editors for working with the latest Java 8 +technologies--Java SE 8, Java SE Embedded 8, and Java ME Embedded 8. The IDE +also has a range of new tools for HTML5/JavaScript, in particular for Node.js, +KnockoutJS, and AngularJS; enhancements that further improve its support for +Maven and Java EE with PrimeFaces; and improvements to PHP and C/C++ support. + +Refer to the `C/C++ Application Learning Trail `_ +for details. + +.. contents:: + +Integration +----------- + +Choose board ``type`` using :ref:`cmd_boards` or `Embedded Boards Explorer `_ +command and generate project via :option:`platformio init --ide` command: + +.. code-block:: shell + + platformio init --ide netbeans --board %TYPE% + + # For example, generate project for Arduino UNO + platformio init --ide netbeans --board uno + +Then: + +1. Open this project via ``Menu: File > Open Project...`` +2. Add new files to ``src`` directory (``*.c, *.cpp, *.ino, etc.``) via + right-click on ``src`` folder in the "Projects" pane +3. Build project using ``Menu: Run > Build Project`` +4. Upload firmware using ``Menu: Run > Run Project`` + +.. warning:: + The libraries which are added, installed or used in the project + after generating process wont be reflected in IDE. To fix it you + need to reinitialize project using :ref:`cmd_init` (repeat it). + +Articles / Manuals +------------------ + +* Feb 22, 2016 - **Grzegorz Hołdys** - `How to Integrate PlatformIO with Netbeans `_ + +See the full list with :ref:`articles`. + +Screenshot +----------- + +.. image:: ../_static/ide-platformio-netbeans.png + :target: http://docs.platformio.org/en/latest/_images/ide-platformio-netbeans.png diff --git a/docs/ide/qtcreator.rst b/docs/ide/qtcreator.rst index c9433ce4..bbcf2001 100644 --- a/docs/ide/qtcreator.rst +++ b/docs/ide/qtcreator.rst @@ -16,11 +16,6 @@ Qt Creator The `Qt Creator `_ is an open source cross-platform integrated development environment. The editor includes such features as syntax highlighting for various languages, project manager, integrated version control systems, rapid code navigation tools and code autocompletion. -This software can be used with: - -* all available :ref:`platforms` -* all available :ref:`frameworks` - Refer to the `Qt-creator Manual `_ page for more detailed information. @@ -107,7 +102,7 @@ On the next steps select any available kit and click Finish button. .. image:: ../_static/ide-platformio-qtcreator-2.png -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): +Secondly, we need to delete default build and clean steps and configure project with PlatformIO Build System (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 diff --git a/docs/ide/sublimetext.rst b/docs/ide/sublimetext.rst index 7e19c468..23c722a3 100644 --- a/docs/ide/sublimetext.rst +++ b/docs/ide/sublimetext.rst @@ -16,11 +16,6 @@ Sublime Text The `Sublime Text `_ is a cross-platform text and source code editor, with a Python application programming interface (API). Sublime Text is proprietary software. Its functionality is extendable with plugins. Most of the extending packages have free-software licenses and are community-built and maintained. Sublime Text lacks graphical setting dialogues and is entirely configured by editing text files. -This software can be used with: - -* all available :ref:`platforms` -* all available :ref:`frameworks` - Refer to the `Sublime Text Documentation `_ page for more detailed information. diff --git a/docs/ide/vim.rst b/docs/ide/vim.rst index e5e9c749..dcb22acf 100644 --- a/docs/ide/vim.rst +++ b/docs/ide/vim.rst @@ -18,11 +18,6 @@ VIM editor. Vim is designed for use both from a command-line interface and as a standalone application in a graphical user interface. -This software can be used with: - -* all available :ref:`platforms` -* all available :ref:`frameworks` - .. contents:: Integration diff --git a/docs/ide/visualstudio.rst b/docs/ide/visualstudio.rst index dfef7a9e..2aa47552 100644 --- a/docs/ide/visualstudio.rst +++ b/docs/ide/visualstudio.rst @@ -16,11 +16,6 @@ Visual Studio The `Microsoft Visual Studio (Free) `_ is an integrated development environment (IDE) from Microsoft. Visual Studio includes a code editor supporting IntelliSense (the code completion component) as well as code refactoring. -This software can be used with: - -* all available :ref:`platforms` -* all available :ref:`frameworks` - Refer to the `Visual Studio Documentation `_ page for more detailed information. @@ -69,7 +64,7 @@ First of all, let's create new project from Visual Studio Start Page: ``Start > .. image:: ../_static/ide-vs-platformio-newproject.png -Secondly, we need to configure project with PlatformIO source code builder: +Secondly, we need to configure project with PlatformIO Build System: .. image:: ../_static/ide-vs-platformio-newproject-2.png @@ -95,14 +90,14 @@ First program in Visual Studio Simple "Blink" project will consist from two files: -1. Main "C" source file named ``main.c`` must be located in the ``src`` directory. -Let's create new file named ``main.c`` using ``Menu: File > New File`` or shortcut ``Ctrl+N``: +1. Main "C++" source file named ``main.cpp`` must be located in the ``src`` directory. +Let's create new file named ``main.cpp`` using ``Menu: File > New File`` or shortcut ``Ctrl+N``: .. image:: ../_static/ide-vs-platformio-newproject-6.png -Copy the source code which is described below to file ``main.c``. +Copy the source code which is described below to file ``main.cpp``. -.. code-block:: c +.. code-block:: cpp #include "Arduino.h" #define WLED 13 // Most Arduino boards already have an LED attached to pin 13 on the board itself @@ -162,3 +157,25 @@ Examples ^^^^^^^^^^^^^^^ Source code of `Visual Studio "Blink" Project `_. + +Known issues +------------ + +IntelliSense Errors +^^^^^^^^^^^^^^^^^^^ + +VS Studio does not allow to specify for project other toolchain which will +be used by IntelliSense. In this case, IntelliSense does not understand +GCC-specific definitions. + +However, these errors does not have any influence on PlatformIO Build +System. It means that you can ignore them and rely on PlatformIO Build System +messages which will be shown in output console after build. + +Nevertheless, you can provide an IntelliSense-friendly definition of problematic +GCC constructs and make sure that the GCC will ignore such definitions or +disable IntelliSense error reporting at all. +See details in `issue #543 `_ + +.. image:: ../_static/ide-vs-platformio-newproject-9.png + :target: http://docs.platformio.org/en/latest/_static/ide-vs-platformio-newproject-9.png diff --git a/docs/index.rst b/docs/index.rst index d90add24..78a9b626 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,9 +12,14 @@ PlatformIO is an open source ecosystem for IoT development ========================================================== -**Cross-platform code builder and library manager. Continuous and IDE +**Cross-platform build system and library manager. Continuous and IDE integration. Arduino and MBED compatible. Ready for Cloud compiling.** +* **PlatformIO IDE** - The next generation integrated development environment for IoT. + C/C++ Intelligent Code Completion and Smart Code Linter for the super-fast coding. + Multi-projects workflow with Multiple Panes. Themes Support with dark and light colors. + Built-in Terminal with PlatformIO CLI tool and support for the powerful Serial Port Monitor. + All advanced instruments without leaving your favourite development environment. * **Development Platforms** - Embedded and Desktop development platforms with pre-built toolchains, debuggers, uploaders and frameworks which work under popular host OS: Mac, Windows, Linux (+ARM) @@ -38,8 +43,8 @@ libOpenCM3, etc.* `Issues `_ * `Blog `_ | `Twitter `_ | - `Hackaday `_ | `Facebook `_ | + `Hackaday `_ | `Reddit `_ Embedded Development. *Easier Than Ever.* @@ -54,7 +59,7 @@ Embedded Development. *Easier Than Ever.* * Pre-built toolchains, :ref:`frameworks` for the :ref:`Development Platforms ` -Smart Code Builder. *Fast and Reliable.* +Smart Build System. *Fast and Reliable.* ---------------------------------------- * Reliable, automatic dependency analysis and detection of build changes @@ -72,16 +77,21 @@ The Missing Library Manager. *It's here!* * It runs on Windows, Mac OS X, and Linux (+ARM). For further details, please refer to -:ref:`What is PlatformIO? How does it work? ` +:ref:`What is PlatformIO? How does it work? ` Contents -------- +.. toctree:: + :maxdepth: 2 + + what-is-platformio + demo + .. toctree:: :caption: Getting Started :maxdepth: 2 - demo installation quickstart userguide/index diff --git a/docs/installation.rst b/docs/installation.rst index 2343516d..b1dedf95 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -14,19 +14,14 @@ Installation ============ +.. include:: /ide/_platformio_ide_extra.rst + **PlatformIO** is written in `Python `_ and works on Mac OS X, Linux, Windows OS and *ARM*-based credit-card sized computers (`Raspberry Pi `_, `BeagleBone `_, `CubieBoard `_). -.. note:: - We are glad to announce official :ref:`ide_atom` which provides - comprehensive facilities for IoT development: built-in PlatformIO CLI tool, - Terminal and other instruments. - - Try :ref:`ide_atom` for free now! - .. contents:: System requirements @@ -41,7 +36,8 @@ System requirements **Windows Users**: Please `Download the latest Python 2.7.x `_ and install it. **DON'T FORGET** to select ``Add python.exe to Path`` feature on the - "Customize" stage, otherwise ``pip`` command will not be available. + "Customize" stage, otherwise Python Package Manager ``pip`` command + will not be available. :Terminal Application: @@ -55,8 +51,11 @@ Installation Methods Please *choose ONE of* the following methods: -a) Python Package Manager -~~~~~~~~~~~~~~~~~~~~~~~~~ +.. contents:: + :local: + +Python Package Manager +~~~~~~~~~~~~~~~~~~~~~~ The latest stable version of PlatformIO may be installed or upgraded via Python Package Manager (`pip `_) as follows: @@ -80,8 +79,8 @@ a few options here: .. _installation_installer_script: -b) Installer Script -~~~~~~~~~~~~~~~~~~~ +Installer Script +~~~~~~~~~~~~~~~~ Super-Quick (Mac / Linux) ''''''''''''''''''''''''' @@ -120,8 +119,19 @@ On *Windows OS* it may look like: # run it C:\Python27\python.exe get-platformio.py -c) Full Guide -~~~~~~~~~~~~~ + +Mac OS X Homebrew +~~~~~~~~~~~~~~~~~ + +The latest stable version of PlatformIO may be installed or upgraded via +Mac OS X Homebrew Packages Manager (`brew `_) as follows: + +.. code-block:: bash + + brew install platformio + +Full Guide +~~~~~~~~~~ 1. Check a ``python`` version (only 2.6-2.7 is supported): @@ -149,8 +159,8 @@ For upgrading ``platformio`` to the latest version: pip install -U platformio -d) Development Version -~~~~~~~~~~~~~~~~~~~~~~ +Development Version +~~~~~~~~~~~~~~~~~~~ Install the latest PlatformIO from the ``develop`` branch: diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index c6b78a7e..356582af 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -58,7 +58,7 @@ Frameworks - Description * - :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 Wiring-based 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. Boards ------ diff --git a/docs/platforms/atmelsam.rst b/docs/platforms/atmelsam.rst index 3f1ce190..5d71c4d6 100644 --- a/docs/platforms/atmelsam.rst +++ b/docs/platforms/atmelsam.rst @@ -64,7 +64,7 @@ Frameworks - Description * - :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 Wiring-based 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. diff --git a/docs/platforms/espressif.rst b/docs/platforms/espressif.rst index 34d8662c..609b2549 100644 --- a/docs/platforms/espressif.rst +++ b/docs/platforms/espressif.rst @@ -64,7 +64,7 @@ Frameworks - Description * - :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 Wiring-based 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. Boards ------ @@ -162,6 +162,13 @@ Espressif - 1024 Kb - 80 Kb + * - ``esp07`` + - `Espressif Generic ESP8266 ESP-07 `_ + - ESP8266 + - 80 MHz + - 4096 Kb + - 80 Kb + * - ``esp12e`` - `Espressif ESP8266 ESP-12E `_ - ESP8266 diff --git a/docs/platforms/espressif_extra.rst b/docs/platforms/espressif_extra.rst index 91e5f61c..d16a704d 100644 --- a/docs/platforms/espressif_extra.rst +++ b/docs/platforms/espressif_extra.rst @@ -171,7 +171,7 @@ You can pass additional options/flags to OTA uploader using Available flags -* ``--port=ESP_PORT`` ESP8266 ota Port. Default 8266 +* ``--port=ESP_PORT`` ESP8266 OTA Port. Default 8266 * ``--auth=AUTH`` Set authentication password * ``--spiffs`` Use this option to transmit a SPIFFS image and do not flash the module @@ -215,9 +215,32 @@ Demo .. image:: ../_static/platformio-demo-ota-esp8266.jpg :target: https://www.youtube.com/watch?v=lXchL3hpDO4 + +Using Arduino Framework with Staging version +-------------------------------------------- + +1. Clone/Copy `main repository `_ to + :ref:`projectconf_pio_home_dir` + ``packages/framework-arduinoespressif`` + and create new file ``packages/framework-arduinoespressif/version.txt`` + with the new version (for example, ``2.2.0``). +2. Try to build project +3. If you see build errors, then try to build this project using the same + ``stage`` on Arduino IDE +4. If it works with Arduino IDE but doesn't work with PlatformIO, then please + `open new issue `_ with + attached information: + + - test project/files + - detailed log of build process from Arduino IDE (please copy it from + console to http://pastebin.com) + - detailed log of build process from PlatformIO Build System ( + please copy it from console to http://pastebin.com) + Articles -------- +* Feb 25, 2016 - **NutDIY** - `PlatformIO Blink On Nodemcu Dev Kit V1.0 (ESP 12-E) `_ +* Feb 23, 2016 - **Ptarmigan Labs** - `ESP8266 Over The Air updating – what are the options? `_ * Jan 16, 2016 - **Dani Eichhorn** - `ESP8266 Arduino IDE Alternative: PlatformIO `_ * Dec 22, 2015 - **Jan Penninkhof** - `Over-the-Air ESP8266 programming using PlatformIO `_ * Dec 01, 2015 - **Tateno Yuichi** - `ESP8266 を CUI で開発する (Develop a ESP8266 in CUI, Japanese) `_ diff --git a/docs/platforms/nordicnrf51.rst b/docs/platforms/nordicnrf51.rst index 15f65721..9d51cb4c 100644 --- a/docs/platforms/nordicnrf51.rst +++ b/docs/platforms/nordicnrf51.rst @@ -58,7 +58,7 @@ Frameworks - Description * - :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 Wiring-based 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. diff --git a/docs/platforms/teensy.rst b/docs/platforms/teensy.rst index 45e1d1c5..c8a74616 100644 --- a/docs/platforms/teensy.rst +++ b/docs/platforms/teensy.rst @@ -64,7 +64,7 @@ Frameworks - Description * - :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 Wiring-based 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. diff --git a/docs/platforms/timsp430.rst b/docs/platforms/timsp430.rst index 3a824872..39aea248 100644 --- a/docs/platforms/timsp430.rst +++ b/docs/platforms/timsp430.rst @@ -58,10 +58,10 @@ Frameworks - Description * - :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 Wiring-based 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_energia` - - Energia framework enables pretty much anyone to start easily creating microcontroller-based projects and applications. Its easy-to-use libraries and functions provide developers of all experience levels to start blinking LEDs, buzzing buzzers and sensing sensors more quickly than ever before. + - Energia Wiring-based framework enables pretty much anyone to start easily creating microcontroller-based projects and applications. Its easy-to-use libraries and functions provide developers of all experience levels to start blinking LEDs, buzzing buzzers and sensing sensors more quickly than ever before. Boards ------ diff --git a/docs/platforms/titiva.rst b/docs/platforms/titiva.rst index 1548200a..8effb509 100644 --- a/docs/platforms/titiva.rst +++ b/docs/platforms/titiva.rst @@ -61,7 +61,7 @@ Frameworks - Description * - :ref:`framework_energia` - - Energia framework enables pretty much anyone to start easily creating microcontroller-based projects and applications. Its easy-to-use libraries and functions provide developers of all experience levels to start blinking LEDs, buzzing buzzers and sensing sensors more quickly than ever before. + - Energia Wiring-based framework enables pretty much anyone to start easily creating microcontroller-based projects and applications. Its easy-to-use libraries and functions provide developers of all experience levels to start blinking LEDs, buzzing buzzers and sensing sensors more quickly than ever before. * - :ref:`framework_libopencm3` - The libOpenCM3 framework aims to create a free/libre/open-source firmware library for various ARM Cortex-M0(+)/M3/M4 microcontrollers, including ST STM32, Ti Tiva and Stellaris, NXP LPC 11xx, 13xx, 15xx, 17xx parts, Atmel SAM3, Energy Micro EFM32 and others. diff --git a/docs/projectconf.rst b/docs/projectconf.rst index 09a49eb5..2f1c368a 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -301,7 +301,10 @@ Example: .. code-block:: ini [env:specific_defines] - build_flags = -Dfoo -Dbar=1 + build_flags = -DFOO -DBAR=1 -DFLOAT_VALUE=1.23457e+07 + + [env:string_defines] + build_flags = '-DHELLO="World!"' '-DWIFI_PASS="My password"' [env:specific_inclibs] build_flags = -I/opt/include -L/opt/lib -lfoo diff --git a/docs/quickstart.rst b/docs/quickstart.rst index af6dcc84..08490e18 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -11,61 +11,250 @@ .. _quickstart: -Quickstart -========== +Quick Start +=========== -.. hint:: - Please read `Get Started `_ - article from the official WebSite. +.. note:: + If you are looking for a Qucik Start for PlatformIO IDE please follow to + :ref:`PlatformIO IDE Quick Start ` page. -1. :ref:`Install PlatformIO `. +This tutorial introduces you to the basics of PlatformIO Command Line Interface +(CLI) workflow and shows you a creation process of a simple cross-platform +“Blink” Project. After finishing you will have a general understanding of how +to work with the multiple development platforms and embedded boards. -2. Find board ``type`` using `Embedded Boards Explorer `_ - or via :ref:`cmd_boards` command. +Setting Up the Project +---------------------- -3. Initialize new PlatformIO based project via :ref:`cmd_init` command with the - pre-configured environments for your boards: +PlatformIO CLI provides special :ref:`cmd_init` command for configuring your projects. +It allows to initialize new empty project or update existing with the new data. + +What is more, :ref:`cmd_init` can be used for :ref:`ide`. It means that you will +be able to import pre-generated PlatformIO project using favourite IDE and +extend it with the professional instruments for IoT development. + +This tutorial is based on the next popular embedded boards and development +platforms using *Arduino Wiring-based Framework*: + + +.. list-table:: + :header-rows: 1 + + * - Platform + - Board + - Framework + + * - Atmel AVR + - Arduino Uno (8-bit ATmega328P) + - Arduino Wiring-based Framework + + * - Espressif + - NodeMCU 1.0 (32-bit ESP8266) + - Arduino Wiring-based Framework + + * - Teensy + - Teensy 3.1 (32-bit ARM MK20DX256) + - Arduino Wiring-based Framework + +Board Identifier +---------------- + +:ref:`cmd_init` command requires to specify board identifier (ID/TYPE). It can +be found using `Embedded Boards Explorer `_ +or :ref:`cmd_boards` command. For example, using :ref:`cmd_boards` let's try +to find Teensy boards: .. code-block:: bash - $ platformio init --board=TYPE_1 --board=TYPE_2 --board=TYPE_N + > platformio boards teensy - The current working directory *** will be used for the new project. - You can specify another project directory via - `platformio init -d %PATH_TO_THE_PROJECT_DIR%` command. + Platform: teensy + --------------------------------------------------------------------------- + Type MCU Frequency Flash RAM Name + --------------------------------------------------------------------------- + teensy20 atmega32u4 16Mhz 31kB 2.5kB Teensy 2.0 + teensy30 mk20dx128 48Mhz 128kB 16kB Teensy 3.0 + teensy31 mk20dx256 72Mhz 256kB 64kB Teensy 3.1 / 3.2 + teensylc mkl26z64 48Mhz 62kB 8kB Teensy LC + teensy20pp at90usb1286 16Mhz 127kB 8kB Teensy++ 2.0 - The next files/directories will be created in *** - platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| - src - Put your source files here - lib - Put here project specific (private) libraries - Do you want to continue? [y/N]: y - Project has been successfully initialized! - Useful commands: - `platformio run` - process/build project from the current directory - `platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board - `platformio run --target clean` - clean project (remove compiled files) +According to the table above the ID/TYPE for Teensy 3.1 is ``teensy31``. Also, +the ID for Arduino UNO is ``uno`` and for NodeMCU 1.0 (ESP-12E Module) +is ``nodemcuv2``. -Put your source files ``*.h, *.c, *.cpp or *.ino`` to ``src`` directory. -4. Process the project's environments. +Initialize Project +------------------ -Change working directory to the project's root where is located -:ref:`Project Configuration File (platformio.ini) ` and run: +PlatformIO ecosystem contains huge database with pre-configured settings for the +most popular embedded boards. It helps you to forget about installing +toolchains, writing build scripts or configuring uploading process. Just tell +PlatformIO the Board ID and you will receive full working project with +pre-installed instruments for the professional development. + +1. Create empty folder where you are going to initialize new PlatformIO + project. Then open system Terminal and change directory to it: + + .. code-block:: bash + + # create new direcotry + > mkdir path_to_the_new_directory + + # go to it + > cd path_to_the_new_directory + +2. Initialize project for the boards mentioned above (you can specify more + than one board at time): + + .. code-block:: bash + + > platformio init --board uno --board nodemcuv2 --board teensy31 + + The current working directory *** will be used for the new project. + You can specify another project directory via + `platformio init -d %PATH_TO_THE_PROJECT_DIR%` command. + + The next files/directories will be created in *** + platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| + src - Put your source files here + lib - Put here project specific (private) libraries + Do you want to continue? [y/N]: y + Project has been successfully initialized! + Useful commands: + `platformio run` - process/build project from the current directory + `platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board + `platformio run --target clean` - clean project (remove compiled files) + + +Congrats! You have just created the first PlatformIO based Project with the +next structure: + +* :ref:`projectconf` +* ``src`` directory where you should place source code + (``*.h, *.c, *.cpp, *.S, *.ino, etc.``) +* ``lib`` directory can be used for the project specific (private) libraries. + More details are located in ``lib/readme.txt`` file. +* Miscellaneous files for CVS and :ref:`ci` support. + + +.. note:: + If you need to add new board to the existing project please use + :ref:`cmd_init` again. + + +The result of just generated ``platformio.ini``: + +.. code-block:: ini + + # + # Project Configuration File + # + # A detailed documentation with the EXAMPLES is located here: + # http://docs.platformio.org/en/latest/projectconf.html + # + + # A sign `#` at the beginning of the line indicates a comment + # Comment lines are ignored. + + # Simple and base environment + # [env:mybaseenv] + # platform = %INSTALLED_PLATFORM_NAME_HERE% + # framework = + # board = + # + # Automatic targets - enable auto-uploading + # targets = upload + + [env:uno] + platform = atmelavr + framework = arduino + board = uno + + [env:nodemcuv2] + platform = espressif + framework = arduino + board = nodemcuv2 + + [env:teensy31] + platform = teensy + framework = arduino + board = teensy31 + + +Now, we need to create ``main.cpp`` file and place it to ``src`` folder of our +newly created project. The contents of ``src/main.cpp``: + +.. code-block:: cpp + + /** + * Blink + * + * Turns on an LED on for one second, + * then off for one second, repeatedly. + */ + #include "Arduino.h" + + void setup() + { + // initialize LED digital pin as an output. + pinMode(LED_BUILTIN, OUTPUT); + } + + void loop() + { + // turn the LED on (HIGH is the voltage level) + digitalWrite(LED_BUILTIN, HIGH); + + // wait for a second + delay(1000); + + // turn the LED off by making the voltage LOW + digitalWrite(LED_BUILTIN, LOW); + + // wait for a second + delay(1000); + } + + +The final Project structure: .. code-block:: bash - $ platformio run - - # if you don't have specified `targets = upload` option for environment, - # then you can upload firmware manually with this command: - $ platformio run --target upload - - # clean project - $ platformio run --target clean + project_dir + ├── lib + │   └── readme.txt + ├── platformio.ini + └── src + └── main.cpp -Useful links: +Process Project +--------------- + +PlatformIO CLI provides special :ref:`cmd_run` command to process project. If +you call it without any arguments, PlatformIO Build System will process all +project environments (which were created per each board specified above). Here +are a few useful commands: + +* ``platformio run``. Process (build) all environments specified in + :ref:`projectconf` +* ``platformio run --target upload``. Build project and upload firmware to the + all devices specified in :ref:`projectconf` +* ``platformio run --target clean``. Clean project (delete compiled objects) +* ``platformio run -e uno``. Process only ``uno`` environment +* ``platformio run -e uno -t upload``. Build project only for ``uno`` and upload + firmware. + +Please follow to :option:`platformio run --target` documentation for the other +targets. + +Finally, demo which demonstrates building project and uploading firmware to +Arduino Uno: + +.. image:: _static/platformio-demo-wiring.gif + +Further Reading +--------------- * `Project examples `_ -* :ref:`userguide` for PlatformIO commands -* `Quickstart for Espressif ESP8266 `_ +* :ref:`userguide` for PlatformIO CLI commands diff --git a/docs/userguide/cmd_init.rst b/docs/userguide/cmd_init.rst index dace0f91..45ef6f30 100644 --- a/docs/userguide/cmd_init.rst +++ b/docs/userguide/cmd_init.rst @@ -33,14 +33,11 @@ Initialize new PlatformIO based project or update existing with new data. This command will create: * :ref:`projectconf` -* ``src`` - a source directory. Put your source files here -* ``lib`` - a directory for the project specific (private) libraries. -* ``.travis.yml`` configuration file (template) for Continuous Integration - with :ref:`ci_travis` - -.. note:: - The source code of each library should be placed in separate directory. - For example, ``lib/private_lib/[here are source files]``. +* ``src`` directory where you should place source code + (``*.h, *.c, *.cpp, *.S, *.ino, etc.``) +* ``lib`` directory can be used for the project specific (private) libraries. + More details are located in ``lib/readme.txt`` file. +* Miscellaneous files for CVS and :ref:`ci` support. Options ------- diff --git a/docs/userguide/lib/index.rst b/docs/userguide/lib/index.rst index 3153ce8c..55626bfb 100644 --- a/docs/userguide/lib/index.rst +++ b/docs/userguide/lib/index.rst @@ -21,6 +21,7 @@ To print all available commands and options use: $ platformio lib --help $ platformio lib COMMAND --help +.. image:: ../../_static/platformio-demo-lib.gif .. toctree:: :maxdepth: 2 diff --git a/docs/userguide/platforms/index.rst b/docs/userguide/platforms/index.rst index 1cd741c1..1d084ccd 100644 --- a/docs/userguide/platforms/index.rst +++ b/docs/userguide/platforms/index.rst @@ -21,6 +21,7 @@ To print all available commands and options use: $ platformio platforms --help $ platformio platforms COMMAND --help +.. image:: ../../_static/platformio-demo-platforms.gif .. toctree:: :maxdepth: 2 diff --git a/docs/what-is-platformio.rst b/docs/what-is-platformio.rst new file mode 100644 index 00000000..4283546e --- /dev/null +++ b/docs/what-is-platformio.rst @@ -0,0 +1,105 @@ +.. Copyright 2014-2016 Ivan Kravets + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +.. _what_is_pio: + +What is PlatformIO? +=================== + +.. contents:: + +Press about PlatformIO +---------------------- + +"Different microcontrollers normally have different developing tools . +For instance Arduino rely on Arduino IDE. Few more advanced users set up different +graphical interfaces like Eclipse for better project management. Sometimes +it may be hard to keep up with different microcontrollers and tools. You +probably thought that single unified development tool could be great. Well +this is what PlatformIO open source ecosystem is for. + +This is cross platform code builder and library manager with platforms like +Arduino or MBED support. They took care of toolchains, debuggers, frameworks +that work on most popular platforms like Windows, Mac and Linux. It supports +more than 200 development boards along with more than 15 development platforms +and 10 frameworks. So most of popular boards are covered. They’ve done hard +work in organizing and managing hundreds of libraries that can be included +in to your project. Also lots of examples allow you to start developing +quickly. PlatformIO initially was developed with Command line philosophy. +It’s been successfully used with other IDE’s like Eclipse or Visual Studio. +Recently they’ve released a version with built in IDE based on Atom text editor", - +[Embedds]_. + +Awards +------ + +PlatformIO was nominated for the year's `best Software and Tools in the 2015/16 IoT Awards `_. + +Problematic +----------- + +* The main problem which repulses people from embedded world is a complicated + process to setup development software for a specific MCU/board: toolchains, + proprietary vendor’s IDE (which sometimes isn’t free) and what is more, + to get a computer with OS where that software is supported. +* Multiple hardware platforms (MCUs, boards) require different toolchains, + IDEs, etc, and, respectively, spending time on learning new development environments. +* Finding proper libraries and code samples showing how to use popular + sensors, actuators, etc. +* Sharing embedded projects between team members, regardless of operating + system they prefer to work with. + +Overview +-------- + +PlatformIO is independent from the platform, in which it is running. In fact, +the only requirement is Python, which exists pretty much everywhere. What this +means is that PlatformIO projects can be easily moved from one computer to +another, as well as that PlatformIO allows for the easy sharing of projects +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 +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 +:ref:`ide` or text editor such as :ref:`ide_atom`, :ref:`ide_clion`, +:ref:`ide_eclipse`, :ref:`ide_emacs`, :ref:`ide_netbeans`, :ref:`ide_qtcreator`, +:ref:`ide_sublimetext`, :ref:`ide_vim`, :ref:`ide_visualstudio`, etc. + +Alright, so PlatformIO can run on different operating systems. But more +importantly, from development perspective at least, is a list of supported +boards and MCUs. To keep things short: PlatformIO supports approximately 200 +`Embedded Boards `_ and all major +:ref:`Development Platforms `. + +User SHOULD have a choise +------------------------- + +* Decide which operation system they want to run development process on. + You can even use one OS at home and another at work. +* Choose which editor to use for writing the code. It can be pretty simple + editor or powerful favorite :ref:`ide`. +* Focus on the code development, significantly simplifying support for the + :ref:`platforms` and MCUs. + + +How does it work? +----------------- + +Without going too deep into PlatformIO implementation details, work cycle of +the project developed using PlatformIO is as follows: + +* Users choose board(s) interested in :ref:`projectconf` +* Based on this list of boards, PlatformIO downloads required toolchains and + installs them automatically. +* Users develop code and PlatformIO makes sure that it is compiled, prepared + and uploaded to all the boards of interest. + + +.. [Embedds] Embedds.com: `Develop easier with PlatformIO ecosystem `_ \ No newline at end of file diff --git a/examples/ide/clion/.gitignore b/examples/ide/clion/.gitignore index e90612ed..a9fe6864 100644 --- a/examples/ide/clion/.gitignore +++ b/examples/ide/clion/.gitignore @@ -1 +1,2 @@ -.pioenvs \ No newline at end of file +.pioenvs +CMakeListsPrivate.txt diff --git a/examples/ide/clion/.idea/encodings.xml b/examples/ide/clion/.idea/encodings.xml new file mode 100644 index 00000000..97626ba4 --- /dev/null +++ b/examples/ide/clion/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/examples/ide/clion/CMakeLists.txt b/examples/ide/clion/CMakeLists.txt index 3c67b267..b70e0173 100644 --- a/examples/ide/clion/CMakeLists.txt +++ b/examples/ide/clion/CMakeLists.txt @@ -1,58 +1,51 @@ -cmake_minimum_required(VERSION 3.2) -project(clion) - -set(PLATFORMIO_CMD platformio) - -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/toolchain-atmelavr/avr/include") -include_directories("$ENV{HOME}/.platformio/packages/toolchain-atmelavr/bfd/include") -include_directories("$ENV{HOME}/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.8.1/include") -include_directories("$ENV{HOME}/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.8.1/include-fixed") - -add_definitions(-DF_CPU=16000000L) -add_definitions(-DARDUINO_ARCH_AVR) -add_definitions(-DARDUINO_AVR_UNO) -add_definitions(-DARDUINO=10607) -add_definitions(-DPLATFORMIO=020701) -add_definitions(-D__AVR_ATmega328P__) - -add_custom_target( - PLATFORMIO_BUILD ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_UPLOAD ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_CLEAN ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_PROGRAM ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_UPLOADFS ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_UPDATE_ALL ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion update - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_executable(clion - src/blink.cpp -) +cmake_minimum_required(VERSION 3.2) +project(clion) + +include(CMakeListsPrivate.txt) + +add_definitions(-DF_CPU=16000000L) +add_definitions(-DARDUINO_ARCH_AVR) +add_definitions(-DARDUINO_AVR_UNO) +add_definitions(-DARDUINO=10607) +add_definitions(-DPLATFORMIO=020805) +add_definitions(-D__AVR_ATmega328P__) + +add_custom_target( + PLATFORMIO_BUILD ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_UPLOAD ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_CLEAN ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_PROGRAM ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_UPLOADFS ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_UPDATE_ALL ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion update + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_executable(clion + src/blink.cpp +) diff --git a/platformio/__init__.py b/platformio/__init__.py index 352fa2fe..710fdf6a 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,13 +14,13 @@ import sys -VERSION = (2, 8, 4) +VERSION = (2, 8, 5) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" __description__ = ( "An open source ecosystem for IoT development. " - "Cross-platform code builder and library manager. " + "Cross-platform build system and library manager. " "Continuous and IDE integration. " "Arduino and MBED compatible. Ready for Cloud compiling." ) diff --git a/platformio/boards/espressif.json b/platformio/boards/espressif.json index b3c9728e..a3a5b0a5 100644 --- a/platformio/boards/espressif.json +++ b/platformio/boards/espressif.json @@ -49,6 +49,31 @@ "vendor": "Espressif" }, + "esp07": { + "build": { + "core": "esp8266", + "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP07", + "f_cpu": "80000000L", + "f_flash": "40000000L", + "flash_mode": "qio", + "ldscript": "esp8266.flash.4m1m.ld", + "mcu": "esp8266", + "variant": "nodemcu" + }, + "frameworks": ["arduino"], + "name": "Espressif Generic ESP8266 ESP-07", + "platform": "espressif", + "upload": { + "maximum_ram_size": 81920, + "maximum_size": 4194304, + "resetmethod": "nodemcu", + "require_upload_port" : true, + "speed": 115200 + }, + "url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family#esp-07", + "vendor": "Espressif" + }, + "esp12e": { "build": { "core": "esp8266", diff --git a/platformio/builder/scripts/atmelsam.py b/platformio/builder/scripts/atmelsam.py index 482bd5c3..20dd5111 100644 --- a/platformio/builder/scripts/atmelsam.py +++ b/platformio/builder/scripts/atmelsam.py @@ -120,7 +120,7 @@ if "due" in env.subst("$BOARD"): ) elif "zero" in env.subst("$BOARD"): env.Append( - CPPFLAGS=[ + CCFLAGS=[ "--param", "max-inline-insns-single=500" ], diff --git a/platformio/builder/scripts/basearm.py b/platformio/builder/scripts/basearm.py index ff11882d..20892b18 100644 --- a/platformio/builder/scripts/basearm.py +++ b/platformio/builder/scripts/basearm.py @@ -31,9 +31,9 @@ env.Replace( ARFLAGS=["rcs"], - ASPPFLAGS=["-x", "assembler-with-cpp"], + ASFLAGS=["-x", "assembler-with-cpp"], - CPPFLAGS=[ + CCFLAGS=[ "-g", # include debugging info (so errors include line numbers) "-Os", # optimize for size "-ffunction-sections", # place each function in its own section @@ -68,7 +68,10 @@ env.Replace( PROGSUFFIX=".elf" ) + env.Append( + ASFLAGS=env.get("CCFLAGS", [])[:], + BUILDERS=dict( ElfToBin=Builder( action=" ".join([ diff --git a/platformio/builder/scripts/baseavr.py b/platformio/builder/scripts/baseavr.py index 133e17c9..055fb742 100644 --- a/platformio/builder/scripts/baseavr.py +++ b/platformio/builder/scripts/baseavr.py @@ -31,9 +31,9 @@ env.Replace( ARFLAGS=["rcs"], - ASPPFLAGS=["-x", "assembler-with-cpp"], + ASFLAGS=["-x", "assembler-with-cpp"], - CPPFLAGS=[ + CCFLAGS=[ "-g", # include debugging info (so errors include line numbers) "-Os", # optimize for size "-Wall", # show warnings @@ -64,6 +64,8 @@ env.Replace( ) env.Append( + ASFLAGS=env.get("CCFLAGS", [])[:], + BUILDERS=dict( ElfToEep=Builder( action=" ".join([ diff --git a/platformio/builder/scripts/espressif.py b/platformio/builder/scripts/espressif.py index 0499c68a..45c9bdad 100644 --- a/platformio/builder/scripts/espressif.py +++ b/platformio/builder/scripts/espressif.py @@ -64,7 +64,7 @@ env.Replace( ARFLAGS=["rcs"], - ASPPFLAGS=["-x", "assembler-with-cpp"], + ASFLAGS=["-x", "assembler-with-cpp"], CFLAGS=[ "-std=gnu99", @@ -75,7 +75,7 @@ env.Replace( "-nostdlib" ], - CPPFLAGS=[ + CCFLAGS=[ "-Os", # optimize for size "-mlongcalls", "-mtext-section-literals", @@ -99,6 +99,7 @@ env.Replace( ], LINKFLAGS=[ + "-Os", "-nostdlib", "-Wl,--no-check-sections", "-u", "call_user_start", @@ -141,6 +142,8 @@ env.Replace( ) env.Append( + ASFLAGS=env.get("CCFLAGS", [])[:], + BUILDERS=dict( ElfToBin=Builder( action=" ".join([ diff --git a/platformio/builder/scripts/frameworks/arduino.py b/platformio/builder/scripts/frameworks/arduino.py index e8bf012a..4dc10571 100644 --- a/platformio/builder/scripts/frameworks/arduino.py +++ b/platformio/builder/scripts/frameworks/arduino.py @@ -15,8 +15,8 @@ """ Arduino -Arduino Framework allows writing cross-platform software to control -devices attached to a wide range of Arduino boards to create all +Arduino Wiring-based 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. http://arduino.cc/en/Reference/HomePage @@ -57,7 +57,7 @@ elif env.get("PLATFORM") == "espressif": env.Prepend( CPPPATH=[join("$PLATFORMFW_DIR", "tools", "sdk", "include")], LIBPATH=[join("$PLATFORMFW_DIR", "tools", "sdk", "lib")], - LIBS=["smartconfig", "pp", "main", "wpa", "lwip", + LIBS=["mesh", "wpa2", "smartconfig", "pp", "main", "wpa", "lwip", "net80211", "wps", "crypto", "phy", "hal", "axtls", "gcc", "m"] ) elif env.get("PLATFORM") == "nordicnrf51": diff --git a/platformio/builder/scripts/frameworks/energia.py b/platformio/builder/scripts/frameworks/energia.py index 79521cc5..24bc9760 100644 --- a/platformio/builder/scripts/frameworks/energia.py +++ b/platformio/builder/scripts/frameworks/energia.py @@ -15,9 +15,9 @@ """ Energia -Energia framework enables pretty much anyone to start easily creating -microcontroller-based projects and applications. Its easy-to-use libraries -and functions provide developers of all experience levels to start +Energia Wiring-based framework enables pretty much anyone to start easily +creating microcontroller-based projects and applications. Its easy-to-use +libraries and functions provide developers of all experience levels to start blinking LEDs, buzzing buzzers and sensing sensors more quickly than ever before. diff --git a/platformio/builder/scripts/frameworks/mbed.py b/platformio/builder/scripts/frameworks/mbed.py index c76202b8..4bfc53cc 100644 --- a/platformio/builder/scripts/frameworks/mbed.py +++ b/platformio/builder/scripts/frameworks/mbed.py @@ -188,10 +188,10 @@ def get_build_flags(data): flags = {} cflags = set(data.get("CFLAGS", [])) cxxflags = set(data.get("CXXFLAGS", [])) - cppflags = set(cflags & cxxflags) - flags['CPPFLAGS'] = list(cppflags) - flags['CXXFLAGS'] = list(cxxflags - cppflags) - flags['CFLAGS'] = list(cflags - cppflags) + ccflags = set(cflags & cxxflags) + flags['CCFLAGS'] = list(ccflags) + flags['CXXFLAGS'] = list(cxxflags - ccflags) + flags['CFLAGS'] = list(cflags - ccflags) return flags @@ -221,7 +221,7 @@ variant_dir = join("$PLATFORMFW_DIR", "variant", variant) env.Replace( _mbed_whole_archive_hook=_mbed_whole_archive_hook, _LIBFLAGS="${_mbed_whole_archive_hook(%s)}" % env.get("_LIBFLAGS")[2:-1], - CPPFLAGS=build_flags.get("CPPFLAGS", []), + CCFLAGS=build_flags.get("CCFLAGS", []), CFLAGS=build_flags.get("CFLAGS", []), CXXFLAGS=build_flags.get("CXXFLAGS", []), LINKFLAGS=eixdata.get("LINKFLAGS", []), diff --git a/platformio/builder/scripts/nordicnrf51.py b/platformio/builder/scripts/nordicnrf51.py index 5d2ccc42..ec3a4ab8 100644 --- a/platformio/builder/scripts/nordicnrf51.py +++ b/platformio/builder/scripts/nordicnrf51.py @@ -27,7 +27,7 @@ SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) if env.subst("$BOARD") == "rfduino": env.Append( - CPPFLAGS=["-fno-builtin"], + CCFLAGS=["-fno-builtin"], LINKFLAGS=["--specs=nano.specs"] ) env.Replace( diff --git a/platformio/builder/scripts/teensy.py b/platformio/builder/scripts/teensy.py index 37bfeb1b..310ad8d0 100644 --- a/platformio/builder/scripts/teensy.py +++ b/platformio/builder/scripts/teensy.py @@ -31,7 +31,7 @@ elif env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy3": LINKFLAGS=[ "-Wl,--defsym=__rtc_localtime=$UNIX_TIME" ], - CPPFLAGS=[ + CCFLAGS=[ "-fsingle-precision-constant" ] ) diff --git a/platformio/builder/scripts/timsp430.py b/platformio/builder/scripts/timsp430.py index 525aa5e9..a0cd720c 100644 --- a/platformio/builder/scripts/timsp430.py +++ b/platformio/builder/scripts/timsp430.py @@ -36,7 +36,7 @@ env.Replace( ARFLAGS=["rcs"], - ASPPFLAGS=["-x", "assembler-with-cpp"], + ASFLAGS=["-x", "assembler-with-cpp"], CCFLAGS=[ "-g", # include debugging info (so errors include line numbers) @@ -74,6 +74,8 @@ env.Replace( ) env.Append( + ASFLAGS=env.get("CCFLAGS", [])[:], + BUILDERS=dict( ElfToHex=Builder( action=" ".join([ diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index f6c38555..85ed52b4 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -213,14 +213,15 @@ def DumpIDEData(env): ) return defines + LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS" + LINTCXXCOM = "$CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS" env_ = env.Clone() data = { "defines": get_defines(env_), "includes": get_includes(env_), - "cc_flags": env_.subst("$SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS"), - "cxx_flags": env_.subst( - "$SHCXXFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS"), + "cc_flags": env_.subst(LINTCCOM), + "cxx_flags": env_.subst(LINTCXXCOM), "cxx_path": where_is_program( env_.subst("$CXX"), env_.subst("${ENV['PATH']}")) } @@ -228,6 +229,8 @@ def DumpIDEData(env): # https://github.com/platformio/platformio-atom-ide/issues/34 _new_defines = [] for item in env_.get("CPPDEFINES", []): + if isinstance(item, list): + item = "=".join(item) item = item.replace('\\"', '"') if " " in item: _new_defines.append(item.replace(" ", "\\\\ ")) @@ -236,9 +239,8 @@ def DumpIDEData(env): env_.Replace(CPPDEFINES=_new_defines) data.update({ - "cc_flags": env_.subst("$SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS"), - "cxx_flags": env_.subst( - "$SHCXXFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS") + "cc_flags": env_.subst(LINTCCOM), + "cxx_flags": env_.subst(LINTCXXCOM) }) return data @@ -254,9 +256,10 @@ def GetCompilerType(env): if result['returncode'] != 0: return None output = "".join([result['out'], result['err']]).lower() - for type_ in ("clang", "gcc"): - if type_ in output: - return type_ + if "clang" in output and "LLVM" in output: + return "clang" + elif "gcc" in output: + return "gcc" return None diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 6e080614..3e51f95b 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -97,17 +97,31 @@ def BuildProgram(env): def ProcessFlags(env, flags): for f in flags: - if f: - env.MergeFlags(str(f)) + if not f: + continue + parsed_flags = env.ParseFlags(str(f)) + for flag in parsed_flags.pop("CPPDEFINES"): + if not isinstance(flag, list): + env.Append(CPPDEFINES=flag) + continue + if '\"' in flag[1]: + flag[1] = flag[1].replace('\"', '\\\"') + env.Append(CPPDEFINES=[flag]) + env.Append(**parsed_flags) # fix relative CPPPATH for i, p in enumerate(env.get("CPPPATH", [])): if isdir(p): env['CPPPATH'][i] = realpath(p) + # fix relative path for "-include" + for i, f in enumerate(env.get("CCFLAGS", [])): + if isinstance(f, tuple) and f[0] == "-include": + env['CCFLAGS'][i] = (f[0], env.File(realpath(f[1].get_path()))) # Cancel any previous definition of name, either built in or # provided with a -D option // Issue #191 - undefines = [u for u in env.get("CCFLAGS", []) if u.startswith("-U")] + undefines = [u for u in env.get("CCFLAGS", []) + if isinstance(u, basestring) and u.startswith("-U")] if undefines: for undef in undefines: env['CCFLAGS'].remove(undef) diff --git a/platformio/commands/init.py b/platformio/commands/init.py index f53a80e8..b2c9d75e 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -18,7 +18,7 @@ from shutil import copyfile import click -from platformio import app, exception +from platformio import app, exception, util from platformio.commands.platforms import \ platforms_install as cli_platforms_install from platformio.ide.projectgenerator import ProjectGenerator @@ -75,26 +75,12 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913 not click.confirm("Do you want to continue?")): raise exception.AbortedByUser() - project_file = join(project_dir, "platformio.ini") - src_dir = join(project_dir, "src") - lib_dir = join(project_dir, "lib") - - for d in (src_dir, lib_dir): - if not isdir(d): - makedirs(d) - - init_lib_readme(lib_dir) - init_ci_conf(project_dir) - init_cvs_ignore(project_dir) - - if not isfile(project_file): - copyfile(join(get_source_dir(), "projectconftpl.ini"), - project_file) + init_base_project(project_dir) if board: fill_project_envs( - ctx, project_file, board, enable_auto_uploading, env_prefix, - ide is not None + ctx, join(project_dir, "platformio.ini"), board, + enable_auto_uploading, env_prefix, ide is not None ) if ide: @@ -126,58 +112,26 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913 ) -def fill_project_envs( # pylint: disable=too-many-arguments,too-many-locals - ctx, project_file, board_types, enable_auto_uploading, - env_prefix, force_download): - builtin_boards = get_boards() - content = [] - used_envs = [] - used_platforms = [] +def init_base_project(project_dir): + platformio_ini = join(project_dir, "platformio.ini") + if not isfile(platformio_ini): + copyfile(join(get_source_dir(), "projectconftpl.ini"), + platformio_ini) - with open(project_file) as f: - used_envs = [l.strip() for l in f.read().splitlines() if - l.strip().startswith("[env:")] + lib_dir = join(project_dir, "lib") + src_dir = join(project_dir, "src") + with util.cd(project_dir): + config = util.get_project_config() + if config.has_option("platformio", "src_dir"): + src_dir = join(project_dir, config.get("platformio", "src_dir")) - for type_ in board_types: - data = builtin_boards[type_] - used_platforms.append(data['platform']) - env_name = "[env:%s%s]" % (env_prefix, type_) + for d in (src_dir, lib_dir): + if not isdir(d): + makedirs(d) - if env_name in used_envs: - continue - - content.append("") - content.append(env_name) - content.append("platform = %s" % data['platform']) - - # find default framework for board - frameworks = data.get("frameworks") - if frameworks: - content.append("framework = %s" % frameworks[0]) - - content.append("board = %s" % type_) - if enable_auto_uploading: - content.append("targets = upload") - - if force_download and used_platforms: - _install_dependent_platforms(ctx, used_platforms) - - if not content: - return - - with open(project_file, "a") as f: - content.append("") - f.write("\n".join(content)) - - -def _install_dependent_platforms(ctx, platforms): - installed_platforms = PlatformFactory.get_platforms(installed=True).keys() - if set(platforms) <= set(installed_platforms): - return - ctx.invoke( - cli_platforms_install, - platforms=list(set(platforms) - set(installed_platforms)) - ) + init_lib_readme(lib_dir) + init_ci_conf(project_dir) + init_cvs_ignore(project_dir) def init_lib_readme(lib_dir): @@ -302,3 +256,57 @@ def init_cvs_ignore(project_dir): return with open(join(project_dir, ".gitignore"), "w") as f: f.write(".pioenvs") + + +def fill_project_envs( # pylint: disable=too-many-arguments,too-many-locals + ctx, platformio_ini, board_types, enable_auto_uploading, + env_prefix, force_download): + builtin_boards = get_boards() + content = [] + used_envs = [] + used_platforms = [] + + with open(platformio_ini) as f: + used_envs = [l.strip() for l in f.read().splitlines() if + l.strip().startswith("[env:")] + + for type_ in board_types: + data = builtin_boards[type_] + used_platforms.append(data['platform']) + env_name = "[env:%s%s]" % (env_prefix, type_) + + if env_name in used_envs: + continue + + content.append("") + content.append(env_name) + content.append("platform = %s" % data['platform']) + + # find default framework for board + frameworks = data.get("frameworks") + if frameworks: + content.append("framework = %s" % frameworks[0]) + + content.append("board = %s" % type_) + if enable_auto_uploading: + content.append("targets = upload") + + if force_download and used_platforms: + _install_dependent_platforms(ctx, used_platforms) + + if not content: + return + + with open(platformio_ini, "a") as f: + content.append("") + f.write("\n".join(content)) + + +def _install_dependent_platforms(ctx, platforms): + installed_platforms = PlatformFactory.get_platforms(installed=True).keys() + if set(platforms) <= set(installed_platforms): + return + ctx.invoke( + cli_platforms_install, + platforms=list(set(platforms) - set(installed_platforms)) + ) diff --git a/platformio/ide/tpls/clion/.gitignore.tpl b/platformio/ide/tpls/clion/.gitignore.tpl new file mode 100644 index 00000000..a9fe6864 --- /dev/null +++ b/platformio/ide/tpls/clion/.gitignore.tpl @@ -0,0 +1,2 @@ +.pioenvs +CMakeListsPrivate.txt diff --git a/platformio/ide/tpls/clion/CMakeLists.txt.tpl b/platformio/ide/tpls/clion/CMakeLists.txt.tpl index 4ad26cb6..25a7b79e 100644 --- a/platformio/ide/tpls/clion/CMakeLists.txt.tpl +++ b/platformio/ide/tpls/clion/CMakeLists.txt.tpl @@ -1,73 +1,60 @@ -cmake_minimum_required(VERSION 3.2) -project({{project_name}}) - -set(ENV{PATH} "{{env_path}}") -set(PLATFORMIO_CMD "{{platformio_path}}") - -% for include in includes: -% if include.startswith(user_home_dir): -% if "windows" in systype: -include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}{{include.replace(user_home_dir, '').replace("\\", "/")}}") -% else: -include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}") -% end -% else: -include_directories("{{include.replace("\\", "/")}}") -% end -% end - -% for define in defines: -add_definitions(-D{{!define}}) -% end - -add_custom_target( - PLATFORMIO_BUILD ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_UPLOAD ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_CLEAN ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_PROGRAM ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_UPLOADFS ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_UPDATE_ALL ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion update - 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 +cmake_minimum_required(VERSION 3.2) +project({{project_name}}) + +include(CMakeListsPrivate.txt) + +% for define in defines: +add_definitions(-D{{!define}}) +% end + +add_custom_target( + PLATFORMIO_BUILD ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_UPLOAD ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_CLEAN ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_PROGRAM ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_UPLOADFS ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_UPDATE_ALL ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion update + 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 diff --git a/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl b/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl new file mode 100644 index 00000000..ef859843 --- /dev/null +++ b/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl @@ -0,0 +1,14 @@ +set(ENV{PATH} "{{env_path}}") +set(PLATFORMIO_CMD "{{platformio_path}}") + +% for include in includes: +% if include.startswith(user_home_dir): +% if "windows" in systype: +include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}{{include.replace(user_home_dir, '').replace("\\", "/")}}") +% else: +include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}") +% end +% else: +include_directories("{{include.replace("\\", "/")}}") +% end +% end \ No newline at end of file diff --git a/platformio/ide/tpls/netbeans/nbproject/configurations.xml.tpl b/platformio/ide/tpls/netbeans/nbproject/configurations.xml.tpl new file mode 100644 index 00000000..897d7451 --- /dev/null +++ b/platformio/ide/tpls/netbeans/nbproject/configurations.xml.tpl @@ -0,0 +1,72 @@ + + + + + platformio.ini + + + nbproject/private/launcher.properties + + + ^(nbproject|.pioenvs)$ + + . + + + + + + default + false + false + + + true + true + + + + . + {{platformio_path}} -f -c netbeans run + {{platformio_path}} -f -c netbeans run --target clean + + + + src + % for include in includes: + {{include}} + % end + + + % for define in defines: + {{define}} + % end + + + + + src + % for include in includes: + {{include}} + % end + + + % for define in defines: + {{define}} + % end + + + + + . + + + + + + + + diff --git a/platformio/ide/tpls/netbeans/nbproject/private/configurations.xml.tpl b/platformio/ide/tpls/netbeans/nbproject/private/configurations.xml.tpl new file mode 100644 index 00000000..2beef95a --- /dev/null +++ b/platformio/ide/tpls/netbeans/nbproject/private/configurations.xml.tpl @@ -0,0 +1,61 @@ + + + + + + + + + platformio.ini + + + + + + + localhost + {{4 if "darwin" in systype else 2 if "linux" in systype else 3}} + + + + . + ${AUTO_FOLDER} + + ${AUTO_FOLDER} + + ${MAKE} ${ITEM_NAME}.o + ${AUTO_COMPILE} + + ${AUTO_COMPILE} + + + + + + + + + + + + + + + gdb + + + + "${OUTPUT_PATH}" + {{platformio_path}} -f -c netbeans run --target upload + + {{platformio_path}} -f -c netbeans run --target upload + . + false + 0 + 0 + + + + + + diff --git a/platformio/ide/tpls/netbeans/nbproject/private/launcher.properties.tpl b/platformio/ide/tpls/netbeans/nbproject/private/launcher.properties.tpl new file mode 100644 index 00000000..6cc2127d --- /dev/null +++ b/platformio/ide/tpls/netbeans/nbproject/private/launcher.properties.tpl @@ -0,0 +1,40 @@ +# Launchers File syntax: +# +# [Must-have property line] +# launcher1.runCommand= +# [Optional extra properties] +# launcher1.displayName= +# launcher1.buildCommand= +# launcher1.runDir= +# launcher1.symbolFiles= +# launcher1.env.= +# (If this value is quoted with ` it is handled as a native command which execution result will become the value) +# [Common launcher properties] +# common.runDir= +# (This value is overwritten by a launcher specific runDir value if the latter exists) +# common.env.= +# (Environment variables from common launcher are merged with launcher specific variables) +# common.symbolFiles= +# (This value is overwritten by a launcher specific symbolFiles value if the latter exists) +# +# In runDir, symbolFiles and env fields you can use these macroses: +# ${PROJECT_DIR} - project directory absolute path +# ${OUTPUT_PATH} - linker output path (relative to project directory path) +# ${OUTPUT_BASENAME}- linker output filename +# ${TESTDIR} - test files directory (relative to project directory path) +# ${OBJECTDIR} - object files directory (relative to project directory path) +# ${CND_DISTDIR} - distribution directory (relative to project directory path) +# ${CND_BUILDDIR} - build directory (relative to project directory path) +# ${CND_PLATFORM} - platform name +# ${CND_CONF} - configuration name +# ${CND_DLIB_EXT} - dynamic library extension +# +# All the project launchers must be listed in the file! +# +# launcher1.runCommand=... +# launcher2.runCommand=... +# ... +# common.runDir=... +# common.env.KEY=VALUE + +# launcher1.runCommand= \ No newline at end of file diff --git a/platformio/ide/tpls/netbeans/nbproject/private/private.xml.tpl b/platformio/ide/tpls/netbeans/nbproject/private/private.xml.tpl new file mode 100644 index 00000000..4f3fdc62 --- /dev/null +++ b/platformio/ide/tpls/netbeans/nbproject/private/private.xml.tpl @@ -0,0 +1,10 @@ + + + + true + + + 0 + 0 + + diff --git a/platformio/ide/tpls/netbeans/nbproject/project.xml.tpl b/platformio/ide/tpls/netbeans/nbproject/project.xml.tpl new file mode 100644 index 00000000..ad4ea18f --- /dev/null +++ b/platformio/ide/tpls/netbeans/nbproject/project.xml.tpl @@ -0,0 +1,26 @@ + + + org.netbeans.modules.cnd.makeproject + + + {{project_name}} + + + + UTF-8 + + + . + + + + Default + 0 + + + + false + + + + diff --git a/platformio/maintenance.py b/platformio/maintenance.py index b281879c..441f5072 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -21,7 +21,7 @@ from time import time import click -from platformio import __version__, app, exception, telemetry +from platformio import __version__, app, exception, telemetry, util from platformio.commands.lib import lib_update as cmd_libraries_update from platformio.commands.platforms import \ platforms_install as cmd_platforms_install @@ -46,6 +46,8 @@ def on_platformio_start(ctx, force, caller): after_upgrade(ctx) + +def on_platformio_end(ctx, result): # pylint: disable=W0613 try: check_platformio_upgrade() check_internal_updates(ctx, "platforms") @@ -55,10 +57,6 @@ def on_platformio_start(ctx, force, caller): "Please check your Internet connection.", fg="red") -def on_platformio_end(ctx, result): # pylint: disable=W0613 - pass - - def on_platformio_exception(e): telemetry.on_exception(e) @@ -149,12 +147,13 @@ def after_upgrade(ctx): if not getenv("PLATFORMIO_IDE"): click.echo("- %s PlatformIO IDE for IoT development > %s" % ( click.style("try", fg="cyan"), - click.style("http://platformio.org/", fg="cyan") + click.style("http://platformio.org/#!/platformio-ide", fg="cyan") + )) + if not util.is_ci(): + click.echo("- %s to keep PlatformIO alive! > %s" % ( + click.style("donate", fg="cyan"), + click.style("http://platformio.org/#!/donate", fg="cyan") )) - click.echo("- %s to keep PlatformIO alive! > %s" % ( - click.style("donate", fg="cyan"), - click.style("http://platformio.org/donate/", fg="cyan") - )) click.echo("*" * terminal_width) click.echo("") diff --git a/platformio/pkgmanager.py b/platformio/pkgmanager.py index c421a443..0c7bdce7 100644 --- a/platformio/pkgmanager.py +++ b/platformio/pkgmanager.py @@ -103,7 +103,7 @@ class PackageManager(object): except (requests.exceptions.ConnectionError, requests.exceptions.ChunkedEncodingError, exception.FDUnrecognizedStatusCode, StopIteration): - if info['url'].startswith("http://sourceforge.net"): + if not info['url'].startswith("http://dl.platformio.org"): dlpath = self.download( "http://dl.platformio.org/packages/%s" % basename(info['url']), pkg_dir, info['sha1']) @@ -126,7 +126,8 @@ class PackageManager(object): click.secho("Not installed", fg="yellow") return False - rmtree(join(self._package_dir, name)) + if isdir(join(self._package_dir, name)): + rmtree(join(self._package_dir, name)) self._unregister(name) click.echo("[%s]" % click.style("OK", fg="green")) diff --git a/platformio/telemetry.py b/platformio/telemetry.py index cabda599..48ca79ab 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -95,7 +95,7 @@ class MeasurementProtocol(TelemetryBase): # gather dependent packages dpdata = [] - dpdata.append("Click/%s" % click.__version__) + dpdata.append("PlatformIO/%s" % __version__) if app.get_session_var("caller_id"): dpdata.append("Caller/%s" % app.get_session_var("caller_id")) if getenv("PLATFORMIO_IDE"): diff --git a/tests/test_pkgmanifest.py b/tests/test_pkgmanifest.py index d9ed89aa..ff0235cb 100644 --- a/tests/test_pkgmanifest.py +++ b/tests/test_pkgmanifest.py @@ -14,29 +14,10 @@ import pytest import requests -from os.path import basename from platformio.util import get_api_result -@pytest.fixture(scope="session") -def sfpkglist(): - result = None - r = None - - try: - r = requests.get("http://sourceforge.net/projects" - "/platformio-storage/files/packages/list") - result = r.json() - r.raise_for_status() - except: - pass - finally: - if r: - r.close() - return result - - def pytest_generate_tests(metafunc): if "package_data" not in metafunc.fixturenames: return @@ -52,39 +33,17 @@ def pytest_generate_tests(metafunc): def validate_response(req): assert req.status_code == 200 assert int(req.headers['Content-Length']) > 0 + assert req.headers['Content-Type'] in ("application/gzip", + "application/octet-stream") -def validate_package(url, sfpkglist): - r = requests.head(url, allow_redirects=True) - validate_response(r) - assert r.headers['Content-Type'] in ("application/x-gzip", - "application/octet-stream") - - -def test_package(package_data, sfpkglist): +def test_package(package_data): assert package_data['url'].endswith("%d.tar.gz" % package_data['version']) - sf_package = "sourceforge.net" in package_data['url'] - - # check content type and that file exists - try: - r = requests.head(package_data['url'], allow_redirects=True) - if 500 <= r.status_code <= 599: - raise requests.exceptions.ConnectionError() - except requests.exceptions.ConnectionError as e: - if sf_package: - return pytest.skip("SF is off-line") - raise Exception(e) + r = requests.head(package_data['url'], allow_redirects=True) validate_response(r) - assert r.headers['Content-Type'] in ("application/x-gzip", - "application/octet-stream") - if not sf_package: - return + if "X-Checksum-Sha1" not in r.headers: + return pytest.skip("X-Checksum-Sha1 is not provided") - # check sha1 sum - if sfpkglist is None: - return pytest.skip("SF is off-line") - pkgname = basename(package_data['url']) - assert pkgname in sfpkglist - assert package_data['sha1'] == sfpkglist.get(pkgname, {}).get("sha1") + assert package_data['sha1'] == r.headers.get("X-Checksum-Sha1")