Compare commits

..

129 Commits

Author SHA1 Message Date
Ivan Kravets
429722724f Merge branch 'release/v2.0.0' 2015-05-22 21:49:13 +03:00
Ivan Kravets
6a7a9a78ae Version bump to 2.0.0 (issues #108, #134, #148, #151, #152, #154, #158, #167, #168, #171, #173, #174, #177, #179, #182, #192, #197, #204) 2015-05-22 21:48:58 +03:00
Ivan Kravets
49842df368 Add links for CI 2015-05-22 21:42:49 +03:00
Ivan Kravets
5cee4463e0 Improve docs 2015-05-22 21:05:38 +03:00
Ivan Kravets
e0f0ee0f1a Force to upgrade PyPi packages 2015-05-22 20:23:09 +03:00
Ivan Kravets
76ddcb9d37 Fix export project for IDE under Windows 2015-05-22 19:27:33 +03:00
Ivan Kravets
a7f8b65356 Fix fetching of IDE data from build process 2015-05-22 19:21:05 +03:00
Ivan Kravets
d3a4a04a6d Allow to initialise PlatformIO project for the specified IDE // Resolve #151 2015-05-22 19:08:51 +03:00
Ivan Kravets
3a82d4a804 Merge branch 'develop' of https://github.com/ivankravets/platformio into develop 2015-05-22 16:45:14 +03:00
Ivan Kravets
274b04c08f Fix system type when machine data is not available 2015-05-22 16:44:53 +03:00
Ivan Kravets
41fc7dffaf Update AppVeyor badge 2015-05-22 16:12:02 +03:00
Ivan Kravets
66ac453c0f Merge branch 'develop' of https://github.com/ivankravets/platformio into develop 2015-05-22 12:05:50 +03:00
Ivan Kravets
251cab64f3 Remove unused dot 2015-05-22 12:05:42 +03:00
Ivan Kravets
963b182cb9 Update example libs 2015-05-22 10:57:23 +03:00
Ivan Kravets
3af709e95b Merge pull request #209 from valeros/develop
Improve support for espressif platform. Add CI services info and integration examples.
2015-05-22 10:55:55 +03:00
Valeriy Koval
9136fe9a8b Improve support for espressif platform. 2015-05-21 17:03:53 +03:00
Valeriy Koval
e15efa7e08 Add CI services info and integration examples. 2015-05-21 16:43:09 +03:00
Ivan Kravets
1f2b31f174 Create separate Continuous Integration page 2015-05-20 15:57:49 +03:00
Ivan Kravets
352fb01068 Merge pull request #207 from valeros/develop
Add platformio ci command examples with different CI systems.
2015-05-19 20:34:58 +03:00
Valeriy Koval
1a9cfc3311 Add platformio ci command examples with different CI systems. 2015-05-19 20:29:03 +03:00
Ivan Kravets
77838f2938 Use default verbosity level for CI command 2015-05-19 14:37:47 +03:00
Ivan Kravets
a1cc5f4282 Fix invalid import 2015-05-18 19:28:35 +03:00
Ivan Kravets
afdc28df80 Disable progress bar for Continuous Integration Systems 2015-05-18 19:22:42 +03:00
Ivan Kravets
49c389ce70 Add Espressif to list of supported platforms 2015-05-18 18:36:13 +03:00
Ivan Kravets
92bfa8f36d Fix removing locked files under windows 2015-05-18 18:26:52 +03:00
Ivan Kravets
fd39a88b26 Ignore errors when deleting CI tmp folder 2015-05-18 18:12:16 +03:00
Ivan Kravets
dd4fa733e1 Fix WindowsError for CI 2015-05-18 18:10:24 +03:00
Ivan Kravets
5d54727139 Update docs with the new boards // Resolve #204 2015-05-18 17:13:58 +03:00
Ivan Kravets
18d4b3fc1b Merge pull request #206 from valeros/develop
Add Armstrap Eagle boards.
2015-05-18 17:11:12 +03:00
Valeriy Koval
82a0ec0d2b Add Armstrap Eagle boards. 2015-05-18 16:43:33 +03:00
Ivan Kravets
6a4843c258 Merge pull request #205 from Lutino/patch-1
Update qtcreator.rst
2015-05-18 11:21:25 +03:00
Lutino
f414b91b08 Update qtcreator.rst
Edited the file to include an additional step for the initalization of the platformio project
2015-05-17 16:27:09 -07:00
Ivan Kravets
8a6fe2692c Add links to Ivan Kravets interview for IT Hare 2015-05-15 23:35:59 +02:00
Ivan Kravets
8673bc15bc Add --force option to avoid blocking caused by prompts 2015-05-15 22:50:39 +02:00
Ivan Kravets
c7b034b154 Add verbosity option for "run" and "ci" commands 2015-05-15 22:40:29 +02:00
Ivan Kravets
4a132941f6 Reorder short version of options 2015-05-15 22:31:55 +02:00
Ivan Kravets
c933c1edea Merge branch 'feature/platformio_20' into develop 2015-05-15 15:23:10 +02:00
Ivan Kravets
ccfc9afba7 Fix absolute paths for CI 2015-05-15 13:56:19 +02:00
Ivan Kravets
0652d439e5 Merge branch 'release/v1.5.0' 2015-05-15 13:00:51 +02:00
Ivan Kravets
49aea2fcf4 Merge branch 'release/v1.5.0' into develop 2015-05-15 13:00:51 +02:00
Ivan Kravets
10a7e38e13 Version bump to 1.5.0 (issues #175, #178, #183, #185, #189, #190, #191, #195) 2015-05-15 13:00:38 +02:00
Ivan Kravets
5bc2cc6325 Use "whole-archive" hook just for ST STM32 platform 2015-05-14 23:52:15 +02:00
Ivan Kravets
b62ac20180 Merge pull request #201 from platformio/release/v1.4.0
Merge from "release"
2015-05-14 23:39:58 +02:00
Ivan Kravets
c827c12710 Merge pull request #200 from TimJay/teensy_soft_reboot
added soft reboot to teensy_loader_cli
2015-05-14 23:28:32 +02:00
Tim Jagenberg
8453d2431c added soft reboot to teensy_loader_cli 2015-05-14 23:22:55 +02:00
Ivan Kravets
7b60d595a7 Add mbed support for Teensy 3.1 // Resolve #183 2015-05-14 23:13:47 +02:00
Ivan Kravets
b8a9afb6fb Fix PyLint warning 2015-05-14 23:13:20 +02:00
Ivan Kravets
91be0fad5d Merge branch 'develop' of https://github.com/ivankravets/platformio into develop 2015-05-14 23:12:50 +02:00
Ivan Kravets
e7ac08df30 Add "docslinkcheck" environment 2015-05-14 22:53:00 +02:00
Ivan Kravets
7b6014c47a Fix invalid "mbed" firmware for Nucleo F411RE 2015-05-14 22:49:55 +02:00
Ivan Kravets
5de7644493 Merge pull request #199 from valeros/develop
Add mbed support for Teensy 3.1 board // Resolve #183
2015-05-14 22:16:18 +02:00
Valeriy Koval
6e9418f583 Add mbed support for Teensy 3.1 board // Resolve #183 2015-05-14 21:17:07 +03:00
Ivan Kravets
84795fb9f4 Remove duplicate code 2015-05-14 17:49:08 +02:00
Ivan Kravets
4ce09f1d43 Implement "whole-archive" hook for mbed-lib and LINCOM command 2015-05-14 17:47:39 +02:00
Ivan Kravets
96b06db5ef Fix firmware uploading under Linux OS for Arduino Leonardo board // Resolve #178 2015-05-14 17:07:20 +02:00
Ivan Kravets
49562a152e Merge pull request #198 from valeros/develop
Fix TouchSerialPort function on Linux system.
2015-05-14 17:00:08 +02:00
Valeriy Koval
9c4960ab2f Fix TouchSerialPort function on Linux system. 2015-05-14 17:57:21 +03:00
Ivan Kravets
e960302b6d Fix handling symbolic links within source code directory // Resolve #190 2015-05-08 18:09:35 +01:00
Ivan Kravets
40322e0f9b Allow to print dump of SCons environment using "envdump" target 2015-05-08 17:32:14 +01:00
Ivan Kravets
72ebe0ec1b Fix PyLint warnings 2015-05-07 18:40:53 +01:00
Ivan Kravets
1a39781cff Fix cancelling any previous definition of name, either built in or provided with a `-D` option // Resolve #191 2015-05-07 18:13:29 +01:00
Ivan Kravets
44eaf1db22 Document PLATFORMIO_CI_SRC environment variable 2015-05-07 17:02:53 +01:00
Ivan Kravets
8133a12dc3 Merge pull request #193 from valeros/feature/platformio_20
Update project generator and his templates.
2015-05-07 16:47:57 +01:00
Ivan Kravets
a1bad33d9d Add "program" to command options 2015-05-07 16:44:56 +01:00
Ivan Kravets
510c4decb7 PlatformIO as Continuous Integration tool for embedded projects // Resolve #108 2015-05-07 16:20:53 +01:00
Ivan Kravets
7822a929f3 Fix tests after removing "autogen" prefix for init project 2015-05-07 15:53:06 +01:00
Valeriy Koval
19b7c730ae Update project generator and templates. 2015-05-07 17:21:44 +03:00
Ivan Kravets
92e81ee619 Cleanup code 2015-05-06 18:07:17 +01:00
Ivan Kravets
eeeed1ba08 Allow to run project with platformio run –project-dir option without changing the current working directory // Resolve #192 2015-05-06 17:29:58 +01:00
Ivan Kravets
04f246ea9d Remove "autogen_" prefix from default env 2015-05-06 11:28:56 +01:00
Ivan Kravets
945b1324af Fix gathering of _tplvars 2015-05-06 11:17:38 +01:00
Ivan Kravets
5469b98057 Improve documentation for User Guide 2015-05-05 16:15:44 +01:00
Ivan Kravets
f001c087ec Allow to specify libraries which are compatible with build environment using use_libs option in platformio.ini 2015-05-05 15:47:21 +01:00
Ivan Kravets
661ca2d27e Update Gemnasium configuration 2015-05-05 12:59:13 +01:00
Ivan Kravets
440a2b9bc8 Fix parsing of includes for PlatformIO Library Dependency Finder // Resolve #189 2015-05-05 12:36:09 +01:00
Ivan Kravets
125c7b2aba Revert caching for development platforms 2015-05-01 17:51:20 +01:00
Ivan Kravets
424e87a811 Add library dependencies using "install_libs" option in platformio.ini // Resolve #134 2015-05-01 13:49:18 +01:00
Ivan Kravets
7391dfa936 Fix caching for installed platforms and libraries 2015-05-01 13:48:06 +01:00
Ivan Kravets
0a474d34d8 Cache get_installed_libs result 2015-05-01 13:00:33 +01:00
Ivan Kravets
ab9a7e05c8 Use "lib_dir" by default for LibraryManager 2015-05-01 12:54:45 +01:00
Ivan Kravets
6967e936a6 Fix CPPFLAGS example for build flags 2015-05-01 12:06:34 +01:00
Ivan Kravets
47903a7ac9 Update User Guide documentation for PlatformIO 2.0 // Issue #158 2015-04-30 14:14:57 +01:00
Ivan Kravets
cd842d5a86 Put UserAgent for all http requests 2015-04-29 18:17:14 +01:00
Ivan Kravets
7b80e17664 Improve handling of platforms commands for telemetry 2015-04-28 13:13:17 +01:00
Ivan Kravets
bdcf89bf32 Correct spelling in Creating platform example 2015-04-27 18:48:16 +01:00
Ivan Kravets
0d19f021f1 Merge pull request #188 from valeros/feature/platformio_20
Move documentation example with creating especial platform to right place
2015-04-27 18:27:09 +01:00
Valeriy Koval
49bd13adc4 Move documentation example with creating especial platform to right place. 2015-04-27 20:25:47 +03:00
Ivan Kravets
5a162b6341 Merge pull request #187 from valeros/develop
Add GDB as alternative uploader to ststm32 platform // Resolve #175
2015-04-27 17:42:16 +01:00
Valeriy Koval
2206ec50a5 Change compare condition 2015-04-27 19:05:59 +03:00
Valeriy Koval
60dc02682b Add GDB as alternative uploader to ststm32 platform // Resolve #175 2015-04-27 18:59:40 +03:00
Ivan Kravets
3657891833 Merge pull request #186 from valeros/feature/platformio_20
Add example with creating especial platform in documentation
2015-04-27 16:31:06 +01:00
Valeriy Koval
1033e827c0 Add example with creating especial platform in documentation 2015-04-27 18:27:26 +03:00
Ivan Kravets
c14b436aec Fix encoding for Project Generator 2015-04-24 17:17:24 +01:00
Ivan Kravets
8b8d5c360c Add prototypes for includes/srcfiles 2015-04-24 16:34:14 +01:00
Ivan Kravets
97d229232d Correct warning about obsoleted commands 2015-04-24 15:51:08 +01:00
Ivan Kravets
36ad6efa25 Handle obsoleted commands // Issue #158 2015-04-24 15:48:32 +01:00
Ivan Kravets
0bf7e68ea5 Require minimum 1 argument for the "uninstall" command 2015-04-24 15:37:08 +01:00
Ivan Kravets
d415cbbe45 Require minimum 1 argument for the "install" command 2015-04-24 15:33:29 +01:00
Ivan Kravets
c79114c345 Fix build system to "PlatformIO" for ST 2015-04-24 14:53:07 +01:00
Ivan Kravets
6fd07e1e56 Initial support of PlatformIO Project Generator // Issue #151 2015-04-24 14:43:13 +01:00
Ivan Kravets
97044bf5a5 Improve cache logic for lookup operations 2015-04-23 14:11:30 +01:00
Ivan Kravets
31a2880c3c Improve carols with Bountysource 2015-04-23 13:09:41 +01:00
Ivan Kravets
476de84dc5 Allow to specify environment prefix when initialise project // Resolve #182 2015-04-23 12:54:59 +01:00
Ivan Kravets
0d648074e4 Allow to add more boards to existing platformio.ini // Resolve #167 2015-04-23 12:40:19 +01:00
Ivan Kravets
47b8a4dd69 Fix test with incorrect board 2015-04-22 15:24:45 +01:00
Ivan Kravets
60863a4304 Fix PyLint warnings 2015-04-22 14:58:42 +01:00
Ivan Kravets
4d8cbc1349 Fix bug with creating copies of source files // Resolve #177 2015-04-22 14:21:26 +01:00
Ivan Kravets
5af3b9b7c9 Validate passed boards before project initialization 2015-04-20 19:55:18 +01:00
Ivan Kravets
84354edcc1 Fix handling user's platforms 2015-04-20 18:48:38 +01:00
Ivan Kravets
2198e317ff Merge pull request #181 from valeros/develop
Fix search command output
2015-04-20 18:02:25 +01:00
Valeriy Koval
9c318c1d34 Fix search command output 2015-04-20 19:58:39 +03:00
Ivan Kravets
c8af9aacbb Merge branch 'feature/platformio_20' of https://github.com/ivankravets/platformio into feature/platformio_20 2015-04-20 17:20:49 +01:00
Ivan Kravets
71261023de Enhance commands output 2015-04-20 17:20:27 +01:00
Ivan Kravets
4cde47af75 Update click to 4.0 2015-04-20 16:26:12 +01:00
Ivan Kravets
ee962c1919 Created PlatformIO gitter.im room 2015-04-20 16:19:59 +01:00
Ivan Kravets
3f52ba3d05 Create gitter.im room // Resolve #174 2015-04-20 16:13:02 +01:00
Ivan Kravets
2c0693fa72 Add article by Michael Ball 2015-04-18 11:18:39 +01:00
Ivan Kravets
1cf026d956 Fix platform tests according refactor changes 2015-04-17 15:32:33 +01:00
Ivan Kravets
07022bb3be Implement PlatformIO CLI 2.0 // Resolve #158 2015-04-17 12:37:03 +01:00
Ivan Kravets
b52ff11d3c Disabled automatic updates by default for platforms, packages and libraries // Resolve #171 2015-04-17 12:28:10 +01:00
Ivan Kravets
333e1d05f5 Merge pull request #176 from valeros/develop
Add examples with preconfigured IDE projects // Resolve #154
2015-04-16 17:39:32 +01:00
Ivan Kravets
a9942e675f Allow to choose which library to update // Resolve #168 2015-04-16 17:34:22 +01:00
Ivan Kravets
8d75194884 Add global -f, --force option which will force to accept any confirmation prompts // Resolve #152 2015-04-16 17:04:45 +01:00
Ivan Kravets
bf0f4c8de4 Extend troubleshooting with obsolete "setuptools" // Issue #173 2015-04-16 13:16:56 +02:00
Valeriy Koval
3a08fb89b2 Fix Sublime Text project template 2015-04-16 09:51:00 +03:00
Valeriy Koval
7918f912c4 Add integration instructions and example for Qt Creator 2015-04-15 16:42:12 +03:00
Valeriy Koval
b26856e04d Add examples with preconfigured IDE projects // Resolve #154 2015-04-15 16:40:23 +03:00
Ivan Kravets
0234fcd2e3 Add Espressif information 2015-04-11 20:00:12 +03:00
Ivan Kravets
6f2441f0fe Merge branch 'release/v1.4.0' into develop 2015-04-11 19:53:49 +03:00
128 changed files with 3549 additions and 675 deletions

View File

@@ -1,3 +1,3 @@
[settings]
line_length=79
known_third_party=click,requests,serial,SCons,pytest
known_third_party=click,requests,serial,SCons,pytest,bottle

View File

@@ -1,6 +1,74 @@
Release History
===============
2.0.0 (2015-05-22)
------------------
* PlatformIO as :ref:`ci` (CI) tool for embedded projects
(`issue #108 <https://github.com/platformio/platformio/issues/108>`_)
* Initialise PlatformIO project for the specified IDE
(`issue #151 <https://github.com/platformio/platformio/issues/151>`_)
* PlatformIO CLI 2.0: "platform" related commands have been
moved to ``platformio platforms`` subcommand
(`issue #158 <https://github.com/platformio/platformio/issues/158>`_)
* Created `PlatformIO gitter.im <https://gitter.im/platformio/platformio>`_ room
(`issue #174 <https://github.com/platformio/platformio/issues/174>`_)
* Global ``-f, --force`` option which will force to accept any
confirmation prompts
(`issue #152 <https://github.com/platformio/platformio/issues/152>`_)
* Run project with `platformio run --project-dir <http://docs.platformio.org/en/latest/userguide/cmd_run.html#cmdoption--project-dir>`_ option without changing the current working
directory
(`issue #192 <https://github.com/platformio/platformio/issues/192>`_)
* Control verbosity of `platformio run <http://docs.platformio.org/en/latest/userguide/cmd_run.html#cmdoption-platformio-run-v>`_ command via ``-v/--verbose`` option
* Add library dependencies for build environment using
`install_libs <http://docs.platformio.org/en/latest/projectconf.html#install-libs>`_
option in ``platformio.ini``
(`issue #134 <https://github.com/platformio/platformio/issues/134>`_)
* Specify libraries which are compatible with build environment using
`use_libs <http://docs.platformio.org/en/latest/projectconf.html#use-libs>`_
option in ``platformio.ini``
(`issue #148 <https://github.com/platformio/platformio/issues/148>`_)
* Add more boards to PlatformIO project with
`platformio init --board <http://docs.platformio.org/en/latest/userguide/cmd_init.html#cmdoption--board>`__
command
(`issue #167 <https://github.com/platformio/platformio/issues/167>`_)
* Choose which library to update
(`issue #168 <https://github.com/platformio/platformio/issues/168>`_)
* Specify `platformio init --env-prefix <http://docs.platformio.org/en/latest/userguide/cmd_init.html#cmdoption--env-prefix>`__ when initialise/update project
(`issue #182 <https://github.com/platformio/platformio/issues/182>`_)
* Added new Armstrap boards
(`issue #204 <https://github.com/platformio/platformio/issues/204>`_)
* Updated SDK for `espressif <http://docs.platformio.org/en/latest/platforms/espressif.html>`__
development platform to v1.1
(`issue #179 <https://github.com/platformio/platformio/issues/179>`_)
* Disabled automatic updates by default for platforms, packages and libraries
(`issue #171 <https://github.com/platformio/platformio/issues/171>`_)
* Fixed bug with creating copies of source files
(`issue #177 <https://github.com/platformio/platformio/issues/177>`_)
1.5.0 (2015-05-15)
------------------
* Added support of `Framework mbed <http://platformio.org/#!/frameworks/mbed>`_
for Teensy 3.1
(`issue #183 <https://github.com/platformio/platformio/issues/183>`_)
* Added GDB as alternative uploader to `ststm32 <http://docs.platformio.org/en/latest/platforms/ststm32.html>`__ platform
(`issue #175 <https://github.com/platformio/platformio/issues/174>`_)
* Added `examples <https://github.com/platformio/platformio/tree/develop/examples>`__
with preconfigured IDE projects
(`issue #154 <https://github.com/platformio/platformio/issues/154>`_)
* Fixed firmware uploading under Linux OS for Arduino Leonardo board
(`issue #178 <https://github.com/platformio/platformio/issues/178>`_)
* Fixed invalid "mbed" firmware for Nucleo F411RE
(`issue #185 <https://github.com/platformio/platformio/issues/185>`_)
* Fixed parsing of includes for PlatformIO Library Dependency Finder
(`issue #189 <https://github.com/platformio/platformio/issues/189>`_)
* Fixed handling symbolic links within source code directory
(`issue #190 <https://github.com/platformio/platformio/issues/190>`_)
* Fixed cancelling any previous definition of name, either built in or provided
with a ``-D`` option
(`issue #191 <https://github.com/platformio/platformio/issues/191>`_)
1.4.0 (2015-04-11)
------------------
@@ -19,8 +87,9 @@ Release History
1.6.3 version (`issue #156 <https://github.com/platformio/platformio/issues/156>`_)
* Upgraded `Energia Framework <http://docs.platformio.org/en/latest/frameworks/energia.html>`__ to
0101E0015 version (`issue #146 <https://github.com/platformio/platformio/issues/146>`_)
* Upgraded `Arduino Framework with Teensy Core <http://docs.platformio.org/en/latest/frameworks/arduino.html>`_ to
1.22 version (`issue #162 <https://github.com/platformio/platformio/issues/162>`_,
* Upgraded `Arduino Framework with Teensy Core <http://docs.platformio.org/en/latest/frameworks/arduino.html>`_
to 1.22 version
(`issue #162 <https://github.com/platformio/platformio/issues/162>`_,
`issue #170 <https://github.com/platformio/platformio/issues/170>`_)
* Fixed exceptions with PlatformIO auto-updates when Internet connection isn't
active

View File

@@ -4,11 +4,11 @@ PlatformIO
.. image:: https://travis-ci.org/platformio/platformio.svg?branch=develop
:target: https://travis-ci.org/platformio/platformio
:alt: Travis.CI Build Status
.. image:: https://ci.appveyor.com/api/projects/status/ee26e58de798rctd/branch/develop?svg=true
.. image:: https://ci.appveyor.com/api/projects/status/dku0h2rutfj0ctls/branch/develop?svg=true
:target: https://ci.appveyor.com/project/ivankravets/platformio
:alt: AppVeyor.CI Build Status
.. image:: https://gemnasium.com/ivankravets/platformio.png
:target: https://gemnasium.com/ivankravets/platformio
:alt: AppVeyor.CI Build Status
.. image:: https://gemnasium.com/platformio/platformio.png
:target: https://gemnasium.com/platformio/platformio
:alt: Dependency Status
.. image:: https://pypip.in/version/platformio/badge.png?style=flat
:target: https://pypi.python.org/pypi/platformio/
@@ -19,6 +19,9 @@ PlatformIO
.. image:: https://pypip.in/license/platformio/badge.png?style=flat
:target: https://pypi.python.org/pypi/platformio/
:alt: License
.. image:: https://badges.gitter.im/Join%20Chat.svg
:alt: Join the chat at https://gitter.im/platformio/platformio
:target: https://gitter.im/platformio/platformio
`Website + Library Search <http://platformio.org>`_ |
`Documentation <http://docs.platformio.org>`_ |
@@ -27,8 +30,8 @@ PlatformIO
`Reddit <http://www.reddit.com/r/platformio/>`_ |
`Twitter <https://twitter.com/PlatformIO_Org>`_
*Atmel AVR & SAM, Freescale Kinetis, Nordic nRF51, NXP LPC, ST STM32,
TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.*
*Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC,
ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.*
.. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-logo.png
:target: http://platformio.org
@@ -43,6 +46,7 @@ and the missing library manager.
* `Embedded Boards Explorer <http://platformio.org/#!/boards>`_
* `Library Manager <http://docs.platformio.org/en/latest/librarymanager/index.html>`_
* `User Guide <http://docs.platformio.org/en/latest/userguide/index.html>`_
* `Continuous Integration <http://docs.platformio.org/en/latest/ci/index.html>`_
* `IDE Integration <http://docs.platformio.org/en/latest/ide.html>`_
* `Articles about us <http://docs.platformio.org/en/latest/articles.html>`_
* `FAQ <http://docs.platformio.org/en/latest/faq.html>`_
@@ -72,7 +76,7 @@ settings for most popular `Embedded Boards <http://platformio.org/#!/boards>`_.
* Configurable `build -flags/-options <http://docs.platformio.org/en/latest/projectconf.html#build-flags>`_
* Automatic **firmware uploading**
* Integration with `development environments (IDE) <http://docs.platformio.org/en/latest/ide.html>`_
* Ready for **Cloud Compiling** and **Continuous Integration**
* Ready for **Cloud Compiling** and `Continuous Integration <http://docs.platformio.org/en/latest/ci/index.html>`_
* Pre-built tool chains, frameworks for the popular `Hardware Platforms <http://platformio.org/#!/platforms>`_
.. image:: https://raw.githubusercontent.com/platformio/platformio-web/develop/app/images/platformio-embedded-development.png
@@ -127,9 +131,10 @@ It has support for the most popular embedded platforms:
* `Atmel AVR <http://platformio.org/#!/platforms/atmelavr>`_
* `Atmel SAM <http://platformio.org/#!/platforms/atmelsam>`_
* `Espressif <http://platformio.org/#!/platforms/espressif>`_
* `Freescale Kinetis <http://platformio.org/#!/platforms/freescalekinetis>`_
* `Nordic nRF51 <http://platformio.org/#!/platforms/nordicnrf51>`_
* `NXP LPC. <http://platformio.org/#!/platforms/nxplpc>`_
* `NXP LPC <http://platformio.org/#!/platforms/nxplpc>`_
* `ST STM32 <http://platformio.org/#!/platforms/ststm32>`_
* `Teensy <http://platformio.org/#!/platforms/teensy>`_
* `TI MSP430 <http://platformio.org/#!/platforms/timsp430>`_

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@@ -4,13 +4,16 @@ Articles about us
=================
.. note::
If you've writeen article about PlatformIO and would like it listed on
If you've written article about PlatformIO and would like it listed on
this page, `please edit this page <https://github.com/platformio/platformio/blob/develop/docs/articles.rst>`_.
Here are recent articles about PlatformIO:
* May 11, 2015 - **IT Hare** - `From Web Developer to Embedded One: Interview with Ivan Kravets, The Guy Behind PlatformIO. Part II <http://ithare.com/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 <http://ithare.com/from-web-development-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 <http://arduino-pi.blogspot.com.es/2015/04/platformio-cross-platform-code-builder.html>`_
* March 23, 2015 - **Atmel** - `Cross-board and cross-vendor embedded development with PlatformIO <http://blog.atmel.com/2015/03/23/cross-board-and-cross-vendor-embedded-development-with-platformio/>`_
* March 22, 2015 - **Mark VandeWettering** - `Discovered a new tool for embedded development: PlatformIO <http://brainwagon.org/2015/03/22/discovered-a-new-tool-for-embedded-development-platformio/>`_
* October 7, 2014 - **Ivan Kravets** - `Integration of PlatformIO library manager to Arduino and Energia IDEs <http://www.ikravets.com/computer-life/platformio/2014/10/07/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 <http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio>`_
* June 17, 2014 - **Ivan Kravets** - `How was PlatformIO born or why I love Python World <http://www.ikravets.com/computer-life/programming/2014/06/17/how-was-platformio-born-or-why-i-love-python-world>`_
* June 17, 2014 - **Ivan Kravets** - `How was PlatformIO born or why I love Python World <http://www.ikravets.com/computer-life/programming/2014/06/17/how-was-platformio-born-or-why-i-love-python-world>`_

213
docs/ci/appveyor.rst Normal file
View File

@@ -0,0 +1,213 @@
.. _ci_appveyor:
AppVeyor
========
`AppVeyor <http://www.appveyor.com/about>`_ is an open-source hosted,
distributed continuous integration service used to build and test projects
hosted at `GitHub <http://en.wikipedia.org/wiki/GitHub>`_ on Windows family
systems.
AppVeyor is configured by adding a file named ``appveyor.yml``, which is a
`YAML <http://en.wikipedia.org/wiki/YAML>`_ format text file, to the root
directory of the GitHub repository.
AppVeyor automatically detects when a commit has been made and pushed to a
GitHub repository that is using AppVeyor, and each time this happens, it will
try to build the project using :ref:`cmd_ci` command. This includes commits to
all branches, not just to the master branch. AppVeyor will also build and run
pull requests. When that process has completed, it will notify a developer in
the way it has been configured to do so — for example, by sending an email
containing the build results (showing success or failure), or by posting a
message on an IRC channel. It can be configured to build project on a range of
different :ref:`platforms`.
Integration
-----------
Put ``appveyor.yml`` to the root directory of the GitHub repository.
.. code-block:: yaml
build: off
environment:
global:
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\scripts\\appveyor\\run_with_compiler.cmd"
matrix:
- PLATFORMIO_CI_SRC: "path\\to\\source\\file.c"
PLATFORMIO_CI_SRC: "path\\to\\source\\file.ino"
PLATFORMIO_CI_SRC: "path\\to\\source\\directory"
WINDOWS_SDK_VERSION: "v7.0"
PYTHON_HOME: "C:\\Python27-x64"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
install:
- "git submodule update --init --recursive"
- "powershell scripts\\appveyor\\install.ps1"
before_test:
- cmd: SET PATH=%PATH%;%PYTHON_HOME%;%PYTHON_HOME%\Scripts
test_script:
- '%WITH_COMPILER% %PYTHON_HOME%\\Scripts\\platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N'
Then create ``scripts/appveyor`` folder and put these 2 scripts (they are the
same for the all projects, don't need to modify them):
1. ``scripts/appveyor/install.ps1``:
.. code-block:: PowerShell
$BASE_URL = "https://www.python.org/ftp/python/"
$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
$GET_PIP_PATH = "C:\get-pip.py"
function DownloadPython ($python_version, $platform_suffix) {
$webclient = New-Object System.Net.WebClient
$filename = "python-" + $python_version + $platform_suffix + ".msi"
$url = $BASE_URL + $python_version + "/" + $filename
$basedir = $pwd.Path + "\"
$filepath = $basedir + $filename
if (Test-Path $filename) {
Write-Host "Reusing" $filepath
return $filepath
}
# Download and retry up to 5 times in case of network transient errors.
Write-Host "Downloading" $filename "from" $url
$retry_attempts = 3
for($i=0; $i -lt $retry_attempts; $i++){
try {
$webclient.DownloadFile($url, $filepath)
break
}
Catch [Exception]{
Start-Sleep 1
}
}
Write-Host "File saved at" $filepath
return $filepath
}
function InstallPython ($python_version, $architecture, $python_home) {
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
if (Test-Path $python_home) {
Write-Host $python_home "already exists, skipping."
return $false
}
if ($architecture -eq "32") {
$platform_suffix = ""
} else {
$platform_suffix = ".amd64"
}
$filepath = DownloadPython $python_version $platform_suffix
Write-Host "Installing" $filepath "to" $python_home
$args = "/qn /i $filepath TARGETDIR=$python_home"
Write-Host "msiexec.exe" $args
Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthru
Write-Host "Python $python_version ($architecture) installation complete"
return $true
}
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."
}
}
function InstallPackage ($python_home, $pkg) {
$pip_path = $python_home + "/Scripts/pip.exe"
& $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://sourceforge.net/projects/scons/files/latest/download"
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
2. ``scripts/appveyor/run_with_compiler.cmd``:
.. code-block:: guess
@ECHO OFF
SET COMMAND_TO_RUN=%*
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%"
IF %MAJOR_PYTHON_VERSION% == "2" (
SET WINDOWS_SDK_VERSION="v7.0"
) ELSE IF %MAJOR_PYTHON_VERSION% == "3" (
SET WINDOWS_SDK_VERSION="v7.1"
) ELSE (
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
EXIT 1
)
IF "%PYTHON_ARCH%"=="64" (
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
SET DISTUTILS_USE_SDK=1
SET MSSdk=1
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
) ELSE (
ECHO Using default MSVC build environment for 32 bit architecture
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
)
For more details as for PlatformIO build process please look into :ref:`cmd_ci`
command.
Examples
--------
1. Integration for `USB_Host_Shield_2.0 <https://github.com/felis/USB_Host_Shield_2.0>`_
project. The ``appveyor.yml`` configuration file:
.. code-block:: yaml
build: off
environment:
global:
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\scripts\\appveyor\\run_with_compiler.cmd"
matrix:
- PLATFORMIO_CI_SRC: "examples\\Bluetooth\\PS3SPP\\PS3SPP.ino"
PLATFORMIO_CI_SRC: "examples\\pl2303\\pl2303_gps\\pl2303_gps.ino"
WINDOWS_SDK_VERSION: "v7.0"
PYTHON_HOME: "C:\\Python27-x64"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
install:
- "git submodule update --init --recursive"
- "powershell scripts\\appveyor\\install.ps1"
before_test:
- cmd: SET PATH=%PATH%;%PYTHON_HOME%;%PYTHON_HOME%\Scripts
- cmd: git clone https://github.com/xxxajk/spi4teensy3.git c:\spi4teensy
test_script:
- '%WITH_COMPILER% %PYTHON_HOME%\\Scripts\\platformio ci --lib="." --lib="c:\spi4teensy" --board=uno --board=teensy31 --board=due'

72
docs/ci/circleci.rst Normal file
View File

@@ -0,0 +1,72 @@
.. _ci_circleci:
Circle CI
=========
`Circle CI <https://circleci.com/about>`_ is a hosted cloud
platform that provides hosted continuous integration, deployment, and testing
to `GitHub <http://en.wikipedia.org/wiki/GitHub>`_ repositories.
Circle CI is configured by adding a file named ``circle.yml``, which is a
`YAML <http://en.wikipedia.org/wiki/YAML>`_ format text file, to the root
directory of the GitHub repository.
Circle CI automatically detects when a commit has been made and pushed to a
GitHub repository that is using Circle CI, and each time this happens, it will
try to build the project using :ref:`cmd_ci` command. This includes commits to
all branches, not just to the master branch. Circle CI will also build and run
pull requests. When that process has completed, it will notify a developer in
the way it has been configured to do so — for example, by sending an email
containing the build results (showing success or failure), or by posting a
message on an IRC channel. It can be configured to build project on a range of
different :ref:`platforms`.
Integration
-----------
Put ``circle.yml`` to the root directory of the GitHub repository.
.. code-block:: yaml
machine:
environment:
- PLATFORMIO_CI_SRC=path/to/source/file.c
- PLATFORMIO_CI_SRC=path/to/source/file.ino
- PLATFORMIO_CI_SRC=path/to/source/directory
dependencies:
pre:
- sudo apt-get install python2.7-dev
- sudo python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
test:
override:
- platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
For more details as for PlatformIO build process please look into :ref:`cmd_ci`
command.
Examples
--------
1. Integration for `USB_Host_Shield_2.0 <https://github.com/felis/USB_Host_Shield_2.0>`_
project. The ``circle.yml`` configuration file:
.. code-block:: yaml
machine:
environment:
PLATFORMIO_CI_SRC: examples/Bluetooth/PS3SPP/PS3SPP.ino
PLATFORMIO_CI_SRC: examples/pl2303/pl2303_gps/pl2303_gps.ino
dependencies:
pre:
- sudo apt-get install python2.7-dev
- sudo python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
- wget https://github.com/xxxajk/spi4teensy3/archive/master.zip -O /tmp/spi4teensy3.zip
- unzip /tmp/spi4teensy3.zip -d /tmp
test:
override:
- platformio ci --lib="." --lib="/tmp/spi4teensy3-master" --board=uno --board=teensy31 --board=due

70
docs/ci/drone.rst Normal file
View File

@@ -0,0 +1,70 @@
.. _ci_drone:
Drone
=====
`Drone <https://drone.io>`_ is a hosted continuous integration service.
It enables you to conveniently set up projects to automatically build, test,
and deploy as you make changes to your code to
`GitHub <http://en.wikipedia.org/wiki/GitHub>`_ and
`BitBucket <http://en.wikipedia.org/wiki/Bitbucket>`_ repositories.
Drone is configured by modifying settings in your project control panel.
Drone automatically detects when a commit has been made and pushed to a
GitHub repository that is using Drone, and each time this happens, it will
try to build the project using :ref:`cmd_ci` command. This includes commits to
all branches, not just to the master branch. Drone will also build and run
pull requests. When that process has completed, it will notify a developer in
the way it has been configured to do so — for example, by sending an email
containing the build results (showing success or failure). It can be
configured to build project on a range of different :ref:`platforms`.
Integration
-----------
Please fill all fields for your project in the Drone control panel:
`Environment Variables`:
.. code-block:: bash
PLATFORMIO_CI_SRC=path/to/source/file.c
PLATFORMIO_CI_SRC=path/to/source/file.ino
PLATFORMIO_CI_SRC=path/to/source/directory
`Commands`:
.. code-block:: bash
python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
.. image:: ../_static/droneci-platformio-integration-1.png
For more details as for PlatformIO build process please look into :ref:`cmd_ci`
command.
Examples
--------
1. Integration for `USB_Host_Shield_2.0 <https://github.com/felis/USB_Host_Shield_2.0>`_
project. The ``circle.yml`` configuration file:
`Environment Variables`:
.. code-block:: bash
PLATFORMIO_CI_SRC=examples/Bluetooth/PS3SPP/PS3SPP.ino
PLATFORMIO_CI_SRC=examples/pl2303/pl2303_gps/pl2303_gps.ino
`Commands`:
.. code-block:: bash
python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
wget https://github.com/xxxajk/spi4teensy3/archive/master.zip -O /tmp/spi4teensy3.zip
unzip /tmp/spi4teensy3.zip -d /tmp
platformio ci --lib="." --lib="/tmp/spi4teensy3-master" --board=uno --board=teensy31 --board=due
.. image:: ../_static/droneci-platformio-integration-2.png

24
docs/ci/index.rst Normal file
View File

@@ -0,0 +1,24 @@
.. _ci:
Continuous Integration
======================
`Continuous Integration (CI, wiki) <http://en.wikipedia.org/wiki/Continuous_integration>`_
is the practice, in software engineering, of merging all developer working
copies with a shared mainline several times a day.
:ref:`cmd_ci` command is intended to be used in combination with the build
servers and the popular
`Continuous Integration Software <http://en.wikipedia.org/wiki/Comparison_of_continuous_integration_software>`_.
By integrating regularly, you can detect errors quickly, and locate them more
easily.
.. toctree::
:maxdepth: 2
appveyor
circleci
drone
shippable
travis

76
docs/ci/shippable.rst Normal file
View File

@@ -0,0 +1,76 @@
.. _ci_shippable:
Shippable
=========
`Shippable <http://en.wikipedia.org/wiki/Shippable>`_ is a hosted cloud
platform that provides hosted continuous integration, deployment, and testing
to `GitHub <http://en.wikipedia.org/wiki/GitHub>`_ and
`BitBucket <http://en.wikipedia.org/wiki/Bitbucket>`_ repositories.
Shippable's continuous integration service is built using Docker.
Shippable is configured by adding a file named ``shippable.yml``, which is a
`YAML <http://en.wikipedia.org/wiki/YAML>`_ format text file, to the root
directory of the GitHub repository or you can use your Travis CI configuration
file ``.travis.yml``.
Shippable automatically detects when a commit has been made and pushed to a
GitHub repository that is using Shippable, and each time this happens, it will
try to build the project using :ref:`cmd_ci` command. This includes commits to
all branches, not just to the master branch. Shippable will also build and run
pull requests. When that process has completed, it will notify a developer in
the way it has been configured to do so — for example, by sending an email
containing the build results (showing success or failure), or by posting a
message on an IRC channel. It can be configured to build project on a range of
different :ref:`platforms`.
Integration
-----------
Please put ``shippable.yml`` or ``.travis.yml`` to the root directory of the
GitHub repository.
.. code-block:: yaml
language: python
python:
- "2.7"
env:
- PLATFORMIO_CI_SRC=path/to/source/file.c
- PLATFORMIO_CI_SRC=path/to/source/file.ino
- PLATFORMIO_CI_SRC=path/to/source/directory
install:
- python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
script:
- platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
For more details as for PlatformIO build process please look into :ref:`cmd_ci`
command.
Examples
--------
1. Integration for `USB_Host_Shield_2.0 <https://github.com/felis/USB_Host_Shield_2.0>`_
project. The ``shippable.yml`` or ``.travis.yml`` configuration file:
.. code-block:: yaml
language: python
python:
- "2.7"
env:
- PLATFORMIO_CI_SRC=examples/Bluetooth/PS3SPP/PS3SPP.ino
- PLATFORMIO_CI_SRC=examples/pl2303/pl2303_gps/pl2303_gps.ino
install:
- python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
- wget https://github.com/xxxajk/spi4teensy3/archive/master.zip -O /tmp/spi4teensy3.zip
- unzip /tmp/spi4teensy3.zip -d /tmp
script:
- platformio ci --lib="." --lib="/tmp/spi4teensy3-master" --board=uno --board=teensy31 --board=due

72
docs/ci/travis.rst Normal file
View File

@@ -0,0 +1,72 @@
.. _ci_travis:
Travis CI
=========
`Travis CI <http://en.wikipedia.org/wiki/Travis_CI>`_ is an open-source hosted,
distributed continuous integration service used to build and test projects
hosted at `GitHub <http://en.wikipedia.org/wiki/GitHub>`_.
Travis CI is configured by adding a file named ``.travis.yml``, which is a
`YAML <http://en.wikipedia.org/wiki/YAML>`_ format text file, to the root
directory of the GitHub repository.
Travis CI automatically detects when a commit has been made and pushed to a
GitHub repository that is using Travis CI, and each time this happens, it will
try to build the project using :ref:`cmd_ci` command. This includes commits to
all branches, not just to the master branch. Travis CI will also build and run
pull requests. When that process has completed, it will notify a developer in
the way it has been configured to do so — for example, by sending an email
containing the build results (showing success or failure), or by posting a
message on an IRC channel. It can be configured to build project on a range of
different :ref:`platforms`.
Integration
-----------
Please put ``.travis.yml`` to the root directory of the GitHub repository.
.. code-block:: yaml
language: python
python:
- "2.7"
env:
- PLATFORMIO_CI_SRC=path/to/source/file.c
- PLATFORMIO_CI_SRC=path/to/source/file.ino
- PLATFORMIO_CI_SRC=path/to/source/directory
install:
- python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
script:
- platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
For more details as for PlatformIO build process please look into :ref:`cmd_ci`
command.
Examples
--------
1. Integration for `USB_Host_Shield_2.0 <https://github.com/felis/USB_Host_Shield_2.0>`_
project. The ``.travis.yml`` configuration file:
.. code-block:: yaml
language: python
python:
- "2.7"
env:
- PLATFORMIO_CI_SRC=examples/Bluetooth/PS3SPP/PS3SPP.ino
- PLATFORMIO_CI_SRC=examples/pl2303/pl2303_gps/pl2303_gps.ino
install:
- python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
- wget https://github.com/xxxajk/spi4teensy3/archive/master.zip -O /tmp/spi4teensy3.zip
- unzip /tmp/spi4teensy3.zip -d /tmp
script:
- platformio ci --lib="." --lib="/tmp/spi4teensy3-master" --board=uno --board=teensy31 --board=due

View File

@@ -69,6 +69,7 @@ If you are going to run *PlatformIO* from **subprocess**, you **MUST
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 <envvar_PLATFORMIO_SETTING_ENABLE_PROMPTS>`
- disable global setting ``enable_prompts`` via :ref:`cmd_settings` command
- masking under Continuous Integration system via environment variable
@@ -86,8 +87,8 @@ Serial does not work with panStampAVR board
Answered in `issue #144 <https://github.com/platformio/platformio/issues/144#issuecomment-87388038>`_.
An error ``pkg_resources.DistributionNotFound``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PlatformIO: command not found || An error ``pkg_resources.DistributionNotFound``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please upgrade *SetupTools* package:

View File

@@ -27,6 +27,40 @@ Boards
`PlatformIO Boards Explorer <http://platformio.org/#!/boards>`_
* For more detailed ``board`` information please scroll tables below by horizontal.
Armstrap
~~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``armstrap_eagle1024``
- `Armstrap Eagle 1024 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
- STM32F417VGT6
- 168 MHz
- 1024 Kb
- 192 Kb
* - ``armstrap_eagle2048``
- `Armstrap Eagle 2048 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
- STM32F427VIT6
- 168 MHz
- 2048 Kb
- 256 Kb
* - ``armstrap_eagle512``
- `Armstrap Eagle 512 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
- STM32F407VET6
- 168 MHz
- 512 Kb
- 192 Kb
ST
~~

View File

@@ -527,6 +527,26 @@ Switch Science
- 32 Kb
- 4 Kb
Teensy
~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``teensy31``
- `Teensy 3.1 <https://www.pjrc.com/store/teensy31.html>`_
- MK20DX256
- 72 MHz
- 256 Kb
- 64 Kb
u-blox
~~~~~~

View File

@@ -27,6 +27,40 @@ Boards
`PlatformIO Boards Explorer <http://platformio.org/#!/boards>`_
* For more detailed ``board`` information please scroll tables below by horizontal.
Armstrap
~~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``armstrap_eagle1024``
- `Armstrap Eagle 1024 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
- STM32F417VGT6
- 168 MHz
- 1024 Kb
- 192 Kb
* - ``armstrap_eagle2048``
- `Armstrap Eagle 2048 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
- STM32F427VIT6
- 168 MHz
- 2048 Kb
- 256 Kb
* - ``armstrap_eagle512``
- `Armstrap Eagle 512 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
- STM32F407VET6
- 168 MHz
- 512 Kb
- 192 Kb
ST
~~

View File

@@ -9,6 +9,7 @@ IDE Integration
ide/arduino
ide/eclipse
ide/energia
ide/qtcreator
ide/sublimetext
ide/vim
ide/visualstudio

View File

@@ -15,15 +15,34 @@ registers, and disassembly viewers.
This software can be used with:
* all availalbe :ref:`platforms`
* all availalbe :ref:`frameworks`
* all available :ref:`platforms`
* all available :ref:`frameworks`
Refer to the `CDT Documentation <https://eclipse.org/cdt/documentation.php>`_
page for more detailed information.
.. contents::
Integration
-----------
Project Generator
^^^^^^^^^^^^^^^^^
Since PlatformIO 2.0 you can generate Eclipse compatible project using
:option:`platformio init --ide` command:
.. code-block:: shell
platformio init --ide eclipse
Then import this project via ``File > Import... > General > Existing Projects
into Workspace > Next`` and specify root directory where is located
:ref:`projectconf`.
Manual Integration
^^^^^^^^^^^^^^^^^^
More detailed information is located in PlatformIO blog: `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO <http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio>`_.
`More examples (TI MSP430, TI TIVA, etc.) <https://github.com/platformio/platformio/tree/develop/examples/ide-eclipse>`_

129
docs/ide/qtcreator.rst Normal file
View File

@@ -0,0 +1,129 @@
.. _ide_qtcreator:
Qt Creator
==========
The `Qt Creator <https://github.com/qtproject/qt-creator>`_ is an open source cross-platform integrated development environment. The editor includes such features as syntax highlighting for various languages, project manager, integrated version control systems, rapid code navigation tools and code autocompletion.
This software can be used with:
* all available :ref:`platforms`
* all available :ref:`frameworks`
Refer to the `Qt-creator Manual <http://doc.qt.io/qtcreator/>`_
page for more detailed information.
.. contents::
Integration
-----------
Project Generator
^^^^^^^^^^^^^^^^^
Since PlatformIO 2.0 you can generate Eclipse compatible project using
:option:`platformio init --ide` command:
.. code-block:: shell
platformio init --ide qtcreator
Then import this project via ``File > New File or Project > Import Project``
and specify root directory where is located :ref:`projectconf`.
Manual Integration
^^^^^^^^^^^^^^^^^^
Setup New Project
~~~~~~~~~~~~~~~~~
First of all, let's create new project from Qt Creator Start Page: ``New Project`` or using ``Menu: File > New File or Project``, then select project with ``Empty Qt Project`` type (``Other Project > Empty Qt Project``), fill ``Name``, ``Create in``.
.. image:: ../_static/ide-platformio-qtcreator-1.png
On the next steps select any available kit and click Finish button.
.. image:: ../_static/ide-platformio-qtcreator-2.png
Secondly, we need to configure project with PlatformIO source code builder (click on Projects label on left menu or ``Ctrl+5`` shortcut):
.. image:: ../_static/ide-platformio-qtcreator-3.png
Thirdly, change project file by adding path to directories with header files. Please edit project file to match the following contents:
.. code-block:: none
win32 {
HOMEDIR += $$(USERPROFILE)
}
else {
HOMEDIR += $$(PWD)
}
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/framework-arduinoavr/cores/arduino"
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/toolchain-atmelavr/avr/include"
win32:INCLUDEPATH ~= s,/,\\,g
.. image:: ../_static/ide-platformio-qtcreator-4.png
First program in Qt Creator
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Simple "Blink" project will consist from two files:
1. In the console, navigate to the root of your project folder and initialize platformio project with ``platformio init``
2. The main "C" source file named ``main.c`` must be located in the ``src`` directory.
Let's create new text file named ``main.c`` using ``Menu: New File or Project > General > Text File``:
.. image:: ../_static/ide-platformio-qtcreator-5.png
Copy the source code which is described below to file ``main.c``.
.. code-block:: c
#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
}
3. Locate the project configuration file named ``platformio.ini`` at the root of the project directory and open it.
.. image:: ../_static/ide-platformio-qtcreator-6.png
Edit the content to match the code described below.
.. code-block:: none
#
# 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.
[env:arduino_uno]
platform = atmelavr
framework = arduino
board = uno
Conclusion
----------
Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build > Build All``:
.. image:: ../_static/ide-platformio-qtcreator-7.png

View File

@@ -7,8 +7,8 @@ The `Sublime Text <http://www.sublimetext.com/>`_ is a cross-platform text and s
This software can be used with:
* all availalbe :ref:`platforms`
* all availalbe :ref:`frameworks`
* all available :ref:`platforms`
* all available :ref:`frameworks`
Refer to the `Sublime Text Documentation <http://docs.sublimetext.info/en/latest>`_
page for more detailed information.
@@ -18,11 +18,27 @@ page for more detailed information.
Integration
-----------
Project Generator
^^^^^^^^^^^^^^^^^
Since PlatformIO 2.0 you can generate Eclipse compatible project using
:option:`platformio init --ide` command:
.. code-block:: shell
platformio init --ide sublimetext
Then import this project via ``Project > Open Project...`` and specify root
directory where is located :ref:`projectconf`.
Manual Integration
^^^^^^^^^^^^^^^^^^
Initial configuration
^^^^^^^^^^^^^^^^^^^^^
~~~~~~~~~~~~~~~~~~~~~
First of all, we need to create "New Build System" with name "PlatformIO"
from ``Menu: Tools Build System New Build System`` and fill it like
from ``Menu: Tools > Build System > New Build System`` and fill it like
described below:
.. code-block:: bash
@@ -48,16 +64,16 @@ Secondly, we need to select "PlatformIO" Build System from a list:
.. image:: ../_static/ide-sublime-text-platformio-newproject-2.png
After that, we can use the necessary commands from
``Menu: Tools Command Palette`` or with ``Ctrl+Shift+P`` (Windows/Linux)
``Menu: Tools > Command Palette`` or with ``Ctrl+Shift+P`` (Windows/Linux)
``Cmd+Shift+P`` (Mac) shortcut.
.. image:: ../_static/ide-sublime-text-platformio-newproject-3.png
Command Hotkeys
~~~~~~~~~~~~~~~
'''''''''''''''
Sublime Text allows to bind own hotkey per command. Let's setup them
for PlatformIO commands using shortcut ``Menu: Preferences Key-Bindings - User``:
for PlatformIO commands using shortcut ``Menu: Preferences > Key-Bindings - User``:
.. image:: ../_static/ide-sublime-text-platformio-newproject-4.png
@@ -76,12 +92,12 @@ In this case, the final code will look like:
]
First program in Sublime Text
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Simple "Blink" project will consist from two files:
1. Main "C" source file named ``main.c`` must be located in the ``src`` directory.
Let's create new file named ``main.c`` using ``Menu: File New File`` or shortcut ``Ctrl+N`` (Windows/Linux) ``Cmd+N`` (Mac) with the next contents:
Let's create new file named ``main.c`` using ``Menu: File > New File`` or shortcut ``Ctrl+N`` (Windows/Linux) ``Cmd+N`` (Mac) with the next contents:
.. code-block:: c
@@ -124,6 +140,6 @@ Copy the source code which is described below to it.
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``.
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``.
.. image:: ../_static/ide-sublime-text-platformio-newproject-5.png

View File

@@ -9,8 +9,8 @@ standalone application in a graphical user interface.
This software can be used with:
* all availalbe :ref:`platforms`
* all availalbe :ref:`frameworks`
* all available :ref:`platforms`
* all available :ref:`frameworks`
Integration
-----------

View File

@@ -7,8 +7,8 @@ The `Microsoft Visual Studio (Free) <http://visualstudio.com/free>`_ is an integ
This software can be used with:
* all availalbe :ref:`platforms`
* all availalbe :ref:`frameworks`
* all available :ref:`platforms`
* all available :ref:`frameworks`
Refer to the `Visual Studio Documentation <https://msdn.microsoft.com/library/vstudio>`_
page for more detailed information.
@@ -18,10 +18,26 @@ page for more detailed information.
Integration
-----------
Setup New Project
Project Generator
^^^^^^^^^^^^^^^^^
First of all, let's create new project from Visual Studio Start Page: ``Start → New Project`` or using ``Menu: File → New → Project``, then select project with ``Makefile`` type (``Visual C++ → General → Makefile Project``), fill ``Project name``, ``Solution name``, ``Location`` fields and press OK button.
Since PlatformIO 2.0 you can generate Eclipse compatible project using
:option:`platformio init --ide` command:
.. code-block:: shell
platformio init --ide visualstudio
Then import this project via ``File > Import ...`` and specify root directory
where is located :ref:`projectconf`.
Manual Integration
^^^^^^^^^^^^^^^^^^
Setup New Project
~~~~~~~~~~~~~~~~~
First of all, let's create new project from Visual Studio Start Page: ``Start > New Project`` or using ``Menu: File > New > Project``, then select project with ``Makefile`` type (``Visual C++ > General > Makefile Project``), fill ``Project name``, ``Solution name``, ``Location`` fields and press OK button.
.. image:: ../_static/ide-vs-platformio-newproject.png
@@ -37,7 +53,7 @@ Release Configuration is the same as Debug, so on the next step we check "Same a
.. image:: ../_static/ide-vs-platformio-newproject-3.png
Thirdly, we need to add directories with header files using project properties (right click on the project name or ``Alt-Enter`` shortcut) and add two directories to ``Configuration Properties NMake Include Search Path``:
Thirdly, we need to add directories with header files using project properties (right click on the project name or ``Alt-Enter`` shortcut) and add two directories to ``Configuration Properties > NMake > Include Search Path``:
.. code-block:: none
@@ -47,12 +63,12 @@ Thirdly, we need to add directories with header files using project properties (
.. image:: ../_static/ide-vs-platformio-newproject-5.png
First program in Visual Studio
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Simple "Blink" project will consist from two files:
1. Main "C" source file named ``main.c`` must be located in the ``src`` directory.
Let's create new file named ``main.c`` using ``Menu: File New File`` or shortcut ``Ctrl+N``:
Let's create new file named ``main.c`` using ``Menu: File > New File`` or shortcut ``Ctrl+N``:
.. image:: ../_static/ide-vs-platformio-newproject-6.png
@@ -103,6 +119,6 @@ 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``:
.. image:: ../_static/ide-vs-platformio-newproject-8.png

View File

@@ -1,7 +1,7 @@
PlatformIO: A cross-platform code builder and the missing library manager
=========================================================================
*Atmel AVR & SAM, Freescale Kinetis, Nordic nRF51, NXP LPC, ST STM32,
*Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC, ST STM32,
TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.*
.. image:: _static/platformio-logo.png
@@ -29,6 +29,7 @@ Embedded Development. *Easier Than Ever.*
* Built-in :ref:`Serial Port Monitor <cmd_serialports_monitor>`
* Configurable build :ref:`-flags/-options <projectconf_build_flags>`
* Integration with :ref:`development environments (IDE) <ide>`
* Ready for Cloud Compiling and :ref:`ci`
* Pre-built tool chains, :ref:`frameworks` for the popular Hardware Platforms
Smart Code Builder. *Fast and Reliable.*
@@ -63,6 +64,7 @@ Contents
frameworks/index
librarymanager/index
userguide/index
ci/index
ide
articles
FAQ <faq>

View File

@@ -134,3 +134,4 @@ The registration requirements:
Now, you can :ref:`register <cmd_lib_register>` your library and allow others
to :ref:`install <cmd_lib_install>` it.

View File

@@ -294,9 +294,124 @@ Installation
1. Create ``platforms`` directory in :ref:`projectconf_pio_home_dir` if it
doesn't exists.
2. Copy ``test.py`` and ``test-builder.py`` files to ``platforms`` directory.
3. Search available platforms via :ref:`cmd_search` command. You should see
3. Search available platforms via :ref:`cmd_platforms_search` command. You should see
``test`` platform.
4. Install ``test`` platform via :ref:`cmd_install` command.
4. Install ``test`` platform via :ref:`cmd_platforms_install` command.
Now, you can use ``test`` for the :ref:`projectconf_env_platform` option in
:ref:`projectconf`.
Example
-------
Let's use the real example which was requested by our user in `issue 175 <https://github.com/platformio/platformio/issues/175>`_. Need to add support for uploading firmware using GDB to
:ref:`platform_ststm32`.
First of all, need to create new folder ``platforms`` in :ref:`projectconf_pio_home_dir`
and copy there two files:
1. Platform manifest file ``ststm32gdb.py`` with the next content:
.. code-block:: python
import os
from platformio.platforms.ststm32 import Ststm32Platform
class Ststm32gdbPlatform(Ststm32Platform):
"""
ST STM32 using GDB as uploader
http://www.st.com/web/en/catalog/mmc/FM141/SC1169?sc=stm32
"""
def get_build_script(self):
return os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"ststm32gdb-builder.py"
)
2. Build script file ``ststm32gdb-builder.py`` with the next content:
.. code-block:: python
"""
Builder for ST STM32 Series ARM microcontrollers with GDB upload.
"""
from os.path import join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
DefaultEnvironment, SConscript)
env = DefaultEnvironment()
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
env.Replace(
UPLOADER=join(
"$PIOPACKAGES_DIR", "toolchain-gccarmnoneeabi",
"bin", "arm-none-eabi-gdb"
),
UPLOADERFLAGS=[
join("$BUILD_DIR", "firmware.elf"),
"-batch",
"-x", join("$PROJECT_DIR", "upload.gdb")
],
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
)
env.Append(
CPPDEFINES=[
"${BOARD_OPTIONS['build']['variant'].upper()}"
],
LINKFLAGS=[
"-nostartfiles",
"-nostdlib"
]
)
#
# Target: Build executable and linkable firmware
#
target_elf = env.BuildFirmware()
#
# Target: Build the .bin file
#
if "uploadlazy" in COMMAND_LINE_TARGETS:
target_firm = join("$BUILD_DIR", "firmware.bin")
else:
target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
#
# Target: Print binary size
#
target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD")
AlwaysBuild(target_size)
#
# Target: Upload by default .bin file
#
upload = env.Alias(
["upload", "uploadlazy"], target_firm, "$UPLOADCMD")
AlwaysBuild(upload)
#
# Target: Define targets
#
Default([target_firm, target_size])
Now, we should see ``ststm32gdb`` platform using :ref:`cmd_platforms_search` command output
and can install it via :ref:`platformio platforms install ststm32gdb <cmd_platforms_install>` command.

View File

@@ -73,6 +73,40 @@ Boards
* For more detailed ``board`` information please scroll tables below by
horizontal.
Armstrap
~~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``armstrap_eagle1024``
- `Armstrap Eagle 1024 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
- STM32F417VGT6
- 168 MHz
- 1024 Kb
- 192 Kb
* - ``armstrap_eagle2048``
- `Armstrap Eagle 2048 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
- STM32F427VIT6
- 168 MHz
- 2048 Kb
- 256 Kb
* - ``armstrap_eagle512``
- `Armstrap Eagle 512 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
- STM32F407VET6
- 168 MHz
- 512 Kb
- 192 Kb
ST
~~

View File

@@ -226,7 +226,7 @@ processes:
* - Format
- Scope
- Description
* - ``Wp,option``
* - ``-Wp,option``
- CPPFLAGS
- Bypass the compiler driver and pass *option* directly through to the
preprocessor
@@ -309,6 +309,35 @@ but will be applied only for the project source code from
This option can be overridden by global environment variable
:ref:`envvar_PLATFORMIO_SRCBUILD_FLAGS`.
``install_libs``
^^^^^^^^^^^^^^^^
Specify dependent libraries which should be installed before environment
process. The only library IDs are allowed. Multiple libraries can be passed
using comma ``,`` sign.
You can obtain library IDs using :ref:`cmd_lib_search` command.
Example:
.. code-block:: ini
[env:depends_on_some_libs]
install_libs = 1,13,19
``use_libs``
^^^^^^^^^^^^
Specify libraries which should be used by ``Library Dependency Finder`` with
the highest priority.
Example:
.. code-block:: ini
[env:libs_with_highest_priority]
use_libs = OneWire_ID1
``ignore_libs``
^^^^^^^^^^^^^^^

View File

@@ -9,8 +9,8 @@ Quickstart
1. :ref:`Install PlatformIO <installation>`.
2. Find board ``type`` on this :ref:`Embedded Boards <platforms>` page or
via :ref:`cmd_boards` command.
2. Find board ``type`` using `Embedded Boards Explorer <http://platformio.org/#!/boards>`_
or via :ref:`cmd_boards` command.
3. Initialize new PlatformIO based project via :ref:`cmd_init` command with the
pre-configured environments for your boards:

110
docs/userguide/cmd_ci.rst Normal file
View File

@@ -0,0 +1,110 @@
.. _cmd_ci:
platformio ci
=============
.. contents::
Usage
-----
.. code-block:: bash
platformio ci [OPTIONS] [SRC]
Description
-----------
:ref:`cmd_ci` command is conceived of as "hot key" for building project with
arbitrary source code structure. In a nutshell, using ``SRC`` and
:option:`platformio ci --lib` contents PlatformIO initialises via
:ref:`cmd_init` new project in :option:`platformio ci --build-dir`
with the build environments (using :option:`platformio ci --board` or
:option:`platformio ci --project-conf`) and processes them via :ref:`cmd_run`
command.
For more details as for integration with the popular Continuous Integration
Systems please follow to :ref:`ci` page.
.. note::
:ref:`cmd_ci` command accepts **multiple** ``SRC`` arguments,
:option:`platformio ci --lib` and :option:`platformio ci --exclude` options
which can be a path to directory, file or
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_.
.. note::
You can omit ``SRC`` argument and set path (multiple paths are allowed
denoting with ``:``) to
``PLATFORMIO_CI_SRC`` `Environment variable <http://en.wikipedia.org/wiki/Environment_variable>`_
Options
-------
.. program:: platformio ci
.. option::
-l, --lib
Source code which will be copied to ``%build_dir%/lib`` directly.
If :option:`platformio ci --lib` is a path to file (not to directory), then
PlatformIO will create temporary directory within ``%build_dir%/lib`` and copy
the rest files into it.
.. option::
--exclude
Exclude directories and/-or files from :option:`platformio ci --build-dir`. The
path must be relative to PlatformIO project within
:option:`platformio ci --build-dir`.
For example, exclude from project ``src`` directory:
* ``examples`` folder
* ``*.h`` files from ``foo`` folder
.. code-block:: bash
platformio ci --exclude=src/examples --exclude=src/foo/*.h [SRC]
.. option::
-b, --board
Build project with automatically pre-generated environments based on board
settings.
For more details please look into :option:`platformio init --board`.
.. option::
--build-dir
Path to directory where PlatformIO will initialise new project. By default it's
temporary directory within your operation system.
.. note::
This directory will be removed at the end of build process. If you want to
keep it, please use :option:`platformio ci --keep-build-dir`.
.. option::
--keep-build-dir
Don't remove :option:`platformio ci --build-dir` after build process.
.. option::
--project-conf
Buid project using pre-configured :ref:`projectconf`.
.. option::
-v, --verbose
Shows details about the results of processing environments. More details
:option:`platformio run --verbose`
Examples
--------
For the examples please follow to :ref:`ci` page.

View File

@@ -29,13 +29,15 @@ This command will create:
Options
-------
.. program:: platformio init
.. option::
--project-dir, -d
-d, --project-dir
A path to the directory where *PlatformIO* will initialise new project.
.. option::
--board, -b
-b, --board
If you specify board ``type`` (you can pass multiple ``--board`` options), then
*PlatformIO* will automatically generate environment for :ref:`projectconf` and
@@ -47,13 +49,32 @@ pre-fill these data:
The full list with pre-configured boards is available here :ref:`platforms`.
.. option::
--ide
Initialise PlatformIO project for the specified IDE which can be imported later
via "Import Project" functionality.
A list with supported IDE is available within ``platformio init --help`` command.
Also, please look into :ref:`ide` page.
.. option::
--disable-auto-uploading
If you initialise project with the specified ``--board``, then *PlatformIO*
If you initialise project with the specified
:option:`platformio init --board`, then *PlatformIO*
will create environment with enabled firmware auto-uploading. This option
allows you to disable firmware auto-uploading by default.
.. option::
--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
--------

View File

@@ -22,6 +22,8 @@ Process environments which are defined in :ref:`projectconf` file
Options
-------
.. program:: platformio run
.. option::
-e, --environment
@@ -39,6 +41,27 @@ Process specified targets
Upload port of embedded board. To print all available ports use
:ref:`cmd_serialports` command
.. option::
--build-dir
Specify the path to project directory. By default, ``--build-dir`` is equal to
current working directory (``CWD``).
.. option::
-v, --verbose
Shows details about the results of processing environments. Each instance of
``--verbose`` on the command line increases the verbosity level by one, so if
you need more details on the output, specify it twice.
There 3 levels of verbosity:
1. ``-v`` - output errors only
2. ``-vv`` - output errors and warnings
3. ``-vvv`` - output errors, warnings and additional information
By default, verbosity level is set to 3 (maximum information).
Examples
--------

View File

@@ -24,6 +24,8 @@ List available `Serial Ports <http://en.wikipedia.org/wiki/Serial_port>`_
Options
~~~~~~~
.. program:: platformio serialports list
.. option::
--json-output
@@ -99,6 +101,8 @@ To control *monitor* please use these "hot keys":
Options
~~~~~~~
.. program:: platformio serialports monitor
.. option::
-p, --port

View File

@@ -16,7 +16,8 @@ Usage
Description
-----------
Check or update installed :ref:`Platforms <platforms>`
Check or update installed :ref:`Platforms <platforms>` and
:ref:`Libraries <librarymanager>`
Examples

View File

@@ -3,7 +3,35 @@
User Guide
==========
To print all available commands and options use:
.. contents::
Usage
-----
.. code-block:: bash
platformio [OPTIONS] COMMAND
Options
-------
.. program:: platformio
.. option::
--force, - f
Force to accept any confirmation prompts. This option allows to avoid an issue
with :ref:`faq_troubleshooting_pioblocksprompt`
.. option::
--version
Show the version of PlatformIO
.. option::
--help
Show help for the available options and commands
.. code-block:: bash
@@ -11,19 +39,19 @@ To print all available commands and options use:
$ platformio COMMAND --help
Commands
--------
.. toctree::
:maxdepth: 2
cmd_boards
cmd_ci
cmd_init
cmd_install
platformio lib <lib/index>
cmd_list
platformio platforms <platforms/index>
cmd_run
cmd_search
cmd_serialports
cmd_settings
cmd_show
cmd_uninstall
cmd_update
cmd_upgrade

View File

@@ -22,6 +22,8 @@ Install new library by specified
Options
-------
.. program:: platformio lib install
.. option::
-v, --version

View File

@@ -21,6 +21,8 @@ List installed libraries
Options
~~~~~~~
.. program:: platformio lib list
.. option::
--json-output

View File

@@ -61,6 +61,8 @@ For more detail information please go to
Options
-------
.. program:: platformio lib search
.. option::
-a, --author

View File

@@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio lib update
platformio lib update [LIBRARY_ID]
Description
@@ -22,6 +22,8 @@ Check or update installed libraries
Examples
--------
1. Update all installed libraries
.. code-block:: bash
$ platformio lib update
@@ -36,8 +38,23 @@ Examples
# Updating [ 13 ] Adafruit-GFX library:
# Versions: Current=a9e5bc4707, Latest=a9e5bc4707 [Up-to-date]
# Updating [ 1 ] OneWire library:
# Versions: Current=2.2, Latest=2.2 [Up-to-date]
# Versions: Current=2.2, Latest=2.2 [Up-to-date]
# Updating [ 4 ] IRremote library:
# Versions: Current=f2dafe5030, Latest=f2dafe5030 [Up-to-date]
# Updating [ 14 ] Adafruit-9DOF-Unified library:
# Versions: Current=b2f07242ac, Latest=b2f07242ac [Up-to-date]
2. Update specified libraries
.. code-block:: bash
$ platformio lib update 1 59
# Updating [ 1 ] OneWire library:
# Versions: Current=2.2, Latest=2.2 [Up-to-date]
# Updating [ 59 ] USB-Host-Shield-20 library:
# Versions: Current=fcab83dcb3, Latest=c61f9ce1c2 [Out-of-date]
# The library #59 'USB-Host-Shield-20' has been successfully uninstalled!
# Installing library [ 59 ]:
# Downloading [####################################] 100%
# Unpacking [####################################] 100%
# The library #59 'USB-Host-Shield-20' has been successfully installed!

View File

@@ -1,7 +1,7 @@
.. _cmd_install:
.. _cmd_platforms_install:
platformio install
==================
platformio platforms install
============================
.. contents::
@@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio install [OPTIONS] [PLATFORMS]
platformio platforms install [OPTIONS] [PLATFORMS]
Description
@@ -27,6 +27,8 @@ There are several predefined aliases for packages, such as:
Options
-------
.. program:: platformio platforms install
.. option::
--with-package
@@ -50,7 +52,7 @@ Examples
.. code-block:: bash
$ platformio install timsp430
$ platformio platforms install timsp430
Installing toolchain-timsp430 package:
Downloading [####################################] 100%
Unpacking [####################################] 100%
@@ -68,7 +70,7 @@ Examples
.. code-block:: bash
$ platformio install timsp430 --skip-default-package --with-package=uploader
$ platformio platforms install timsp430 --skip-default-package --with-package=uploader
Installing tool-mspdebug package:
Downloading [####################################] 100%
Unpacking [####################################] 100%

View File

@@ -1,7 +1,7 @@
.. _cmd_list:
.. _cmd_platforms_list:
platformio list
===============
platformio platforms list
=========================
.. contents::
@@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio list [OPTIONS]
platformio platforms list [OPTIONS]
Description
@@ -21,6 +21,8 @@ List installed :ref:`Platforms <platforms>`
Options
~~~~~~~
.. program:: platformio platforms list
.. option::
--json-output
@@ -31,7 +33,7 @@ Examples
.. code-block:: bash
$ platformio list
$ platformio platforms list
atmelavr with packages: toolchain-atmelavr, tool-avrdude, framework-arduinoavr, tool-micronucleus
atmelsam with packages: framework-arduinosam, ldscripts, toolchain-gccarmnoneeabi, tool-bossac
freescalekinetis with packages: framework-mbed, toolchain-gccarmnoneeabi

View File

@@ -1,7 +1,7 @@
.. _cmd_search:
.. _cmd_platforms_search:
platformio search
=================
platformio platforms search
===========================
.. contents::
@@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio search QUERY [OPTIONS]
platformio platforms search QUERY [OPTIONS]
Description
@@ -21,6 +21,8 @@ Search for development :ref:`Platforms <platforms>`
Options
~~~~~~~
.. program:: platformio platforms search
.. option::
--json-output
@@ -34,7 +36,7 @@ Examples
.. code-block:: bash
$ platformio search
$ platformio platforms search
atmelavr (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa)
--------
Atmel AVR 8- and 32-bit MCUs deliver a unique combination of performance...
@@ -75,7 +77,7 @@ Examples
.. code-block:: bash
$ platformio search ti
$ platformio platforms search ti
timsp430 (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa)
--------
MSP430 microcontrollers (MCUs) from Texas Instruments (TI) are ...
@@ -88,7 +90,7 @@ Examples
.. code-block:: bash
$ platformio search mbed
$ platformio platforms search mbed
freescalekinetis (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa)
----------------
Freescale Kinetis Microcontrollers is family of multiple hardware- and ...

View File

@@ -1,7 +1,7 @@
.. _cmd_show:
.. _cmd_platforms_show:
platformio show
===============
platformio platforms show
=========================
.. contents::
@@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio show PLATFORM
platformio platforms show PLATFORM
Description
@@ -24,7 +24,7 @@ Examples
.. code-block:: bash
$ platformio show atmelavr
$ platformio platforms show atmelavr
atmelavr - An embedded platform for Atmel AVR microcontrollers (with Arduino Framework)
----------
Package: toolchain-atmelavr

View File

@@ -1,7 +1,7 @@
.. _cmd_uninstall:
.. _cmd_platforms_uninstall:
platformio uninstall
====================
platformio platforms uninstall
==============================
.. contents::
@@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio uninstall PLATFORM
platformio platforms uninstall PLATFORM
Description
@@ -24,7 +24,7 @@ Examples
.. code-block:: bash
$ platformio uninstall timsp430
$ platformio platforms uninstall timsp430
Uninstalling toolchain-timsp430 package: [OK]
Uninstalling tool-mspdebug package: [OK]
Uninstalling framework-energiamsp430 package: [OK]

View File

@@ -0,0 +1,99 @@
.. _cmd_platforms_update:
platformio platforms update
===========================
.. contents::
Usage
-----
.. code-block:: bash
platformio platforms update
Description
-----------
Check or update installed :ref:`Platforms <platforms>`
Examples
--------
.. code-block:: bash
$ platformio platforms update
Platform atmelavr
--------
Updating toolchain-atmelavr package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-avrdude package:
Versions: Current=2, Latest=2 [Up-to-date]
Updating framework-arduinoavr package:
Versions: Current=12, Latest=12 [Up-to-date]
Updating tool-micronucleus package:
Versions: Current=1, Latest=1 [Up-to-date]
Platform atmelsam
--------
Updating framework-arduinosam package:
Versions: Current=3, Latest=3 [Up-to-date]
Updating ldscripts package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating toolchain-gccarmnoneeabi package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-bossac package:
Versions: Current=1, Latest=1 [Up-to-date]
Platform stm32
--------
Updating toolchain-gccarmnoneeabi package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-stlink package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-spl package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-cmsis package:
Versions: Current=2, Latest=2 [Up-to-date]
Updating framework-opencm3 package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating ldscripts package:
Versions: Current=1, Latest=1 [Up-to-date]
Platform teensy
--------
Updating toolchain-atmelavr package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating ldscripts package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-arduinoteensy package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating toolchain-gccarmnoneeabi package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-teensy package:
Versions: Current=1, Latest=1 [Up-to-date]
Platform timsp430
--------
Updating toolchain-timsp430 package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-mspdebug package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-energiamsp430 package:
Versions: Current=2, Latest=2 [Up-to-date]
Platform titiva
--------
Updating ldscripts package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating toolchain-gccarmnoneeabi package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating tool-lm4flash package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-opencm3 package:
Versions: Current=1, Latest=1 [Up-to-date]
Updating framework-energiativa package:
Versions: Current=4, Latest=4 [Up-to-date]

View File

@@ -0,0 +1,22 @@
.. _userguide_platforms:
Platforms Manager
=================
To print all available commands and options use:
.. code-block:: bash
$ platformio platforms --help
$ platformio platforms COMMAND --help
.. toctree::
:maxdepth: 2
cmd_install
cmd_list
cmd_search
cmd_show
cmd_uninstall
cmd_update

View File

@@ -1,29 +1,43 @@
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
const char* ssid = "*****";
const char* password = "*****";
const char* ssid = "******";
const char* password = "******";
MDNSResponder mdns;
ESP8266WebServer server(80);
const int led = 13;
void handle_root() {
void handleRoot() {
digitalWrite(led, 1);
server.send(200, "text/plain", "hello from esp8266!");
delay(100);
digitalWrite(led, 0);
}
void handleNotFound(){
digitalWrite(led, 1);
String message = "File Not Found\n\n";
message += "URI: ";
message += server.uri();
message += "\nMethod: ";
message += (server.method() == HTTP_GET)?"GET":"POST";
message += "\nArguments: ";
message += server.args();
message += "\n";
for (uint8_t i=0; i<server.args(); i++){
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
}
server.send(404, "text/plain", message);
digitalWrite(led, 0);
}
void setup(void)
{
Serial.begin(115200);
void setup(void){
pinMode(led, OUTPUT);
digitalWrite(led, 0);
// Connect to WiFi network
Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.println("");
@@ -37,18 +51,23 @@ void setup(void)
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
server.on("/", handle_root);
if (mdns.begin("esp8266", WiFi.localIP())) {
Serial.println("MDNS responder started");
}
server.on("/", handleRoot);
server.on("/inline", [](){
server.send(200, "text/plain", "this works as well");
});
server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP server started");
}
void loop(void)
{
void loop(void){
server.handleClient();
}
}

View File

@@ -0,0 +1,23 @@
#
# 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:arduino_uno]
platform = atmelavr
framework = arduino
board = uno

View File

@@ -0,0 +1,19 @@
win32 {
HOMEDIR += $$(USERPROFILE)
}
else {
HOMEDIR += $$(PWD)
}
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/framework-arduinoavr/cores/arduino"
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/toolchain-atmelavr/avr/include"
win32:INCLUDEPATH ~= s,/,\\,g
# DEFINES += __AVR_ATmega328__
OTHER_FILES += \
platformio.ini
SOURCES += \
src/main.c

View File

@@ -0,0 +1,25 @@
#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);
}

View File

@@ -0,0 +1,23 @@
#
# 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:flora8]
platform = atmelavr
framework = arduino
board = flora8

View File

@@ -0,0 +1,43 @@
{
"build_systems":
[
{
"cmd":
[
"platformio",
"run"
],
"name": "PlatformIO",
"variants":
[
{
"cmd":
[
"platformio",
"run",
"-t",
"clean"
],
"name": "Clean"
},
{
"cmd":
[
"platformio",
"run",
"-t",
"upload"
],
"name": "Upload"
}
],
"working_dir": "${project_path:${folder}}"
}
],
"folders":
[
{
"path": "."
}
]
}

View File

@@ -0,0 +1,24 @@
/*
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);
}

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{0FA9C3A8-452B-41EF-A418-9102B170F49F}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeBuildCommandLine>platformio run</NMakeBuildCommandLine>
<NMakeCleanCommandLine>platformio run -t clean</NMakeCleanCommandLine>
<NMakePreprocessorDefinitions>WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
<NMakeIncludeSearchPath>$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<NMakeBuildCommandLine>platformio run</NMakeBuildCommandLine>
<NMakeCleanCommandLine>platformio run -t clean</NMakeCleanCommandLine>
<NMakePreprocessorDefinitions>WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
<NMakeIncludeSearchPath>$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
</PropertyGroup>
<ItemDefinitionGroup>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="readme.txt" />
</ItemGroup>
<ItemGroup>
<None Include="platformio.ini" />
<None Include="src\blink.pde" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Source Files\src">
<UniqueIdentifier>{cad450ef-1a84-42d4-a5b5-a1736b8833d3}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="readme.txt" />
</ItemGroup>
<ItemGroup>
<None Include="platformio.ini" />
<None Include="src\blink.pde">
<Filter>Source Files\src</Filter>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,23 @@
#
# 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:arduino_uno]
platform = atmelavr
framework = arduino
board = uno

View File

@@ -0,0 +1,24 @@
/*
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);
}

View File

@@ -41,3 +41,9 @@ board = frdm_kl25z
platform = ststm32
framework = mbed
board = nucleo_f401re
# Teensy Platform
[env:teensy31]
platform = teensy
framework = mbed
board = teensy31

View File

@@ -5,22 +5,22 @@
; http://docs.platformio.org/en/latest/projectconf.html
;
[env:autogen_uno]
[env:uno]
platform = atmelavr
framework = arduino
board = uno
[env:autogen_teensy31]
[env:teensy31]
platform = teensy
framework = arduino
board = teensy31
[env:autogen_lpmsp430g2553]
[env:lpmsp430g2553]
platform = timsp430
framework = energia
board = lpmsp430g2553
[env:autogen_lptm4c1230c3pm]
[env:lptm4c1230c3pm]
platform = titiva
framework = energia
board = lptm4c1230c3pm

View File

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

View File

@@ -31,20 +31,38 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
mod = __import__("platformio.commands." + name,
None, None, ["cli"])
except ImportError:
raise exception.UnknownCLICommand(name)
try:
return self._handle_obsolate_command(name)
except AttributeError:
raise exception.UnknownCLICommand(name)
return mod.cli
@staticmethod
def _handle_obsolate_command(name):
if name in ("install", "list", "search", "show", "uninstall"):
click.secho(
"Warning! `platformio %s` command is obsoleted and will be "
"removed in the next release! Please use "
"`platformio platforms %s` instead." % (name, name),
fg="red"
)
from platformio.commands import platforms
return getattr(platforms, "platforms_" + name)
raise AttributeError()
@click.command(cls=PlatformioCLI)
@click.version_option(__version__, prog_name="PlatformIO")
@click.option("--force", "-f", is_flag=True,
help="Force to accept any confirmation prompts")
@click.pass_context
def cli(ctx):
maintenance.on_platformio_start(ctx)
def cli(ctx, force):
maintenance.on_platformio_start(ctx, force)
@cli.resultcallback()
@click.pass_context
def process_result(ctx, result):
def process_result(ctx, result, force): # pylint: disable=W0613
maintenance.on_platformio_end(ctx, result)
@@ -54,7 +72,7 @@ def main():
# /en/latest/security.html#insecureplatformwarning
requests.packages.urllib3.disable_warnings()
cli(None)
cli(None, None)
except Exception as e: # pylint: disable=W0703
if not isinstance(e, exception.ReturnErrorCode):
maintenance.on_platformio_exception(e)

View File

@@ -24,11 +24,11 @@ DEFAULT_SETTINGS = {
},
"auto_update_platforms": {
"description": "Automatically update platforms (Yes/No)",
"value": True
"value": False
},
"auto_update_libraries": {
"description": "Automatically update libraries (Yes/No)",
"value": True
"value": False
},
"enable_telemetry": {
"description": ("Shares commands, platforms and libraries usage"
@@ -47,6 +47,11 @@ DEFAULT_SETTINGS = {
}
SESSION_VARS = {
"force_option": False
}
class State(object):
def __init__(self, path=None):
@@ -101,9 +106,12 @@ def set_state_item(name, value):
def get_setting(name):
# disable prompts for Continuous Integration systems
if name == "enable_prompts" and getenv("CI", "").lower() == "true":
return False
if name == "enable_prompts":
# disable prompts for Continuous Integration systems
# and when global "--force" option is set
if any([getenv("CI", "").lower() == "true",
get_session_var("force_option")]):
return False
_env_name = "PLATFORMIO_SETTING_%s" % name.upper()
if _env_name in environ:
@@ -127,3 +135,12 @@ def reset_settings():
with State() as data:
if "settings" in data:
del data['settings']
def get_session_var(name, default=None):
return SESSION_VARS.get(name, default)
def set_session_var(name, value):
assert name in SESSION_VARS
SESSION_VARS[name] = value

View File

@@ -2,11 +2,11 @@
"esp01": {
"build": {
"core": "esp8266",
"extra_flags": "-DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266",
"extra_flags": "-DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DESP8266",
"f_cpu": "80000000L",
"ldscript": "esp8266.ld",
"ldscript": "esp8266.flash.512k.ld",
"mcu": "esp8266",
"variant": "esp01"
"variant": "generic"
},
"frameworks": ["arduino"],
"name": "Espressif ESP8266 board",

View File

@@ -330,5 +330,65 @@
},
"url": "https://developer.mbed.org/platforms/ST-Nucleo-L152RE/",
"vendor": "ST"
},
"armstrap_eagle512": {
"build": {
"core": "stm32",
"extra_flags": "-DSTM32F40_41xxx",
"f_cpu": "168000000L",
"ldscript": "armstrap_eagle_512.ld",
"cpu": "cortex-m4",
"mcu": "stm32f407vet6",
"variant": "stm32f4"
},
"frameworks": ["cmsis", "spl"],
"name": "Armstrap Eagle 512",
"platform": "ststm32",
"upload": {
"maximum_ram_size": 196608,
"maximum_size": 524288
},
"url": "http://docs.armstrap.org/en/latest/hardware-overview.html",
"vendor": "Armstrap"
},
"armstrap_eagle1024": {
"build": {
"core": "stm32",
"extra_flags": "-DSTM32F40_41xxx",
"f_cpu": "168000000L",
"ldscript": "armstrap_eagle_1024.ld",
"cpu": "cortex-m4",
"mcu": "stm32f417vgt6",
"variant": "stm32f4"
},
"frameworks": ["cmsis", "spl"],
"name": "Armstrap Eagle 1024",
"platform": "ststm32",
"upload": {
"maximum_ram_size": 196608,
"maximum_size": 1048576
},
"url": "http://docs.armstrap.org/en/latest/hardware-overview.html",
"vendor": "Armstrap"
},
"armstrap_eagle2048": {
"build": {
"core": "stm32",
"extra_flags": "-DSTM32F427_437xx",
"f_cpu": "168000000L",
"ldscript": "armstrap_eagle_2048.ld",
"cpu": "cortex-m4",
"mcu": "stm32f427vit6",
"variant": "stm32f4"
},
"frameworks": ["cmsis", "spl"],
"name": "Armstrap Eagle 2048",
"platform": "ststm32",
"upload": {
"maximum_ram_size": 262144,
"maximum_size": 2091752
},
"url": "http://docs.armstrap.org/en/latest/hardware-overview.html",
"vendor": "Armstrap"
}
}

View File

@@ -62,7 +62,7 @@
"mcu": "mk20dx256",
"cpu": "cortex-m4"
},
"frameworks": ["arduino"],
"frameworks": ["arduino", "mbed"],
"name": "Teensy 3.1",
"platform": "teensy",
"upload": {

View File

@@ -37,6 +37,7 @@ commonvars.AddVariables(
("BUILD_FLAGS",),
("SRCBUILD_FLAGS",),
("IGNORE_LIBS",),
("USE_LIBS",),
# board options
("BOARD",),

View File

@@ -43,6 +43,8 @@ env.Replace(
"-Os", # optimize for size
"-mlongcalls",
"-mtext-section-literals",
"-falign-functions=4",
"-U__STRICT_ANSI__",
"-MMD" # output dependancy info
],
@@ -70,12 +72,12 @@ env.Replace(
UPLOADER=join("$PIOPACKAGES_DIR", "tool-esptool", "esptool"),
UPLOADERFLAGS=[
"-vv",
"-cd", "none",
"-cd", "ck",
"-cb", "$UPLOAD_SPEED",
"-cp", "$UPLOAD_PORT",
"-ca", "0x00000",
"-cf", "${SOURCES[0]}",
"-ca", "0x40000",
"-ca", "0x10000",
"-cf", "${SOURCES[1]}"
],
UPLOADCMD='$UPLOADER $UPLOADERFLAGS'
@@ -88,6 +90,9 @@ env.Append(
"$UPLOADER",
"-eo", "$SOURCES",
"-bo", "${TARGETS[0]}",
"-bm", "qio",
"-bf", "40",
"-bz", "512K",
"-bs", ".text",
"-bs", ".data",
"-bs", ".rodata",
@@ -135,7 +140,7 @@ if "uploadlazy" in COMMAND_LINE_TARGETS:
else:
target_firm = env.ElfToBin(
[join("$BUILD_DIR", "firmware_00000"),
join("$BUILD_DIR", "firmware_40000")], target_elf)
join("$BUILD_DIR", "firmware_10000")], target_elf)
#

View File

@@ -46,8 +46,8 @@ elif env.get("PLATFORM") == "espressif":
env.Prepend(
CPPPATH=[join("$PLATFORMFW_DIR", "sdk", "include")],
LIBPATH=[join("$PLATFORMFW_DIR", "sdk", "lib")],
LIBS=["hal", "phy", "net80211", "lwip",
"wpa", "main", "pp", "c", "gcc"]
LIBS=["smartconfig", "pp", "main", "wpa", "lwip",
"net80211", "phy", "hal", "gcc", "m"]
)
env.Replace(PLATFORMFW_DIR=PLATFORMFW_DIR)
@@ -106,20 +106,20 @@ env.Append(
#
if env.subst("${PLATFORMFW_DIR}")[-3:] == "sam":
env.VariantDir(
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkCMSISInc"),
join("$PLATFORMFW_DIR", "system", "CMSIS", "CMSIS", "Include")
)
env.VariantDir(
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkDeviceInc"),
join("$PLATFORMFW_DIR", "system", "CMSIS", "Device", "ATMEL")
)
env.VariantDir(
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkLibSam"),
join("$PLATFORMFW_DIR", "system", "libsam")
)
env.VariantDir(
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkArduinoInc"),
join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}")
)

View File

@@ -25,7 +25,7 @@ env.Replace(
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-cmsis")
)
env.VariantDir(
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkCMSIS"),
join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}")
)

View File

@@ -28,7 +28,7 @@ ENERGIA_VERSION = int(
"version.txt")).read().replace(".", "").strip())
# include board variant
env.VariantDir(
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkEnergiaVariant"),
join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}")
)

View File

@@ -138,7 +138,7 @@ if BOARD_BUILDOPTS.get("core") == "lm4f":
CPPDEFINES=["LM4F"]
)
env.VariantDir(
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkLibOpenCM3Variant"),
join("$PLATFORMFW_DIR", "include")
)
@@ -166,7 +166,7 @@ env.Replace(
)
libs = []
env.VariantDir(
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkLibOpenCM3"),
"$PLATFORMFW_DIR"
)

View File

@@ -53,7 +53,8 @@ MBED_VARIANTS = {
"frdm_k64f": "K64F",
"frdm_kl05z": "KL05Z",
"frdm_k20d50m": "K20D50M",
"frdm_k22f": "K22F"
"frdm_k22f": "K22F",
"teensy31": "TEENSY3_1"
}
MBED_LIBS_MAP = {
@@ -133,7 +134,7 @@ def add_mbedlib(libname, libar):
(libname.upper(), crc32(root)))
if var_dir in env.get("CPPPATH"):
continue
env.VariantDir(var_dir, root)
env.VariantDirWrap(var_dir, root)
env.Append(CPPPATH=[var_dir])
@@ -177,6 +178,20 @@ def get_build_flags(data):
return flags
def _mbed_whole_archive_hook(flags):
if (not isinstance(flags, list) or
env.get("BOARD_OPTIONS", {}).get("platform") != "ststm32"):
return flags
for pos, flag in enumerate(flags[:]):
if isinstance(flag, basestring):
continue
flags.insert(pos, "-Wl,-whole-archive")
flags.insert(pos + 2, "-Wl,-no-whole-archive")
return flags
board_type = env.subst("$BOARD")
variant = MBED_VARIANTS[
board_type] if board_type in MBED_VARIANTS else board_type.upper()
@@ -187,6 +202,8 @@ build_flags = get_build_flags(eixdata)
variant_dir = join("$PLATFORMFW_DIR", "variant", variant)
env.Replace(
_mbed_whole_archive_hook=_mbed_whole_archive_hook,
_LIBFLAGS="${_mbed_whole_archive_hook(%s)}" % env.get("_LIBFLAGS")[2:-1],
CPPFLAGS=build_flags.get("CPPFLAGS", []),
CFLAGS=build_flags.get("CFLAGS", []),
CXXFLAGS=build_flags.get("CXXFLAGS", []),
@@ -204,7 +221,7 @@ if board_type in ("frdm_k22f", "frdm_k64f"):
for lib_path in eixdata.get("CPPPATH"):
_vdir = join("$BUILD_DIR", "FrameworkMbedInc%d" % crc32(lib_path))
env.VariantDir(_vdir, join(variant_dir, lib_path))
env.VariantDirWrap(_vdir, join(variant_dir, lib_path))
env.Append(CPPPATH=[_vdir])
env.Append(

View File

@@ -22,7 +22,7 @@ env.Replace(
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-spl")
)
env.VariantDir(
env.VariantDirWrap(
join("$BUILD_DIR", "FrameworkSPLInc"),
join("$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}",
"variants", "${BOARD_OPTIONS['build']['variant']}", "inc")
@@ -55,6 +55,8 @@ extra_flags = env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags")
ignore_files = []
if "STM32F40_41xxx" in extra_flags:
ignore_files += ["stm32f4xx_fmc.c"]
if "STM32F427_437xx" in extra_flags:
ignore_files += ["stm32f4xx_fsmc.c"]
elif "STM32F303xC" in extra_flags:
ignore_files += ["stm32f30x_hrtim.c"]
elif "STM32L1XX_MD" in extra_flags:

View File

@@ -6,25 +6,46 @@
"""
import platform
from os.path import join
from os.path import isfile, join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
DefaultEnvironment, SConscript)
DefaultEnvironment, Exit, SConscript)
env = DefaultEnvironment()
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
env.Replace(
UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"),
UPLOADERFLAGS=[
"write", # write in flash
"$SOURCES", # firmware path to flash
"0x08000000" # flash start adress
],
if env['UPLOAD_PROTOCOL'] == "gdb":
if not isfile(join(env.subst("$PROJECT_DIR"), "upload.gdb")):
Exit(
"You are using GDB as firmware uploader. "
"Please specify upload commands in upload.gdb "
"file in project directory!"
)
env.Replace(
UPLOADER=join(
"$PIOPACKAGES_DIR", "toolchain-gccarmnoneeabi",
"bin", "arm-none-eabi-gdb"
),
UPLOADERFLAGS=[
join("$BUILD_DIR", "firmware.elf"),
"-batch",
"-x", join("$PROJECT_DIR", "upload.gdb")
],
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
)
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
)
else:
env.Replace(
UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"),
UPLOADERFLAGS=[
"write", # write in flash
"$SOURCES", # firmware path to flash
"0x08000000" # flash start adress
],
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
)
env.Append(

View File

@@ -40,6 +40,7 @@ if isfile(env.subst(join(
UPLOADERFLAGS=[
"-mmcu=$BOARD_MCU",
"-w", # wait for device to apear
"-s", # soft reboot if device not online
"-v" # verbose output
],
UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES'

View File

@@ -2,6 +2,7 @@
# See LICENSE for details.
from os.path import join
from platform import system
from shutil import copyfile
from time import sleep
@@ -23,6 +24,12 @@ def FlushSerialBuffer(env, port):
def TouchSerialPort(env, port, baudrate):
if system() == "Linux":
try:
s = Serial(env.subst(port))
s.close()
except: # pylint: disable=W0702
pass
s = Serial(port=env.subst(port), baudrate=baudrate)
s.setDTR(False)
s.close()

View File

@@ -2,11 +2,13 @@
# See LICENSE for details.
import atexit
import json
import re
from os import getenv, listdir, remove, sep, walk
from os.path import basename, dirname, isdir, isfile, join, normpath
from SCons.Script import Exit, SConscript, SConscriptChdir
from SCons.Script import (COMMAND_LINE_TARGETS, DefaultEnvironment, Exit,
SConscript, SConscriptChdir)
from SCons.Util import case_sensitive_suffixes
from platformio.util import pioversion_to_intstr
@@ -15,23 +17,18 @@ from platformio.util import pioversion_to_intstr
def BuildFirmware(env):
# fix ASM handling under non-casitive OS
if not case_sensitive_suffixes('.s', '.S'):
if not case_sensitive_suffixes(".s", ".S"):
env.Replace(
AS="$CC",
ASCOM="$ASPPCOM"
)
if "extra_flags" in env.get("BOARD_OPTIONS", {}).get("build", {}):
env.MergeFlags(env.subst("${BOARD_OPTIONS['build']['extra_flags']}"))
if "BUILD_FLAGS" in env:
env.MergeFlags(env['BUILD_FLAGS'])
env.ProcessFlags()
env.BuildFramework()
firmenv = env.Clone()
vdirs = firmenv.VariantDirRecursive(
join("$BUILD_DIR", "src"), "$PROJECTSRC_DIR")
join("$BUILD_DIR", "src"), "$PROJECTSRC_DIR", duplicate=False)
# build dependent libs
deplibs = firmenv.BuildDependentLibraries("$PROJECTSRC_DIR")
@@ -60,6 +57,19 @@ def BuildFirmware(env):
*pioversion_to_intstr())]
)
if "envdump" in COMMAND_LINE_TARGETS:
print env.Dump()
Exit()
if "idedata" in COMMAND_LINE_TARGETS:
_data = {"defines": [], "includes": []}
for item in env.get("VARIANT_DIRS", []):
_data['includes'].append(env.subst(item[1]))
for item in env.get("CPPDEFINES", []):
_data['defines'].append(env.subst(item))
print json.dumps(_data)
Exit()
return firmenv.Program(
join("$BUILD_DIR", "firmware"),
[firmenv.GlobCXXFiles(vdir) for vdir in vdirs],
@@ -69,6 +79,22 @@ def BuildFirmware(env):
)
def ProcessFlags(env):
if "extra_flags" in env.get("BOARD_OPTIONS", {}).get("build", {}):
env.MergeFlags(env.subst("${BOARD_OPTIONS['build']['extra_flags']}"))
if "BUILD_FLAGS" in env:
env.MergeFlags(env['BUILD_FLAGS'])
# Cancel any previous definition of name, either built in or
# provided with a -D option // Issue #191
undefines = [f for f in env.get("CCFLAGS", []) if f.startswith("-U")]
if undefines:
for undef in undefines:
env['CCFLAGS'].remove(undef)
env.Append(_CPPDEFFLAGS=" %s" % " ".join(undefines))
def GlobCXXFiles(env, path):
files = []
for suff in ["*.c", "*.cpp", "*.S"]:
@@ -78,18 +104,23 @@ def GlobCXXFiles(env, path):
return files
def VariantDirWrap(env, variant_dir, src_dir, duplicate=True):
DefaultEnvironment().Append(VARIANT_DIRS=[(variant_dir, src_dir)])
env.VariantDir(variant_dir, src_dir, duplicate)
def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True,
ignore_pattern=None):
if not ignore_pattern:
ignore_pattern = (".git", ".svn")
variants = []
src_dir = env.subst(src_dir)
for root, _, _ in walk(src_dir):
for root, _, _ in walk(src_dir, followlinks=True):
_src_dir = root
_var_dir = variant_dir + root.replace(src_dir, "")
if any([s in _var_dir.lower() for s in ignore_pattern]):
continue
env.VariantDir(_var_dir, _src_dir, duplicate)
env.VariantDirWrap(_var_dir, _src_dir, duplicate)
variants.append(_var_dir)
return variants
@@ -131,9 +162,11 @@ def BuildLibrary(env, variant_dir, library_dir, ignore_files=None):
def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
INCLUDES_RE = re.compile(r"^\s*#include\s+(\<|\")([^\>\"\']+)(?:\>|\")",
re.M)
INCLUDES_RE = re.compile(
r"^\s*#include\s+(\<|\")([^\>\"\']+)(?:\>|\")", re.M)
LIBSOURCE_DIRS = [env.subst(d) for d in env.get("LIBSOURCE_DIRS", [])]
USE_LIBS = [l.strip() for l in env.get("USE_LIBS", "").split(",")
if l.strip()]
# start internal prototypes
@@ -174,7 +207,10 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
if not isdir(lsd_dir):
continue
for ld in listdir(lsd_dir):
for ld in USE_LIBS + listdir(lsd_dir):
if not isdir(join(lsd_dir, ld)):
continue
inc_path = normpath(join(lsd_dir, ld, self.name))
try:
lib_dir = inc_path[:inc_path.index(
@@ -205,6 +241,7 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
"libs": set(),
"ordered": set()
}
state = _process_src_dir(state, env.subst(src_dir))
result = []
@@ -213,22 +250,17 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
return result
def _process_src_dir(state, src_dir):
for root, _, _ in walk(src_dir):
for root, _, _ in walk(src_dir, followlinks=True):
for node in (env.GlobCXXFiles(root) +
env.Glob(join(root, "*.h"))):
state = _parse_includes(state, node)
return state
def _parse_includes(state, node):
if node.path in state['paths']:
return state
else:
state['paths'].add(node.path)
skip_includes = ("arduino.h", "energia.h")
matches = INCLUDES_RE.findall(node.get_text_contents())
for (inc_type, inc_name) in matches:
base_dir = dirname(node.path)
base_dir = dirname(node.get_abspath())
if inc_name.lower() in skip_includes:
continue
if join(base_dir, inc_name) in state['paths']:
@@ -365,7 +397,7 @@ def ConvertInoToCpp(env):
if not data:
return
tmpcpp_file = join(env.subst("$PROJECTSRC_DIR"), "piomain.cpp")
tmpcpp_file = join(env.subst("$PROJECTSRC_DIR"), "tmp_ino_to.cpp")
with open(tmpcpp_file, "w") as f:
f.write(data)
@@ -378,7 +410,9 @@ def exists(_):
def generate(env):
env.AddMethod(BuildFirmware)
env.AddMethod(ProcessFlags)
env.AddMethod(GlobCXXFiles)
env.AddMethod(VariantDirWrap)
env.AddMethod(VariantDirRecursive)
env.AddMethod(BuildFramework)
env.AddMethod(BuildLibrary)

View File

@@ -18,6 +18,7 @@ def cli(query, json_output): # pylint: disable=R0912
BOARDLIST_TPL = ("{type:<30} {mcu:<14} {frequency:<8} "
" {flash:<7} {ram:<6} {name}")
terminal_width, _ = click.get_terminal_size()
grpboards = {}
for type_, data in get_boards().items():
@@ -31,12 +32,14 @@ def cli(query, json_output): # pylint: disable=R0912
if query.lower() not in search_data.lower():
continue
click.echo("\nPlatform: %s" % platform)
click.echo("-" * 75)
click.echo("")
click.echo("Platform: ", nl=False)
click.secho(platform, bold=True)
click.echo("-" * terminal_width)
click.echo(BOARDLIST_TPL.format(
type=click.style("Type", fg="cyan"), mcu="MCU",
frequency="Frequency", flash="Flash", ram="RAM", name="Name"))
click.echo("-" * 75)
click.echo("-" * terminal_width)
for type_, data in sorted(boards.items(), key=lambda b: b[1]['name']):
if query:

146
platformio/commands/ci.py Normal file
View File

@@ -0,0 +1,146 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import stat
from glob import glob
from os import chmod, environ, makedirs, remove
from os.path import abspath, basename, isdir, isfile, join
from shutil import copyfile, copytree, rmtree
from tempfile import mkdtemp
import click
from platformio import app
from platformio.commands.init import cli as cmd_init
from platformio.commands.run import cli as cmd_run
from platformio.exception import CIBuildEnvsEmpty
from platformio.util import get_boards
def validate_path(ctx, param, value): # pylint: disable=W0613
invalid_path = None
for p in value:
if not glob(p):
invalid_path = p
break
try:
assert invalid_path is None
return value
except AssertionError:
raise click.BadParameter("Found invalid path: %s" % invalid_path)
def validate_boards(ctx, param, value): # pylint: disable=W0613
unknown_boards = set(value) - set(get_boards().keys())
try:
assert not unknown_boards
return value
except AssertionError:
raise click.BadParameter(
"%s. Please search for the board types using "
"`platformio boards` command" % ", ".join(unknown_boards))
@click.command("ci", short_help="Continuous Integration")
@click.argument("src", nargs=-1, callback=validate_path)
@click.option("--lib", "-l", multiple=True, callback=validate_path)
@click.option("--exclude", multiple=True)
@click.option("--board", "-b", multiple=True, callback=validate_boards)
@click.option("--build-dir", default=mkdtemp,
type=click.Path(exists=True, file_okay=False, dir_okay=True,
writable=True, resolve_path=True))
@click.option("--keep-build-dir", is_flag=True)
@click.option("--project-conf",
type=click.Path(exists=True, file_okay=True, dir_okay=False,
readable=True, resolve_path=True))
@click.option("--verbose", "-v", count=True, default=3)
@click.pass_context
def cli(ctx, src, lib, exclude, board, # pylint: disable=R0913
build_dir, keep_build_dir, project_conf, verbose):
if not src:
src = environ.get("PLATFORMIO_CI_SRC", "").split(":")
if not src:
raise click.BadParameter("Missing argument 'src'")
try:
app.set_session_var("force_option", True)
_clean_dir(build_dir)
for dir_name, patterns in dict(lib=lib, src=src).iteritems():
if not patterns:
continue
contents = []
for p in patterns:
contents += glob(p)
_copy_contents(join(build_dir, dir_name), contents)
if project_conf and isfile(project_conf):
copyfile(project_conf, join(build_dir, "platformio.ini"))
elif not board:
raise CIBuildEnvsEmpty()
if exclude:
_exclude_contents(build_dir, exclude)
# initialise project
ctx.invoke(cmd_init, project_dir=build_dir, board=board,
disable_auto_uploading=True)
# process project
ctx.invoke(cmd_run, project_dir=build_dir, verbose=verbose)
finally:
if not keep_build_dir:
rmtree(
build_dir, onerror=lambda action, name, exc:
(chmod(name, stat.S_IWRITE), remove(name))
)
def _clean_dir(dirpath):
rmtree(dirpath)
makedirs(dirpath)
def _copy_contents(dst_dir, contents):
items = {
"dirs": set(),
"files": set()
}
for path in contents:
path = abspath(path)
if isdir(path):
items['dirs'].add(path)
elif isfile(path):
items['files'].add(path)
dst_dir_name = basename(dst_dir)
if dst_dir_name == "src" and len(items['dirs']) == 1:
copytree(list(items['dirs']).pop(), dst_dir)
else:
makedirs(dst_dir)
for d in items['dirs']:
copytree(d, join(dst_dir, basename(d)))
if not items['files']:
return
if dst_dir_name == "lib":
dst_dir = join(dst_dir, mkdtemp(dir=dst_dir))
for f in items['files']:
copyfile(f, join(dst_dir, basename(f)))
def _exclude_contents(dst_dir, patterns):
contents = []
for p in patterns:
contents += glob(join(dst_dir, p))
for path in contents:
path = abspath(path)
if isdir(path):
rmtree(path)
elif isfile(path):
remove(path)

View File

@@ -8,46 +8,53 @@ from shutil import copyfile
import click
from platformio import app, exception
from platformio.ide.projectgenerator import ProjectGenerator
from platformio.util import get_boards, get_source_dir
def validate_boards(ctx, param, value): # pylint: disable=W0613
unknown_boards = set(value) - set(get_boards().keys())
try:
assert not unknown_boards
return value
except AssertionError:
raise click.BadParameter(
"%s. Please search for the board types using "
"`platformio boards` command" % ", ".join(unknown_boards))
@click.command("init", short_help="Initialize new PlatformIO based project")
@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("--board", "-b", multiple=True, metavar="TYPE")
@click.option("--board", "-b", multiple=True, metavar="TYPE",
callback=validate_boards)
@click.option("--ide",
type=click.Choice(ProjectGenerator.get_supported_ides()))
@click.option("--disable-auto-uploading", is_flag=True)
def cli(project_dir, board, disable_auto_uploading):
project_file = join(project_dir, "platformio.ini")
src_dir = join(project_dir, "src")
lib_dir = join(project_dir, "lib")
if all([isfile(project_file), isdir(src_dir), isdir(lib_dir)]):
raise exception.ProjectInitialized()
builtin_boards = set(get_boards().keys())
if board and not set(board).issubset(builtin_boards):
raise exception.UnknownBoard(
", ".join(set(board).difference(builtin_boards)))
@click.option("--env-prefix", default="")
def cli(project_dir, board, ide, disable_auto_uploading, env_prefix):
# ask about auto-uploading
if board and app.get_setting("enable_prompts"):
disable_auto_uploading = not click.confirm(
"\nWould you like to enable firmware auto-uploading when project "
"Would you like to enable firmware auto-uploading when project "
"is successfully built using `platformio run` command? \n"
"Don't forget that you can upload firmware manually using "
"`platformio run --target upload` command."
)
click.echo("")
if project_dir == getcwd():
click.secho("\nThe current working directory", fg="yellow", nl=False)
click.secho(" %s " % project_dir, fg="cyan", nl=False)
click.secho(
"will be used for the new project.\n"
"will be used for project.\n"
"You can specify another project directory via\n"
"`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.\n",
"`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.",
fg="yellow"
)
click.echo("")
click.echo("The next files/directories will be created in %s" %
click.style(project_dir, fg="cyan"))
@@ -58,51 +65,75 @@ def cli(project_dir, board, disable_auto_uploading):
click.echo("%s - Put here project specific or 3-rd party libraries" %
click.style("lib", fg="cyan"))
if (not app.get_setting("enable_prompts") or
click.confirm("Do you want to continue?")):
for d in (src_dir, lib_dir):
if not isdir(d):
makedirs(d)
if not isfile(project_file):
copyfile(join(get_source_dir(), "projectconftpl.ini"),
project_file)
if board:
fill_project_envs(project_file, board, disable_auto_uploading)
click.secho(
"Project has been successfully initialized!\nUseful commands:\n"
"`platformio run` - process/build project from the current "
"directory\n"
"`platformio run --target upload` or `platformio run -t upload` "
"- upload firmware to embedded board\n"
"`platformio run --target clean` - clean project (remove compiled "
"files)",
fg="green"
)
else:
if (app.get_setting("enable_prompts") and
not click.confirm("Do you want to continue?")):
raise exception.AbortedByUser()
project_file = join(project_dir, "platformio.ini")
src_dir = join(project_dir, "src")
lib_dir = join(project_dir, "lib")
def fill_project_envs(project_file, board_types, disable_auto_uploading):
for d in (src_dir, lib_dir):
if not isdir(d):
makedirs(d)
if not isfile(project_file):
copyfile(join(get_source_dir(), "projectconftpl.ini"),
project_file)
if board:
fill_project_envs(
project_file, board, disable_auto_uploading, env_prefix)
if ide:
pg = ProjectGenerator(project_dir, ide)
pg.generate()
click.secho(
"\nProject has been successfully initialized!\nUseful commands:\n"
"`platformio run` - process/build project from the current "
"directory\n"
"`platformio run --target upload` or `platformio run -t upload` "
"- upload firmware to embedded board\n"
"`platformio run --target clean` - clean project (remove compiled "
"files)",
fg="green"
)
def fill_project_envs(project_file, board_types, disable_auto_uploading,
env_prefix):
builtin_boards = get_boards()
content = []
for type_ in board_types:
if type_ not in builtin_boards:
continue
else:
content.append("")
used_envs = []
with open(project_file) as f:
used_envs = [l.strip() for l in f.read().splitlines() if
l.strip().startswith("[env:")]
for type_ in board_types:
data = builtin_boards[type_]
env_name = "[env:%s%s]" % (env_prefix, type_)
if env_name in used_envs:
continue
content.append("")
content.append(env_name)
content.append("platform = %s" % data['platform'])
# find default framework for board
frameworks = data.get("frameworks")
content.append("[env:autogen_%s]" % type_)
content.append("platform = %s" % data['platform'])
if frameworks:
content.append("framework = %s" % frameworks[0])
content.append("board = %s" % type_)
content.append("board = %s" % type_)
content.append("%stargets = upload" % ("# " if disable_auto_uploading
else ""))
if not content:
return
with open(project_file, "a") as f:
content.append("")
f.write("\n".join(content))

View File

@@ -1,20 +0,0 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import click
from platformio.platforms.base import PlatformFactory
@click.command("install", short_help="Install new platforms")
@click.argument("platforms", nargs=-1)
@click.option("--with-package", multiple=True, metavar="<package>")
@click.option("--without-package", multiple=True, metavar="<package>")
@click.option("--skip-default-package", is_flag=True)
def cli(platforms, with_package, without_package, skip_default_package):
for platform in platforms:
p = PlatformFactory.newPlatform(platform)
if p.install(with_package, without_package, skip_default_package):
click.secho("The platform '%s' has been successfully installed!" %
platform, fg="green")

View File

@@ -7,7 +7,7 @@ import click
from platformio import app, exception
from platformio.libmanager import LibraryManager
from platformio.util import get_api_result, get_lib_dir
from platformio.util import get_api_result
LIBLIST_TPL = ("[{id:^14}] {name:<25} {compatibility:<30} "
"\"{authornames}\": {description}")
@@ -21,7 +21,9 @@ def echo_liblist_header():
authornames="Authors",
description="Description"
))
click.echo("-" * 85)
terminal_width, _ = click.get_terminal_size()
click.echo("-" * terminal_width)
def echo_liblist_item(item):
@@ -98,7 +100,7 @@ def lib_search(query, **filters):
@click.option("-v", "--version")
@click.pass_context
def lib_install(ctx, libid, version):
lm = LibraryManager(get_lib_dir())
lm = LibraryManager()
for id_ in libid:
click.echo(
"Installing library [ %s ]:" % click.style(str(id_), fg="green"))
@@ -147,7 +149,7 @@ def lib_install_dependency(ctx, data):
@cli.command("uninstall", short_help="Uninstall libraries")
@click.argument("libid", type=click.INT, nargs=-1)
def lib_uninstall(libid):
lm = LibraryManager(get_lib_dir())
lm = LibraryManager()
for id_ in libid:
info = lm.get_info(id_)
if lm.uninstall(id_):
@@ -158,7 +160,7 @@ def lib_uninstall(libid):
@cli.command("list", short_help="List installed libraries")
@click.option("--json-output", is_flag=True)
def lib_list(json_output):
lm = LibraryManager(get_lib_dir())
lm = LibraryManager()
items = lm.get_installed().values()
if json_output:
@@ -177,7 +179,7 @@ def lib_list(json_output):
@cli.command("show", short_help="Show details about installed library")
@click.argument("libid", type=click.INT)
def lib_show(libid):
lm = LibraryManager(get_lib_dir())
lm = LibraryManager()
info = lm.get_info(libid)
click.secho(info['name'], fg="cyan")
click.echo("-" * len(info['name']))
@@ -209,13 +211,18 @@ def lib_show(libid):
@cli.command("update", short_help="Update installed libraries")
@click.argument("libid", type=click.INT, nargs=-1, required=False,
metavar="[LIBRARY_ID]")
@click.pass_context
def lib_update(ctx):
lm = LibraryManager(get_lib_dir())
def lib_update(ctx, libid):
lm = LibraryManager()
for id_, latest_version in (lm.get_latest_versions() or {}).items():
if libid and int(id_) not in libid:
continue
info = lm.get_info(int(id_))
click.echo("Updating [ %s ] %s library:" % (
click.echo("Updating [ %s ] %s library:" % (
click.style(id_, fg="yellow"),
click.style(info['name'], fg="cyan")))

View File

@@ -1,34 +0,0 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import json
import click
from platformio.platforms.base import PlatformFactory
@click.command("list", short_help="List installed platforms")
@click.option("--json-output", is_flag=True)
def cli(json_output):
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
installed_platforms.sort()
data = []
for platform in installed_platforms:
p = PlatformFactory.newPlatform(platform)
data.append({
"name": platform,
"packages": p.get_installed_packages()
})
if json_output:
click.echo(json.dumps(data))
else:
for item in data:
click.echo("{name:<20} with packages: {pkgs}".format(
name=click.style(item['name'], fg="cyan"),
pkgs=", ".join(item['packages'])
))

View File

@@ -0,0 +1,155 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import json
from datetime import datetime
import click
from platformio import app
from platformio.exception import PlatformNotInstalledYet
from platformio.pkgmanager import PackageManager
from platformio.platforms.base import PlatformFactory
@click.group(short_help="Platforms and Packages Manager")
def cli():
pass
@cli.command("install", short_help="Install new platforms")
@click.argument("platforms", nargs=-1, required=True)
@click.option("--with-package", multiple=True, metavar="<package>")
@click.option("--without-package", multiple=True, metavar="<package>")
@click.option("--skip-default-package", is_flag=True)
def platforms_install(platforms, with_package, without_package,
skip_default_package):
for platform in platforms:
p = PlatformFactory.newPlatform(platform)
if p.install(with_package, without_package, skip_default_package):
click.secho("The platform '%s' has been successfully installed!" %
platform, fg="green")
@cli.command("list", short_help="List installed platforms")
@click.option("--json-output", is_flag=True)
def platforms_list(json_output):
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
installed_platforms.sort()
data = []
for platform in installed_platforms:
p = PlatformFactory.newPlatform(platform)
data.append({
"name": platform,
"packages": p.get_installed_packages()
})
if json_output:
click.echo(json.dumps(data))
else:
for item in data:
click.echo("{name:<20} with packages: {pkgs}".format(
name=click.style(item['name'], fg="cyan"),
pkgs=", ".join(item['packages'])
))
@cli.command("search", short_help="Search for development platforms")
@click.argument("query", required=False)
@click.option("--json-output", is_flag=True)
def platforms_search(query, json_output):
data = []
platforms = PlatformFactory.get_platforms().keys()
platforms.sort()
for platform in platforms:
p = PlatformFactory.newPlatform(platform)
type_ = p.get_type()
description = p.get_description()
if query == "all":
query = ""
search_data = "%s %s %s" % (type_, description, p.get_packages())
if query and query.lower() not in search_data.lower():
continue
data.append({
"type": type_,
"description": description,
"packages": p.get_packages()
})
if json_output:
click.echo(json.dumps(data))
else:
terminal_width, _ = click.get_terminal_size()
for item in data:
click.secho(item['type'], fg="cyan", nl=False)
click.echo(" (available packages: %s)" % ", ".join(
item.get("packages").keys()))
click.echo("-" * terminal_width)
click.echo(item['description'])
click.echo()
@cli.command("show", short_help="Show details about installed platform")
@click.argument("platform")
@click.pass_context
def platforms_show(ctx, platform):
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
if platform not in installed_platforms:
if (not app.get_setting("enable_prompts") or
click.confirm("The platform '%s' has not been installed yet. "
"Would you like to install it now?" % platform)):
ctx.invoke(platforms_install, platforms=[platform])
else:
raise PlatformNotInstalledYet(platform)
p = PlatformFactory.newPlatform(platform)
click.echo("{name:<20} - {description} [ {url} ]".format(
name=click.style(p.get_type(), fg="cyan"),
description=p.get_description(), url=p.get_vendor_url()))
installed_packages = PackageManager.get_installed()
for name in p.get_installed_packages():
data = installed_packages[name]
pkgalias = p.get_pkg_alias(name)
click.echo("----------")
click.echo("Package: %s" % click.style(name, fg="yellow"))
if pkgalias:
click.echo("Alias: %s" % pkgalias)
click.echo("Version: %d" % int(data['version']))
click.echo("Installed: %s" % datetime.fromtimestamp(
data['time']).strftime("%Y-%m-%d %H:%M:%S"))
@cli.command("uninstall", short_help="Uninstall platforms")
@click.argument("platforms", nargs=-1, required=True)
def platforms_uninstall(platforms):
for platform in platforms:
p = PlatformFactory.newPlatform(platform)
if p.uninstall():
click.secho("The platform '%s' has been successfully "
"uninstalled!" % platform, fg="green")
@cli.command("update", short_help="Update installed Platforms and Packages")
def platforms_update():
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
installed_platforms.sort()
for platform in installed_platforms:
click.echo("\nPlatform %s" % click.style(platform, fg="cyan"))
click.echo("--------")
p = PlatformFactory.newPlatform(platform)
p.update()

View File

@@ -2,6 +2,7 @@
# See LICENSE for details.
from datetime import datetime
from os import chdir, getcwd
from os.path import getmtime, isdir, join
from shutil import rmtree
from time import time
@@ -9,7 +10,10 @@ from time import time
import click
from platformio import app, exception, telemetry, util
from platformio.commands.install import cli as cmd_install
from platformio.commands.lib import lib_install as cmd_lib_install
from platformio.commands.platforms import \
platforms_install as cmd_platforms_install
from platformio.libmanager import LibraryManager
from platformio.platforms.base import PlatformFactory
@@ -17,110 +21,162 @@ from platformio.platforms.base import PlatformFactory
@click.option("--environment", "-e", multiple=True, metavar="<environment>")
@click.option("--target", "-t", multiple=True, metavar="<target>")
@click.option("--upload-port", metavar="<upload port>")
@click.option("--project-dir", 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)
@click.pass_context
def cli(ctx, environment, target, upload_port):
def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
project_dir, verbose):
initial_cwd = getcwd()
chdir(project_dir)
try:
config = util.get_project_config()
config = util.get_project_config()
if not config.sections():
raise exception.ProjectEnvsNotAvailable()
if not config.sections():
raise exception.ProjectEnvsNotAvailable()
unknown = set(environment) - set([s[4:] for s in config.sections()])
if unknown:
raise exception.UnknownEnvNames(", ".join(unknown))
unknown = set(environment) - set([s[4:] for s in config.sections()])
if unknown:
raise exception.UnknownEnvNames(", ".join(unknown))
# remove ".pioenvs" if project config is modified
_pioenvs_dir = util.get_pioenvs_dir()
if (isdir(_pioenvs_dir) and
getmtime(join(util.get_project_dir(), "platformio.ini")) >
getmtime(_pioenvs_dir)):
rmtree(_pioenvs_dir)
# remove ".pioenvs" if project config is modified
_pioenvs_dir = util.get_pioenvs_dir()
if (isdir(_pioenvs_dir) and
getmtime(join(util.get_project_dir(), "platformio.ini")) >
getmtime(_pioenvs_dir)):
rmtree(_pioenvs_dir)
results = []
for section in config.sections():
# skip main configuration section
if section == "platformio":
continue
found_error = False
_first_done = False
for section in config.sections():
# skip main configuration section
if section == "platformio":
continue
elif section[:4] != "env:":
raise exception.InvalidEnvName(section)
if not section.startswith("env:"):
raise exception.InvalidEnvName(section)
envname = section[4:]
if environment and envname not in environment:
# echo("Skipped %s environment" % style(envname, fg="yellow"))
continue
envname = section[4:]
if environment and envname not in environment:
# echo("Skipped %s environment" % style(envname, fg="yellow"))
continue
options = {}
for k, v in config.items(section):
options[k] = v
if results:
click.echo()
if _first_done:
click.echo()
options = {}
for k, v in config.items(section):
options[k] = v
if not process_environment(ctx, envname, options, target, upload_port):
found_error = True
_first_done = True
ep = EnvironmentProcessor(
ctx, envname, options, target, upload_port, verbose)
results.append(ep.process())
if found_error:
raise exception.ReturnErrorCode()
if not all(results):
raise exception.ReturnErrorCode()
finally:
chdir(initial_cwd)
def process_environment(ctx, name, options, targets, upload_port):
terminal_width, _ = click.get_terminal_size()
start_time = time()
class EnvironmentProcessor(object):
click.echo("[%s] Processing %s (%s)" % (
datetime.now().strftime("%c"),
click.style(name, fg="cyan", bold=True),
", ".join(["%s: %s" % (k, v) for k, v in options.iteritems()])
))
click.secho("-" * terminal_width, bold=True)
def __init__(self, cmd_ctx, name, options, # pylint: disable=R0913
targets, upload_port, verbose):
self.cmd_ctx = cmd_ctx
self.name = name
self.options = options
self.targets = targets
self.upload_port = upload_port
self.verbose_level = int(verbose)
result = _run_environment(ctx, name, options, targets, upload_port)
def process(self):
terminal_width, _ = click.get_terminal_size()
start_time = time()
is_error = result['returncode'] != 0
summary_text = " Took %.2f seconds " % (time() - start_time)
half_line = "=" * ((terminal_width - len(summary_text) - 10) / 2)
click.echo("%s [%s]%s%s" % (
half_line,
(click.style(" ERROR ", fg="red", bold=True)
if is_error else click.style("SUCCESS", fg="green", bold=True)),
summary_text,
half_line
), err=is_error)
click.echo("[%s] Processing %s (%s)" % (
datetime.now().strftime("%c"),
click.style(self.name, fg="cyan", bold=True),
", ".join(["%s: %s" % (k, v) for k, v in self.options.iteritems()])
))
click.secho("-" * terminal_width, bold=True)
return not is_error
result = self._run()
is_error = result['returncode'] != 0
summary_text = " Took %.2f seconds " % (time() - start_time)
half_line = "=" * ((terminal_width - len(summary_text) - 10) / 2)
click.echo("%s [%s]%s%s" % (
half_line,
(click.style(" ERROR ", fg="red", bold=True)
if is_error else click.style("SUCCESS", fg="green", bold=True)),
summary_text,
half_line
), err=is_error)
return not is_error
def _get_build_variables(self):
variables = ["PIOENV=" + self.name]
if self.upload_port:
variables.append("UPLOAD_PORT=%s" % self.upload_port)
for k, v in self.options.items():
k = k.upper()
if k == "TARGETS" or (k == "UPLOAD_PORT" and self.upload_port):
continue
variables.append("%s=%s" % (k.upper(), v))
return variables
def _get_build_targets(self):
targets = []
if self.targets:
targets = [t for t in self.targets]
elif "targets" in self.options:
targets = self.options['targets'].split()
return targets
def _run(self):
if "platform" not in self.options:
raise exception.UndefinedEnvPlatform(self.name)
platform = self.options['platform']
build_vars = self._get_build_variables()
build_targets = self._get_build_targets()
telemetry.on_run_environment(self.options, build_targets)
# install platform and libs dependencies
_autoinstall_platform(self.cmd_ctx, platform)
if "install_libs" in self.options:
_autoinstall_libs(self.cmd_ctx, self.options['install_libs'])
p = PlatformFactory.newPlatform(platform)
return p.run(build_vars, build_targets, self.verbose_level)
def _run_environment(ctx, name, options, targets, upload_port):
variables = ["PIOENV=" + name]
if upload_port:
variables.append("UPLOAD_PORT=%s" % upload_port)
for k, v in options.items():
k = k.upper()
if k == "TARGETS" or (k == "UPLOAD_PORT" and upload_port):
continue
variables.append("%s=%s" % (k.upper(), v))
envtargets = []
if targets:
envtargets = [t for t in targets]
elif "targets" in options:
envtargets = options['targets'].split()
if "platform" not in options:
raise exception.UndefinedEnvPlatform(name)
platform = options['platform']
telemetry.on_run_environment(options, envtargets)
def _autoinstall_platform(ctx, platform):
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
if (platform not in installed_platforms and (
not app.get_setting("enable_prompts") or
click.confirm("The platform '%s' has not been installed yet. "
"Would you like to install it now?" % platform))):
ctx.invoke(cmd_install, platforms=[platform])
ctx.invoke(cmd_platforms_install, platforms=[platform])
p = PlatformFactory.newPlatform(platform)
return p.run(variables, envtargets)
def _autoinstall_libs(ctx, libids_list):
require_libs = [int(l.strip()) for l in libids_list.split(",")]
installed_libs = [
l['id'] for l in LibraryManager().get_installed().values()
]
not_intalled_libs = set(require_libs) - set(installed_libs)
if not require_libs or not not_intalled_libs:
return
if (not app.get_setting("enable_prompts") or
click.confirm(
"The libraries with IDs '%s' have not been installed yet. "
"Would you like to install them now?" %
", ".join([str(i) for i in not_intalled_libs])
)):
ctx.invoke(cmd_lib_install, libid=not_intalled_libs)

View File

@@ -1,46 +0,0 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import json
import click
from platformio.platforms.base import PlatformFactory
@click.command("search", short_help="Search for development platforms")
@click.argument("query", required=False)
@click.option("--json-output", is_flag=True)
def cli(query, json_output):
data = []
platforms = PlatformFactory.get_platforms().keys()
platforms.sort()
for platform in platforms:
p = PlatformFactory.newPlatform(platform)
type_ = p.get_type()
description = p.get_description()
if query == "all":
query = ""
search_data = "%s %s %s" % (type_, description, p.get_packages())
if query and query.lower() not in search_data.lower():
continue
data.append({
"type": type_,
"description": description,
"packages": p.get_packages()
})
if json_output:
click.echo(json.dumps(data))
else:
for item in data:
click.secho(item['type'], fg="cyan", nl=False)
click.echo(" (available packages: %s)" % ", ".join(
p.get_packages().keys()))
click.secho("-" * len(item['type']), fg="cyan")
click.echo(item['description'])
click.echo()

View File

@@ -25,7 +25,7 @@ def serialports_list(json_output):
for item in get_serialports():
click.secho(item['port'], fg="cyan")
click.echo("----------")
click.echo("-" * len(item['port']))
click.echo("Hardware ID: %s" % item['hwid'])
click.echo("Description: %s" % item['description'])
click.echo("")

View File

@@ -16,6 +16,7 @@ def cli():
def settings_get(name):
list_tpl = "{name:<40} {value:<35} {description}"
terminal_width, _ = click.get_terminal_size()
click.echo(list_tpl.format(
name=click.style("Name", fg="cyan"),
@@ -23,7 +24,7 @@ def settings_get(name):
click.style(" [Default]", fg="yellow")),
description="Description"
))
click.echo("-" * 90)
click.echo("-" * terminal_width)
for _name, _data in sorted(app.DEFAULT_SETTINGS.items()):
if name and name != _name:

View File

@@ -1,46 +0,0 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from datetime import datetime
import click
from platformio import app
from platformio.commands.install import cli as cmd_install
from platformio.exception import PlatformNotInstalledYet
from platformio.pkgmanager import PackageManager
from platformio.platforms.base import PlatformFactory
@click.command("show", short_help="Show details about installed platform")
@click.argument("platform")
@click.pass_context
def cli(ctx, platform):
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
if platform not in installed_platforms:
if (not app.get_setting("enable_prompts") or
click.confirm("The platform '%s' has not been installed yet. "
"Would you like to install it now?" % platform)):
ctx.invoke(cmd_install, platforms=[platform])
else:
raise PlatformNotInstalledYet(platform)
p = PlatformFactory.newPlatform(platform)
click.echo("{name:<20} - {description} [ {url} ]".format(
name=click.style(p.get_type(), fg="cyan"),
description=p.get_description(), url=p.get_vendor_url()))
installed_packages = PackageManager.get_installed()
for name in p.get_installed_packages():
data = installed_packages[name]
pkgalias = p.get_pkg_alias(name)
click.echo("----------")
click.echo("Package: %s" % click.style(name, fg="yellow"))
if pkgalias:
click.echo("Alias: %s" % pkgalias)
click.echo("Version: %d" % int(data['version']))
click.echo("Installed: %s" % datetime.fromtimestamp(
data['time']).strftime("%Y-%m-%d %H:%M:%S"))

View File

@@ -1,17 +0,0 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import click
from platformio.platforms.base import PlatformFactory
@click.command("uninstall", short_help="Uninstall platforms")
@click.argument("platforms", nargs=-1)
def cli(platforms):
for platform in platforms:
p = PlatformFactory.newPlatform(platform)
if p.uninstall():
click.secho("The platform '%s' has been successfully "
"uninstalled!" % platform, fg="green")

View File

@@ -3,18 +3,14 @@
import click
from platformio.platforms.base import PlatformFactory
from platformio.commands.lib import lib_update as cmd_lib_update
from platformio.commands.platforms import \
platforms_update as cmd_platforms_update
@click.command("update", short_help="Update installed platforms")
def cli():
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
installed_platforms.sort()
for platform in installed_platforms:
click.echo("\nPlatform %s" % click.style(platform, fg="cyan"))
click.echo("--------")
p = PlatformFactory.newPlatform(platform)
p.update()
@click.command("update",
short_help="Update installed Platforms, Packages and Libraries")
@click.pass_context
def cli(ctx):
ctx.invoke(cmd_platforms_update)
ctx.invoke(cmd_lib_update)

View File

@@ -4,9 +4,8 @@
import click
import requests
from platformio import __version__
from platformio import __version__, util
from platformio.exception import GetLatestVersionError
from platformio.util import exec_command
@click.command("upgrade",
@@ -22,9 +21,9 @@ def cli():
click.secho("Please wait while upgrading PlatformIO ...",
fg="yellow")
pip_result = exec_command(["pip", "install", "--upgrade",
"platformio"])
pio_result = exec_command(["platformio", "--version"])
pip_result = util.exec_command(["pip", "install", "--upgrade",
"platformio"])
pio_result = util.exec_command(["platformio", "--version"])
if last in pio_result['out'].strip():
click.secho("PlatformIO has been successfully upgraded to %s" %
@@ -37,7 +36,9 @@ def cli():
def get_latest_version():
try:
pkgdata = requests.get(
"https://pypi.python.org/pypi/platformio/json").json()
"https://pypi.python.org/pypi/platformio/json",
headers=util.get_request_defheaders()
).json()
return pkgdata['info']['version']
except:
raise GetLatestVersionError()

View File

@@ -3,15 +3,16 @@
from email.utils import parsedate_tz
from math import ceil
from os import environ
from os.path import getsize, join
from time import mktime
from click import progressbar
from requests import get
import click
import requests
from platformio import util
from platformio.exception import (FDSHASumMismatch, FDSizeMismatch,
FDUnrecognizedStatusCode)
from platformio.util import change_filemtime, exec_command
class FileDownloader(object):
@@ -27,7 +28,8 @@ class FileDownloader(object):
self.set_destination(join(dest_dir, self._fname))
self._progressbar = None
self._request = get(url, stream=True)
self._request = requests.get(url, stream=True,
headers=util.get_request_defheaders())
if self._request.status_code != 200:
raise FDUnrecognizedStatusCode(self._request.status_code, url)
@@ -48,9 +50,14 @@ class FileDownloader(object):
f = open(self._destination, "wb")
chunks = int(ceil(self.get_size() / float(self.CHUNK_SIZE)))
with progressbar(length=chunks, label="Downloading") as pb:
for _ in pb:
if environ.get("CI") == "true":
click.echo("Downloading...")
for _ in range(0, chunks):
f.write(next(itercontent))
else:
with click.progressbar(length=chunks, label="Downloading") as pb:
for _ in pb:
f.write(next(itercontent))
f.close()
self._request.close()
@@ -66,11 +73,12 @@ class FileDownloader(object):
dlsha1 = None
try:
result = exec_command(["sha1sum", self._destination])
result = util.exec_command(["sha1sum", self._destination])
dlsha1 = result['out']
except OSError:
try:
result = exec_command(["shasum", "-a", "1", self._destination])
result = util.exec_command(
["shasum", "-a", "1", self._destination])
dlsha1 = result['out']
except OSError:
pass
@@ -83,7 +91,7 @@ class FileDownloader(object):
def _preserve_filemtime(self, lmdate):
timedata = parsedate_tz(lmdate)
lmtime = mktime(timedata[:9])
change_filemtime(self._destination, lmtime)
util.change_filemtime(self._destination, lmtime)
def __del__(self):
self._request.close()

Some files were not shown because too many files have changed in this diff Show More