diff --git a/.gitignore b/.gitignore index f3fa86a2..b2891149 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,5 @@ .pioenvs .tox .sconsign.dblite -examples/ide-eclipse/.metadata -examples/ide-eclipse/RemoteSystemsTempFiles docs/_build dist diff --git a/.isort.cfg b/.isort.cfg index 3dbd6d91..907a398d 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,3 +1,3 @@ [settings] line_length=79 -known_third_party=click,requests,serial,SCons,pytest,bottle +known_third_party=bottle,click,lockfile,pytest,requests,serial,SCons diff --git a/.travis.yml b/.travis.yml index 144e8731..30cef265 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ env: - TOX_ENV=py27 install: - - pip install tox + - pip install -U pip setuptools tox script: - tox -e $TOX_ENV diff --git a/HISTORY.rst b/HISTORY.rst index 880f3c02..62b68fb3 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,8 +1,50 @@ Release History =============== +PlatformIO 2.0 +-------------- + +2.3.0 (2015-09-05) +~~~~~~~~~~~~~~~~~~ + +* Added + `native `__, + `linux_arm `__, + `linux_i686 `__, + `linux_x86_64 `__, + `windows_x86 `__ + development platforms + (`issue #263 `_) +* Added `PlatformIO Demo `_ + page to documentation +* Simplified `installation `__ + process of PlatformIO + (`issue #274 `_) +* Significantly improved `Project Generator `__ which allows to integrate with `the most popular + IDE `__ +* Added short ``-h`` help option for PlatformIO and sub-commands +* Updated `mbed `__ + framework +* Updated ``tool-teensy`` package for `Teensy `__ + platform + (`issue #268 `_) +* Added FAQ answer when `Program "platformio" not found in PATH `_ + (`issue #272 `_) +* Generate "readme.txt" for project "lib" directory + (`issue #273 `_) +* Use toolchain's includes pattern ``include*`` for Project Generator + (`issue #277 `_) +* Added support for Adafruit Gemma board to + `atmelavr `__ + platform + (`pull #256 `_) +* Fixed includes list for Windows OS when generating project for `Eclipse IDE `__ + (`issue #270 `_) +* Fixed ``AttributeError: 'module' object has no attribute 'packages'`` + (`issue #252 `_) + 2.2.2 (2015-07-30) ------------------- +~~~~~~~~~~~~~~~~~~ * Integration with `Atom IDE `__ * Support for off-line/unpublished/private libraries @@ -18,7 +60,7 @@ Release History (`issue #254 `_) 2.2.1 (2015-07-17) ------------------- +~~~~~~~~~~~~~~~~~~ * Project generator for `CLion IDE `__ (`issue #132 `_) @@ -29,7 +71,7 @@ Release History (`issue #248 `_) 2.2.0 (2015-07-01) ------------------- +~~~~~~~~~~~~~~~~~~ * Allowed to exclude/include source files from build process using `src_filter `__ @@ -60,12 +102,12 @@ Release History (`issue #245 `_) 2.1.2 (2015-06-21) ------------------- +~~~~~~~~~~~~~~~~~~ * Fixed broken link to SCons installer 2.1.1 (2015-06-09) ------------------- +~~~~~~~~~~~~~~~~~~ * Automatically detect upload port using VID:PID board settings (`issue #231 `_) @@ -74,7 +116,7 @@ Release History (`issue #229 `_) 2.1.0 (2015-06-03) ------------------- +~~~~~~~~~~~~~~~~~~ * Added Silicon Labs EFM32 `siliconlabsefm32 `_ development platform @@ -93,12 +135,12 @@ Release History (`issue #221 `_) 2.0.2 (2015-05-27) ------------------- +~~~~~~~~~~~~~~~~~~ * Fixed libraries order for "Library Dependency Finder" under Linux OS 2.0.1 (2015-05-27) ------------------- +~~~~~~~~~~~~~~~~~~ * Handle new environment variable `PLATFORMIO_BUILD_FLAGS `_ @@ -119,7 +161,7 @@ Release History (`issue #217 `_) 2.0.0 (2015-05-22) ------------------- +~~~~~~~~~~~~~~~~~~ *Made in* `Paradise `_ @@ -166,8 +208,11 @@ Release History * Fixed bug with creating copies of source files (`issue #177 `_) +PlatformIO 1.0 +-------------- + 1.5.0 (2015-05-15) ------------------- +~~~~~~~~~~~~~~~~~~ * Added support of `Framework mbed `_ for Teensy 3.1 @@ -190,7 +235,7 @@ Release History (`issue #191 `_) 1.4.0 (2015-04-11) ------------------- +~~~~~~~~~~~~~~~~~~ * Added `espressif `_ development platform with ESP01 board @@ -216,7 +261,7 @@ Release History 1.3.0 (2015-03-27) ------------------- +~~~~~~~~~~~~~~~~~~ * Moved PlatformIO source code and repositories from `Ivan Kravets `_ account to `PlatformIO Organisation `_ @@ -237,7 +282,7 @@ Release History 1.2.0 (2015-03-20) ------------------- +~~~~~~~~~~~~~~~~~~ * Added full support of `mbed `__ framework including libraries: *RTOS, Ethernet, DSP, FAT, USB*. @@ -269,7 +314,7 @@ Release History (`issue #100 `_) 1.1.0 (2015-03-05) ------------------- +~~~~~~~~~~~~~~~~~~ * Implemented ``PLATFORMIO_*`` environment variables (`issue #102 `_) @@ -287,7 +332,7 @@ Release History * Fixed uploading for *Digispark* board (`issue #106 `_) 1.0.1 (2015-02-27) ------------------- +~~~~~~~~~~~~~~~~~~ **PlatformIO 1.0 - recommended for production** @@ -354,9 +399,11 @@ Release History error (`issue #81 `_) * Several bug fixes, increased stability and performance improvements +PlatformIO 0.0 +-------------- 0.10.2 (2015-01-06) -------------------- +~~~~~~~~~~~~~~~~~~~ * Fixed an issue with ``--json-output`` (`issue #42 `_) @@ -365,7 +412,7 @@ Release History under Windows OS (`issue #45 `_) 0.10.1 (2015-01-02) -------------------- +~~~~~~~~~~~~~~~~~~~ * Added ``--json-output`` option to `platformio list `__, @@ -377,7 +424,7 @@ Release History command 0.10.0 (2015-01-01) -------------------- +~~~~~~~~~~~~~~~~~~~ **Happy New Year!** @@ -400,7 +447,7 @@ Release History * Fixed bug with *Arduino USB* boards (`issue #40 `_) 0.9.2 (2014-12-10) ------------------- +~~~~~~~~~~~~~~~~~~ * Replaced "dark blue" by "cyan" colour for the texts (`issue #33 `_) * Added new setting `enable_prompts `_ @@ -409,7 +456,7 @@ Release History * Fixed compilation bug on *Windows* with installed *MSVC* (`issue #18 `_) 0.9.1 (2014-12-05) ------------------- +~~~~~~~~~~~~~~~~~~ * Ask user to install platform (when it hasn't been installed yet) within `platformio run `__ @@ -418,13 +465,13 @@ Release History * Fixed "*OSError: [Errno 2] No such file or directory*" within `platformio run `__ command when PlatformIO isn't installed properly -* Fixed example for `Eclipse IDE with Tiva board `_ +* Fixed example for `Eclipse IDE with Tiva board `_ (`issue #32 `_) -* Upgraded `Eclipse Project Examples `_ +* Upgraded `Eclipse Project Examples `_ to latest *Luna* and *PlatformIO* releases 0.9.0 (2014-12-01) ------------------- +~~~~~~~~~~~~~~~~~~ * Implemented `platformio settings `_ command * Improved `platformio init `_ command. @@ -442,7 +489,7 @@ Release History (`issue #28 `_) 0.8.0 (2014-10-19) ------------------- +~~~~~~~~~~~~~~~~~~ * Avoided trademark issues in `library.json `_ with the new fields: `frameworks `_, @@ -459,7 +506,7 @@ Release History command: ``--framework`` and ``--platform`` 0.7.1 (2014-10-06) ------------------- +~~~~~~~~~~~~~~~~~~ * Fixed bug with order for includes in conversation from INO/PDE to CPP * Automatic detection of port on upload (`issue #15 `_) @@ -467,7 +514,7 @@ Release History 0.7.0 (2014-09-24) ------------------- +~~~~~~~~~~~~~~~~~~ * Implemented new `[platformio] `_ section for Configuration File with `home_dir `_ @@ -475,14 +522,14 @@ Release History * Implemented *Library Manager* (`issue #6 `_) 0.6.0 (2014-08-09) ------------------- +~~~~~~~~~~~~~~~~~~ * Implemented `platformio serialports monitor `_ (`issue #10 `_) * Fixed an issue ``ImportError: No module named platformio.util`` (`issue #9 `_) * Fixed bug with auto-conversation from Arduino \*.ino to \*.cpp 0.5.0 (2014-08-04) ------------------- +~~~~~~~~~~~~~~~~~~ * Improved nested lookups for libraries * Disabled default warning flag "-Wall" @@ -497,7 +544,7 @@ Release History * Fixed a bug with nested libs building 0.4.0 (2014-07-31) ------------------- +~~~~~~~~~~~~~~~~~~ * Implemented `platformio serialports `_ command * Allowed to put special build flags only for ``src`` files via @@ -517,13 +564,13 @@ Release History 0.3.1 (2014-06-21) ------------------- +~~~~~~~~~~~~~~~~~~ * Fixed auto-installer for Windows OS (bug with %PATH% customisations) 0.3.0 (2014-06-21) ------------------- +~~~~~~~~~~~~~~~~~~ * Allowed to pass multiple "SomePlatform" to install/uninstall commands * Added "IDE Integration" section to README with Eclipse project examples @@ -533,7 +580,7 @@ Release History 0.2.0 (2014-06-15) ------------------- +~~~~~~~~~~~~~~~~~~ * Resolved `issue #1 "Build referred libraries" `_ * Renamed project's "libs" directory to "lib" @@ -542,6 +589,6 @@ Release History 0.1.0 (2014-06-13) ------------------- +~~~~~~~~~~~~~~~~~~ * Birth! First alpha release diff --git a/README.rst b/README.rst index b18d99bf..bc7998be 100644 --- a/README.rst +++ b/README.rst @@ -10,29 +10,32 @@ PlatformIO .. image:: https://circleci.com/gh/platformio/platformio/tree/develop.svg?style=svg :target: https://circleci.com/gh/platformio/platformio/tree/develop :alt: Circle.CI Build Status -.. image:: https://gemnasium.com/platformio/platformio.png - :target: https://gemnasium.com/platformio/platformio - :alt: Dependency Status +.. image:: https://requires.io/github/platformio/platformio/requirements.svg?branch=develop + :target: https://requires.io/github/platformio/platformio/requirements/?branch=develop + :alt: Requirements Status .. image:: https://img.shields.io/pypi/v/platformio.svg :target: https://pypi.python.org/pypi/platformio/ :alt: Latest Version -.. image:: https://img.shields.io/pypi/dm/platformio.svg - :target: https://pypi.python.org/pypi/platformio/ - :alt: Downloads .. image:: https://img.shields.io/pypi/l/platformio.svg :target: https://pypi.python.org/pypi/platformio/ :alt: License +.. 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 :alt: Join the chat at https://gitter.im/platformio/platformio :target: https://gitter.im/platformio/platformio -.. image:: https://www.openhub.net/p/platformio/widgets/project_thin_badge.gif - :target: https://www.openhub.net/p/platformio -`Website + Library Search `_ | -`Documentation `_ | +`Home & Demo `_ | `Project Examples `_ | +`Code `_ | +`Documentation `_ || `Blog `_ | `Reddit `_ | +`Facebook `_ | `Twitter `_ .. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-logo.png @@ -46,6 +49,9 @@ Continuous integration, Arduino and MBED compatible). Silicon Labs EFM32, ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.* +.. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-demo-wiring.gif + :target: http://platformio.org + * `Get Started `_ * `Web 2.0 Library Search `_ * `Development Platforms `_ diff --git a/appveyor.yml b/appveyor.yml index a213b1f2..cd09e534 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,12 +9,18 @@ environment: PYTHON_HOME: "C:\\Python27-x64" PYTHON_VERSION: "2.7" PYTHON_ARCH: "64" + init: - "ECHO %TOXENV%" - ps: "ls C:\\Python*" + install: - "git submodule update --init --recursive" - "powershell scripts\\appveyor\\install.ps1" + +before_test: + - cmd: SET PATH=%PATH%;C:\MinGW\bin + test_script: - "%PYTHON_HOME%\\Scripts\\tox --version" - "%PYTHON_HOME%\\Scripts\\pip --version" diff --git a/docs/_static/ide-platformio-clion.png b/docs/_static/ide-platformio-clion.png index 11f0754f..96049b35 100644 Binary files a/docs/_static/ide-platformio-clion.png and b/docs/_static/ide-platformio-clion.png differ diff --git a/docs/_static/ide-platformio-qtcreator-3.png b/docs/_static/ide-platformio-qtcreator-3.png index 8c908e38..b341e505 100644 Binary files a/docs/_static/ide-platformio-qtcreator-3.png and b/docs/_static/ide-platformio-qtcreator-3.png differ diff --git a/docs/_static/platformio-demo-lib.gif b/docs/_static/platformio-demo-lib.gif new file mode 100644 index 00000000..238df416 Binary files /dev/null and b/docs/_static/platformio-demo-lib.gif differ diff --git a/docs/_static/platformio-demo-platforms.gif b/docs/_static/platformio-demo-platforms.gif new file mode 100644 index 00000000..3e68a73b Binary files /dev/null and b/docs/_static/platformio-demo-platforms.gif differ diff --git a/docs/_static/platformio-demo-wiring.gif b/docs/_static/platformio-demo-wiring.gif new file mode 100644 index 00000000..a89550bc Binary files /dev/null and b/docs/_static/platformio-demo-wiring.gif differ diff --git a/docs/articles.rst b/docs/articles.rst index eead4cbe..1351bc6d 100644 --- a/docs/articles.rst +++ b/docs/articles.rst @@ -4,18 +4,31 @@ Articles about us ================= .. note:: - If you've written article about PlatformIO and would like it listed on - this page, `please edit this page `_. + If you've written article about PlatformIO and would like it listed on + this page, `please edit this page `_. Here are recent articles about PlatformIO: +2015 +^^^^ + +* Sep 01, 2015 - **Thomas P. Weldon, Ph.D.** - `Improvised MBED FRDM-K64F Eclipse/PlatformIO Setup and Software Installation `_ +* Aug 01, 2015 - **Russell Davis** - `PlatformIO on the Raspberry Pi `_ +* Jul 25, 2015 - **DinoTools** - `Erste Schritte mit PlatformIO (German) `_ * Jul 20, 2015 - **Eli Fatsi** - `Arduino Development in Atom Editor `_ +* Jul 14, 2015 - **ElbinarIO** - `Programar para Arduino y otros microcontroladores desde la linea de comandos (Spanish) `_ +* Jul 11, 2015 - **TrojanC** - `Learning Arduino GitHub Repository `_ * Jun 02, 2015 - **Alejandro Guirao Rodriguez** - `Discovering PlatformIO: The RaspberryPi / Arduino combo kit is a winner option when prototyping an IoT-style project `_ * 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 `_ -* October 7, 2014 - **Ivan Kravets** - `Integration of PlatformIO library manager to Arduino and Energia IDEs `_ -* June 20, 2014 - **Ivan Kravets** - `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO `_ -* June 17, 2014 - **Ivan Kravets** - `How was PlatformIO born or why I love Python World `_ +* February 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 `_ diff --git a/docs/ci/appveyor.rst b/docs/ci/appveyor.rst index edfafcd5..e05ca4f2 100644 --- a/docs/ci/appveyor.rst +++ b/docs/ci/appveyor.rst @@ -113,17 +113,12 @@ same for the all projects, don't need to modify them): function InstallPip ($python_home) { - $pip_path = $python_home + "/Scripts/pip.exe" $python_path = $python_home + "/python.exe" - if (-not(Test-Path $pip_path)) { - Write-Host "Installing pip..." - $webclient = New-Object System.Net.WebClient - $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) - Write-Host "Executing:" $python_path $GET_PIP_PATH - Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru - } else { - Write-Host "pip already installed." - } + Write-Host "Installing pip..." + $webclient = New-Object System.Net.WebClient + $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) + Write-Host "Executing:" $python_path $GET_PIP_PATH + Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru } function InstallPackage ($python_home, $pkg) { @@ -131,19 +126,11 @@ same for the all projects, don't need to modify them): & $pip_path install -U $pkg } - function InstallScons ($python_home) { - Write-Host "Start installing Scons" - $pip_path = $python_home + "/Scripts/pip.exe" - & $pip_path install --egg "http://dl.platformio.org/scons.zip" - Write-Host "Scons installed" - } - function main () { InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON_HOME InstallPip $env:PYTHON_HOME InstallPackage $env:PYTHON_HOME setuptools InstallPackage $env:PYTHON_HOME platformio - InstallScons $env:PYTHON_HOME } main diff --git a/docs/demo.rst b/docs/demo.rst new file mode 100644 index 00000000..15db587a --- /dev/null +++ b/docs/demo.rst @@ -0,0 +1,50 @@ +.. _demo: + +Demo +==== + +.. contents:: + +Wiring Blink +------------ + +.. image:: _static/platformio-demo-wiring.gif + +Used in demo +~~~~~~~~~~~~ + +1. Source code of `Wiring Blink Example `_ +2. :ref:`cmd_run` command +3. :ref:`platformio run -t upload ` command. + +Platform Manager +---------------- + +.. image:: _static/platformio-demo-platforms.gif + +Used in demo +~~~~~~~~~~~~ + +1. :ref:`userguide_platforms` +2. :ref:`cmd_platforms_list` command +3. :ref:`platformio platforms search avr ` command +4. :ref:`platformio platforms show teensy ` command +5. :ref:`cmd_platforms_update` command. + +Library Manager +--------------- + +.. image:: _static/platformio-demo-lib.gif + +Used in demo +~~~~~~~~~~~~ + +1. :ref:`userguide_lib` +2. :ref:`platformio lib search 1-wire ` command +3. :ref:`platformio lib install 54 ` command +4. :ref:`platformio lib search -f mbed ` command +5. :ref:`platformio lib search -k rf ` command +6. :ref:`platformio lib search radiohead ` command +7. :ref:`platformio lib install 124 --version "1.40" ` command +8. :ref:`platformio lib show 124 ` command +9. :ref:`cmd_lib_update` command. diff --git a/docs/envvars.rst b/docs/envvars.rst index 383322f3..8682e51d 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -18,10 +18,7 @@ General PlatformIO uses *General* environment variables for the common operations/commands. -.. _envvar_CI: - -CI -~~ +.. envvar:: CI PlatformIO handles ``CI`` variable which is setup by `Continuous Integration `_ @@ -29,33 +26,21 @@ PlatformIO handles ``CI`` variable which is setup by Currently, PlatformIO uses it to disable prompts. In other words, ``CI=true`` automatically setup -:ref:`PLATFORMIO_SETTING_ENABLE_PROMPTS=false `. +:envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS=false `. -.. _envvar_PLATFORMIO_HOME_DIR: - -PLATFORMIO_HOME_DIR -~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_HOME_DIR Allows to override :ref:`projectconf` option :ref:`projectconf_pio_home_dir`. -.. _envvar_PLATFORMIO_LIB_DIR: - -PLATFORMIO_LIB_DIR -~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_LIB_DIR Allows to override :ref:`projectconf` option :ref:`projectconf_pio_lib_dir`. -.. _envvar_PLATFORMIO_SRC_DIR: - -PLATFORMIO_SRC_DIR -~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SRC_DIR Allows to override :ref:`projectconf` option :ref:`projectconf_pio_src_dir`. -.. _envvar_PLATFORMIO_ENVS_DIR: - -PLATFORMIO_ENVS_DIR -~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_ENVS_DIR Allows to override :ref:`projectconf` option :ref:`projectconf_pio_envs_dir`. @@ -63,74 +48,53 @@ Allows to override :ref:`projectconf` option :ref:`projectconf_pio_envs_dir`. Builder ------- -.. _envvar_PLATFORMIO_BUILD_FLAGS: - -PLATFORMIO_BUILD_FLAGS -~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_BUILD_FLAGS Allows to set :ref:`projectconf` option :ref:`projectconf_build_flags`. -.. _envvar_PLATFORMIO_SRC_BUILD_FLAGS: - -PLATFORMIO_SRC_BUILD_FLAGS -~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SRC_BUILD_FLAGS Allows to set :ref:`projectconf` option :ref:`projectconf_src_build_flags`. -.. _envvar_PLATFORMIO_SRC_FILTER: - -PLATFORMIO_SRC_FILTER -~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SRC_FILTER Allows to set :ref:`projectconf` option :ref:`projectconf_src_filter`. -.. _envvar_PLATFORMIO_EXTRA_SCRIPT: - -PLATFORMIO_EXTRA_SCRIPT -~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_EXTRA_SCRIPT Allows to set :ref:`projectconf` option :ref:`projectconf_extra_script`. + Settings -------- Allows to override PlatformIO settings. You can manage them via :ref:`cmd_settings` command. - -PLATFORMIO_SETTING_AUTO_UPDATE_LIBRARIES -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_AUTO_UPDATE_LIBRARIES Allows to override setting :ref:`setting_auto_update_libraries`. -PLATFORMIO_SETTING_AUTO_UPDATE_PLATFORMS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_AUTO_UPDATE_PLATFORMS Allows to override setting :ref:`setting_auto_update_platforms`. -PLATFORMIO_SETTING_CHECK_LIBRARIES_INTERVAL -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_CHECK_LIBRARIES_INTERVAL Allows to override setting :ref:`setting_check_libraries_interval`. -PLATFORMIO_SETTING_CHECK_PLATFORMIO_INTERVAL -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_CHECK_PLATFORMIO_INTERVAL Allows to override setting :ref:`setting_check_platformio_interval`. -PLATFORMIO_SETTING_CHECK_PLATFORMS_INTERVAL -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_CHECK_PLATFORMS_INTERVAL Allows to override setting :ref:`setting_check_platforms_interval`. -.. _envvar_PLATFORMIO_SETTING_ENABLE_PROMPTS: - -PLATFORMIO_SETTING_ENABLE_PROMPTS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_ENABLE_PROMPTS Allows to override setting :ref:`setting_enable_prompts`. -PLATFORMIO_SETTING_ENABLE_TELEMETRY -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_ENABLE_TELEMETRY Allows to override setting :ref:`setting_enable_telemetry`. diff --git a/docs/faq.rst b/docs/faq.rst index 59e8d400..bea8d298 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -70,11 +70,35 @@ DISABLE** all prompts. It will allow you to avoid blocking. There are a few options: - using :option:`platformio --force` option before each command -- using environment variable :ref:`PLATFORMIO_SETTING_ENABLE_PROMPTS=No ` +- using environment variable :envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS=No ` - disable global setting ``enable_prompts`` via :ref:`cmd_settings` command - masking under Continuous Integration system via environment variable - :ref:`CI=true `. + :envvar:`CI=true `. +.. _faq_troubleshooting_pionotfoundinpath: + +Program ``platformio`` not found in PATH +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Where is ``platformio`` binary installed? Run this command in Terminal + +.. code-block:: bash + + # for Unix + which platformio + echo $PATH + + # for Windows OS + where platformio + echo %PATH% + +For example, ``which platformio`` is equal to ``/usr/local/bin/platformio``, +then `PATH (wiki) `_ +should contain ``/usr/local/bin`` directory. + +**Unix Users**: You can make "symlinks" from ``platformio`` and ``scons`` +programs to the ``bin`` directory which is included in ``$PATH``. For example, +see `issue #272 `_. Windows: ``UnicodeDecodeError: 'ascii' codec can't decode byte`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -101,6 +125,11 @@ Please upgrade *SetupTools* package: $ [sudo] pip uninstall platformio $ [sudo] pip install platformio +Windows: ``AttributeError: 'module' object has no attribute 'packages'`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Answered in `issue #252 `_. + ARM toolchain: ``cc1plus: error while loading shared libraries`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/frameworks/arduino.rst b/docs/frameworks/arduino.rst index b0b06738..ba909a08 100644 --- a/docs/frameworks/arduino.rst +++ b/docs/frameworks/arduino.rst @@ -59,6 +59,13 @@ Adafruit - 32 Kb - 2.5 Kb + * - ``gemma`` + - `Adafruit Gemma `_ + - ATTINY85 + - 8 MHz + - 8 Kb + - 0.5 Kb + * - ``protrinket3`` - `Adafruit Pro Trinket 3V/12MHz (USB) `_ - ATMEGA328P diff --git a/docs/ide/arduino.rst b/docs/ide/arduino.rst index 7cd3b3a5..894cb461 100644 --- a/docs/ide/arduino.rst +++ b/docs/ide/arduino.rst @@ -23,7 +23,6 @@ Integration More detailed information is located in PlatformIO blog: `Integration of PlatformIO library manager to Arduino IDE `_. - Screenshot ---------- diff --git a/docs/ide/clion.rst b/docs/ide/clion.rst index 4f8bc333..5353fd06 100644 --- a/docs/ide/clion.rst +++ b/docs/ide/clion.rst @@ -33,8 +33,18 @@ Since PlatformIO 2.0 you can generate CLion compatible project using platformio init --ide clion --board %TYPE% -Then import this project from start menu or via ``File > Import Project>`` and -specify root directory where is located :ref:`projectconf`. +Then: + +1. Import this project via ``Menu: File > Import Project`` + and specify root directory where is located :ref:`projectconf` +2. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``) +3. Build project: ``Menu: Run > Build``. + +There are 3 predefined targets for building: + +* ``PLATFORMIO_BUILD`` - build project without auto-uploading +* ``PLATFORMIO_UPLOAD`` - build and upload (if no errors) +* ``PLATFORMIO_CLEAN`` - clean compiled objects and etc. .. warning:: CLion is still in the development stage, so some of the features (like, @@ -49,3 +59,11 @@ Screenshot .. image:: ../_static/ide-platformio-clion.png :target: http://docs.platformio.org/en/latest/_static/ide-platformio-clion.png + +Examples +-------- + +"Blink" Project +^^^^^^^^^^^^^^^ + +Source code of `CLion "Blink" Project `_. diff --git a/docs/ide/eclipse.rst b/docs/ide/eclipse.rst index e40fcbff..753ff838 100644 --- a/docs/ide/eclipse.rst +++ b/docs/ide/eclipse.rst @@ -37,19 +37,31 @@ Since PlatformIO 2.0 you can generate Eclipse compatible project using platformio init --ide eclipse --board %TYPE% -Then import this project via ``File > Import... > General > Existing Projects -into Workspace > Next`` and specify root directory where is located -:ref:`projectconf`. +Then: + +1. Import this project via + ``Menu: File > Import... > General > Existing Projects into Workspace > Next`` + and specify root directory where is located :ref:`projectconf` +2. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``) +3. Build project: ``Menu: Project > Build Project``. + Manual Integration ^^^^^^^^^^^^^^^^^^ -More detailed information is located in PlatformIO blog: `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO `_. - -`More examples (TI MSP430, TI TIVA, etc.) `_ +* `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO `_ +* `Improvised MBED FRDM-K64F Eclipse/PlatformIO Setup and Software Installation `_ Screenshot ---------- .. image:: ../_static/ide-platformio-eclipse.png :target: http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio + +Examples +-------- + +"Blink" Project +^^^^^^^^^^^^^^^ + +Source code of `Eclipse "Blink" Project `_. diff --git a/docs/ide/qtcreator.rst b/docs/ide/qtcreator.rst index e53ff505..8e687052 100644 --- a/docs/ide/qtcreator.rst +++ b/docs/ide/qtcreator.rst @@ -18,6 +18,11 @@ page for more detailed information. Integration ----------- +.. note:: + Please verify that folder where is located ``platformio`` program is added + to `PATH (wiki) `_ environment + variable. See FAQ: :ref:`faq_troubleshooting_pionotfoundinpath`. + Project Generator ^^^^^^^^^^^^^^^^^ @@ -29,10 +34,42 @@ Since PlatformIO 2.0 you can generate Qt Creator compatible project using platformio init --ide qtcreator --board %TYPE% -Then import this project via ``File > New File or Project > Import Project`` -and specify root directory where is located :ref:`projectconf`. +Then: -After import, we need to delete default build and clean steps and configure project with PlatformIO source code builder (click on Projects label on left menu or ``Ctrl+5`` shortcut): +1. Import project via ``File > Open File or Project`` and select + ``platformio.pro`` from the folder where is located :ref:`projectconf` +2. Select default desktop kit and click on ``Configure Project`` (``Projects`` + mode, left panel) +3. Set ``General > Build directory`` to the project directory where + is located :ref:`projectconf` +4. Remove all items from ``Build Steps``, click on + ``Build Steps > Add Build Step > Custom Process Step`` and set: + + * **Command**: ``platformio`` + * **Arguments**: ``-f -c qtcreator run`` + * **Working directory**: ``%{buildDir}`` + +5. Remove all items from ``Clean Steps``, click on + ``Clean Steps > Add Clean Step > Custom Process Step`` and set: + + * **Command**: ``platformio`` + * **Arguments**: ``-f -c qtcreator run --target clean`` + * **Working directory**: ``%{buildDir}`` + +6. Update ``PATH`` in ``Build Environment > PATH > EDIT`` with the result of + this command (paste in Terminal): + +.. code-block:: shell + + # Linux, Mac + echo $PATH + + # Windows + echo %PATH% + +7. Switch to ``Edit`` mode (left panel) and open source file from ``src`` + directory (``*.c, *.cpp, *.ino, etc.``) +8. Build project: ``Menu: Build > Build All``. .. image:: ../_static/ide-platformio-qtcreator-3.png :target: http://docs.platformio.org/en/latest/_static/ide-platformio-qtcreator-3.png @@ -129,12 +166,21 @@ Edit the content to match the code described below. framework = arduino board = uno - Conclusion ----------- +~~~~~~~~~~ -Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build > Build All``: +Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build > Build All``. + +Screenshot +---------- .. image:: ../_static/ide-platformio-qtcreator-7.png :target: http://docs.platformio.org/en/latest/_static/ide-platformio-qtcreator-7.png +Examples +-------- + +"Blink" Project +^^^^^^^^^^^^^^^ + +Source code of `Qt Creator "Blink" Project `_. diff --git a/docs/ide/sublimetext.rst b/docs/ide/sublimetext.rst index 9e6ab34e..7241c25c 100644 --- a/docs/ide/sublimetext.rst +++ b/docs/ide/sublimetext.rst @@ -29,12 +29,23 @@ Since PlatformIO 2.0 you can generate Sublime Text compatible project using platformio init --ide sublimetext --board %TYPE% -Then import this project via ``Project > Open Project...`` and specify root -directory where is located :ref:`projectconf`. +Then: + +1. Import project via ``Menu: Project > Open Project...`` and select + ``platformio.sublime-project`` from the folder where is located :ref:`projectconf` +2. Select PlatformIO as build system: ``Menu: Tools > Build System > PlatformIO`` +3. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``) +4. Build project: ``Menu: Tools > Build``. + Manual Integration ^^^^^^^^^^^^^^^^^^ +.. note:: + Please verify that folder where is located ``platformio`` program is added + to `PATH (wiki) `_ environment + variable. See FAQ: :ref:`faq_troubleshooting_pionotfoundinpath`. + Initial configuration ~~~~~~~~~~~~~~~~~~~~~ @@ -45,17 +56,17 @@ described below: .. code-block:: bash { - "cmd": ["platformio", "--force", "run"], + "cmd": ["platformio", "-f", "-c", "sublimetext", "run"], "working_dir": "${project_path:${folder}}", "variants": [ { "name": "Clean", - "cmd": ["platformio", "--force", "run", "--target", "clean"] + "cmd": ["platformio", "-f", "-c", "sublimetext", "run", "--target", "clean"] }, { "name": "Upload", - "cmd": ["platformio", "--force", "run", "--target", "upload"] + "cmd": ["platformio", "-f", "-c", "sublimetext", "run", "--target", "upload"] } ] } @@ -139,8 +150,19 @@ Copy the source code which is described below to it. board = uno Conclusion ----------- +~~~~~~~~~~ Taking everything into account, we can open project directory in Sublime Text using ``Menu: File > Open Folder`` and build it with shortcut ``Ctrl+B`` (Windows/Linux) or ``Cmd+B`` (Mac), clean project with shortcut ``F11`` and upload firmware to target with shortcut ``F12``. +Screenshot +---------- + .. image:: ../_static/ide-sublime-text-platformio-newproject-5.png + +Examples +-------- + +"Blink" Project +^^^^^^^^^^^^^^^ + +Source code of `Sublime Text "Blink" Project `_. diff --git a/docs/ide/vim.rst b/docs/ide/vim.rst index a9ccc115..cad03289 100644 --- a/docs/ide/vim.rst +++ b/docs/ide/vim.rst @@ -15,6 +15,11 @@ This software can be used with: Integration ----------- +.. note:: + Please verify that folder where is located ``platformio`` program is added + to `PATH (wiki) `_ environment + variable. See FAQ: :ref:`faq_troubleshooting_pionotfoundinpath`. + Recommended bundles: * Syntax highlight - `Arduino-syntax-file `_ @@ -30,10 +35,10 @@ Put to the project directory ``Makefile`` wrapper with contents: #PATH := /usr/local/bin:$(PATH) all: - platformio --force run --target upload + platformio -f -c vim run --target upload clean: - platformio --force run --target clean + platformio -f -c vim run --target clean Now, in VIM ``cd /path/to/this/project`` and press ``Ctrl+B`` or ``Cmd+B`` diff --git a/docs/ide/visualstudio.rst b/docs/ide/visualstudio.rst index ef365e78..26885b39 100644 --- a/docs/ide/visualstudio.rst +++ b/docs/ide/visualstudio.rst @@ -18,6 +18,11 @@ page for more detailed information. Integration ----------- +.. note:: + Please verify that folder where is located ``platformio`` program is added + to `PATH (wiki) `_ environment + variable. See FAQ: :ref:`faq_troubleshooting_pionotfoundinpath`. + Project Generator ^^^^^^^^^^^^^^^^^ @@ -29,8 +34,12 @@ Since PlatformIO 2.0 you can generate Visual Studio compatible project using platformio init --ide visualstudio --board %TYPE% -Then import this project via ``File->Open->Project/Solution`` and specify root -directory where is located :ref:`projectconf`. +Then: + +1. Import this project via ``Menu: File > Open > Project/Solution`` + and specify root directory where is located :ref:`projectconf` +2. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``) +3. Build project: ``Menu: Build > Build Solution``. Manual Integration ^^^^^^^^^^^^^^^^^^ @@ -118,9 +127,20 @@ Copy the source code which is described below to it. Conclusion ----------- +~~~~~~~~~~ -Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build > Build Solution``: +Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build > Build Solution``. + +Screenshot +---------- .. image:: ../_static/ide-vs-platformio-newproject-8.png :target: http://docs.platformio.org/en/latest/_static/ide-vs-platformio-newproject-8.png + +Examples +-------- + +"Blink" Project +^^^^^^^^^^^^^^^ + +Source code of `Visual Studio "Blink" Project `_. diff --git a/docs/index.rst b/docs/index.rst index a0d4a37c..febb2777 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -19,6 +19,7 @@ libOpenCM3, etc.* `Issues `_ * `Blog `_ | `Reddit `_ | + `Facebook `_ | `Twitter `_ You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO* @@ -60,18 +61,40 @@ Contents -------- .. toctree:: + :caption: Getting Started :maxdepth: 2 - quickstart + demo installation + quickstart + userguide/index + +.. toctree:: + :caption: Configuration + :maxdepth: 2 + projectconf envvars + +.. toctree:: + :caption: Instruments + :maxdepth: 2 + Platforms & Boards frameworks/index + +.. toctree:: + :caption: Integration + :maxdepth: 2 + librarymanager/index - userguide/index ci/index ide + +.. toctree:: + :caption: Miscellaneous + :maxdepth: 2 + articles FAQ history diff --git a/docs/installation.rst b/docs/installation.rst index 20e447de..20062390 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -18,57 +18,69 @@ System requirements * Mac OS X * Linux, +ARM * Windows -* `Python 2.6 or Python 2.7 `_ +* Python 2.6.x or Python 2.7.x(recommended) All commands below should be executed in `Command-line `_ -application: +application (Terminal): -* *Mac OS X / Linux* this is *Terminal* application. -* *Windows* this is - `Command Prompt `_ (``cmd.exe``) - application. +* Mac OS X / Linux – *Terminal* application +* Windows – ``cmd.exe`` application. -.. warning:: - If you are going to run *PlatformIO* from **subprocess**, you - :ref:`MUST DISABLE ` all prompts. - It will allow you to avoid blocking. - -.. note:: - **Linux Users:** Don't forget to install "udev" rules file - `99-platformio-udev.rules `_ (an instruction is located in the file). - - **Windows Users:** Please check that you have correctly installed USB driver - from board manufacturer - -Troubleshooting ---------------- - -For further details, frequently questions, please refer to :ref:`faq`. - -Installation Methods +Installation options -------------------- -Please *choose one of* the following installation methods: +.. warning:: + **Windows OS**: 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. -Super-Quick (Mac / Linux) -~~~~~~~~~~~~~~~~~~~~~~~~~ +Please *choose one of* the following installation options: -To install or upgrade *PlatformIO* paste that at a *Terminal* prompt -(**you MIGHT need** to run ``sudo`` first, just for installation): +Python Package Manager +~~~~~~~~~~~~~~~~~~~~~~ + +The latest stable version of PlatformIO may be done via +`pip `_ as follows: .. code-block:: bash - [sudo] python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)" + # update dependent packages to the latest versions + pip install -U pip setuptools + + # install the latest version of PlatformIO + pip install -U scons platformio + +Note that you may run into permissions issues running these commands. You have +a few options here: + +* Run with ``sudo`` to install PlatformIO and dependencies globally +* Specify the `pip install --user `_ + option to install local to your user +* Run the command in a `virtualenv `_ local to a + specific project working set. + +Installer Script +~~~~~~~~~~~~~~~~ + +Super-Quick (Mac / Linux) +''''''''''''''''''''''''' + +To install or upgrade *PlatformIO* paste that at a *Terminal* prompt +(**MAY require** administrator access ``sudo``): + +.. code-block:: bash + + python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)" -Installer Script (Mac / Linux / Windows) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Local Download (Mac / Linux / Windows) +'''''''''''''''''''''''''''''''''''''' -To install or upgrade *PlatformIO*, download +To install or upgrade *PlatformIO*, download (save as...) `get-platformio.py `_ -script. Then run the following (**you MIGHT need** to run ``sudo`` first, -just for installation): +script. Then run the following (**MAY require** administrator access ``sudo``): .. code-block:: bash @@ -96,9 +108,9 @@ Full Guide .. code-block:: bash - $ python --version + python --version -*Windows OS* Users only: +*Windows Users* only: * `Download Python 2.7 `_ and install it. * Add to PATH system variable ``;C:\Python27;C:\Python27\Scripts;`` and @@ -106,30 +118,21 @@ Full Guide article `How to set the path and environment variables in Windows `_. - -2. Check a ``pip`` tool for installing and managing *Python* packages: +2. Install a ``platformio`` and related packages: .. code-block:: bash - $ pip search platformio - -You should see short information about ``platformio`` package. + pip install -U pip setuptools + pip install -U scons platformio If your computer does not recognize ``pip`` command, try to install it first using `these instructions `_. -3. Install a ``platformio`` and related packages: +For upgrading ``platformio`` to the latest version: .. code-block:: bash - $ pip install platformio && pip install --egg scons - -For upgrading the ``platformio`` to new version please use this command: - -.. code-block:: bash - - $ pip install -U platformio - + pip install -U platformio Development Version ~~~~~~~~~~~~~~~~~~~ @@ -141,8 +144,26 @@ Install the latest PlatformIO from the ``develop`` branch: .. code-block:: bash - $ pip install https://github.com/platformio/platformio/archive/develop.zip + pip install -U pip setuptools + pip install -U https://github.com/platformio/platformio/archive/develop.zip If you want to be up-to-date with the latest ``develop`` version of PlatformIO, then you need to re-install PlatformIO each time if you see the new commits in `PlatformIO GitHub repository (branch: develop) `_. + +Troubleshooting +--------------- + +.. warning:: + If you are going to run *PlatformIO* from **subprocess**, you + :ref:`MUST DISABLE ` all prompts. + It will allow you to avoid blocking. + +.. note:: + **Linux OS**: Don't forget to install "udev" rules file + `99-platformio-udev.rules `_ (an instruction is located in the file). + + **Windows OS**: Please check that you have correctly installed USB driver + from board manufacturer + +For further details, frequently questions, please refer to :ref:`faq`. diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index 0ffb8f67..7a536133 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -78,6 +78,13 @@ Adafruit - 32 Kb - 2.5 Kb + * - ``gemma`` + - `Adafruit Gemma `_ + - ATTINY85 + - 8 MHz + - 8 Kb + - 0.5 Kb + * - ``protrinket3`` - `Adafruit Pro Trinket 3V/12MHz (USB) `_ - ATMEGA328P diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index dfbd0bdc..2521f0a0 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -108,9 +108,21 @@ Packages * - ``toolchain-atmelavr`` - `avr-gcc `_, `GDB `_, `AVaRICE `_, `SimulAVR `_ + * - ``toolchain-gccarmlinuxgnueabi`` + - `GCC for Linux ARM GNU EABI `_, `GDB `_ + * - ``toolchain-gccarmnoneeabi`` - `gcc-arm-embedded `_, `GDB `_ + * - ``toolchain-gcclinux32`` + - `GCC for Linux i686 `_ + + * - ``toolchain-gcclinux64`` + - `GCC for Linux x86_64 `_ + + * - ``toolchain-gccmingw32`` + - `MinGW `_ + * - ``toolchain-timsp430`` - `msp-gcc `_, `GDB `_ @@ -200,7 +212,7 @@ Build Script Platform's build script is based on a next-generation build tool named `SCons `_. PlatformIO has own built-in firmware builder -``env.BuildFirmware`` with the nested libraries search. Please look into a +``env.BuildProgram`` with the nested libraries search. Please look into a base template of ``test-builder.py``. .. code-block:: python @@ -260,7 +272,7 @@ base template of ``test-builder.py``. # # Target: Build executable and linkable firmware # - target_elf = env.BuildFirmware() + target_elf = env.BuildProgram() # # Target: Build the .bin file @@ -383,7 +395,7 @@ and copy there two files: # Target: Build executable and linkable firmware # - target_elf = env.BuildFirmware() + target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/docs/platforms/index.rst b/docs/platforms/index.rst index 1ed7a115..f39029f9 100644 --- a/docs/platforms/index.rst +++ b/docs/platforms/index.rst @@ -11,6 +11,9 @@ Also it has pre-configured settings for most popular **Embedded Platform Boards**. You have no need to specify in :ref:`projectconf` type or frequency of MCU, upload protocol or etc. Please use ``board`` option. +Embedded +-------- + .. toctree:: :maxdepth: 2 @@ -25,5 +28,24 @@ MCU, upload protocol or etc. Please use ``board`` option. teensy timsp430 titiva + +Desktop +------- + +.. toctree:: + :maxdepth: 2 + + native + linux_arm + linux_i686 + linux_x86_64 + windows_x86 + +Own Platform/Board +------------------ + +.. toctree:: + :maxdepth: 2 + creating_platform creating_board diff --git a/docs/platforms/linux_arm.rst b/docs/platforms/linux_arm.rst new file mode 100644 index 00000000..9a3b3f02 --- /dev/null +++ b/docs/platforms/linux_arm.rst @@ -0,0 +1,21 @@ +.. _platform_linux_arm: + +Platform ``linux_arm`` +====================== +Linux ARM is a Unix-like and mostly POSIX-compliant computer operating system (OS) assembled under the model of free and open-source software development and distribution. Using host OS (Mac OS X, Linux ARM) you can build native application for Linux ARM platform. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``toolchain-gccarmlinuxgnueabi`` + - `GCC for Linux ARM GNU EABI `_, `GDB `_ \ No newline at end of file diff --git a/docs/platforms/linux_i686.rst b/docs/platforms/linux_i686.rst new file mode 100644 index 00000000..8b0e18d4 --- /dev/null +++ b/docs/platforms/linux_i686.rst @@ -0,0 +1,21 @@ +.. _platform_linux_i686: + +Platform ``linux_i686`` +======================= +Linux i686 (32-bit) is a Unix-like and mostly POSIX-compliant computer operating system (OS) assembled under the model of free and open-source software development and distribution. Using host OS (Mac OS X or Linux 32-bit) you can build native application for Linux i686 platform. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``toolchain-gcclinux32`` + - `GCC for Linux i686 `_ \ No newline at end of file diff --git a/docs/platforms/linux_x86_64.rst b/docs/platforms/linux_x86_64.rst new file mode 100644 index 00000000..a19f02a4 --- /dev/null +++ b/docs/platforms/linux_x86_64.rst @@ -0,0 +1,21 @@ +.. _platform_linux_x86_64: + +Platform ``linux_x86_64`` +========================= +Linux x86_64 (64-bit) is a Unix-like and mostly POSIX-compliant computer operating system (OS) assembled under the model of free and open-source software development and distribution. Using host OS (Mac OS X or Linux 64-bit) you can build native application for Linux x86_64 platform. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``toolchain-gcclinux64`` + - `GCC for Linux x86_64 `_ \ No newline at end of file diff --git a/docs/platforms/native.rst b/docs/platforms/native.rst new file mode 100644 index 00000000..5a01d633 --- /dev/null +++ b/docs/platforms/native.rst @@ -0,0 +1,9 @@ +.. _platform_native: + +Platform ``native`` +=================== +Native development platform is intended to be used for desktop OS. This platform uses built-in tool chains (preferable based on GCC), frameworks, libs from particular OS where it will be run. + +For more detailed information please visit `vendor site `_. + +.. contents:: \ No newline at end of file diff --git a/docs/platforms/windows_x86.rst b/docs/platforms/windows_x86.rst new file mode 100644 index 00000000..a8b72c95 --- /dev/null +++ b/docs/platforms/windows_x86.rst @@ -0,0 +1,21 @@ +.. _platform_windows_x86: + +Platform ``windows_x86`` +======================== +Windows x86 (32-bit) is a metafamily of graphical operating systems developed and marketed by Microsoft. Using host OS (Windows, Linux 32/64 or Mac OS X) you can build native application for Windows x86 platform. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``toolchain-gccmingw32`` + - `MinGW `_ \ No newline at end of file diff --git a/docs/projectconf.rst b/docs/projectconf.rst index 34c0feeb..a3641e5c 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -42,7 +42,7 @@ A default value is User's home directory: * Windows ``%HOMEPATH%\.platformio`` This option can be overridden by global environment variable -:ref:`envvar_PLATFORMIO_HOME_DIR`. +:envvar:`PLATFORMIO_HOME_DIR`. .. _projectconf_pio_lib_dir: @@ -55,7 +55,7 @@ This directory is used to store external libraries downloaded by A default value is ``%home_dir%/lib``. This option can be overridden by global environment variable -:ref:`envvar_PLATFORMIO_LIB_DIR`. +:envvar:`PLATFORMIO_LIB_DIR`. .. note:: You can put here your own/private libraries. The source code of each @@ -73,7 +73,7 @@ command. A default value is ``%project_dir%/src``. This option can be overridden by global environment variable -:ref:`envvar_PLATFORMIO_SRC_DIR`. +:envvar:`PLATFORMIO_SRC_DIR`. .. note:: This option is useful for people who migrate from Arduino/Energia IDEs where @@ -97,7 +97,7 @@ next build operation. A default value is ``%project_dir%/.pioenvs``. This option can be overridden by global environment variable -:ref:`envvar_PLATFORMIO_ENVS_DIR`. +:envvar:`PLATFORMIO_ENVS_DIR`. .. note:: If you have any problems with building your Project environmets which @@ -267,7 +267,7 @@ processes: ``-l``. This option can be set by global environment variable -:ref:`envvar_PLATFORMIO_BUILD_FLAGS`. +:envvar:`PLATFORMIO_BUILD_FLAGS`. Example: @@ -309,7 +309,7 @@ but will be applied only for the project source code from :ref:`projectconf_pio_src_dir` directory. This option can be set by global environment variable -:ref:`envvar_PLATFORMIO_SRC_BUILD_FLAGS`. +:envvar:`PLATFORMIO_SRC_BUILD_FLAGS`. .. _projectconf_src_filter: @@ -331,7 +331,7 @@ By default, ``src_filter`` is predefined to exclude ``.git`` and ``svn`` repository folders and exclude ``examples`` folder. This option can be set by global environment variable -:ref:`envvar_PLATFORMIO_SRC_FILTER`. +:envvar:`PLATFORMIO_SRC_FILTER`. ``lib_install`` ^^^^^^^^^^^^^^^ @@ -404,7 +404,7 @@ section of `SCons documentation `_. This option can be set by global environment variable -:ref:`envvar_PLATFORMIO_EXTRA_SCRIPT`. +:envvar:`PLATFORMIO_EXTRA_SCRIPT`. Example, specify own upload command for :ref:`platform_atmelavr`: @@ -435,14 +435,8 @@ See built-in examples of `PlatformIO build scripts PLEASE EDIT ME <-| src - Put your source code here - lib - Put here project specific or 3-rd party libraries + lib - Put here project specific (private) libraries Do you want to continue? [y/N]: y Project has been successfully initialized! Useful commands: diff --git a/docs/userguide/cmd_init.rst b/docs/userguide/cmd_init.rst index 02e140de..29fedc47 100644 --- a/docs/userguide/cmd_init.rst +++ b/docs/userguide/cmd_init.rst @@ -23,8 +23,12 @@ This command will create: * :ref:`projectconf` * ``src`` - a source directory. Put your source code here -* ``lib`` - a directory for the project specific libraries. PlatformIO will - compile them to static libraries and link to executable file +* ``lib`` - a directory for the project specific (private) libraries. + PlatformIO will compile them to static libraries and link to executable file + +.. note:: + The source code of each library should be placed in separate directory. + For example, ``lib/private_lib/[here are source files]``. Options ------- @@ -70,11 +74,11 @@ allows you to disable firmware auto-uploading by default. --env-prefix An environment prefix which will be used with pair in board type. - For example, the default environment name for ``teensy_31`` board will be ``[env:teensy_31]``. + Examples -------- @@ -91,7 +95,7 @@ Examples The next files/directories will be created in *** platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| src - Put your source code here - lib - Put here project specific or 3-rd party libraries + lib - Put here project specific (private) libraries Do you want to continue? [y/N]: y Project has been successfully initialized! Useful commands: @@ -109,7 +113,7 @@ Examples The next files/directories will be created in *** platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| src - Put your source code here - lib - Put here project specific or 3-rd party libraries + lib - Put here project specific (private) libraries Do you want to continue? [y/N]: y Project has been successfully initialized! Useful commands: @@ -133,7 +137,7 @@ Examples The next files/directories will be created in *** platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| src - Put your source code here - lib - Put here project specific or 3-rd party libraries + lib - Put here project specific (private) libraries Do you want to continue? [y/N]: y Project has been successfully initialized! Useful commands: diff --git a/docs/userguide/cmd_run.rst b/docs/userguide/cmd_run.rst index 62cd265c..d1a52aa7 100644 --- a/docs/userguide/cmd_run.rst +++ b/docs/userguide/cmd_run.rst @@ -33,7 +33,16 @@ Process specified environments .. option:: -t, --target -Process specified targets +Process specified targets. + +Pre-built targets: + +* ``clean`` delete compiled object files, libraries and firmware/program binaries +* ``upload`` enable "auto-uploading" for embedded platforms after building + operation +* ``uploadlazy`` upload existing firmware without project rebuilding +* ``envdump`` dump current build environment +* ``size`` print the size of the sections in a firmware/program .. option:: --upload-port @@ -42,10 +51,10 @@ Upload port of embedded board. To print all available ports use :ref:`cmd_serialports` command .. option:: - --build-dir + -d, --project-dir -Specify the path to project directory. By default, ``--build-dir`` is equal to -current working directory (``CWD``). +Specify the path to project directory. By default, ``--project-dir`` is equal +to current working directory (``CWD``). .. option:: -v, --verbose diff --git a/docs/userguide/index.rst b/docs/userguide/index.rst index 6c52a9e5..5f72d899 100644 --- a/docs/userguide/index.rst +++ b/docs/userguide/index.rst @@ -18,7 +18,7 @@ Options .. program:: platformio .. option:: - --force, - f + --force, -f Force to accept any confirmation prompts. This option allows to avoid an issue with :ref:`faq_troubleshooting_pioblocksprompt` @@ -29,7 +29,7 @@ with :ref:`faq_troubleshooting_pioblocksprompt` Show the version of PlatformIO .. option:: - --help + --help, -h Show help for the available options and commands diff --git a/docs/userguide/platforms/index.rst b/docs/userguide/platforms/index.rst index 7a582752..cdb6211e 100644 --- a/docs/userguide/platforms/index.rst +++ b/docs/userguide/platforms/index.rst @@ -1,7 +1,7 @@ .. _userguide_platforms: -Platforms Manager -================= +Platform Manager +================ To print all available commands and options use: diff --git a/examples/desktop/hello-world/README.rst b/examples/desktop/hello-world/README.rst new file mode 100644 index 00000000..27f3cb49 --- /dev/null +++ b/examples/desktop/hello-world/README.rst @@ -0,0 +1,18 @@ +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `source code with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platformio-develop/examples/desktop/hello-world + + # Process example project + > platformio run + + # Clean build files + > platformio run --target clean diff --git a/examples/desktop/hello-world/platformio.ini b/examples/desktop/hello-world/platformio.ini new file mode 100644 index 00000000..9ab3f31f --- /dev/null +++ b/examples/desktop/hello-world/platformio.ini @@ -0,0 +1,51 @@ +# +# 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:native] +platform = native + +# +# If host OS is Mac OS X +# + +# [env:darwin_x86_64] +# platform = native + +# [env:linux_i686] +# platform = linux_i686 + +# [env:linux_x86_64] +# platform = linux_x86_64 + +# [env:windows_x86] +# platform = windows_x86 + +# [env:linux_armv6l] +# platform = linux_arm +# build_flags = -march=armv6 + +# +# If host OS is Linux +# + +# [env:linux_i686] +# platform = linux_i686 + +# [env:linux_x86_64] +# platform = linux_x86_64 diff --git a/examples/desktop/hello-world/src/main.c b/examples/desktop/hello-world/src/main.c new file mode 100644 index 00000000..21049ca9 --- /dev/null +++ b/examples/desktop/hello-world/src/main.c @@ -0,0 +1,7 @@ +#include + +int main() +{ + printf("Hello World from PlatformIO!\n"); + return 0; +} diff --git a/examples/ide-eclipse/README.rst b/examples/ide-eclipse/README.rst deleted file mode 100644 index c29734d7..00000000 --- a/examples/ide-eclipse/README.rst +++ /dev/null @@ -1,14 +0,0 @@ -Eclipse IDE Integration -======================= - -The detailed information and steps are described in this article: -`Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO `_. - - -.. image:: http://www.ikravets.com/wp-content/uploads/2014/06/eclipse_platformio_build_arduino_uno.png - :width: 850px - :target: http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio - -.. image:: http://www.ikravets.com/wp-content/uploads/2014/06/eclipse_debugging_result_1-1024x775.png - :width: 850px - :target: http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio diff --git a/examples/ide-eclipse/arduino_pro5/src/main.c b/examples/ide-eclipse/arduino_pro5/src/main.c deleted file mode 100644 index 07fc3605..00000000 --- a/examples/ide-eclipse/arduino_pro5/src/main.c +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (C) Ivan Kravets - * See LICENSE for details. - */ - -#include "Arduino.h" -#define WLED 13 // Most Arduino boards already have an LED attached to pin 13 on the board itself - -void setup() -{ - pinMode(WLED, OUTPUT); // set pin as output -} - -void loop() -{ - digitalWrite(WLED, HIGH); // set the LED on - delay(1000); // wait for a second - digitalWrite(WLED, LOW); // set the LED off - delay(1000); // wait for a second -} diff --git a/examples/ide-eclipse/atmelavr_atmega168/.cproject b/examples/ide-eclipse/atmelavr_atmega168/.cproject deleted file mode 100644 index e544fe2b..00000000 --- a/examples/ide-eclipse/atmelavr_atmega168/.cproject +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/ide-eclipse/atmelavr_atmega168/.project b/examples/ide-eclipse/atmelavr_atmega168/.project deleted file mode 100644 index b42a0017..00000000 --- a/examples/ide-eclipse/atmelavr_atmega168/.project +++ /dev/null @@ -1,27 +0,0 @@ - - - atmelavr_atmega168 - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/examples/ide-eclipse/atmelavr_atmega168/.settings/org.eclipse.cdt.codan.core.prefs b/examples/ide-eclipse/atmelavr_atmega168/.settings/org.eclipse.cdt.codan.core.prefs deleted file mode 100644 index 77386c23..00000000 --- a/examples/ide-eclipse/atmelavr_atmega168/.settings/org.eclipse.cdt.codan.core.prefs +++ /dev/null @@ -1,67 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.cdt.codan.checkers.errnoreturn=Warning -org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false} -org.eclipse.cdt.codan.checkers.errreturnvalue=Error -org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.checkers.noreturn=Error -org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false} -org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error -org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error -org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning -org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error -org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning -org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false} -org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning -org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()} -org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error -org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning -org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true} -org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error -org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error -org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error -org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error -org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error -org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error -org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error -org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info -org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()} -org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning -org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error -org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error -org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error -org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning -org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning -org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning -org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()} -org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning -org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false} -org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning -org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false} -org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error -org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} -org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning -org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true} -org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning -org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true} -org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning -org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")} -org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error -org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} diff --git a/examples/ide-eclipse/atmelavr_atmega168/platformio.ini b/examples/ide-eclipse/atmelavr_atmega168/platformio.ini deleted file mode 100644 index f195b366..00000000 --- a/examples/ide-eclipse/atmelavr_atmega168/platformio.ini +++ /dev/null @@ -1,28 +0,0 @@ -# -# 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:atmelavr_atmega168] -platform = atmelavr -board_mcu = atmega168 -board_f_cpu = 16000000L - -upload_protocol = arduino -upload_speed = 19200 - -# targets = upload diff --git a/examples/ide-eclipse/atmelavr_atmega168/src/main.c b/examples/ide-eclipse/atmelavr_atmega168/src/main.c deleted file mode 100644 index 757d3c5f..00000000 --- a/examples/ide-eclipse/atmelavr_atmega168/src/main.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (C) Ivan Kravets - * See LICENSE for details. - */ - -#include -#include - -int main(void) -{ - // make the LED pin an output for PORTB5 - DDRB = 1 << 5; - - while (1) - { - _delay_ms(500); - - // toggle the LED - PORTB ^= 1 << 5; - } - - return 0; -} diff --git a/examples/ide-eclipse/tilaunchpad_msp430g2/.cproject b/examples/ide-eclipse/tilaunchpad_msp430g2/.cproject deleted file mode 100644 index 398d9cbf..00000000 --- a/examples/ide-eclipse/tilaunchpad_msp430g2/.cproject +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/ide-eclipse/tilaunchpad_msp430g2/.project b/examples/ide-eclipse/tilaunchpad_msp430g2/.project deleted file mode 100644 index 14e9c185..00000000 --- a/examples/ide-eclipse/tilaunchpad_msp430g2/.project +++ /dev/null @@ -1,27 +0,0 @@ - - - tilaunchpad_msp430g2 - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/examples/ide-eclipse/tilaunchpad_msp430g2/platformio.ini b/examples/ide-eclipse/tilaunchpad_msp430g2/platformio.ini deleted file mode 100644 index 4a112a96..00000000 --- a/examples/ide-eclipse/tilaunchpad_msp430g2/platformio.ini +++ /dev/null @@ -1,27 +0,0 @@ -# -# 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:launchpad_msp430g2] -platform = timsp430 -board_mcu = msp430g2553 -board_f_cpu = 16000000L - -upload_protocol = rf2500 - -# targets = upload diff --git a/examples/ide-eclipse/tilaunchpad_msp430g2/src/main.c b/examples/ide-eclipse/tilaunchpad_msp430g2/src/main.c deleted file mode 100644 index 38a421a5..00000000 --- a/examples/ide-eclipse/tilaunchpad_msp430g2/src/main.c +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (C) Ivan Kravets - * See LICENSE for details. - */ - -#include - -int main(void) -{ - WDTCTL = WDTPW + WDTHOLD; - - // make the LED pin an output for P1.0 - P1DIR |= 0x01; - - volatile int i; - - while (1) - { - for (i = 0; i < 10000; i++); - - // toggle the LED - P1OUT ^= 0x01; - } - - return 0; -} diff --git a/examples/ide-eclipse/titiva_lm4f120/.cproject b/examples/ide-eclipse/titiva_lm4f120/.cproject deleted file mode 100644 index 04a84c44..00000000 --- a/examples/ide-eclipse/titiva_lm4f120/.cproject +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/ide-eclipse/titiva_lm4f120/.project b/examples/ide-eclipse/titiva_lm4f120/.project deleted file mode 100644 index 36085734..00000000 --- a/examples/ide-eclipse/titiva_lm4f120/.project +++ /dev/null @@ -1,27 +0,0 @@ - - - titiva_lm4f120 - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/examples/ide-eclipse/titiva_lm4f120/src/main.c b/examples/ide-eclipse/titiva_lm4f120/src/main.c deleted file mode 100644 index 3a69d908..00000000 --- a/examples/ide-eclipse/titiva_lm4f120/src/main.c +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (C) Ivan Kravets - * See LICENSE for details. - */ - -#define false 0 -#define true 1 -typedef int bool; - -#include -#include "inc/hw_memmap.h" -#include "driverlib/gpio.h" -#include "driverlib/sysctl.h" - -#define LED_RED GPIO_PIN_1 -#define LED_BLUE GPIO_PIN_2 -#define LED_GREEN GPIO_PIN_3 - - -void setup() { - SysCtlClockSet( - SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); - - SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); - GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN); -} - - -void loop() { - GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_RED); - SysCtlDelay(3000000); - GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_BLUE); - SysCtlDelay(3000000); - GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_GREEN); - SysCtlDelay(3000000); -} diff --git a/examples/ide/clion/.idea/clion.iml b/examples/ide/clion/.idea/clion.iml new file mode 100644 index 00000000..352882ec --- /dev/null +++ b/examples/ide/clion/.idea/clion.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/examples/ide/clion/.idea/misc.xml b/examples/ide/clion/.idea/misc.xml new file mode 100644 index 00000000..6b328020 --- /dev/null +++ b/examples/ide/clion/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/examples/ide/clion/.idea/modules.xml b/examples/ide/clion/.idea/modules.xml new file mode 100644 index 00000000..9ce81f04 --- /dev/null +++ b/examples/ide/clion/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/examples/ide/clion/.idea/platformio.iml b/examples/ide/clion/.idea/platformio.iml new file mode 100644 index 00000000..bc2cd874 --- /dev/null +++ b/examples/ide/clion/.idea/platformio.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/examples/ide/clion/.idea/vcs.xml b/examples/ide/clion/.idea/vcs.xml new file mode 100644 index 00000000..6564d52d --- /dev/null +++ b/examples/ide/clion/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/examples/ide/clion/.idea/workspace.xml b/examples/ide/clion/.idea/workspace.xml new file mode 100644 index 00000000..214a2cba --- /dev/null +++ b/examples/ide/clion/.idea/workspace.xml @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + C/C++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1435919971910 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/ide/clion/CMakeLists.txt b/examples/ide/clion/CMakeLists.txt new file mode 100644 index 00000000..06cc9517 --- /dev/null +++ b/examples/ide/clion/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.2) +project(PlatformIO) + +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=10605) +add_definitions(-DPLATFORMIO=020300) +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} +) \ No newline at end of file diff --git a/examples/ide/clion/README.rst b/examples/ide/clion/README.rst new file mode 100644 index 00000000..73698c03 --- /dev/null +++ b/examples/ide/clion/README.rst @@ -0,0 +1,8 @@ +CLion IDE Integration +===================== + +The detailed information and steps are described in the main documentation: +`PlatformIO integration with CLion IDE `_. + +.. image:: http://docs.platformio.org/en/latest/_images/ide-platformio-clion.png + :target: http://docs.platformio.org/en/latest/ide/clion.html diff --git a/examples/ide/clion/lib/readme.txt b/examples/ide/clion/lib/readme.txt new file mode 100644 index 00000000..413c26e5 --- /dev/null +++ b/examples/ide/clion/lib/readme.txt @@ -0,0 +1,8 @@ + +Documentation: http://docs.platformio.org/en/latest/userguide/cmd_init.html + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory. +For example, "lib/private_lib/[here are source files]". diff --git a/examples/ide/sublime-text/platformio.ini b/examples/ide/clion/platformio.ini similarity index 91% rename from examples/ide/sublime-text/platformio.ini rename to examples/ide/clion/platformio.ini index 785c3eda..7e183bf7 100644 --- a/examples/ide/sublime-text/platformio.ini +++ b/examples/ide/clion/platformio.ini @@ -17,7 +17,8 @@ # Automatic targets - enable auto-uploading # targets = upload -[env:flora8] +[env:uno] platform = atmelavr framework = arduino -board = flora8 +board = uno +# targets = upload diff --git a/examples/ide/clion/src/blink.cpp b/examples/ide/clion/src/blink.cpp new file mode 100644 index 00000000..262a6310 --- /dev/null +++ b/examples/ide/clion/src/blink.cpp @@ -0,0 +1,15 @@ +#include "Arduino.h" + +// Most Arduino boards already have a LED attached to pin 13 on the board itself +#define LED_PIN 13 + +void setup() { + pinMode(LED_PIN, OUTPUT); // set pin as output +} + +void loop() { + digitalWrite(LED_PIN, HIGH); // set the LED on + delay(1000); // wait for a second + digitalWrite(LED_PIN, LOW); // set the LED off + delay(1000); // wait for a second +} diff --git a/examples/ide-eclipse/arduino_pro5/.cproject b/examples/ide/eclipse/.cproject similarity index 56% rename from examples/ide-eclipse/arduino_pro5/.cproject rename to examples/ide/eclipse/.cproject index 9fdb0166..a8e197bf 100644 --- a/examples/ide-eclipse/arduino_pro5/.cproject +++ b/examples/ide/eclipse/.cproject @@ -15,43 +15,66 @@ - + - + @@ -63,7 +86,7 @@ - + @@ -74,7 +97,7 @@ - + diff --git a/examples/ide-eclipse/arduino_pro5/.project b/examples/ide/eclipse/.project similarity index 96% rename from examples/ide-eclipse/arduino_pro5/.project rename to examples/ide/eclipse/.project index 25893375..7d8cd85e 100644 --- a/examples/ide-eclipse/arduino_pro5/.project +++ b/examples/ide/eclipse/.project @@ -1,6 +1,6 @@ - arduino_pro5 + PlatformIO diff --git a/examples/ide/eclipse/.settings/language.settings.xml b/examples/ide/eclipse/.settings/language.settings.xml new file mode 100644 index 00000000..2135df98 --- /dev/null +++ b/examples/ide/eclipse/.settings/language.settings.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/examples/ide/eclipse/README.rst b/examples/ide/eclipse/README.rst new file mode 100644 index 00000000..bb4bfbe6 --- /dev/null +++ b/examples/ide/eclipse/README.rst @@ -0,0 +1,8 @@ +Eclipse IDE Integration +======================= + +The detailed information and steps are described in the main documentation: +`PlatformIO integration with Eclipse IDE `_. + +.. image:: http://docs.platformio.org/en/latest/_images/ide-platformio-eclipse.png + :target: http://docs.platformio.org/en/latest/ide/eclipse.html diff --git a/examples/ide/eclipse/lib/readme.txt b/examples/ide/eclipse/lib/readme.txt new file mode 100644 index 00000000..413c26e5 --- /dev/null +++ b/examples/ide/eclipse/lib/readme.txt @@ -0,0 +1,8 @@ + +Documentation: http://docs.platformio.org/en/latest/userguide/cmd_init.html + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory. +For example, "lib/private_lib/[here are source files]". diff --git a/examples/ide/visual-studio/platformio.ini b/examples/ide/eclipse/platformio.ini similarity index 91% rename from examples/ide/visual-studio/platformio.ini rename to examples/ide/eclipse/platformio.ini index b79bfb2d..7e183bf7 100644 --- a/examples/ide/visual-studio/platformio.ini +++ b/examples/ide/eclipse/platformio.ini @@ -17,7 +17,8 @@ # Automatic targets - enable auto-uploading # targets = upload -[env:arduino_uno] +[env:uno] platform = atmelavr framework = arduino -board = uno \ No newline at end of file +board = uno +# targets = upload diff --git a/examples/ide/eclipse/src/blink.cpp b/examples/ide/eclipse/src/blink.cpp new file mode 100644 index 00000000..262a6310 --- /dev/null +++ b/examples/ide/eclipse/src/blink.cpp @@ -0,0 +1,15 @@ +#include "Arduino.h" + +// Most Arduino boards already have a LED attached to pin 13 on the board itself +#define LED_PIN 13 + +void setup() { + pinMode(LED_PIN, OUTPUT); // set pin as output +} + +void loop() { + digitalWrite(LED_PIN, HIGH); // set the LED on + delay(1000); // wait for a second + digitalWrite(LED_PIN, LOW); // set the LED off + delay(1000); // wait for a second +} diff --git a/examples/ide/qtcreator/README.rst b/examples/ide/qtcreator/README.rst new file mode 100644 index 00000000..6136828a --- /dev/null +++ b/examples/ide/qtcreator/README.rst @@ -0,0 +1,8 @@ +Qt Creator IDE Integration +========================== + +The detailed information and steps are described in the main documentation: +`PlatformIO integration with Qt Creator `_. + +.. image:: http://docs.platformio.org/en/latest/_static/ide-platformio-qtcreator-7.png + :target: http://docs.platformio.org/en/latest/ide/qtcreator.html diff --git a/examples/ide/qtcreator/lib/readme.txt b/examples/ide/qtcreator/lib/readme.txt new file mode 100644 index 00000000..413c26e5 --- /dev/null +++ b/examples/ide/qtcreator/lib/readme.txt @@ -0,0 +1,8 @@ + +Documentation: http://docs.platformio.org/en/latest/userguide/cmd_init.html + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory. +For example, "lib/private_lib/[here are source files]". diff --git a/examples/ide/qtcreator/platformio.ini b/examples/ide/qtcreator/platformio.ini index b79bfb2d..7e183bf7 100644 --- a/examples/ide/qtcreator/platformio.ini +++ b/examples/ide/qtcreator/platformio.ini @@ -17,7 +17,8 @@ # Automatic targets - enable auto-uploading # targets = upload -[env:arduino_uno] +[env:uno] platform = atmelavr framework = arduino -board = uno \ No newline at end of file +board = uno +# targets = upload diff --git a/examples/ide/qtcreator/platformio.pro b/examples/ide/qtcreator/platformio.pro index 22188cd8..19dedbdf 100644 --- a/examples/ide/qtcreator/platformio.pro +++ b/examples/ide/qtcreator/platformio.pro @@ -2,18 +2,25 @@ win32 { HOMEDIR += $$(USERPROFILE) } else { - HOMEDIR += $$(PWD) + HOMEDIR += $$(HOME) } -INCLUDEPATH += "$$HOMEDIR/.platformio/packages/framework-arduinoavr/cores/arduino" -INCLUDEPATH += "$$HOMEDIR/.platformio/packages/toolchain-atmelavr/avr/include" +INCLUDEPATH += "$${HOMEDIR}/.platformio/packages/framework-arduinoavr/variants/standard" +INCLUDEPATH += "$${HOMEDIR}/.platformio/packages/framework-arduinoavr/cores/arduino" +INCLUDEPATH += "$${HOMEDIR}/.platformio/packages/toolchain-atmelavr/avr/include" +INCLUDEPATH += "$${HOMEDIR}/.platformio/packages/toolchain-atmelavr/bfd/include" +INCLUDEPATH += "$${HOMEDIR}/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.8.1/include" +INCLUDEPATH += "$${HOMEDIR}/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.8.1/include-fixed" -win32:INCLUDEPATH ~= s,/,\\,g - -# DEFINES += __AVR_ATmega328__ +DEFINES += "F_CPU=16000000L" +DEFINES += "ARDUINO_ARCH_AVR" +DEFINES += "ARDUINO_AVR_UNO" +DEFINES += "ARDUINO=10605" +DEFINES += "PLATFORMIO=020300" +DEFINES += "__AVR_ATmega328P__" OTHER_FILES += \ platformio.ini SOURCES += \ - src/main.c + src/blink.cpp diff --git a/examples/ide/qtcreator/src/blink.cpp b/examples/ide/qtcreator/src/blink.cpp new file mode 100644 index 00000000..262a6310 --- /dev/null +++ b/examples/ide/qtcreator/src/blink.cpp @@ -0,0 +1,15 @@ +#include "Arduino.h" + +// Most Arduino boards already have a LED attached to pin 13 on the board itself +#define LED_PIN 13 + +void setup() { + pinMode(LED_PIN, OUTPUT); // set pin as output +} + +void loop() { + digitalWrite(LED_PIN, HIGH); // set the LED on + delay(1000); // wait for a second + digitalWrite(LED_PIN, LOW); // set the LED off + delay(1000); // wait for a second +} diff --git a/examples/ide/qtcreator/src/main.c b/examples/ide/qtcreator/src/main.c deleted file mode 100644 index 34714182..00000000 --- a/examples/ide/qtcreator/src/main.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "Arduino.h" -/* - Blink - Turns on an LED on for one second, then off for one second, repeatedly. - - This example code is in the public domain. -*/ - -int led = 1; // blink 'digital' pin 1 - AKA the built in red LED - -// the setup routine runs once when you press reset: -void setup() { - // initialize the digital pin as an output. - pinMode(led, OUTPUT); - -} - -// the loop routine runs over and over again forever: -void loop() { - digitalWrite(led, HIGH); - delay(1000); - digitalWrite(led, LOW); - delay(1000); -} - diff --git a/examples/ide/sublime-text/src/Blink.pde b/examples/ide/sublime-text/src/Blink.pde deleted file mode 100644 index a4282d6b..00000000 --- a/examples/ide/sublime-text/src/Blink.pde +++ /dev/null @@ -1,24 +0,0 @@ -/* - Blink - Turns on an LED on for one second, then off for one second, repeatedly. - - This example code is in the public domain. -*/ - -int led = 1; // blink 'digital' pin 1 - AKA the built in red LED - -// the setup routine runs once when you press reset: -void setup() { - // initialize the digital pin as an output. - pinMode(led, OUTPUT); - -} - -// the loop routine runs over and over again forever: -void loop() { - digitalWrite(led, HIGH); - delay(1000); - digitalWrite(led, LOW); - delay(1000); -} - diff --git a/examples/ide/sublimetext/README.rst b/examples/ide/sublimetext/README.rst new file mode 100644 index 00000000..78da7c22 --- /dev/null +++ b/examples/ide/sublimetext/README.rst @@ -0,0 +1,8 @@ +Sublime Text Integration +======================== + +The detailed information and steps are described in the main documentation: +`PlatformIO integration with Sublime Text `_. + +.. image:: http://docs.platformio.org/en/latest/_images/ide-sublime-text-platformio-newproject-5.png + :target: http://docs.platformio.org/en/latest/ide/sublimetext.html diff --git a/examples/ide/sublimetext/lib/readme.txt b/examples/ide/sublimetext/lib/readme.txt new file mode 100644 index 00000000..413c26e5 --- /dev/null +++ b/examples/ide/sublimetext/lib/readme.txt @@ -0,0 +1,8 @@ + +Documentation: http://docs.platformio.org/en/latest/userguide/cmd_init.html + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory. +For example, "lib/private_lib/[here are source files]". diff --git a/examples/ide-eclipse/arduino_pro5/platformio.ini b/examples/ide/sublimetext/platformio.ini similarity index 87% rename from examples/ide-eclipse/arduino_pro5/platformio.ini rename to examples/ide/sublimetext/platformio.ini index 4e2b4dff..7e183bf7 100644 --- a/examples/ide-eclipse/arduino_pro5/platformio.ini +++ b/examples/ide/sublimetext/platformio.ini @@ -17,9 +17,8 @@ # Automatic targets - enable auto-uploading # targets = upload -[env:arduino_pro5v] +[env:uno] platform = atmelavr framework = arduino -board = pro16MHzatmega168 - -# targets = upload \ No newline at end of file +board = uno +# targets = upload diff --git a/examples/ide/sublime-text/platformio.sublime-project b/examples/ide/sublimetext/platformio.sublime-project similarity index 64% rename from examples/ide/sublime-text/platformio.sublime-project rename to examples/ide/sublimetext/platformio.sublime-project index e8bd688b..88a0f925 100644 --- a/examples/ide/sublime-text/platformio.sublime-project +++ b/examples/ide/sublimetext/platformio.sublime-project @@ -5,6 +5,7 @@ "cmd": [ "platformio", + "-f", "-c", "sublimetext", "run" ], "name": "PlatformIO", @@ -14,8 +15,9 @@ "cmd": [ "platformio", + "-f", "-c", "sublimetext", "run", - "-t", + "--target", "clean" ], "name": "Clean" @@ -24,14 +26,16 @@ "cmd": [ "platformio", + "-f", "-c", "sublimetext", "run", - "-t", + "--target", "upload" ], "name": "Upload" } ], - "working_dir": "${project_path:${folder}}" + "working_dir": "${project_path:${folder}}", + "selector": "source.c, source.c++" } ], "folders": diff --git a/examples/ide/sublimetext/src/blink.cpp b/examples/ide/sublimetext/src/blink.cpp new file mode 100644 index 00000000..262a6310 --- /dev/null +++ b/examples/ide/sublimetext/src/blink.cpp @@ -0,0 +1,15 @@ +#include "Arduino.h" + +// Most Arduino boards already have a LED attached to pin 13 on the board itself +#define LED_PIN 13 + +void setup() { + pinMode(LED_PIN, OUTPUT); // set pin as output +} + +void loop() { + digitalWrite(LED_PIN, HIGH); // set the LED on + delay(1000); // wait for a second + digitalWrite(LED_PIN, LOW); // set the LED off + delay(1000); // wait for a second +} diff --git a/examples/ide/visual-studio/blink.vcxproj.filters b/examples/ide/visual-studio/blink.vcxproj.filters deleted file mode 100644 index 87bc92f6..00000000 --- a/examples/ide/visual-studio/blink.vcxproj.filters +++ /dev/null @@ -1,29 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {cad450ef-1a84-42d4-a5b5-a1736b8833d3} - - - - - - - - - Source Files\src - - - \ No newline at end of file diff --git a/examples/ide/visual-studio/src/blink.pde b/examples/ide/visual-studio/src/blink.pde deleted file mode 100644 index a4282d6b..00000000 --- a/examples/ide/visual-studio/src/blink.pde +++ /dev/null @@ -1,24 +0,0 @@ -/* - Blink - Turns on an LED on for one second, then off for one second, repeatedly. - - This example code is in the public domain. -*/ - -int led = 1; // blink 'digital' pin 1 - AKA the built in red LED - -// the setup routine runs once when you press reset: -void setup() { - // initialize the digital pin as an output. - pinMode(led, OUTPUT); - -} - -// the loop routine runs over and over again forever: -void loop() { - digitalWrite(led, HIGH); - delay(1000); - digitalWrite(led, LOW); - delay(1000); -} - diff --git a/examples/ide/visualstudio/README.rst b/examples/ide/visualstudio/README.rst new file mode 100644 index 00000000..683412ba --- /dev/null +++ b/examples/ide/visualstudio/README.rst @@ -0,0 +1,8 @@ +Visual Studio Integration +========================= + +The detailed information and steps are described in the main documentation: +`PlatformIO integration with Visual Studio `_. + +.. image:: http://docs.platformio.org/en/latest/_images/ide-vs-platformio-newproject-8.png + :target: http://docs.platformio.org/en/latest/ide/visualstudio.html diff --git a/examples/ide/visualstudio/lib/readme.txt b/examples/ide/visualstudio/lib/readme.txt new file mode 100644 index 00000000..fa10918b --- /dev/null +++ b/examples/ide/visualstudio/lib/readme.txt @@ -0,0 +1,8 @@ + +Documentation: http://docs.platformio.org/en/latest/userguide/cmd_init.html + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory. +For example, "lib/private_lib/[here are source files]". diff --git a/examples/ide-eclipse/titiva_lm4f120/platformio.ini b/examples/ide/visualstudio/platformio.ini similarity index 84% rename from examples/ide-eclipse/titiva_lm4f120/platformio.ini rename to examples/ide/visualstudio/platformio.ini index 3dfecf6a..829194f0 100644 --- a/examples/ide-eclipse/titiva_lm4f120/platformio.ini +++ b/examples/ide/visualstudio/platformio.ini @@ -16,10 +16,9 @@ # # Automatic targets - enable auto-uploading # targets = upload - -[env:launchpad_lm4f120] -platform = titiva -framework = energia -board = lplm4f120h5qr - -# targets = upload + +[env:uno] +platform = atmelavr +framework = arduino +board = uno +# targets = upload diff --git a/examples/ide/visual-studio/blink.vcxproj b/examples/ide/visualstudio/platformio.vcxproj similarity index 63% rename from examples/ide/visual-studio/blink.vcxproj rename to examples/ide/visualstudio/platformio.vcxproj index 1bef37cb..36707b41 100644 --- a/examples/ide/visual-studio/blink.vcxproj +++ b/examples/ide/visualstudio/platformio.vcxproj @@ -1,62 +1,63 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {0FA9C3A8-452B-41EF-A418-9102B170F49F} - MakeFileProj - - - - Makefile - true - v120 - - - Makefile - false - v120 - - - - - - - - - - - - - platformio run - platformio run -t clean - WIN32;_DEBUG;$(NMakePreprocessorDefinitions) - $(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath) - - - platformio run - platformio run -t clean - WIN32;NDEBUG;$(NMakePreprocessorDefinitions) - $(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath) - - - - - - - - - - - - - - \ No newline at end of file + + + + + Debug + Win32 + + + Release + Win32 + + + + {0FA9C3A8-452B-41EF-A418-9102B170F49F} + MakeFileProj + + + + Makefile + true + v120 + + + Makefile + false + v120 + + + + + + + + + + + + + platformio -f -c visualstudio run + platformio -f -c visualstudio run --target clean + F_CPU=16000000L;ARDUINO_ARCH_AVR;ARDUINO_AVR_UNO;ARDUINO=10605;PLATFORMIO=020300;__AVR_ATmega328P__ + $(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\variants\standard;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\lib\gcc\avr\4.8.1\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\lib\gcc\avr\4.8.1\include-fixed + + + platformio run + platformio run --target clean + {";".join(defines)}} + $(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\variants\standard;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\lib\gcc\avr\4.8.1\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\lib\gcc\avr\4.8.1\include-fixed + + + + + + + + + + + + Source Files + + + diff --git a/examples/ide/visualstudio/platformio.vcxproj.filters b/examples/ide/visualstudio/platformio.vcxproj.filters new file mode 100644 index 00000000..a1327e90 --- /dev/null +++ b/examples/ide/visualstudio/platformio.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;ino;pde + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + + + + + + Source Files + + + diff --git a/examples/ide/visualstudio/src/blink.cpp b/examples/ide/visualstudio/src/blink.cpp new file mode 100644 index 00000000..262a6310 --- /dev/null +++ b/examples/ide/visualstudio/src/blink.cpp @@ -0,0 +1,15 @@ +#include "Arduino.h" + +// Most Arduino boards already have a LED attached to pin 13 on the board itself +#define LED_PIN 13 + +void setup() { + pinMode(LED_PIN, OUTPUT); // set pin as output +} + +void loop() { + digitalWrite(LED_PIN, HIGH); // set the LED on + delay(1000); // wait for a second + digitalWrite(LED_PIN, LOW); // set the LED off + delay(1000); // wait for a second +} diff --git a/platformio/__init__.py b/platformio/__init__.py index 48b1e7d2..95c2f1eb 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (2, 2, 2) +VERSION = (2, 3, 0) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/__main__.py b/platformio/__main__.py index a298502e..d6674297 100644 --- a/platformio/__main__.py +++ b/platformio/__main__.py @@ -51,18 +51,20 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904 raise AttributeError() -@click.command(cls=PlatformioCLI) +@click.command(cls=PlatformioCLI, + context_settings=dict(help_option_names=["-h", "--help"])) @click.version_option(__version__, prog_name="PlatformIO") @click.option("--force", "-f", is_flag=True, - help="Force to accept any confirmation prompts") + help="Force to accept any confirmation prompts.") +@click.option("--caller", "-c", help="Caller ID (service).") @click.pass_context -def cli(ctx, force): - maintenance.on_platformio_start(ctx, force) +def cli(ctx, force, caller): + maintenance.on_platformio_start(ctx, force, caller) @cli.resultcallback() @click.pass_context -def process_result(ctx, result, force): # pylint: disable=W0613 +def process_result(ctx, result, force, caller): # pylint: disable=W0613 maintenance.on_platformio_end(ctx, result) @@ -70,9 +72,14 @@ def main(): try: # https://urllib3.readthedocs.org # /en/latest/security.html#insecureplatformwarning - requests.packages.urllib3.disable_warnings() + try: + requests.packages.urllib3.disable_warnings() + except AttributeError: + raise exception.PlatformioException( + "Invalid installation of Python `requests` package`. See " + "< https://github.com/platformio/platformio/issues/252 >") - cli(None, None) + cli(None, None, None) except Exception as e: # pylint: disable=W0703 if not isinstance(e, exception.ReturnErrorCode): maintenance.on_platformio_exception(e) diff --git a/platformio/app.py b/platformio/app.py index b77e481d..6a6f7ee8 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -5,6 +5,8 @@ import json from os import environ, getenv from os.path import isfile, join +from lockfile import LockFile + from platformio import __version__ from platformio.exception import InvalidSettingName, InvalidSettingValue from platformio.util import get_home_dir, is_ci @@ -48,7 +50,9 @@ DEFAULT_SETTINGS = { SESSION_VARS = { - "force_option": False + "command_ctx": None, + "force_option": False, + "caller_id": None } @@ -59,22 +63,30 @@ class State(object): if not self.path: self.path = join(get_home_dir(), "appstate.json") self._state = {} + self._prev_state = {} + self._lock = None def __enter__(self): try: if isfile(self.path): + self._lock = LockFile(self.path) + self._lock.acquire() with open(self.path, "r") as fp: self._state = json.load(fp) except ValueError: self._state = {} + self._prev_state = self._state.copy() return self._state def __exit__(self, type_, value, traceback): - with open(self.path, "w") as fp: - if "dev" in __version__: - json.dump(self._state, fp, indent=4) - else: - json.dump(self._state, fp) + if self._prev_state != self._state: + with open(self.path, "w") as fp: + if "dev" in __version__: + json.dump(self._state, fp, indent=4) + else: + json.dump(self._state, fp) + if self._lock: + self._lock.release() def sanitize_setting(name, value): diff --git a/platformio/boards/adafruit.json b/platformio/boards/adafruit.json index 38ff5b4a..6e81d2f7 100644 --- a/platformio/boards/adafruit.json +++ b/platformio/boards/adafruit.json @@ -47,6 +47,26 @@ "vendor": "Adafruit" }, + "gemma": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_GEMMA", + "f_cpu": "8000000L", + "mcu": "attiny85", + "variant": "gemma" + }, + "frameworks": ["arduino"], + "name": "Adafruit Gemma", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 512, + "maximum_size": 8192, + "protocol": "usbtiny" + }, + "url": "http://www.adafruit.com/products/1222", + "vendor": "Adafruit" + }, + "trinket5": { "build": { "core": "arduino", diff --git a/platformio/builder/main.py b/platformio/builder/main.py index d74f6c50..0dd206f3 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -5,14 +5,22 @@ try: from platformio import util except ImportError: import sys - for _path in sys.path: - if "platformio" in _path: - sys.path.insert(0, _path[:_path.rfind("platformio") - 1]) + for p in sys.path: + _new_path = None + if not p.endswith("site-packages") and "site-packages" in p: + _new_path = p[:p.rfind("site-packages") + 13] + elif "platformio" in p: + _new_path = p[:p.rfind("platformio") - 1] + if _new_path and _new_path not in sys.path: + sys.path.insert(0, _new_path) + try: + from platformio import util break - from platformio import util + except ImportError: + pass import json -from os import getenv +from os import environ from os.path import isfile, join from time import time @@ -63,7 +71,11 @@ DefaultEnvironment( toolpath=[join("$PIOBUILDER_DIR", "tools")], variables=commonvars, + # Propagating External Environment + ENV=environ, + UNIX_TIME=int(time()), + PROGNAME="program", PIOHOME_DIR=util.get_home_dir(), PROJECT_DIR=util.get_project_dir(), @@ -123,16 +135,17 @@ for opt in ("LIB_IGNORE", "LIB_USE"): continue env[opt] = [l.strip() for l in env[opt].split(",") if l.strip()] -env.PrependENVPath( - "PATH", - env.subst(join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN", "bin")) -) +if env.subst("$PIOPACKAGE_TOOLCHAIN"): + env.PrependENVPath( + "PATH", + env.subst(join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN", "bin")) + ) SConscriptChdir(0) SConscript(env.subst("$BUILD_SCRIPT")) -if getenv("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT", None)): - SConscript(getenv("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT"))) +if environ.get("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT", None)): + SConscript(environ.get("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT"))) if "envdump" in COMMAND_LINE_TARGETS: print env.Dump() diff --git a/platformio/builder/scripts/atmelavr.py b/platformio/builder/scripts/atmelavr.py index 1027b6a4..6bdc2b62 100644 --- a/platformio/builder/scripts/atmelavr.py +++ b/platformio/builder/scripts/atmelavr.py @@ -95,7 +95,7 @@ else: # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Extract EEPROM data (from EEMEM directive) to .eep file diff --git a/platformio/builder/scripts/atmelsam.py b/platformio/builder/scripts/atmelsam.py index 083f4136..00d0fa78 100644 --- a/platformio/builder/scripts/atmelsam.py +++ b/platformio/builder/scripts/atmelsam.py @@ -77,7 +77,7 @@ env.Append( # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/basearm.py b/platformio/builder/scripts/basearm.py index 33114dca..cb685caf 100644 --- a/platformio/builder/scripts/basearm.py +++ b/platformio/builder/scripts/basearm.py @@ -52,7 +52,10 @@ env.Replace( LIBS=["c", "gcc", "m"], - SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES' + SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES', + + PROGNAME="firmware", + PROGSUFFIX=".elf" ) env.Append( diff --git a/platformio/builder/scripts/baseavr.py b/platformio/builder/scripts/baseavr.py index 3ac52b00..7566bcc4 100644 --- a/platformio/builder/scripts/baseavr.py +++ b/platformio/builder/scripts/baseavr.py @@ -49,7 +49,10 @@ env.Replace( LIBS=["m"], - SIZEPRINTCMD='"$SIZETOOL" --mcu=$BOARD_MCU -C -d $SOURCES' + SIZEPRINTCMD='"$SIZETOOL" --mcu=$BOARD_MCU -C -d $SOURCES', + + PROGNAME="firmware", + PROGSUFFIX=".elf" ) env.Append( diff --git a/platformio/builder/scripts/espressif.py b/platformio/builder/scripts/espressif.py index 3875dd15..09c7196b 100644 --- a/platformio/builder/scripts/espressif.py +++ b/platformio/builder/scripts/espressif.py @@ -80,7 +80,10 @@ env.Replace( "-ca", "0x40000" if "FRAMEWORK" not in env else "0x10000", "-cf", "${SOURCES[1]}" ], - UPLOADCMD='$UPLOADER $UPLOADERFLAGS' + UPLOADCMD='$UPLOADER $UPLOADERFLAGS', + + PROGNAME="firmware", + PROGSUFFIX=".elf" ) env.Append( @@ -129,7 +132,7 @@ if "FRAMEWORK" not in env: # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .hex diff --git a/platformio/builder/scripts/frameworks/mbed.py b/platformio/builder/scripts/frameworks/mbed.py index 6c3bcf8d..f4c18f42 100644 --- a/platformio/builder/scripts/frameworks/mbed.py +++ b/platformio/builder/scripts/frameworks/mbed.py @@ -211,6 +211,9 @@ env.Replace( join(variant_dir, eixdata.get("LDSCRIPT_PATH")[0])) ) +# restore external build flags +env.ProcessFlags() + # Hook for K64F and K22F if board_type in ("frdm_k22f", "frdm_k64f"): env.Append( diff --git a/platformio/builder/scripts/freescalekinetis.py b/platformio/builder/scripts/freescalekinetis.py index c80d7134..0f23c8f6 100644 --- a/platformio/builder/scripts/freescalekinetis.py +++ b/platformio/builder/scripts/freescalekinetis.py @@ -18,7 +18,7 @@ SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/linux_arm.py b/platformio/builder/scripts/linux_arm.py new file mode 100644 index 00000000..b8864388 --- /dev/null +++ b/platformio/builder/scripts/linux_arm.py @@ -0,0 +1,49 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Linux ARM +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +from platformio.util import get_systype + +env = DefaultEnvironment() + +env.Replace( + _BINPREFIX="", + AR="${_BINPREFIX}ar", + AS="${_BINPREFIX}as", + CC="${_BINPREFIX}gcc", + CXX="${_BINPREFIX}g++", + OBJCOPY="${_BINPREFIX}objcopy", + RANLIB="${_BINPREFIX}ranlib", + SIZETOOL="${_BINPREFIX}size", + + SIZEPRINTCMD='"$SIZETOOL" $SOURCES' +) + +if get_systype() == "darwin_x86_64": + env.Replace( + _BINPREFIX="arm-linux-gnueabihf-" + ) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/builder/scripts/linux_i686.py b/platformio/builder/scripts/linux_i686.py new file mode 100644 index 00000000..d0b0968e --- /dev/null +++ b/platformio/builder/scripts/linux_i686.py @@ -0,0 +1,49 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Linux Linux i686 / 32-bit +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +from platformio.util import get_systype + +env = DefaultEnvironment() + +env.Replace( + _BINPREFIX="", + AR="${_BINPREFIX}ar", + AS="${_BINPREFIX}as", + CC="${_BINPREFIX}gcc", + CXX="${_BINPREFIX}g++", + OBJCOPY="${_BINPREFIX}objcopy", + RANLIB="${_BINPREFIX}ranlib", + SIZETOOL="${_BINPREFIX}size", + + SIZEPRINTCMD='"$SIZETOOL" $SOURCES' +) + +if get_systype() == "darwin_x86_64": + env.Replace( + _BINPREFIX="i586-pc-linux-" + ) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/builder/scripts/linux_x86_64.py b/platformio/builder/scripts/linux_x86_64.py new file mode 100644 index 00000000..ecb5e775 --- /dev/null +++ b/platformio/builder/scripts/linux_x86_64.py @@ -0,0 +1,49 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Linux Linux x64_64 / 64-bit +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +from platformio.util import get_systype + +env = DefaultEnvironment() + +env.Replace( + _BINPREFIX="", + AR="${_BINPREFIX}ar", + AS="${_BINPREFIX}as", + CC="${_BINPREFIX}gcc", + CXX="${_BINPREFIX}g++", + OBJCOPY="${_BINPREFIX}objcopy", + RANLIB="${_BINPREFIX}ranlib", + SIZETOOL="${_BINPREFIX}size", + + SIZEPRINTCMD='"$SIZETOOL" $SOURCES' +) + +if get_systype() == "darwin_x86_64": + env.Replace( + _BINPREFIX="x86_64-pc-linux-" + ) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/builder/scripts/native.py b/platformio/builder/scripts/native.py new file mode 100644 index 00000000..28e94fe9 --- /dev/null +++ b/platformio/builder/scripts/native.py @@ -0,0 +1,33 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for native platform +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +env = DefaultEnvironment() + +env.Replace( + SIZEPRINTCMD="size $SOURCES" +) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/builder/scripts/nordicnrf51.py b/platformio/builder/scripts/nordicnrf51.py index 15e67cc2..caed2f55 100644 --- a/platformio/builder/scripts/nordicnrf51.py +++ b/platformio/builder/scripts/nordicnrf51.py @@ -18,7 +18,7 @@ SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/nxplpc.py b/platformio/builder/scripts/nxplpc.py index 39b9dfd9..9585eb5a 100644 --- a/platformio/builder/scripts/nxplpc.py +++ b/platformio/builder/scripts/nxplpc.py @@ -27,7 +27,7 @@ SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/siliconlabsefm32.py b/platformio/builder/scripts/siliconlabsefm32.py index 29692f6f..1fd710b9 100644 --- a/platformio/builder/scripts/siliconlabsefm32.py +++ b/platformio/builder/scripts/siliconlabsefm32.py @@ -18,7 +18,7 @@ SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/ststm32.py b/platformio/builder/scripts/ststm32.py index c1622028..aeff2818 100644 --- a/platformio/builder/scripts/ststm32.py +++ b/platformio/builder/scripts/ststm32.py @@ -65,7 +65,7 @@ env.Append( # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/teensy.py b/platformio/builder/scripts/teensy.py index fc4f4f91..e7a5643f 100644 --- a/platformio/builder/scripts/teensy.py +++ b/platformio/builder/scripts/teensy.py @@ -61,7 +61,7 @@ else: # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the firmware file diff --git a/platformio/builder/scripts/timsp430.py b/platformio/builder/scripts/timsp430.py index 90507539..b38d4c12 100644 --- a/platformio/builder/scripts/timsp430.py +++ b/platformio/builder/scripts/timsp430.py @@ -57,7 +57,10 @@ env.Replace( "$UPLOAD_PROTOCOL" if system() != "Windows" else "tilib", "--force-reset" ], - UPLOADCMD='$UPLOADER $UPLOADERFLAGS "prog $SOURCES"' + UPLOADCMD='$UPLOADER $UPLOADERFLAGS "prog $SOURCES"', + + PROGNAME="firmware", + PROGSUFFIX=".elf" ) env.Append( @@ -80,7 +83,7 @@ env.Append( # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .hex diff --git a/platformio/builder/scripts/titiva.py b/platformio/builder/scripts/titiva.py index db14ecdf..a94a64e7 100644 --- a/platformio/builder/scripts/titiva.py +++ b/platformio/builder/scripts/titiva.py @@ -31,7 +31,7 @@ env.Append( # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/windows_x86.py b/platformio/builder/scripts/windows_x86.py new file mode 100644 index 00000000..d06a9f80 --- /dev/null +++ b/platformio/builder/scripts/windows_x86.py @@ -0,0 +1,54 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Windows x86 / 32bit +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +from platformio.util import get_systype + +env = DefaultEnvironment() + +env.Replace( + _BINPREFIX="", + AR="${_BINPREFIX}ar", + AS="${_BINPREFIX}as", + CC="${_BINPREFIX}gcc", + CXX="${_BINPREFIX}g++", + OBJCOPY="${_BINPREFIX}objcopy", + RANLIB="${_BINPREFIX}ranlib", + SIZETOOL="${_BINPREFIX}size", + + SIZEPRINTCMD='"$SIZETOOL" $SOURCES', + PROGSUFFIX=".exe" +) + +if get_systype() == "darwin_x86_64": + env.Replace( + _BINPREFIX="i586-mingw32-" + ) +elif get_systype() in ("linux_x86_64", "linux_i686"): + env.Replace( + _BINPREFIX="i686-w64-mingw32-" + ) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 851b1f97..f54c317e 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -4,9 +4,11 @@ import atexit import re from glob import glob -from os import remove +from os import environ, remove from os.path import basename, join +from platformio.util import exec_command, where_is_program + class InoToCPPConverter(object): @@ -120,7 +122,9 @@ def ConvertInoToCpp(env): def DumpIDEData(env): data = { "defines": [], - "includes": [] + "includes": [], + "cxx_path": where_is_program( + env.subst("$CXX"), env.subst("${ENV['PATH']}")) } # includes from framework and libs @@ -133,8 +137,8 @@ def DumpIDEData(env): toolchain_dir = env.subst( join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN")) toolchain_incglobs = [ - join(toolchain_dir, "*", "include"), - join(toolchain_dir, "lib", "gcc", "*", "*", "include") + join(toolchain_dir, "*", "include*"), + join(toolchain_dir, "lib", "gcc", "*", "*", "include*") ] for g in toolchain_incglobs: data['includes'].extend(glob(g)) @@ -157,6 +161,22 @@ def DumpIDEData(env): return data +def GetCompilerType(env): + try: + sysenv = environ.copy() + sysenv['PATH'] = str(env['ENV']['PATH']) + result = exec_command([env.subst("$CC"), "-v"], env=sysenv) + except OSError: + return None + if result['returncode'] != 0: + return None + output = "".join([result['out'], result['err']]).lower() + for type_ in ("clang", "gcc"): + if type_ in output: + return type_ + return None + + def exists(_): return True @@ -164,4 +184,5 @@ def exists(_): def generate(env): env.AddMethod(ConvertInoToCpp) env.AddMethod(DumpIDEData) + env.AddMethod(GetCompilerType) return env diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 1cc75a53..ddd82e25 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -90,7 +90,8 @@ def AutodetectUploadPort(env): else: Exit("Error: Please specify `upload_port` for environment or use " "global `--upload-port` option.\n" - "For the some development platforms it can be USB flash drive\n") + "For some development platforms this can be a USB flash drive " + "(i.e. /media//)\n") def UploadToDisk(_, target, source, env): # pylint: disable=W0613,W0621 diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index a2c9746a..26171436 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -12,7 +12,6 @@ from SCons.Util import case_sensitive_suffixes from platformio.util import pioversion_to_intstr - SRC_BUILD_EXT = ["c", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"] SRC_HEADER_EXT = ["h", "hpp"] SRC_DEFAULT_FILTER = " ".join([ @@ -20,7 +19,7 @@ SRC_DEFAULT_FILTER = " ".join([ ]) -def BuildFirmware(env): +def BuildProgram(env): # fix ASM handling under non-casitive OS if not case_sensitive_suffixes(".s", ".S"): @@ -43,7 +42,7 @@ def BuildFirmware(env): ) # enable "cyclic reference" for linker - if env.get("LIBS", deplibs): + if env.get("LIBS", deplibs) and env.GetCompilerType() == "gcc": env.Prepend( _LIBFLAGS="-Wl,--start-group " ) @@ -63,14 +62,13 @@ def BuildFirmware(env): ) return env.Program( - join("$BUILD_DIR", "firmware"), + join("$BUILD_DIR", env.subst("$PROGNAME")), env.LookupSources( "$BUILDSRC_DIR", "$PROJECTSRC_DIR", duplicate=False, src_filter=getenv("PLATFORMIO_SRC_FILTER", env.get("SRC_FILTER", None))), LIBS=env.get("LIBS", []) + deplibs, - LIBPATH=env.get("LIBPATH", []) + ["$BUILD_DIR"], - PROGSUFFIX=".elf" + LIBPATH=env.get("LIBPATH", []) + ["$BUILD_DIR"] ) @@ -331,7 +329,7 @@ def exists(_): def generate(env): - env.AddMethod(BuildFirmware) + env.AddMethod(BuildProgram) env.AddMethod(ProcessFlags) env.AddMethod(IsFileWithExt) env.AddMethod(VariantDirWrap) diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 3346b635..75a263ed 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -62,7 +62,7 @@ def cli(project_dir, board, ide, disable_auto_uploading, env_prefix): click.style("platformio.ini", fg="cyan")) click.echo("%s - Put your source code here" % click.style("src", fg="cyan")) - click.echo("%s - Put here project specific or 3-rd party libraries" % + click.echo("%s - Put here project specific (private) libraries" % click.style("lib", fg="cyan")) if (app.get_setting("enable_prompts") and @@ -77,6 +77,18 @@ def cli(project_dir, board, ide, disable_auto_uploading, env_prefix): if not isdir(d): makedirs(d) + if not isfile(join(lib_dir, "readme.txt")): + with open(join(lib_dir, "readme.txt"), "w") as f: + f.write(""" +Documentation: http://docs.platformio.org/en/latest/userguide/cmd_init.html + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory. +For example, "lib/private_lib/[here are source files]". +""") + if not isfile(project_file): copyfile(join(get_source_dir(), "projectconftpl.ini"), project_file) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 14ab8271..8f4324c1 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -22,7 +22,7 @@ from platformio.platforms.base import PlatformFactory @click.option("--environment", "-e", multiple=True, metavar="") @click.option("--target", "-t", multiple=True, metavar="") @click.option("--upload-port", metavar="") -@click.option("--project-dir", default=getcwd, +@click.option("--project-dir", "-d", default=getcwd, type=click.Path(exists=True, file_okay=False, dir_okay=True, writable=True, resolve_path=True)) @click.option("--verbose", "-v", count=True, default=3) diff --git a/platformio/commands/serialports.py b/platformio/commands/serialports.py index 33dea746..2e157110 100644 --- a/platformio/commands/serialports.py +++ b/platformio/commands/serialports.py @@ -7,7 +7,8 @@ import sys import click from serial.tools import miniterm -from platformio.exception import PlatformioException +from platformio import app +from platformio.exception import MinitermException from platformio.util import get_serialports @@ -69,7 +70,7 @@ def serialports_list(json_output): @click.option("--quiet", is_flag=True, help="Diagnostics: suppress non-error messages, default=Off") def serialports_monitor(**kwargs): - sys.argv = sys.argv[2:] + sys.argv = app.get_session_var("command_ctx").args[1:] if not kwargs['port']: for item in get_serialports(): @@ -80,4 +81,4 @@ def serialports_monitor(**kwargs): try: miniterm.main() except Exception as e: # pylint: disable=W0702 - raise PlatformioException(str(e)) + raise MinitermException("Miniterm: %s" % e) diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index 263401de..1140b096 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -4,8 +4,7 @@ import click import requests -from platformio import __version__, util -from platformio.exception import GetLatestVersionError +from platformio import __version__, exception, util @click.command("upgrade", @@ -21,16 +20,46 @@ def cli(): click.secho("Please wait while upgrading PlatformIO ...", fg="yellow") - pip_result = util.exec_command(["pip", "install", "--upgrade", - "platformio"]) - pio_result = util.exec_command(["platformio", "--version"]) + cmds = ( + ["pip", "install", "--upgrade", "pip", "setuptools"], + ["pip", "install", "--upgrade", "platformio"], + ["platformio", "--version"] + ) - if last in pio_result['out'].strip(): - click.secho("PlatformIO has been successfully upgraded to %s" % - last, fg="green") - else: - click.secho(pip_result['out'], fg="green") - click.secho(pip_result['err'], fg="red") + cmd = None + r = None + try: + for cmd in cmds: + r = None + r = util.exec_command(cmd) + assert r['returncode'] == 0 + assert last in r['out'].strip() + click.secho( + "PlatformIO has been successfully upgraded to %s" % last, + fg="green") + click.echo("Release notes: ", nl=False) + click.secho("http://docs.platformio.org/en/latest/history.html", + fg="cyan") + except (OSError, AssertionError) as e: + if not r: + raise exception.PlatformioException( + "\n".join([str(cmd), str(e)])) + if ("Permission denied" in r['err'] and + "windows" not in util.get_systype()): + click.secho(""" +----------------- +Permission denied +----------------- +You need the `sudo` permission to install Python packages. Try + +> sudo platformio upgrade + +WARNING! Don't use `sudo` for the rest PlatformIO commands. +""", fg="yellow", err=True) + raise exception.ReturnErrorCode() + else: + raise exception.PlatformioException( + "\n".join([str(cmd), r['out'], r['err']])) def get_latest_version(): @@ -41,4 +70,4 @@ def get_latest_version(): ).json() return pkgdata['info']['version'] except: - raise GetLatestVersionError() + raise exception.GetLatestVersionError() diff --git a/platformio/exception.py b/platformio/exception.py index d8cb13fd..233e591a 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -17,6 +17,10 @@ class ReturnErrorCode(PlatformioException): pass +class MinitermException(PlatformioException): + pass + + class AbortedByUser(PlatformioException): MESSAGE = "Aborted by user" diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 1720e467..9007a06a 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -2,7 +2,8 @@ # See LICENSE for details. import json -from os import listdir, makedirs, walk +import os +import re from os.path import abspath, basename, expanduser, isdir, join, relpath import bottle @@ -23,7 +24,7 @@ class ProjectGenerator(object): @staticmethod def get_supported_ides(): tpls_dir = join(util.get_source_dir(), "ide", "tpls") - return sorted([d for d in listdir(tpls_dir) + return sorted([d for d in os.listdir(tpls_dir) if isdir(join(tpls_dir, d))]) @util.memoized @@ -43,25 +44,30 @@ class ProjectGenerator(object): @util.memoized def get_project_build_data(self): + data = { + "defines": [], + "includes": [], + "cxx_path": None + } envdata = self.get_project_env() if "env_name" not in envdata: - return None + return data result = util.exec_command( ["platformio", "run", "-t", "idedata", "-e", envdata['env_name'], "--project-dir", self.project_dir] ) - if result['returncode'] != 0 or '{"includes":' not in result['out']: - return None + if result['returncode'] != 0 or '"includes":' not in result['out']: + return data output = result['out'] try: - start_index = output.index('\n{"includes":') + start_index = output.index('\n{"') stop_index = output.rindex('}') - return json.loads(output[start_index + 1:stop_index + 1]) + data = json.loads(output[start_index + 1:stop_index + 1]) except ValueError: pass - return None + return data def get_project_name(self): return basename(self.project_dir) @@ -69,7 +75,7 @@ class ProjectGenerator(object): def get_srcfiles(self): result = [] with util.cd(self.project_dir): - for root, _, files in walk(util.get_projectsrc_dir()): + for root, _, files in os.walk(util.get_projectsrc_dir()): for f in files: result.append(relpath(join(root, f))) return result @@ -77,20 +83,23 @@ class ProjectGenerator(object): def get_tpls(self): tpls = [] tpls_dir = join(util.get_source_dir(), "ide", "tpls", self.ide) - for root, _, files in walk(tpls_dir): + for root, _, files in os.walk(tpls_dir): for f in files: - if f.endswith(".tpl"): - tpls.append(( - root.replace(tpls_dir, ""), join(root, f))) + if not f.endswith(".tpl"): + continue + _relpath = root.replace(tpls_dir, "") + if _relpath.startswith(os.sep): + _relpath = _relpath[1:] + tpls.append((_relpath, join(root, f))) return tpls def generate(self): for _relpath, _path in self.get_tpls(): tpl_dir = self.project_dir if _relpath: - tpl_dir = join(self.project_dir, _relpath)[1:] + tpl_dir = join(self.project_dir, _relpath) if not isdir(tpl_dir): - makedirs(tpl_dir) + os.makedirs(tpl_dir) file_name = basename(_path)[:-4] with open(join(tpl_dir, file_name), "w") as f: @@ -104,16 +113,20 @@ class ProjectGenerator(object): def _gather_tplvars(self): self._tplvars.update(self.get_project_env()) - - build_data = self.get_project_build_data() - + self._tplvars.update(self.get_project_build_data()) self._tplvars.update({ "project_name": self.get_project_name(), - "includes": (build_data['includes'] - if build_data and "includes" in build_data else []), - "defines": (build_data['defines'] - if build_data and "defines" in build_data else []), "srcfiles": self.get_srcfiles(), "user_home_dir": abspath(expanduser("~")), - "project_dir": self.project_dir + "project_dir": self.project_dir, + "systype": util.get_systype(), + "platformio_path": self._fix_os_path( + util.where_is_program("platformio")), + "env_pathsep": os.pathsep, + "env_path": self._fix_os_path(os.getenv("PATH")) }) + + @staticmethod + def _fix_os_path(path): + return (re.sub(r"[\\]+", '\\' * 4, path) if "windows" in + util.get_systype() else path) diff --git a/platformio/ide/tpls/clion/CMakeLists.txt.tpl b/platformio/ide/tpls/clion/CMakeLists.txt.tpl index 9707347f..fe6d5807 100644 --- a/platformio/ide/tpls/clion/CMakeLists.txt.tpl +++ b/platformio/ide/tpls/clion/CMakeLists.txt.tpl @@ -1,5 +1,9 @@ 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): include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}") @@ -14,18 +18,18 @@ add_definitions(-D{{define}}) add_custom_target( PLATFORMIO_BUILD ALL - COMMAND platformio -f run + COMMAND ${PLATFORMIO_CMD} -f -c clion run WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) add_custom_target( PLATFORMIO_UPLOAD ALL - COMMAND platformio -f run --target upload + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) add_custom_target( PLATFORMIO_CLEAN ALL - COMMAND platformio -f run --target clean + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) \ No newline at end of file diff --git a/platformio/ide/tpls/eclipse/.cproject.tpl b/platformio/ide/tpls/eclipse/.cproject.tpl index c6f6e077..08b8a369 100644 --- a/platformio/ide/tpls/eclipse/.cproject.tpl +++ b/platformio/ide/tpls/eclipse/.cproject.tpl @@ -19,13 +19,17 @@ - +