Compare commits

...

143 Commits

Author SHA1 Message Date
23017a22ec Merge branch 'release/v0.10.1' 2015-01-02 23:18:14 +02:00
6c86bb4167 Bump to 0.10.1 (resolve issue #42) 2015-01-02 23:17:30 +02:00
ca31230928 Improve lib scanner 2015-01-02 23:14:45 +02:00
01f8795981 Add "--json-output" option to "platformio list", "platformio serialports list" and "platformio lib list" cmds // Resolve #42 2015-01-02 21:03:14 +02:00
2566879a99 Fix indention 2015-01-02 20:27:34 +02:00
418b693fe0 Fix missing auto-uploading by default within init command 2015-01-02 20:25:30 +02:00
8686936a07 Revert lowercase to Quickstart 2015-01-02 17:18:32 +02:00
79b8e6c24e Mention "boards" command on QuickStart page 2015-01-02 15:19:44 +02:00
8c2dd44f44 Update platformio.ini for the examples 2015-01-02 00:16:29 +02:00
f172019edc Disable blink for "thanks" 2015-01-01 22:57:02 +02:00
44bf3e8479 Start 0.11.0-dev 2015-01-01 21:04:27 +02:00
17d6c02d83 Merge branch 'release/v0.10.0' 2015-01-01 21:00:27 +02:00
bd6a57095a Merge branch 'release/v0.10.0' into develop 2015-01-01 21:00:27 +02:00
68733a447a Bump to 0.10.0 (resolve issues: #11, #21, #35, #37, #38, #39, #40, #43 ) 2015-01-01 20:57:47 +02:00
1fb0644f51 Happy New Year to copyrights :) 2015-01-01 19:50:45 +02:00
c74d10b2e3 Migrate to PlatformIO open-source ORG domain 2014-12-30 23:22:42 +02:00
95582d16a6 Rename Twitter account to @PlatformIO_Org 2014-12-30 14:02:20 +02:00
e8628443f0 Correct spelling 2014-12-29 20:27:11 +02:00
af191834d1 Allow to initialise project with the specified embedded boards // Resolve #21 2014-12-29 20:22:01 +02:00
82744afe58 Allow auto-installation of platforms when prompts are disabled // Resolve #43 2014-12-29 15:10:31 +02:00
c109857707 Correct Engduino names 2014-12-28 23:49:46 +02:00
740f609ca8 Added docs for Engduino boards 2014-12-28 23:38:45 +02:00
1b7065d8c1 Added support for *Engduino* boards // Resolve #38 2014-12-28 23:38:18 +02:00
f78f5b454b Parse libs in header files 2014-12-28 23:09:07 +02:00
c3686b4098 Improve compatibility with Arduino bundled libs 2014-12-28 22:58:27 +02:00
9cfa4e40d0 Cleanup extra_flags 2014-12-28 22:57:36 +02:00
4a5903849e Automatic detection of port on "serialports monitor" // Resolve #37 2014-12-28 20:57:05 +02:00
200944ebb3 Fix lint warning with unused argument 2014-12-28 20:43:29 +02:00
7af9f50426 Fix firmware uploading to Arduino Leonardo-based boards // Resolve #40 2014-12-28 20:41:21 +02:00
fe60369b6a Fix pre-configured settings for Arduino boards and ATmega 328 MCU 2014-12-28 20:03:43 +02:00
15acca7b57 Mention about "boards" command in the platform page 2014-12-28 00:06:54 +02:00
2aa4d0af33 Implement 'boards' command // Resolve #11 2014-12-27 23:59:20 +02:00
01bbfcced0 Update "requests" to 2.5.1 2014-12-26 23:49:21 +02:00
65895e658f Fix bug with Arduino's USB boards // Resolve issue #40 2014-12-26 23:48:07 +02:00
0241d65460 Avoid SSL connection to packages manifest file // Resolve #39 2014-12-24 22:12:42 +02:00
060e1764cb Fix urllib3's SSL warning under Python <= 2.7.2 // Resolve #39 2014-12-24 21:36:11 +02:00
9dcc774bfd Add example with uploading firmware via USB programmer (USBasp) // Resolve #35 2014-12-19 19:53:25 +02:00
11b26b3730 Clarify when lib not found by search request 2014-12-16 23:45:00 +02:00
d9a7537d5d Add example to lib search with the "excluding" operator 2014-12-14 19:47:19 +02:00
d68937afe0 Reduce terminate timeout 2014-12-14 19:46:40 +02:00
43441a431e Improve Telemetry service 2014-12-14 00:39:33 +02:00
9e4618ca7e Finally fix issue #18 - Compilation fails on Windows 2014-12-13 22:54:50 +02:00
69cde35fb7 Start 0.10.0-dev 2014-12-10 23:13:41 +02:00
ac02348833 Merge branch 'release/v0.9.2' 2014-12-10 23:12:27 +02:00
311c07e857 Merge branch 'release/v0.9.2' into develop 2014-12-10 23:12:27 +02:00
34c0ccb29f Ready for v0.9.2 2014-12-10 23:11:05 +02:00
efac8ec940 Fix compilation bug on Windows with installed MSVC // Issue #18 2014-12-10 23:07:02 +02:00
4f56bf66db Fix compilation bug on Windows with installed MSVC 2014-12-10 23:01:48 +02:00
3157ceaa47 Add new setting enable_prompts and avoid blocking / Resolve #34 2014-12-10 22:32:22 +02:00
2b2ceb60cc Replace "dark blue" with "cyan" colour / Resolve #33 2014-12-10 21:40:39 +02:00
4f3c4e0901 Update "requests" to 2.5.0 2014-12-10 21:31:50 +02:00
5442ee459d Fix enable/disable telemetry service 2014-12-06 19:00:36 +02:00
63dcb5586c Start 0.10.0-dev 2014-12-05 00:12:44 +02:00
e521a691ae Merge branch 'release/v0.9.1' 2014-12-05 00:04:38 +02:00
b653aca20f Merge branch 'release/v0.9.1' into develop 2014-12-05 00:04:38 +02:00
e0120bc86e Ready for v0.9.1 2014-12-05 00:02:09 +02:00
0dff38fcdd Upgrade Eclipse Project Examples to latest Luna and PlatformIO releases 2014-12-04 23:57:52 +02:00
d8863d1861 Code improvements 2014-12-04 23:17:45 +02:00
8596d271a2 Cleanup click-based source code 2014-12-03 20:16:50 +02:00
affb47b82e Ask user to install platform when it hasn't been installed yet 2014-12-03 20:15:52 +02:00
61e07fe169 Improve documentation 2014-12-03 14:56:24 +02:00
caf6746e89 Fix "OSError: [Errno 2] No such file or directory" when PlatformIO isn't installed properly 2014-12-03 14:18:22 +02:00
f1f6817615 Merge branch 'develop' of https://github.com/ivankravets/platformio into develop 2014-12-03 14:16:47 +02:00
06f4e5c835 Merge pull request #32 from franciscoruiz/eclipse-ide-examples-tiva
Fixed example for Eclipse IDE with Tiva board
2014-12-03 13:25:00 +02:00
0aeb2e89de Register "serialports" like multicommand 2014-12-03 12:46:24 +02:00
d1513169fc More clarifications about NotPlatformProject 2014-12-03 12:45:23 +02:00
2af34821aa Made main.c compliant with Energy
Complaining about main() defined twice
2014-12-03 00:31:34 +00:00
e1ad6072dd Set platformio as builder for the project
Both for building and cleaning
2014-12-03 00:29:44 +00:00
c69c889a26 Fixed paths to included files for toolchain and framework 2014-12-03 00:28:17 +00:00
2be4bc4817 Fixed reference to non-existing image in README 2014-12-03 00:24:35 +00:00
32d422bd97 Simplify SF URL to manifest file 2014-12-01 23:21:21 +02:00
be0eb901db Start 0.10.0-dev 2014-12-01 23:11:16 +02:00
ce1b32e4e9 Merge branch 'release/v0.9.0' 2014-12-01 23:04:54 +02:00
e2a4f48953 Merge branch 'release/v0.9.0' into develop 2014-12-01 23:04:54 +02:00
2bc68df958 Preparation for v0.9.0 2014-12-01 23:04:26 +02:00
ba00ee20c2 Switch to SF Storage 2014-12-01 22:45:53 +02:00
107a849f88 Correct dynamic library name 2014-12-01 16:40:46 +02:00
ddab7046ca Don't show obsolate version in =dev mode 2014-12-01 16:33:35 +02:00
e49d4e2722 Fix #28: bug with code builder and built-in Arduino libraries 2014-12-01 16:11:30 +02:00
3c9e809b58 Improve "init" command. Resolve #31 2014-11-30 18:14:18 +02:00
a82d09e816 Trim spaces 2014-11-30 18:13:45 +02:00
6b9cbde8eb Improve telemetry for run env command 2014-11-30 17:00:30 +02:00
22297b9cfd Implement "platformio settings" command 2014-11-29 22:58:10 +02:00
d8837e4756 Allow "upload_port" auto-detecting 2014-11-29 22:56:08 +02:00
bcfb007c90 Added Migration Manager which simplifies process with upgrading to a major release 2014-11-29 22:55:32 +02:00
33d87367e7 Add Telemetry Service 2014-11-29 22:48:15 +02:00
257f751dfa Implement ApplicationState Manager 2014-11-29 22:39:44 +02:00
e41226fcbc Remove copyrights from use's file 2014-11-27 22:25:40 +02:00
4efb798371 Add ready for compilers 2014-11-27 22:22:39 +02:00
f8f47886d3 Resolve issue #27 with LICENSE 2014-11-27 22:17:48 +02:00
dec78d29e8 Improve install/uninstall commands 2014-11-24 22:24:19 +02:00
102175215c Allow for search args to be empty 2014-11-24 21:59:25 +02:00
cd2cc16fcf Improve support for 3-rd party platforms 2014-11-24 21:36:44 +02:00
b103dc01c0 Refactored Package Manager 2014-11-22 23:55:17 +02:00
f8ed09c3ad Improve installation section 2014-11-21 21:06:32 +02:00
7f918da87d Fix SHA1 package verification under Cygwin Env. Resolve #26 2014-11-21 18:13:02 +02:00
32230c6b60 Add pic for colourful output 2014-11-15 20:18:50 +02:00
d8b00eef97 Improve PlatformIO ideas 2014-11-15 20:12:27 +02:00
2b1b64c5c1 Add 'sudo' notice 2014-11-14 00:17:09 +02:00
145fcb63e2 Improve installation 2014-11-14 00:12:23 +02:00
6748fb974b Add pics to IDE page 2014-11-12 19:33:35 +02:00
da234bf228 Update project title 2014-11-07 22:22:18 +02:00
c821cdefa4 Add logo, improve texts 2014-11-07 22:14:44 +02:00
7eb86305d4 Add "user Guide" shortcut to lib menu 2014-11-06 20:21:48 +02:00
66b5299b56 Update Twitter link 2014-11-05 20:58:35 +02:00
fcd0528a9e Fix trademark issues 2014-10-27 22:47:53 +02:00
99929d7fa6 Fix "repository" field and "type" attribute 2014-10-24 22:59:15 +03:00
6c7be9b339 Improve lib examples 2014-10-22 23:52:17 +03:00
73004d0ad8 Switch to 0.9.0-dev branch 2014-10-19 18:01:27 +03:00
c867f9a90a Merge branch 'release/v0.8.0' 2014-10-19 17:59:44 +03:00
7f7620a08c Merge branch 'release/v0.8.0' into develop 2014-10-19 17:59:44 +03:00
416bf8e7af Ready for v0.8.0 2014-10-19 17:58:35 +03:00
b3eebf717d Correct 7-th example for lib search command 2014-10-19 17:56:08 +03:00
baef85aed1 Fix PyLint warnings from the last CI build 2014-10-19 00:21:10 +03:00
2d6c0ef66d Avoid trademark issues in library.json; switch to PlatformIO Library Registry ID logic
Resolve issue #17
2014-10-19 00:14:11 +03:00
4f817a5b61 Describe new fields: frameworks, platforms, authors and dependencies 2014-10-18 20:03:38 +03:00
01d415cc7f Avoid trademarks issues 2014-10-15 22:33:23 +03:00
d13bf3325b Update "colorama" to 0.3.2 2014-10-08 23:10:34 +03:00
0e62ad1600 Cleanup citate 2014-10-08 17:44:20 +03:00
700c6c9b3e Improve citrate 2014-10-08 17:42:02 +03:00
ac02703f5f Disable checking for link anchors 2014-10-08 17:41:48 +03:00
1f80b6746e Fix links 2014-10-07 16:13:24 +03:00
9f87342e30 Add Arduino & Energia IDEs 2014-10-07 16:11:12 +03:00
13d6616b55 Update README.rst 2014-10-06 23:35:52 +03:00
81700523ed Update README.rst 2014-10-06 23:35:38 +03:00
7f1827f1e5 Switch to v0.8.0 2014-10-06 23:33:45 +03:00
8d491b4146 Merge branch 'release/v0.7.1' 2014-10-06 23:28:12 +03:00
0ea57b8bca Merge branch 'release/v0.7.1' into develop 2014-10-06 23:28:12 +03:00
466026b5c6 Update project description, history and etc 2014-10-06 23:27:49 +03:00
c90ef9919b Improve title 2014-10-06 16:21:24 +03:00
8649114546 Fix link to Web Library Search site 2014-10-06 16:15:40 +03:00
dcfa899520 Fix make directory operation for invalid library name 2014-10-06 14:09:22 +03:00
2e03d27d27 Update "requests" to 2.4.3 2014-10-06 13:57:40 +03:00
9ead140b6e Fix lib update crashing when no libs are installed (resolve issue #19) 2014-10-05 23:34:40 +03:00
719e03da16 Expand user path from lib_dir 2014-10-04 23:30:51 +03:00
6a775f3951 Skip "platformio" section from "run" process 2014-10-04 18:53:59 +03:00
7de5166694 Change "print" function to Py2.x 2014-10-03 19:54:02 +03:00
907a72d3bd Move to latest version of SCons 2014-10-03 19:48:17 +03:00
024be2e094 Automatic detection of port on upload (resolve #15) 2014-10-03 19:47:34 +03:00
1c4b97c2f2 Fix lint warning with anomalous backslash 2014-09-30 20:58:30 +03:00
2a7e67b8e4 Fix bug with order for "includes" in conversation from INO/PDE to CPP 2014-09-30 20:55:08 +03:00
09761004dd Ready for 0.8.0-dev 2014-09-24 22:33:40 +03:00
766bc44b23 Merge branch 'release/v0.7.0' into develop 2014-09-24 22:25:58 +03:00
103 changed files with 4062 additions and 1135 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
examples/ide-eclipse/.metadata
examples/ide-eclipse/RemoteSystemsTempFiles
docs/_build
dist

View File

@ -38,7 +38,7 @@ load-plugins=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=C0103,C0111,E0611,F0401,I0011,R0801,R0903
disable=C0103,C0111,E0611,F0401,I0011,R0801,R0903,R0922
[REPORTS]

View File

@ -1,17 +1,120 @@
Release History
===============
0.10.1 (2015-01-02)
-------------------
* Added ``--json-output`` option to
`platformio list <http://docs.platformio.org/en/latest/userguide/cmd_list.html>`__,
`platformio serialports list <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html>`__ and
`platformio lib list <http://docs.platformio.org/en/latest/userguide/cmd_lib_list.html>`__
commands which allows to return the output in `JSON <http://en.wikipedia.org/wiki/JSON>`_ format
(`issue #42 <https://github.com/ivankravets/platformio/issues/42>`_)
* Fixed missing auto-uploading by default after `platformio init <http://docs.platformio.org/en/latest/userguide/cmd_init.html>`__
command
0.10.0 (2015-01-01)
-------------------
**Happy New Year!**
* Implemented `platformio boards <http://docs.platformio.org/en/latest/userguide/cmd_boards.html>`_
command (`issue #11 <https://github.com/ivankravets/platformio/issues/11>`_)
* Added support of *Engduino* boards for
`atmelavr <http://docs.platformio.org/en/latest/platforms/atmelavr.html#engduino>`__
platform (`issue #38 <https://github.com/ivankravets/platformio/issues/38>`_)
* Added ``--board`` option to `platformio init <http://docs.platformio.org/en/latest/userguide/cmd_init.html>`__
command which allows to initialise project with the specified embedded boards
(`issue #21 <https://github.com/ivankravets/platformio/issues/21>`_)
* Added `example with uploading firmware <http://docs.platformio.org/en/latest/projectconf.html#examples>`_
via USB programmer (USBasp) for
`atmelavr <http://docs.platformio.org/en/latest/platforms/atmelavr.html>`_
*MCUs* (`issue #35 <https://github.com/ivankravets/platformio/issues/35>`_)
* Automatic detection of port on `platformio serialports monitor <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`_
(`issue #37 <https://github.com/ivankravets/platformio/issues/37>`_)
* Allowed auto-installation of platforms when prompts are disabled (`issue #43 <https://github.com/ivankravets/platformio/issues/43>`_)
* Fixed urllib3's *SSL* warning under Python <= 2.7.2 (`issue #39 <https://github.com/ivankravets/platformio/issues/39>`_)
* Fixed bug with *Arduino USB* boards (`issue #40 <https://github.com/ivankravets/platformio/issues/40>`_)
0.9.2 (2014-12-10)
------------------
* Replaced "dark blue" by "cyan" colour for the texts (`issue #33 <https://github.com/ivankravets/platformio/issues/33>`_)
* Added new setting `enable_prompts <http://docs.platformio.org/en/latest/userguide/cmd_settings.html>`_
and allowed to disable all *PlatformIO* prompts (useful for cloud compilers)
(`issue #34 <https://github.com/ivankravets/platformio/issues/34>`_)
* Fixed compilation bug on *Windows* with installed *MSVC* (`issue #18 <https://github.com/ivankravets/platformio/issues/18>`_)
0.9.1 (2014-12-05)
------------------
* Ask user to install platform (when it hasn't been installed yet) within
`platformio run <http://docs.platformio.org/en/latest/userguide/cmd_run.html>`__
and `platformio show <http://docs.platformio.org/en/latest/userguide/cmd_show.html>`_ commands
* Improved main `documentation <http://docs.platformio.org>`_
* Fixed "*OSError: [Errno 2] No such file or directory*" within
`platformio run <http://docs.platformio.org/en/latest/userguide/cmd_run.html>`__
command when PlatformIO isn't installed properly
* Fixed example for `Eclipse IDE with Tiva board <https://github.com/ivankravets/platformio/tree/develop/examples/ide-eclipse>`_
(`issue #32 <https://github.com/ivankravets/platformio/issues/32>`_)
* Upgraded `Eclipse Project Examples <https://github.com/ivankravets/platformio/tree/develop/examples/ide-eclipse>`_
to latest *Luna* and *PlatformIO* releases
0.9.0 (2014-12-01)
------------------
* Implemented `platformio settings <http://docs.platformio.org/en/latest/userguide/cmd_settings.html>`_ command
* Improved `platformio init <http://docs.platformio.org/en/latest/userguide/cmd_init.html>`_ command.
Added new option ``--project-dir`` where you can specify another path to
directory where new project will be initialized (`issue #31 <https://github.com/ivankravets/platformio/issues/31>`_)
* Added *Migration Manager* which simplifies process with upgrading to a
major release
* Added *Telemetry Service* which should help us make *PlatformIO* better
* Implemented *PlatformIO AppState Manager* which allow to have multiple
``.platformio`` states.
* Refactored *Package Manager*
* Download Manager: fixed SHA1 verification within *Cygwin Environment*
(`issue #26 <https://github.com/ivankravets/platformio/issues/26>`_)
* Fixed bug with code builder and built-in Arduino libraries
(`issue #28 <https://github.com/ivankravets/platformio/issues/28>`_)
0.8.0 (2014-10-19)
------------------
* Avoided trademark issues in `library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`_
with the new fields: `frameworks <http://docs.platformio.org/en/latest/librarymanager/config.html#frameworks>`_,
`platforms <http://docs.platformio.org/en/latest/librarymanager/config.html#platforms>`_
and `dependencies <http://docs.platformio.org/en/latest/librarymanager/config.html#dependencies>`_
(`issue #17 <https://github.com/ivankravets/platformio/issues/17>`_)
* Switched logic from "Library Name" to "Library Registry ID" for all
`platformio lib <http://docs.platformio.org/en/latest/userguide/lib/index.html>`_
commands (install, uninstall, update and etc.)
* Renamed ``author`` field to `authors <http://docs.platformio.org/en/latest/librarymanager/config.html#authors>`_
and allowed to setup multiple authors per library in `library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`_
* Added option to specify "maintainer" status in `authors <http://docs.platformio.org/en/latest/librarymanager/config.html#authors>`_ field
* New filters/options for `platformio lib search <http://docs.platformio.org/en/latest/userguide/lib/cmd_search.html>`_
command: ``--framework`` and ``--platform``
0.7.1 (2014-10-06)
------------------
* Fixed bug with order for includes in conversation from INO/PDE to CPP
* Automatic detection of port on upload (`issue #15 <https://github.com/ivankravets/platformio/issues/15>`_)
* Fixed lib update crashing when no libs are installed (`issue #19 <https://github.com/ivankravets/platformio/issues/19>`_)
0.7.0 (2014-09-24)
------------------
* Implemented new ``[platformio]`` section for Configuration File with ``home_dir``
* Implemented new `[platformio] <http://docs.platformio.org/en/latest/projectconf.html#platformio>`_
section for Configuration File with `home_dir <http://docs.platformio.org/en/latest/projectconf.html#home-dir>`_
option (`issue #14 <https://github.com/ivankravets/platformio/issues/14>`_)
* Implemented *Library Manager* (`issue #6 <https://github.com/ivankravets/platformio/issues/6>`_)
0.6.0 (2014-08-09)
------------------
* Implemented ``serialports monitor`` (`issue #10 <https://github.com/ivankravets/platformio/issues/10>`_)
* Implemented `platformio serialports monitor <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`_ (`issue #10 <https://github.com/ivankravets/platformio/issues/10>`_)
* Fixed an issue ``ImportError: No module named platformio.util`` (`issue #9 <https://github.com/ivankravets/platformio/issues/9>`_)
* Fixed bug with auto-conversation from Arduino \*.ino to \*.cpp
@ -23,27 +126,31 @@ Release History
* Added auto-conversation from \*.ino to valid \*.cpp for Arduino/Energia
frameworks (`issue #7 <https://github.com/ivankravets/platformio/issues/7>`_)
* Added `Arduino example <https://github.com/ivankravets/platformio/tree/develop/examples/arduino-adafruit-library>`_
with external library (Adafruit CC3000)
* Implemented ``platformio upgrade`` command and "auto-check" for the latest
with external library (*Adafruit CC3000*)
* Implemented `platformio upgrade <http://docs.platformio.org/en/latest/userguide/cmd_upgrade.html>`_
command and "auto-check" for the latest
version (`issue #8 <https://github.com/ivankravets/platformio/issues/8>`_)
* Fixed an issue with "auto-reset" for Raspduino board
* Fixed an issue with "auto-reset" for *Raspduino* board
* Fixed a bug with nested libs building
0.4.0 (2014-07-31)
------------------
* Implemented ``serialports`` command
* Implemented `platformio serialports <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html>`_ command
* Allowed to put special build flags only for ``src`` files via
``srcbuild_flags`` environment option
`srcbuild_flags <http://docs.platformio.org/en/latest/projectconf.html#srcbuild-flags>`_
environment option
* Allowed to override some of settings via system environment variables
such as: ``$PIOSRCBUILD_FLAGS`` and ``$PIOENVS_DIR``
* Added ``--upload-port`` option for ``platformio run`` command
* Added ``--upload-port`` option for `platformio run <http://docs.platformio.org/en/latest/userguide/cmd_run.html#cmdoption--upload-port>`__ command
* Implemented (especially for `SmartAnthill <http://smartanthill.ikravets.com/>`_)
``platformio run -t uploadlazy`` target (no dependencies to framework libs,
ELF and etc.)
* Allowed to skip default packages via ``platformio install --skip-default-package`` flag
* Added tools for Raspberry Pi platform
* Added support for Microduino and Raspduino boards in ``atmelavr`` platform
`platformio run -t uploadlazy <http://docs.platformio.org/en/latest/userguide/cmd_run.html>`_
target (no dependencies to framework libs, ELF and etc.)
* Allowed to skip default packages via `platformio install --skip-default-package <http://docs.platformio.org/en/latest/userguide/cmd_install.html#cmdoption--skip-default>`_
option
* Added tools for *Raspberry Pi* platform
* Added support for *Microduino* and *Raspduino* boards in
`atmelavr <http://docs.platformio.org/en/latest/platforms/atmelavr.html>`_ platform
0.3.1 (2014-06-21)

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2014 Ivan Kravets
Copyright (c) 2014-2015 Ivan Kravets
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -17,66 +17,112 @@ PlatformIO
:target: https://pypi.python.org/pypi/platformio/
:alt: License
`Website <http://platformio.ikravets.com>`_ |
`Documentation <http://docs.platformio.ikravets.com>`_ |
`Website + Library Search <http://platformio.org>`_ |
`Documentation <http://docs.platformio.org>`_ |
`Project Examples <https://github.com/ivankravets/platformio/tree/develop/examples>`_ |
`Bugs/Questions <https://github.com/ivankravets/platformio/issues>`_ |
`Blog <http://www.ikravets.com/category/computer-life/platformio>`_ |
`Twitter <https://twitter.com/smartanthill>`_
`Twitter <https://twitter.com/PlatformIO_Org>`_
**PlatformIO** is a cross-platform code builder and library manager.
.. image:: https://raw.githubusercontent.com/ivankravets/platformio/develop/docs/_static/platformio-logo.png
:target: http://platformio.org
* `Website + Library Search <http://platformio.ikravets.com>`_
* `Quickstart <http://docs.platformio.ikravets.com/en/latest/quickstart.html>`_
* `Installation <http://docs.platformio.ikravets.com/en/latest/installation.html>`_
* `Project Configuration File <http://docs.platformio.ikravets.com/en/latest/projectconf.html>`_
* `Platforms & Embedded Boards <http://docs.platformio.ikravets.com/en/latest/platforms/index.html>`_
* `User Guide <http://docs.platformio.ikravets.com/en/latest/userguide/index.html>`_
* `IDE Integration <http://docs.platformio.ikravets.com/en/latest/ide.html>`_
* `Release History <http://docs.platformio.ikravets.com/en/latest/history.html>`_
`PlatformIO <http://platformio.org>`_ is a cross-platform code builder
and the missing library manager.
You have no need to install any *IDE* or compile any tool chains. *PlatformIO*
* `Get Started <http://platformio.org/#!/get-started>`_
* `Web 2.0 Library Search <http://platformio.org/#!/lib>`_
* `Development Platforms <http://platformio.org/#!/platforms>`_
* `Embedded Boards <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>`_
* `IDE Integration <http://docs.platformio.org/en/latest/ide.html>`_
* `Release History <http://docs.platformio.org/en/latest/history.html>`_
You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO*
has pre-built different development platforms including: compiler, debugger,
uploader (for embedded boards) and many other useful tools.
**PlatformIO** allows developer to compile the same code with different
platforms using only one command
`platformio run <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_run.html>`_.
Use whenever. *Run everywhere.*
-------------------------------
*PlatformIO* is written in pure *Python* and **doesn't depend** on any
additional libraries/tools from an operation system. It allows you to use
*PlatformIO* beginning from *PC (Mac, Linux, Win)* and ending with credit-card
sized computers (like *Raspberry Pi*).
Embedded Development. *Easier Than Ever.*
-----------------------------------------
*PlatformIO* is well suited for embedded development and has pre-configured
settings for most popular `Embedded Boards <http://platformio.org/#!/boards>`_.
* Colourful `command-line output <https://raw.githubusercontent.com/ivankravets/platformio/develop/examples/platformio-examples.png>`_
* Built-in `Serial Port Monitor <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`_
* 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 compilers**
* Pre-built tool chains, frameworks for the popular `Hardware Platforms <http://platformio.org/#!/platforms>`_
.. image:: https://raw.githubusercontent.com/ivankravets/platformio-web/develop/app/images/platformio-embedded-development.png
:target: http://platformio.org
:alt: PlatformIO Embedded Development Process
The Missing Library Manager. *It's here!*
-----------------------------------------
*PlatformIO Library Manager* is the missing library manager for development
platforms which allows you to organize and have up-to-date external libraries.
* Friendly `Command-Line Interface <http://docs.platformio.org/en/latest/librarymanager/index.html>`_
* Modern `Web 2.0 Library Search <http://platformio.org/#!/lib>`_
* Open Source `Library Registry API <https://github.com/ivankravets/platformio-api>`_
* Library Crawler based on `library.json <http://docs.platformio.org/en/latest/librarymanager/config.html>`_
specification
* Library **dependency management**
* Automatic library updating
.. image:: https://raw.githubusercontent.com/ivankravets/platformio-web/develop/app/images/platformio-library-manager.png
:target: http://platformio.org
:alt: PlatformIO Library Manager Architecture
Smart Code Builder. *Fast and Reliable.*
----------------------------------------
*PlatformIO Code Builder* is built-on a next-generation software construction
tool named `SCons <http://www.scons.org/>`_. Think of *SCons* as an improved,
cross-platform substitute for the classic *Make* utility.
* Reliable, automatic *dependency analysis*
* Reliable detection of *build changes*
* Improved support for *parallel builds*
* Ability to share *built files in a cache*
* Lookup for external libraries which are installed via `Library Manager <http://docs.platformio.org/en/latest/librarymanager/index.html>`_
.. image:: https://raw.githubusercontent.com/ivankravets/platformio-web/develop/app/images/platformio-scons-builder.png
:target: http://platformio.org
:alt: PlatformIO Code Builder Architecture
Single source code. *Multiple platforms.*
-----------------------------------------
*PlatformIO* allows developer to compile the same code with different
development platforms using the *Only One Command*
`platformio run <http://docs.platformio.org/en/latest/userguide/cmd_run.html>`_.
This happens due to
`Project Configuration File <http://docs.platformio.ikravets.com/en/latest/projectconf.html>`_
where you can setup different environments with specific
options: platform type, firmware uploading settings, pre-built framework
and many more.
.. image:: examples/platformio-examples.png
:target: https://github.com/ivankravets/platformio/raw/develop/examples/platformio-examples.png
:alt: Examples
:width: 730px
**PlatformIO** is well suited for **embedded development**. It can:
* Automatically analyse dependency
* Reliably detect build changes
* Build framework or library source code to static library
* Build *ELF* (executable and linkable firmware)
* Convert *ELF* to *HEX* or *BIN* file
* Extract *EEPROM* data
* Upload firmware to your device
`Project Configuration File (platformio.ini) <http://docs.platformio.org/en/latest/projectconf.html>`_
where you can setup different environments with specific options (platform
type, firmware uploading settings, pre-built framework, build flags and many
more).
It has support for many popular embedded platforms like these:
* ``atmelavr`` `Atmel AVR <http://en.wikipedia.org/wiki/Atmel_AVR>`_
(including `Arduino <http://www.arduino.cc>`_ based boards)
* ``timsp430`` `TI MSP430 <http://www.ti.com/lsds/ti/microcontroller/16-bit_msp430/overview.page>`_
(including `MSP430 LaunchPads <http://www.ti.com/ww/en/launchpad/launchpads-msp430.html>`_)
* ``titiva`` `TI TIVA C <http://www.ti.com/lsds/ti/microcontroller/tiva_arm_cortex/c_series/overview.page>`_
(including `TIVA C Series LaunchPads <http://www.ti.com/ww/en/launchpad/launchpads-connected.html>`_)
* ``atmelavr`` `Atmel AVR <http://platformio.org/#!/platforms/atmelavr>`_
(including *Arduino*-based boards, *Microduino, Raspduino, Teensy*)
* ``timsp430`` `TI MSP430 <http://platformio.org/#!/platforms/timsp430>`_
(including *MSP430* LaunchPads)
* ``titiva`` `TI TIVA C <http://platformio.org/#!/platforms/titiva>`_
(including *TIVA C* Series LaunchPads)
Licence
-------
Copyright (C) 2014 Ivan Kravets
Copyright (C) 2014-2015 Ivan Kravets
Licenced under the MIT Licence.

BIN
docs/_static/ide-platformio-arduino.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
docs/_static/ide-platformio-eclipse.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

BIN
docs/_static/ide-platformio-energia.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

BIN
docs/_static/ide-platformio-vim.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
docs/_static/platformio-logo.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -45,7 +45,7 @@ master_doc = 'index'
# General information about the project.
project = u'PlatformIO'
copyright = u'2014, Ivan Kravets'
copyright = u'2014-2015, Ivan Kravets'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@ -274,4 +274,5 @@ if not on_rtd: # only import and set the theme if we're building docs locally
# A timeout value, in seconds, for the linkcheck builder
# http://sphinx-doc.org/config.html#confval-linkcheck_timeout
linkcheck_timeout = 30
linkcheck_timeout = 10
linkcheck_anchors = False

View File

@ -3,14 +3,37 @@
IDE Integration
===============
Arduino IDE
-----------
.. image:: _static/ide-platformio-arduino.png
:target: http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides
* `Integration of PlatformIO library manager to Arduino IDE <http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides>`_
Eclipse
-------
`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>`_
.. image:: _static/ide-platformio-eclipse.png
:target: http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio
* `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 and etc) <https://github.com/ivankravets/platformio/tree/develop/examples/ide-eclipse>`_
Energia IDE
-----------
.. image:: _static/ide-platformio-energia.png
:target: http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides
* `Integration of PlatformIO library manager to Energia IDE <http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides>`_
VIM
---
.. image:: _static/ide-platformio-vim.png
Recommended bundles:
* Syntax highlight - `Arduino-syntax-file <https://github.com/vim-scripts/Arduino-syntax-file>`_

View File

@ -1,12 +1,15 @@
PlatformIO: A cross-platform code builder and library manager
=============================================================
PlatformIO: A cross-platform code builder and the missing library manager
=========================================================================
`Website + Library Search <http://platformio.ikravets.com>`_ |
.. image:: _static/platformio-logo.png
:target: http://platformio.org
`Website + Library Search <http://platformio.org>`_ |
`Project Examples <https://github.com/ivankravets/platformio/tree/develop/examples>`_ |
`Source Code <https://github.com/ivankravets/platformio>`_ |
`Bugs/Questions <https://github.com/ivankravets/platformio/issues>`_ |
`Issues <https://github.com/ivankravets/platformio/issues>`_ |
`Blog <http://www.ikravets.com/category/computer-life/platformio>`_ |
`Twitter <https://twitter.com/smartanthill>`_
`Twitter <https://twitter.com/PlatformIO_Org>`_
You have no need to install any *IDE* or compile any tool chains. *PlatformIO*
has pre-built different development platforms including: compiler, debugger,
@ -27,9 +30,7 @@ instruments.
* Automatically analyse dependency
* Reliably detect build changes
* Build framework or library source code to static library
* Build *ELF* (executable and linkable firmware)
* Convert *ELF* to *HEX* or *BIN* file
* Extract *EEPROM* data
* Lookup for external libraries which are installed via :ref:`librarymanager`
* Upload firmware to your device

View File

@ -3,31 +3,56 @@
Installation
============
*PlatformIO* is written in `Python <https://www.python.org>`_ and works with
versions 2.6 and 2.7 on Unix/Linux, OS X, Windows and Credit-card ARM-based
computers (Raspberry Pi).
*PlatformIO* is written in `Python <http://python.org/download/>`_ and works
on *Mac OS X*, *Linux*, *Windows OS* and Credit-card *ARM*-based
computers (*Raspberry Pi*).
System requirements
-------------------
* **Operating systems:**
* Mac OS X
* Linux
* Windows
* `Python 2.6 or Python 2.7 <http://python.org/download/>`_
All commands below should be executed in
`Command-line <http://en.wikipedia.org/wiki/Command-line_interface>`_
application in your *OS*:
application:
* *Unix/Linux/OS X* this is *Terminal* application.
* *Mac OS X / Linux* this is *Terminal* application.
* *Windows* this is
`Command Prompt <http://en.wikipedia.org/wiki/Command_Prompt>`_ (``cmd.exe``)
application.
.. warning::
If you are going to use *PlatformIO* for "*Cloud Compiling*", please
don't forget to turn off :ref:`enable_prompts <cmd_settings>` setting. It
will allow you to avoid blocking when call ``platformio`` like subprocess.
Super-Quick
-----------
Please *choose one of* the following:
To install or upgrade *PlatformIO*, download
`get-platformio.py <https://raw.githubusercontent.com/ivankravets/platformio/develop/scripts/get-platformio.py>`_ script.
Super-Quick (Mac / Linux)
-------------------------
Then run the following (which may require administrator access):
To install or upgrade *PlatformIO* paste that at a *Terminal* prompt
(you might need to run ``sudo`` first):
.. code-block:: bash
$ [sudo] python get-platformio.py
python -c "$(curl -fsSL https://raw.githubusercontent.com/ivankravets/platformio/master/scripts/get-platformio.py)"
Installer Script (Mac / Linux / Windows)
----------------------------------------
To install or upgrade *PlatformIO*, download
`get-platformio.py <https://raw.githubusercontent.com/ivankravets/platformio/develop/scripts/get-platformio.py>`_
script. Then run the following (you might need to run ``sudo`` first):
.. code-block:: bash
python get-platformio.py
On *Windows OS* it may look like:

View File

@ -1,18 +1,20 @@
.. |PIOAPICR| replace:: *PlatformIO Library Registry Crawler*
.. _library_config:
library.json
============
*PlatformIO*-suitable library should be defined by a manifest file
``library.json`` in a `JSON-style <http://en.wikipedia.org/wiki/JSON>`_.
A data in ``library.json`` should be represented via
`associative array <http://en.wikipedia.org/wiki/Associative_array>`_
(name/value pairs). An order doesn't matter.
``library.json`` is a manifest file of development library.
The allowable fields (names from pairs) are described below. The fields
(:ref:`libjson_name`, :ref:`libjson_description` and :ref:`libjson_keywords`)
will be displayed in the search results at the :ref:`cmd_lib_search` (*CLI*)
and at the *WebSite*. Also, they can be used for searching for libraries.
Initially it was
developed for :ref:`librarymanager`, but later was accepted by worldwide embedded
community like a **standard library specification**.
A data in ``library.json`` should be represented
in `JSON-style <http://en.wikipedia.org/wiki/JSON>`_ via
`associative array <http://en.wikipedia.org/wiki/Associative_array>`_
(name/value pairs). An order doesn't matter. The allowable fields
(names from pairs) are described below.
.. contents::
@ -60,6 +62,89 @@ start/end with them). A list from the keywords can be specified with
separator ``,``
.. _libjson_authors:
``authors``
-----------
*Required* if :ref:`libjson_repository` field is not defined | Type: ``Object``
or ``Array``
An author contact information
* ``name`` Full name (**Required**)
* ``email``
* ``url`` An author's contact page
* ``maintainer`` Specify "maintainer" status
Examples:
.. code-block:: javascript
"authors":
{
"name": "John Smith",
"email": "me@john-smith.com",
"url": "http://www.john-smith/contact"
}
...
"authors":
[
{
"name": "John Smith",
"email": "me@john-smith.com",
"url": "http://www.john-smith/contact"
},
{
"name": "Andrew Smith",
"email": "me@andrew-smith.com",
"url": "http://www.andrew-smith/contact",
"maintainer": true
}
]
.. note::
You can omit :ref:`libjson_authors` field and define
:ref:`libjson_repository` field. Only *GitHub-based* repository is
supported now. In this case
|PIOAPICR| will use information from
`GitHub API Users <https://developer.github.com/v3/users/>`_.
.. _libjson_repository:
``repository``
--------------
*Required* if :ref:`libjson_downloadurl` field is not defined | Type: ``Object``
The repository in which the source code can be found.
Example:
.. code-block:: javascript
"repository":
{
"type": "git",
"url": "https://github.com/foo/bar.git"
}
.. _libjson_downloadurl:
``downloadUrl``
---------------
*Required* if :ref:`libjson_repository` field is not defined | Type: ``String``
It is the *HTTP URL* to the archived source code of library. It should end
with the type of archive (``.zip`` or ``.tar.gz``).
.. _libjson_version:
``version``
@ -79,70 +164,7 @@ A version of the current library source code.
.. note::
You can omit :ref:`libjson_version` field and define
:ref:`libjson_repository` field. In this case
*PlatformIO-API Crawler* will use the *CVS*-revision from the latest commit.
.. _libjson_author:
``author``
----------
*Required* if :ref:`libjson_repository` field is not defined | Type: ``Object``
An author contact information
* ``name`` Full name (**Required**)
* ``email``
* ``url`` An author's contact page
Example:
.. code-block:: javascript
"author":
{
"name": "John Smith",
"email": "me@john-smith.com",
"url": "http://www.john-smith/contact"
}
.. note::
You can omit :ref:`libjson_author` field and define
:ref:`libjson_repository` field. Only *GitHub-based* repository is
supported now. In this case
*PlatformIO-API Crawler* will use information from
`GitHub API Users <https://developer.github.com/v3/users/>`_.
.. _libjson_repository:
``repository``
--------------
*Required* if :ref:`libjson_downloadurl` field is not defined | Type: ``Object``
The repository in which the source code can be found.
Example:
.. code-block:: javascript
"repository":
{
"name": "git",
"url": "https://github.com/foo/bar.git"
}
.. _libjson_downloadurl:
``downloadUrl``
---------------
*Required* if :ref:`libjson_repository` field is not defined | Type: ``String``
It is the *HTTP URL* to the archived source code of library. It should end
with the type of archive (``.zip`` or ``.tar.gz``).
|PIOAPICR| will use the *CVS*-revision from the latest commit.
.. _libjson_include:
@ -154,7 +176,7 @@ with the type of archive (``.zip`` or ``.tar.gz``).
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
If :ref:`libjson_include` field is a type of ``String``, then
*PlatformIO-API Crawler* will recognize it like a "relative path inside
|PIOAPICR| will recognize it like a "relative path inside
repository/archive to library source code". See example below where the only
source code from the relative directory ``LibrarySourceCodeHere`` will be
included.
@ -164,7 +186,7 @@ included.
"include": "some/child/dir/LibrarySourceCodeHere"
If :ref:`libjson_include` field is a type of ``Array``, then
*PlatformIO-API Crawler* firstly will apply :ref:`libjson_exclude` filter and
|PIOAPICR| firstly will apply :ref:`libjson_exclude` filter and
then include only directories/files which match with :ref:`libjson_include`
patterns.
@ -207,25 +229,63 @@ Pattern Meaning
Exclude the directories and files which match with :ref:`libjson_exclude`
patterns.
.. _libjson_frameworks:
``frameworks``
--------------
*Optional* | Type: ``String`` or ``Array``
A list with compatible frameworks. The available framework types are defined in
the :ref:`platforms` section.
.. _libjson_platforms:
``platforms``
-------------
*Optional* | Type: ``String`` or ``Array``
A list with compatible platforms. The available platform types are
defined in :ref:`platforms` section.
.. _libjson_dependencies:
``dependencies``
----------------
*Optional* | Type: ``Array``
*Optional* | Type: ``Array`` or ``Object``
A list of dependent libraries. They will be installed automatically with
:ref:`cmd_lib_install` command.
Allowed requirements for dependent library:
* ``name`` | Type: ``String``
* ``authors`` | Type: ``String`` or ``Array``
* ``frameworks`` | Type: ``String`` or ``Array``
* ``platforms`` | Type: ``String`` or ``Array``
Example:
.. code-block:: javascript
"dependencies":
[
"Library-Foo",
"Library-Bar"
{
"name": "Library-Foo",
"authors":
[
"Jhon Smith",
"Andrew Smith"
]
},
{
"name": "Library-Bar",
"frameworks": "FrameworkFoo, FrameworkBar"
}
]

View File

@ -1,5 +1,5 @@
.. _library_creating:
.. |PIOAPICR| replace:: *PlatformIO-API Crawler*
.. |PIOAPICR| replace:: *PlatformIO Library Registry Crawler*
Creating Library
================
@ -36,21 +36,23 @@ you **need to specify** only these fields in the :ref:`library_config`:
* :ref:`libjson_repository`
|PIOAPICR| will populate the rest fields, like :ref:`libjson_version` or
:ref:`libjson_author` with an actual information from *GitHub*.
:ref:`libjson_authors` with an actual information from *GitHub*.
Example:
.. code-block:: javascript
{
"name": "Arduino-IRremote",
"name": "IRremote",
"keywords": "infrared, ir, remote",
"description": "Send and receive infrared signals with multiple protocols",
"repository":
{
"type": "git",
"url": "https://github.com/shirriff/Arduino-IRremote.git"
}
},
"frameworks": "arduino",
"platforms": "atmelavr"
}
Under CVS (SVN/GIT)
@ -62,7 +64,7 @@ The list of **required** fields in the :ref:`library_config` will look like:
* :ref:`libjson_name`
* :ref:`libjson_keywords`
* :ref:`libjson_description`
* :ref:`libjson_author`
* :ref:`libjson_authors`
* :ref:`libjson_repository`
Example:
@ -70,10 +72,10 @@ Example:
.. code-block:: javascript
{
"name": "Arduino-XBee",
"name": "XBee",
"keywords": "xbee, protocol, radio",
"description": "Arduino library for communicating with XBees in API mode",
"author":
"authors":
{
"name": "Andrew Rapp",
"email": "andrew.rapp@gmail.com",
@ -83,7 +85,9 @@ Example:
{
"type": "git",
"url": "https://code.google.com/p/xbee-arduino/"
}
},
"frameworks": "arduino",
"platforms": "atmelavr"
}
Self-hosted
@ -97,24 +101,26 @@ of **required** fields in the :ref:`library_config` will look like:
* :ref:`libjson_name`
* :ref:`libjson_keywords`
* :ref:`libjson_description`
* :ref:`libjson_author`
* :ref:`libjson_authors`
* :ref:`libjson_version`
* :ref:`libjson_downloadurl`
.. code-block:: javascript
{
"name": "Arduino-OneWire",
"name": "OneWire",
"keywords": "onewire, 1-wire, bus, sensor, temperature, ibutton",
"description": "Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc)",
"author":
"authors":
{
"name": "Paul Stoffregen",
"url": "http://www.pjrc.com/teensy/td_libs_OneWire.html"
},
"version": "2.2",
"downloadUrl": "http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip",
"include": "OneWire"
"include": "OneWire",
"frameworks": "arduino",
"platforms": "atmelavr"
}

View File

@ -5,11 +5,11 @@ Library Manager
..
*"The missing library manager for embedded platforms"* [#]_
*"The missing library manager for development platforms"* [#]_
*PlatformIO Library Manager* allows you to organize external embedded libraries.
You can search for new libraries via :ref:`Command Line <cmd_lib_search>`
or `WebSite <http://platformio.ikravets.com>`_ interfaces.
You can search for new libraries via :ref:`Command Line interface <cmd_lib_search>`
or `Web 2.0 Library Search <http://platformio.org/#!/lib>`_.
You don't need to bother for finding the latest version of library. Due to
:ref:`cmd_lib_update` command you will have up-to-date external libraries.
@ -17,8 +17,9 @@ You don't need to bother for finding the latest version of library. Due to
.. toctree::
:maxdepth: 2
creating
config
creating
User Guide <../userguide/lib/index.rst>
.. [#] Inspired by `npm <https://www.npmjs.org>`_ and `bower
<http://bower.io>`_ package managers for web.

View File

@ -30,7 +30,7 @@ Packages
- uploader
- `AVRDUDE <http://www.nongnu.org/avrdude/>`_
* - ``framework-arduinoavr``
-
- framework
- See below in :ref:`atmelavr_frameworks`
@ -59,8 +59,9 @@ Boards
------
.. note::
For more detailed ``board`` information please scroll tables below by
horizontal.
* You can list pre-configured boards by :ref:`cmd_boards` command
* For more detailed ``board`` information please scroll tables below by
horizontal.
Arduino
~~~~~~~
@ -218,6 +219,41 @@ More detailed information you can find here
`Arduino boards <http://arduino.cc/en/Main/Products>`_.
Engduino
~~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller ``board_mcu``
- Frequency ``board_f_cpu``
- Flash
- RAM
* - ``engduinov1``
- `Engduino 1 <http://www.engduino.org>`_
- ATmega32u4 ``atmega32u4``
- 8 MHz ``8000000L``
- 32 Kb
- 2.5 Kb
* - ``engduinov2``
- `Engduino 2 <http://www.engduino.org>`_
- ATmega32u4 ``atmega32u4``
- 8 MHz ``8000000L``
- 32 Kb
- 2.5 Kb
* - ``engduinov3``
- `Engduino 3 <http://www.engduino.org>`_
- ATmega32u4 ``atmega32u4``
- 8 MHz ``8000000L``
- 32 Kb
- 2.5 Kb
More detailed information you can find here
`Engduino Site <http://www.engduino.org>`_.
Microduino
~~~~~~~~~~
@ -319,5 +355,5 @@ Raspduino
- 32 Kb
- 2 Kb
More detailed information you can find in
More detailed information you can find here
`Wiki <http://www.bitwizard.nl/wiki/index.php/Raspduino>`_.

View File

@ -3,9 +3,9 @@
Platforms & Embedded Boards
===========================
*PlatformIO* has pre-built different development platforms for popular OS (Mac,
Linux 32/64/ARM and Windows). Each of them include compiler, debugger, uploader
(for embedded) and many other useful tools.
*PlatformIO* has pre-built different development platforms for popular OS
(*Mac OS X, Linux (+ARMv6) and Windows*). Each of them include compiler,
debugger, uploader (for embedded) and many other useful tools.
Also it has pre-configured settings for most popular **Embedded Platform
Boards**. You have no need to specify in :ref:`projectconf` type or frequency of

View File

@ -27,7 +27,7 @@ Packages
- uploader
- `MSPDebug <http://mspdebug.sourceforge.net>`_
* - ``framework-energiamsp430``
-
- framework
- See below in :ref:`timsp430_frameworks`
@ -56,8 +56,9 @@ Boards
------
.. note::
For more detailed ``board`` information please scroll table below by
horizontal.
* You can list pre-configured boards by :ref:`cmd_boards` command
* For more detailed ``board`` information please scroll tables below by
horizontal.
.. list-table::
:header-rows: 1

View File

@ -28,7 +28,7 @@ Packages
- uploader
- `Flash Programmer <http://www.ti.com/tool/lmflashprogrammer>`_
* - ``framework-energiativa``
-
- framework
- See below in :ref:`titiva_frameworks`
.. note::
@ -56,8 +56,9 @@ Boards
------
.. note::
For more detailed ``board`` information please scroll table below by
horizontal.
* You can list pre-configured boards by :ref:`cmd_boards` command
* For more detailed ``board`` information please scroll tables below by
horizontal.
.. list-table::
:header-rows: 1

View File

@ -8,7 +8,7 @@ The Project configuration file is named ``platformio.ini``. This is a
``platformio.ini`` has sections (each denoted by a ``[header]``) and
key / value pairs within the sections. A sign ``#`` at the beginning of the
line indicate a comment. Comment lines are ignored.
line indicates a comment. Comment lines are ignored.
The sections and their allowable values are described below.
@ -58,18 +58,24 @@ For example, ``[env:hello_world]``.
Options
~~~~~~~
.. _projectconf_env_platform:
``platform``
^^^^^^^^^^^^
:ref:`Platform <platforms>` type
.. _projectconf_env_framework:
``framework``
^^^^^^^^^^^^^
See ``framework`` type in *Frameworks* section of :ref:`platforms`
.. _projectconf_env_board:
``board``
^^^^^^^^^
@ -113,6 +119,9 @@ This option is used by "uploader" tool to send firmware to the board via
* ``/dev/ttyUSB0`` - Unix-based OS
* ``COM3`` - Windows OS
If ``upload_port`` isn't specified, then *PlatformIO* will try to detect
``upload_port`` automatically.
To print all available serial ports use :ref:`cmd_serialports` command.
@ -142,6 +151,8 @@ When no targets are defined, *PlatformIO* will build only sources by default.
(``targets = upload``).
.. _projectconf_build_flags:
``build_flags``
^^^^^^^^^^^^^^^
@ -232,6 +243,8 @@ For more detailed information about available flags/options go to:
This is option ``srcbuild_flags`` has the same behaviour like ``build_flags``
but will be applied only for project source code from ``src`` directory.
.. _projectconf_examples:
Examples
--------
@ -239,17 +252,13 @@ Examples
``board_*`` and ``upload_*`` options (use only ``board`` option) and Arduino
Wiring-based Framework
.. code-block:: ini
.. code-block:: ini
[env:atmelavr_arduino_uno_board]
platform = atmelavr
framework = arduino
board = uno
upload_port = /dev/ttyUSB0
# for Windows OS
# upload_port = COM3
# enable auto-uploading
targets = upload
@ -258,17 +267,13 @@ Examples
auto pre-configured ``board_*`` and ``upload_*`` options (use only
``board`` option) and Arduino Wiring-based Framework
.. code-block:: ini
.. code-block:: ini
[env:atmelavr_microduino_core_board]
platform = atmelavr
framework = arduino
board = 168pa8m
upload_port = /dev/ttyUSB0
# for Windows OS
# upload_port = COM3
# enable auto-uploading
targets = upload
@ -277,7 +282,7 @@ Examples
auto pre-configured ``board_*`` and ``upload_*`` options (use only
``board`` option) and Arduino Wiring-based Framework
.. code-block:: ini
.. code-block:: ini
[env:atmelavr_raspduino_board]
platform = atmelavr
@ -293,7 +298,7 @@ Examples
4. :ref:`platform_atmelavr`: Embedded board that is based on ATmega168 MCU with
"arduino" bootloader
.. code-block:: ini
.. code-block:: ini
[env:atmelavr_atmega168_board]
platform = atmelavr
@ -310,11 +315,23 @@ Examples
targets = upload
5. :ref:`platform_timsp430`: TI MSP430G2553 LaunchPad with auto pre-configured
5. Upload firmware via USB programmer (USBasp) to :ref:`platform_atmelavr`
microcontrollers
.. code-block:: ini
[env:atmelavr_usbasp]
platform = atmelavr
framework = arduino
board = pro8MHzatmega328
upload_protocol = usbasp -B5
6. :ref:`platform_timsp430`: TI MSP430G2553 LaunchPad with auto pre-configured
``board_*`` and ``upload_*`` options (use only ``board`` option) and Energia
Wiring-based Framework
.. code-block:: ini
.. code-block:: ini
[env:timsp430_g2553_launchpad]
platform = timsp430
@ -322,9 +339,9 @@ Examples
board = lpmsp430g2553
6. :ref:`platform_timsp430`: Embedded board that is based on MSP430G2553 MCU
7. :ref:`platform_timsp430`: Embedded board that is based on MSP430G2553 MCU
.. code-block:: ini
.. code-block:: ini
[env:timsp430_g2553_board]
platform = timsp430
@ -337,11 +354,11 @@ Examples
targets = upload
5. :ref:`platform_titiva`: TI Tiva C ARM Series TM4C123G LaunchPad with auto
8. :ref:`platform_titiva`: TI Tiva C ARM Series TM4C123G LaunchPad with auto
pre-configured ``board_*`` and ``upload_*`` options (use only ``board``
option) and Energia Wiring-based Framework
.. code-block:: ini
.. code-block:: ini
[env:titiva_tm4c1230c3pm_launchpad]
platform = titiva

View File

@ -3,62 +3,51 @@
Quickstart
==========
First, :ref:`Install PlatformIO <installation>`.
.. note::
Please read `Get Started <http://platformio.org/#!/get-started>`_
article from the official WebSite.
Print all available development platforms for installing
1. :ref:`Install PlatformIO <installation>`.
2. Find board ``type`` on this :ref:`Embedded Boards <platforms>` page or
via :ref:`cmd_boards` command.
3. Initialize new PlatformIO based project with the pre-configured
environments for your boards:
.. code-block:: bash
$ platformio search all
[ ... ]
$ platformio init --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
The current working directory *** will be used for the new project.
You can specify another project directory via
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.
Install new development platform
The next files/directories will be created in ***
`platformio.ini` - Project Configuration File
`src` - a source directory. Put your source code here
`lib` - a directory for the project specific libraries
Do you want to continue? [y/N]: y
Project has been successfully initialized!
Now you can process it with `platformio run` command.
.. code-block:: bash
More detailed information about this command is here :ref:`cmd_init`.
$ platformio install PLATFORM
Downloading [####################################] 100%
Unpacking [####################################] 100%
Installing .....
[ ... ]
The platform 'PLATFORM' has been successfully installed!
Initialize new PlatformIO based project
.. code-block:: bash
$ cd /path/to/empty/directory
$ platformio init
Project has been initialized!
Please put your source code to `src` directory, external libraries to `lib`
and setup environments in `platformio.ini` file.
Then process project with `platformio run` command.
Setup environments in ``platformio.ini``. For more examples go to
:ref:`projectconf`
.. code-block:: ini
# Simple and base environment
[env:mybaseenv]
platform = %INSTALLED_PLATFORM_NAME_HERE%
Process the project's environments
4. Process the project's environments.
.. code-block:: bash
$ platformio run
# if embedded project then upload firmware
# if you don't have specified `targets = upload` option for environment,
# then you can upload firmware manually with this command:
$ platformio run --target upload
# clean project
$ platformio run --target clean
If you don't have installed required platforms, then *PlatformIO* will propose
you to install them automatically.
Further examples can be found in the ``examples/`` directory in the source
distribution or `on the web <https://github.com/ivankravets/platformio/tree/develop/examples>`_.

View File

@ -0,0 +1,86 @@
.. _cmd_boards:
platformio boards
=================
.. contents::
Usage
-----
.. code-block:: bash
# Print all available pre-configured embedded boards
platformio boards
# Filter boards by "Query"
platformio boards QUERY
Description
-----------
List pre-configured Embedded Boards
Examples
--------
1. Show Arduino-based boards
.. code-block:: bash
$ platformio boards arduino
Platform: atmelavr
---------------------------------------------------------------------------
Type MCU Frequency Flash RAM Name
---------------------------------------------------------------------------
btatmega168 atmega168 16Mhz 14Kb 1Kb Arduino BT ATmega168
btatmega328 atmega328p 16Mhz 28Kb 2Kb Arduino BT ATmega328
diecimilaatmega168 atmega168 16Mhz 14Kb 1Kb Arduino Duemilanove or Diecimila ATmega168
diecimilaatmega328 atmega328p 16Mhz 30Kb 2Kb Arduino Duemilanove or Diecimila ATmega328
esplora atmega32u4 16Mhz 28Kb 2Kb Arduino Esplora
ethernet atmega328p 16Mhz 31Kb 2Kb Arduino Ethernet
...
2. Show boards which are based on ``ATmega168`` MCU
.. code-block:: bash
$ platformio boards atmega168
Platform: atmelavr
---------------------------------------------------------------------------
Type MCU Frequency Flash RAM Name
---------------------------------------------------------------------------
btatmega168 atmega168 16Mhz 14Kb 1Kb Arduino BT ATmega168
diecimilaatmega168 atmega168 16Mhz 14Kb 1Kb Arduino Duemilanove or Diecimila ATmega168
miniatmega168 atmega168 16Mhz 14Kb 1Kb Arduino Mini ATmega168
atmegangatmega168 atmega168 16Mhz 14Kb 1Kb Arduino NG or older ATmega168
nanoatmega168 atmega168 16Mhz 14Kb 1Kb Arduino Nano ATmega168
pro8MHzatmega168 atmega168 8Mhz 14Kb 1Kb Arduino Pro or Pro Mini ATmega168 (3.3V, 8 MHz)
pro16MHzatmega168 atmega168 16Mhz 14Kb 1Kb Arduino Pro or Pro Mini ATmega168 (5V, 16 MHz)
lilypadatmega168 atmega168 8Mhz 14Kb 1Kb LilyPad Arduino ATmega168
168pa16m atmega168p 16Mhz 15Kb 1Kb Microduino Core (Atmega168PA@16M,5V)
168pa8m atmega168p 8Mhz 15Kb 1Kb Microduino Core (Atmega168PA@8M,3.3V)
3. Show boards by :ref:`platform_timsp430`
.. code-block:: bash
$ platformio boards timsp430
Platform: timsp430
---------------------------------------------------------------------------
Type MCU Frequency Flash RAM Name
---------------------------------------------------------------------------
lpmsp430fr5739 msp430fr5739 16Mhz 15Kb 1Kb FraunchPad w/ msp430fr5739
lpmsp430f5529 msp430f5529 16Mhz 128Kb 1Kb LaunchPad w/ msp430f5529 (16MHz)
lpmsp430f5529_25 msp430f5529 25Mhz 128Kb 1Kb LaunchPad w/ msp430f5529 (25MHz)
lpmsp430fr5969 msp430fr5969 8Mhz 64Kb 1Kb LaunchPad w/ msp430fr5969
lpmsp430g2231 msp430g2231 1Mhz 2Kb 128B LaunchPad w/ msp430g2231 (1MHz)
lpmsp430g2452 msp430g2452 16Mhz 8Kb 256B LaunchPad w/ msp430g2452 (16MHz)
lpmsp430g2553 msp430g2553 16Mhz 16Kb 512B LaunchPad w/ msp430g2553 (16MHz)

View File

@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio init
platformio init [OPTIONS]
Description
@ -21,22 +21,85 @@ Initialize new PlatformIO based project.
This command will create:
* ``.pioenvs`` - a temporary working directory.
* ``lib`` - a directory for project specific libraries. PlatformIO will
compile them to static libraries and link to executable file
* ``src`` - a source directory. Put your source code here.
* :ref:`projectconf`
* ``src`` - a source directory. Put your source code here
* ``lib`` - a directory for the project specific libraries. PlatformIO will
compile them to static libraries and link to executable file
Options
-------
.. option::
--project-dir, -d
A path to the directory where *PlatformIO* will initialise new project.
.. option::
--board, -b
If you specify board ``type`` (you can pass multiple ``--board`` options), then
*PlatformIO* will automatically generate environment for :ref:`projectconf` and
pre-fill these data:
* :ref:`projectconf_env_platform`
* :ref:`projectconf_env_framework`
* :ref:`projectconf_env_board`
The full list with pre-configured boards is available here :ref:`platforms`.
.. option::
--disable-auto-uploading
If you initialise project with the specified ``--board``, then *PlatformIO*
will create environment with enabled firmware auto-uploading. This option
allows you to disable firmware auto-uploading by default.
Examples
--------
1. Create new project in the current working directory
.. code-block:: bash
# Change directory to the future project
$ cd /path/to/empty/directory
$ platformio init
Project has been initialized!
Please put your source code to `src` directory, external libraries to `lib`
and setup environments in `platformio.ini` file.
Then process project with `platformio run` command.
The current working directory *** will be used for the new project.
You can specify another project directory via
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.
The next files/directories will be created in ***
platformio.ini - Project Configuration File
src - a source directory. Put your source code here
lib - a directory for the project specific libraries
Do you want to continue? [y/N]: y
Project has been successfully initialized!
Now you can process it with `platformio run` command.
2. Create new project in the specified directory
.. code-block:: bash
$ platformio init -d %PATH_TO_DIR%
The next files/directories will be created in ***
platformio.ini - Project Configuration File
src - a source directory. Put your source code here
lib - a directory for the project specific libraries
Do you want to continue? [y/N]: y
Project has been successfully initialized!
Now you can process it with `platformio run` command.
3. Initialise project for Arduino Uno
.. code-block:: bash
$ platformio init --board uno
The next files/directories will be created in ***
platformio.ini - Project Configuration File
src - a source directory. Put your source code here
lib - a directory for the project specific libraries
Do you want to continue? [y/N]: y
Project has been successfully initialized!
Now you can process it with `platformio run` command.

View File

@ -23,7 +23,7 @@ There are several predefined aliases for packages, such as:
* ``toolchain``
* ``uploader``
* ``framework``
Options
-------

View File

@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio list
platformio list [OPTIONS]
Description
@ -18,6 +18,13 @@ Description
List installed :ref:`Platforms <platforms>`
Options
~~~~~~~
.. option::
--json-output
Return the output in `JSON <http://en.wikipedia.org/wiki/JSON>`_ format
Examples
--------

View File

@ -11,7 +11,7 @@ Usage
.. code-block:: bash
# Print all available development platforms
platformio search all
platformio search
# Filter platforms by "Query"
platformio search QUERY

View File

@ -13,7 +13,7 @@ Usage
.. code-block:: bash
platformio serialports list
platformio serialports list [OPTIONS]
Description
@ -21,6 +21,14 @@ Description
List available `Serial Ports <http://en.wikipedia.org/wiki/Serial_port>`_
Options
~~~~~~~
.. option::
--json-output
Return the output in `JSON <http://en.wikipedia.org/wiki/JSON>`_ format
Examples
~~~~~~~~

View File

@ -0,0 +1,114 @@
.. _cmd_settings:
platformio settings
===================
Manage PlatformIO settings
.. contents::
platformio settings get
-----------------------
Usage
~~~~~
.. code-block:: bash
platformio settings get [NAME]
Description
~~~~~~~~~~~
Get/List existing settings
Examples
~~~~~~~~
1. List all settings and current their values
.. code-block:: bash
$ platformio settings get
Name Value [Default] Description
------------------------------------------------------------------------------------------
auto_update_libraries Yes Automatically update libraries (Yes/No)
auto_update_platforms Yes Automatically update platforms (Yes/No)
check_libraries_interval 7 Check for the library updates interval (days)
check_platformio_interval 3 Check for the new PlatformIO interval (days)
check_platforms_interval 7 Check for the platforms updates interval (days)
2. Show specified setting
.. code-block:: bash
$ platformio settings get auto_update_platforms
Name Value [Default] Description
------------------------------------------------------------------------------------------
auto_update_platforms Yes Automatically update platforms (Yes/No)
platformio settings set
-----------------------
Usage
~~~~~
.. code-block:: bash
platformio settings set NAME VALUE
Description
~~~~~~~~~~~
Set new value for the setting
Examples
~~~~~~~~
Change to check for the new PlatformIO each day
.. code-block:: bash
$ platformio settings set check_platformio_interval 1
The new value for the setting has been set!
Name Value [Default] Description
------------------------------------------------------------------------------------------
check_platformio_interval 1 [3] Check for the new PlatformIO interval (days)
platformio settings reset
-------------------------
Usage
~~~~~
.. code-block:: bash
platformio settings reset
Description
~~~~~~~~~~~
Reset settings to default
Examples
~~~~~~~~
.. code-block:: bash
$ platformio settings reset
The settings have been reseted!
Name Value [Default] Description
------------------------------------------------------------------------------------------
auto_update_libraries Yes Automatically update libraries (Yes/No)
auto_update_platforms Yes Automatically update platforms (Yes/No)
check_libraries_interval 7 Check for the library updates interval (days)
check_platformio_interval 3 Check for the new PlatformIO interval (days)
check_platforms_interval 7 Check for the platform updates interval (days)

View File

@ -14,6 +14,7 @@ To print all available commands and options use:
.. toctree::
:maxdepth: 2
cmd_boards
cmd_init
cmd_install
platformio lib <lib/index>
@ -21,6 +22,7 @@ To print all available commands and options use:
cmd_run
cmd_search
cmd_serialports
cmd_settings
cmd_show
cmd_uninstall
cmd_update

View File

@ -10,13 +10,14 @@ Usage
.. code-block:: bash
platformio lib install [OPTIONS] [NAMES]
platformio lib install [OPTIONS] [LIBRARY_ID]
Description
-----------
Install new library
Install new library by specified
`PlatformIO Library Registry ID <http://platformio.org/#!/lib>`_.
Options
-------
@ -34,35 +35,38 @@ Examples
.. code-block:: bash
$ platformio lib install Arduino-IRremote
Installing Arduino-IRremote library:
Downloading [####################################] 100%
Unpacking [####################################] 100%
The library 'Arduino-IRremote' has been successfully installed!
# IRremote: http://platformio.org/#!/lib/show/4/IRremote
$ platformio lib install 4
# Installing library [ 4 ]:
# Downloading [####################################] 100%
# Unpacking [####################################] 100%
# The library #4 'IRremote' has been successfully installed!
2. Install specified version of library
.. code-block:: bash
$ platformio lib install Arduino-XBee --version=0.5
Installing Arduino-XBee library:
Downloading [####################################] 100%
Unpacking [####################################] 100%
The library 'Arduino-XBee' has been successfully installed!
# XBee: http://platformio.org/#!/lib/show/6/XBee
$ platformio lib install 6 --version=0.5
# Installing library [ 6 ]:
# Downloading [####################################] 100%
# Unpacking [####################################] 100%
# The library #6 'XBee' has been successfully installed!
3. Install library with dependencies
.. code-block:: bash
$ platformio lib install Adafruit-Arduino-ST7735
Installing Adafruit-Arduino-ST7735 library:
Downloading [####################################] 100%
Unpacking [####################################] 100%
The library 'Adafruit-Arduino-ST7735' has been successfully installed!
Installing dependencies:
Installing Adafruit-Arduino-GFX library:
Downloading [####################################] 100%
Unpacking [####################################] 100%
The library 'Adafruit-Arduino-GFX' has been successfully installed!
# Adafruit-ST7735: http://platformio.org/#!/lib/show/12/Adafruit-ST7735
$ platformio lib install 12
# Installing library [ 12 ]:
# Downloading [####################################] 100%
# Unpacking [####################################] 100%
# The library #12 'Adafruit-ST7735' has been successfully installed!
# Installing dependencies:
# Installing library [ 13 ]:
# Downloading [####################################] 100%
# Unpacking [####################################] 100%
# The library #13 'Adafruit-GFX' has been successfully installed!

View File

@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio lib list
platformio lib list [OPTIONS]
Description
@ -18,6 +18,13 @@ Description
List installed libraries
Options
~~~~~~~
.. option::
--json-output
Return the output in `JSON <http://en.wikipedia.org/wiki/JSON>`_ format
Examples
--------
@ -25,7 +32,15 @@ Examples
.. code-block:: bash
$ platformio lib list
Arduino-IRremote Send and receive infrared signals with multiple protocols
...
Arduino-Webduino An extensible web server library (for use with the Arduino Ethernet Shield)
Arduino-XBee Arduino library for communicating with XBees in API mode
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 23 ] Adafruit-L3GD20-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the L3GD20 Gyroscope
# [ 12 ] Adafruit-ST7735 arduino, atmelavr "Adafruit Industries": A library for the Adafruit 1.8" SPI display
# [ 31 ] Adafruit-Unified-Sensor arduino, atmelavr "Adafruit Industries": Adafruit Unified Sensor Driver
# [ 26 ] Adafruit-LSM303DLHC-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer)
# [ 6 ] XBee arduino, atmelavr "Andrew Rapp": Arduino library for communicating with XBees in API mode
# [ 13 ] Adafruit-GFX arduino, atmelavr "Adafruit Industries": A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.)
# [ 4 ] IRremote arduino, atmelavr "Ken Shirriff": Send and receive infrared signals with multiple protocols
# [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303)
# ...

View File

@ -16,8 +16,8 @@ Usage
Description
-----------
Search for library over ``name``, ``description`` and ``keywords`` fields from
the :ref:`library_config` file in the boolean mode.
Search for library in `PlatformIO Library Registry <http://platformio.org/#!/lib>`_
by :ref:`library_config` fields in the boolean mode.
The boolean search capability supports the following operators:
@ -71,66 +71,143 @@ Filter libraries by specified author
Filter libraries by specified keyword
.. option::
-f, --framework
Filter libraries by specified framework
.. option::
-p, --platform
Filter libraries by specified keyword
Examples
--------
1. Search for "1-Wire" library
1. List all libraries
.. code-block:: bash
$ platformio lib search 1-wire
Found N libraries:
Arduino-OneWire Control devices (from Dallas Semiconductor) that use the One Wire protocol
...
$ platformio lib search
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303)
# [ 13 ] Adafruit-GFX arduino, atmelavr "Adafruit Industries": A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.)
# [ 23 ] Adafruit-L3GD20-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the L3GD20 Gyroscope
# [ 26 ] Adafruit-LSM303DLHC-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer)
# [ 12 ] Adafruit-ST7735 arduino, atmelavr "Adafruit Industries": A library for the Adafruit 1.8" SPI display
# [ 31 ] Adafruit-Unified-Sensor arduino, atmelavr "Adafruit Industries": Adafruit Unified Sensor Driver
# [ 4 ] IRremote arduino, atmelavr "Ken Shirriff": Send and receive infrared signals with multiple protocols
# [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc)
# [ 6 ] XBee arduino, atmelavr "Andrew Rapp": Arduino library for communicating with XBees in API mode
# [ 15 ] Adafruit-ADXL345-Unified arduino, atmelavr "Adafruit Industries": Unified driver for the ADXL345 Accelerometer
# Show next libraries? [y/N]:
# ...
2. Search for Arduino-based "I2C" libraries. The ``+`` sign is here like ``AND``
operator.
2. Search for `1-Wire libraries <http://platformio.org/#!/lib/search?query=%25221-wire%2522>`_
.. code-block:: bash
$ platformio lib search "+i2c +arduino"
Found N libraries:
i2cdevlib-Arduino-i2cdev The I2C Device Library (i2cdevlib) is a collection of uniform and well-documented classes to provide simple and intuitive interfaces to I2C devices.
i2cdevlib-Arduino-AK8975 AK8975 is 3-axis electronic compass IC with high sensitive Hall sensor technology
...
$ platformio lib search "1-wire"
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc)
# ...
3. Search for libraries by "web" and "http" keywords. The ``""`` here is for
"empty" query argument.
3. Search for `Arduino-based "I2C" libraries <http://platformio.org/#!/lib/search?query=framework%253Aarduino%2520i2c>`_
.. code-block:: bash
$ platformio lib search "" --keyword web --keyword http
Found N libraries:
Arduino-Webduino An extensible web server library (for use with the Arduino Ethernet Shield)
Arduino-aJson An Arduino library to enable JSON processing with Arduino
...
$ platformio lib search "i2c" --framework="arduino"
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 11 ] I2Cdevlib-Core arduino, atmelavr "Jeff Rowberg": The I2C Device Library (I2Cdevlib) is a collection of uniform and well-documented classes to provide simple and intuitive interfaces to I2C devices.
# [ 24 ] Adafruit-L3GD20 arduino, atmelavr "Adafruit Industries": Driver for Adafruit's L3GD20 I2C Gyroscope Breakout
# [ 10 ] I2Cdevlib-AK8975 arduino, atmelavr "Jeff Rowberg": AK8975 is 3-axis electronic compass IC with high sensitive Hall sensor technology
# [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303)
# ...
4. Search for libraries from "Adafruit Industries" author.
4. Search for `libraries by "web" and "http" keywords <http://platformio.org/#!/lib/search?query=keyword%253A%2522web%2522%2520keyword%253A%2522http%2522>`_.
.. code-block:: bash
$ platformio lib search "" --author "Adafruit Industries"
Found N libraries:
Adafruit-Arduino-ST7735 A library for the Adafruit 1.8" SPI display
Adafruit-Arduino-GFX A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.)
...
$ platformio lib search --keyword="web" --keyword="http"
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 5 ] Webduino arduino, atmelavr "Ben Combee": An extensible web server library (for use with the Arduino WizNet Ethernet Shield)
# [ 17 ] Adafruit-CC3000 arduino, atmelavr "Adafruit Industries": Library code for Adafruit's CC3000 Wi-Fi/WiFi breakouts
# ...
5. Search for libraries that are compatible with Dallas temperature sensors
5. Search for `libraries by "Adafruit Industries" author <http://platformio.org/#!/lib/search?query=author%253A%2522Adafruit%20Industries%2522>`_
.. code-block:: bash
$ platformio lib search --author="Adafruit Industries"
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303)
# [ 13 ] Adafruit-GFX arduino, atmelavr "Adafruit Industries": A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.)
# [ 23 ] Adafruit-L3GD20-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the L3GD20 Gyroscope
# [ 26 ] Adafruit-LSM303DLHC-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer)
# ...
6. Search for `libraries which are compatible with Dallas temperature sensors <http://platformio.org/#!/lib/search?query=DS*>`_
like DS18B20, DS18S20 and etc.
.. code-block:: bash
$ platformio lib search "DS*"
Found N libraries:
Arduino-OneWire Control devices (from Dallas Semiconductor) that use the One Wire protocol
...
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc)
# ...
6. Search for Arduino-based *X10* or *XBee* libraries. The search query that is
described below can be interpreted like ``arduino x10 OR arduino xbee``.
7. Search for `Energia-based *nRF24* or *HttpClient* libraries <http://platformio.org/#!/lib/search?query=framework%253Aenergia%2520%252B(nRF24%2520HttpClient)>`_.
The search query that is described below can be interpreted like
``energia nRF24 OR energia HttpClient``
.. code-block:: bash
$ platformio lib search "+arduino +(x10 xbee)"
Found 2 libraries:
Arduino-X10 Sending X10 signals over AC power lines
Arduino-XBee Arduino library for communicating with XBees in API mode
$ platformio lib search "+(nRF24 HttpClient)" --framework="energia"
# Found 2 libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 46 ] HttpClient energia, timsp430, titiva "Zack Lalanne": HttpClient is a library to make it easier to interact with web servers
# [ 43 ] nRF24 energia, timsp430 "Eric": The nRF24L01 is a low-cost 2.4GHz ISM transceiver module. It supports a number of channel frequencies in the 2.4GHz band and a range of data rates.
8. Search for the `all sensor libraries excluding temperature <http://platformio.org/#!/lib/search?query=sensor%2520-temperature>`_.
.. code-block:: bash
$ platformio lib search "sensor -temperature"
# Found N libraries:
#
# [ ID ] Name Compatibility "Authors": Description
# -------------------------------------------------------------------------------------
# [ 31 ] Adafruit-Unified-Sensor arduino, atmelavr "Adafruit Industries": Adafruit Unified Sensor Driver
# [ 10 ] I2Cdevlib-AK8975 arduino, atmelavr "Jeff Rowberg": AK8975 is 3-axis electronic compass IC with high sensitive Hall sensor technology
# [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303)
# [ 23 ] Adafruit-L3GD20-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the L3GD20 Gyroscope
# [ 26 ] Adafruit-LSM303DLHC-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer)
# [ 33 ] Adafruit-TMP006 arduino, atmelavr "Adafruit Industries": A library for the Adafruit TMP006 Infrared Thermopile Sensor
# [ 34 ] Adafruit-TSL2561-Unified arduino, atmelavr "Adafruit Industries": Unified light sensor driver for Adafruit's TSL2561 breakouts
# [ 97 ] I2Cdevlib-BMA150 arduino, atmelavr "Jeff Rowberg": The BMA150 is a triaxial, low-g acceleration sensor IC with digital output for consumer market applications
# [ 106 ] I2Cdevlib-MPR121 arduino, atmelavr "Jeff Rowberg": The MPR121 is a 12-bit proximity capacitive touch sensor
# [ 111 ] I2Cdevlib-AK8975 energia, timsp430 "Jeff Rowberg": AK8975 is 3-axis electronic compass IC with high sensitive Hall sensor technology
# Show next libraries? [y/N]:

View File

@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio lib show NAME
platformio lib show ID
Description
@ -24,11 +24,14 @@ Examples
.. code-block:: bash
$ platformio lib show Arduino-XBee
Arduino-XBee
------------
Author: Andrew Rapp <andrew.rapp@gmail.com>
Keywords: xbee, protocol, radio
Version: 0.5
Arduino library for communicating with XBees in API mode
# OneWire: http://platformio.org/#!/lib/show/1/OneWire
$ platformio lib show 1
# OneWire
# -------
# Authors: Paul Stoffregen <paul@pjrc.com> http://www.pjrc.com/teensy/td_libs_OneWire.html (maintainer), Jim Studt, Jason Dangel <dangel.jason@gmail.com>, Derek Yerger, Tom Pollard <pollard@alum.mit.edu>, Robin James
# Keywords: onewire, 1-wire, bus, sensor, temperature, ibutton
# Frameworks: arduino
# Platforms: atmelavr
# Version: 2.2
#
# Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc)

View File

@ -10,7 +10,7 @@ Usage
.. code-block:: bash
platformio lib uninstall NAME
platformio lib uninstall ID
Description
@ -24,8 +24,6 @@ Examples
.. code-block:: bash
$ platformio lib install Arduino-IRremote
Installing Arduino-IRremote library:
Downloading [####################################] 100%
Unpacking [####################################] 100%
The library 'Arduino-IRremote' has been successfully installed!
# XBee: http://platformio.org/#!/lib/show/6/XBee
$ platformio lib uninstall 6
# The library #6 'XBee' has been successfully uninstalled!

View File

@ -25,9 +25,19 @@ Examples
.. code-block:: bash
$ platformio lib update
Updating Arduino-IRremote library:
Versions: Current=24ba950f5c, Latest=24ba950f5c [Up-to-date]
Updating Arduino-Webduino library:
Versions: Current=3631af8e02, Latest=3631af8e02 [Up-to-date]
Updating Arduino-XBee library:
Versions: Current=0.5, Latest=0.5 [Up-to-date]
# Updating [ 23 ] Adafruit-L3GD20-Unified library:
# Versions: Current=63de2eb9ea, Latest=63de2eb9ea [Up-to-date]
# Updating [ 12 ] Adafruit-ST7735 library:
# Versions: Current=e880eb1687, Latest=e880eb1687 [Up-to-date]
# Updating [ 31 ] Adafruit-Unified-Sensor library:
# Versions: Current=88ae805bce, Latest=88ae805bce [Up-to-date]
# Updating [ 26 ] Adafruit-LSM303DLHC-Unified library:
# Versions: Current=59767208a8, Latest=59767208a8 [Up-to-date]
# 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]
# 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]

View File

@ -1,5 +1,21 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
#
# 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:microduino]
platform = atmelavr

View File

@ -1,5 +1,21 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
#
# 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_pro5v]
platform = atmelavr

View File

@ -1,13 +1,27 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
#
# 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_pro5v]
platform = atmelavr
board_mcu = atmega168
board_f_cpu = 16000000L
upload_port = /dev/tty.SLAB_USBtoUART
# upload_port = COM3
upload_protocol = arduino
upload_speed = 19200

View File

@ -5,7 +5,7 @@ The detailed information and steps are described in this article:
`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>`_.
.. image:: http://www.ikravets.com/wp-content/uploads/2014/06/eclipse_build_arduino_pro5v-1024x822.png
.. image:: http://www.ikravets.com/wp-content/uploads/2014/06/eclipse_platformio_build_arduino_uno.png
:width: 850px
:target: http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.910961921">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.910961921" moduleId="org.eclipse.cdt.core.settings" name="Default">
@ -13,41 +11,46 @@
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="0.910961921" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.910961921." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.952979152" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.952979152.52310970" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.1519453406" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.952979152.52310970" name=""/>
<builder cleanBuildTarget="run --target clean" command="platformio" id="org.eclipse.cdt.build.core.settings.default.builder.1519453406" incrementalBuildTarget="run" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1409095472" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.1624502120" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.239157887" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/atmelavr/tools/toolchain/avr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/atmelavr/frameworks/arduino/cores/arduino&quot;"/>
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.239157887" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-atmelavr/avr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-arduinoavr/cores/arduino&quot;"/>
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.922107295" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.922107295" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__AVR_ATmega168__"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.149990277" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.54121539" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1096940598" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1096940598" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/atmelavr/tools/toolchain/avr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/atmelavr/frameworks/arduino/cores/arduino&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-atmelavr/avr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-arduinoavr/cores/arduino&quot;"/>
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1198905600" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1198905600" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__AVR_ATmega168__"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.762536863" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1310559623" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.41298875" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.41298875" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/atmelavr/tools/toolchain/avr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/atmelavr/frameworks/arduino/cores/arduino&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-atmelavr/avr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-arduinoavr/cores/arduino&quot;"/>
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.884639970" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.884639970" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__AVR_ATmega168__"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.549319812" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
@ -74,4 +77,5 @@
<resource resourceType="PROJECT" workspacePath="/arduino_pro5"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>

View File

@ -1,5 +0,0 @@
all:
platformio run -t upload
clean:
platformio run -t clean

View File

@ -1,8 +1,23 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
#
# 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_pro5v]
platform = atmelavr
framework = arduino
board = pro16MHzatmega168
upload_port = /dev/tty.SLAB_USBtoUART
board = pro16MHzatmega168

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.1706826288">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1706826288" moduleId="org.eclipse.cdt.core.settings" name="Default">
@ -13,18 +11,19 @@
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1706826288" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.1706826288." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.944229927" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.944229927.1146791472" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.81097189" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.944229927.1146791472" name=""/>
<builder cleanBuildTarget="run --target clean" command="platformio" id="org.eclipse.cdt.build.core.settings.default.builder.81097189" incrementalBuildTarget="run" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.615700392" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.509191184" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1976688999" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/atmelavr/tools/toolchain/avr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-atmelavr/avr/include&quot;"/>
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1146079252" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__AVR_ATmega168__"/>
@ -34,6 +33,7 @@
<tool id="org.eclipse.cdt.build.core.settings.holder.524184308" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1379816017" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/atmelavr/tools/toolchain/avr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-atmelavr/avr/include&quot;"/>
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1180078676" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__AVR_ATmega168__"/>
@ -43,6 +43,7 @@
<tool id="org.eclipse.cdt.build.core.settings.holder.746817635" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.905883681" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/atmelavr/tools/toolchain/avr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-atmelavr/avr/include&quot;"/>
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1589314232" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__AVR_ATmega168__"/>

View File

@ -1,5 +0,0 @@
all:
platformio run -t upload
clean:
platformio run -t clean

View File

@ -1,12 +1,26 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# http://docs.platformio.org/en/latest/projectconf.html
#
# A sign `#` at the beginning of the line indicates a comment
# Comment lines are ignored.
# Simple and base environment
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload
[env:atmelavr_atmega168]
platform = atmelavr
board_mcu = atmega168
board_f_cpu = 16000000L
upload_port = /dev/tty.SLAB_USBtoUART
# upload_port = COM3
upload_protocol = arduino
upload_speed = 19200
upload_speed = 19200

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.1778616297">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1778616297" moduleId="org.eclipse.cdt.core.settings" name="Default">
@ -13,30 +11,36 @@
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1778616297" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.1778616297." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.576447412" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.576447412.203226592" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.592280532" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.576447412.203226592" name=""/>
<builder cleanBuildTarget="run --target clean" command="platformio" id="org.eclipse.cdt.build.core.settings.default.builder.592280532" incrementalBuildTarget="run" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.251286138" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.1824859462" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.2021826184" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/timsp430/tools/toolchain/msp430/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-timsp430/msp430/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-energiamsp430/cores/msp430&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1509314343" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1251065831" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1876118829" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/timsp430/tools/toolchain/msp430/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-timsp430/msp430/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-energiamsp430/cores/msp430&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.518683230" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.847615484" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1922525168" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/timsp430/tools/toolchain/msp430/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-timsp430/msp430/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-energiamsp430/cores/msp430&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.68822385" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
@ -57,5 +61,9 @@
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Default">
<resource resourceType="PROJECT" workspacePath="/tilaunchpad_msp430g2"/>
</configuration>
</storageModule>
</cproject>

View File

@ -1,5 +0,0 @@
all:
platformio run -t upload
clean:
platformio run -t clean

View File

@ -1,5 +1,21 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# http://docs.platformio.org/en/latest/projectconf.html
#
# A sign `#` at the beginning of the line indicates a comment
# Comment lines are ignored.
# Simple and base environment
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload
[env:launchpad_msp430g2]
platform = timsp430

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.18931736">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.18931736" moduleId="org.eclipse.cdt.core.settings" name="Default">
@ -13,33 +11,34 @@
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="0.18931736" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.18931736." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.946409409" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.946409409.264614082" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.2099118713" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.946409409.264614082" name=""/>
<builder cleanBuildTarget="run --target clean" command="platformio" id="org.eclipse.cdt.build.core.settings.default.builder.2099118713" incrementalBuildTarget="run" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1860044306" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.490604788" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1186638432" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/titiva/frameworks/energia/cores/lm4f&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/titiva/tools/toolchain/arm-none-eabi/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-energiativa/cores/lm4f&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1338936035" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1620533967" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1007143336" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/titiva/frameworks/energia/cores/lm4f&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/titiva/tools/toolchain/arm-none-eabi/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-energiativa/cores/lm4f&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.2051673558" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.549164281" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.454536693" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/titiva/frameworks/energia/cores/lm4f&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/titiva/tools/toolchain/arm-none-eabi/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-energiativa/cores/lm4f&quot;"/>
</option>
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1468046922" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>

View File

@ -1,5 +0,0 @@
all:
platformio run -t upload
clean:
platformio run -t clean

View File

@ -1,8 +1,23 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# http://docs.platformio.org/en/latest/projectconf.html
#
# A sign `#` at the beginning of the line indicates a comment
# Comment lines are ignored.
# Simple and base environment
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload
[env:launchpad_lm4f120]
platform = titiva
framework = energia
board = lplm4f120h5qr
targets = upload

View File

@ -3,9 +3,9 @@
* See LICENSE for details.
*/
#define false 0
#define true 1
typedef int bool;
#define false 0
#define true 1
typedef int bool;
#include <stdint.h>
#include "inc/hw_memmap.h"
@ -16,27 +16,21 @@ typedef int bool;
#define LED_BLUE GPIO_PIN_2
#define LED_GREEN GPIO_PIN_3
int main(void)
{
void setup() {
SysCtlClockSet(
SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN);
while (1)
{
GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_RED);
SysCtlDelay(3000000);
GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_BLUE);
SysCtlDelay(3000000);
GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_GREEN);
SysCtlDelay(3000000);
}
return 0;
}
// hook for Energia main.cpp where these methods are defined
void setup() {}
void loop() {}
void loop() {
GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_RED);
SysCtlDelay(3000000);
GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_BLUE);
SysCtlDelay(3000000);
GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_GREEN);
SysCtlDelay(3000000);
}

View File

@ -1,5 +1,21 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# http://docs.platformio.org/en/latest/projectconf.html
#
# A sign `#` at the beginning of the line indicates a comment
# Comment lines are ignored.
# Simple and base environment
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload
[env:launchpad_msp430g2]
platform = timsp430

View File

@ -1,5 +1,21 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# http://docs.platformio.org/en/latest/projectconf.html
#
# A sign `#` at the beginning of the line indicates a comment
# Comment lines are ignored.
# Simple and base environment
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload
[env:launchpad_lm4f120]
platform = titiva

View File

@ -1,19 +1,34 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# http://docs.platformio.org/en/latest/projectconf.html
#
[env:arduino_pro5v]
# 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 = pro16MHzatmega168
upload_port = /dev/tty.SLAB_USBtoUART
board = uno
[env:launchpad_msp430g2]
platform = timsp430
framework = energia
board = lpmsp430g2553
[env:launchpad_lm4f120]
[env:launchpad_tm4c1230c3pm]
platform = titiva
framework = energia
board = lplm4f120h5qr
build_flags = "-DLED_PIN=GREEN_LED"
board = lptm4c1230c3pm
build_flags = -DLED_PIN=GREEN_LED

View File

@ -1,18 +1,18 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
VERSION = (0, 7, 0)
VERSION = (0, 10, 1)
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"
__description__ = ("A cross-platform code builder and library manager")
__url__ = "http://platformio.ikravets.com"
__description__ = ("A cross-platform code builder and "
"the missing library manager")
__url__ = "http://platformio.org"
__author__ = "Ivan Kravets"
__email__ = "me@ikravets.com"
__license__ = "MIT License"
__copyright__ = "Copyright (C) 2014 Ivan Kravets"
__copyright__ = "Copyright (C) 2014-2015 Ivan Kravets"
__apiurl__ = "http://api.platformio.ikravets.com"
__pkgmanifesturl__ = "http://dl.platformio.ikravets.com/packages/manifest.json"
__apiurl__ = "http://api.platformio.org"

View File

@ -1,21 +1,19 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os import listdir, makedirs
from os.path import getmtime, isdir, isfile, join
from os import listdir
from os.path import join
from sys import exit as sys_exit
from time import time
from traceback import format_exc
from click import command, MultiCommand, secho, version_option
import click
from platformio import __version__
from platformio.commands.upgrade import get_latest_version
from platformio import __version__, maintenance
from platformio.exception import PlatformioException, UnknownCLICommand
from platformio.util import get_home_dir, get_source_dir
from platformio.util import get_source_dir
class PlatformioCLI(MultiCommand): # pylint: disable=R0904
class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
def list_commands(self, ctx):
cmds = []
@ -28,6 +26,7 @@ class PlatformioCLI(MultiCommand): # pylint: disable=R0904
return cmds
def get_command(self, ctx, name):
mod = None
try:
mod = __import__("platformio.commands." + name,
None, None, ["cli"])
@ -36,35 +35,27 @@ class PlatformioCLI(MultiCommand): # pylint: disable=R0904
return mod.cli
@command(cls=PlatformioCLI)
@version_option(__version__, prog_name="PlatformIO")
def cli():
pass
@click.command(cls=PlatformioCLI)
@click.version_option(__version__, prog_name="PlatformIO")
@click.pass_context
def cli(ctx):
maintenance.on_platformio_start(ctx)
def autocheck_latest_version():
check_interval = 3600 * 24 * 7 # 1 week
checkfile = join(get_home_dir(), ".pioupgrade")
if isfile(checkfile) and getmtime(checkfile) > (time() - check_interval):
return False
if not isdir(get_home_dir()):
makedirs(get_home_dir())
with open(checkfile, "w") as f:
f.write(str(time()))
return get_latest_version() != __version__
@cli.resultcallback()
@click.pass_context
def process_result(ctx, result):
maintenance.on_platformio_end(ctx, result)
def main():
try:
if autocheck_latest_version():
secho("\nThere is a new version of PlatformIO available.\n"
"Please upgrade it via `platformio upgrade` command.\n",
fg="yellow")
cli()
cli(None)
except Exception as e: # pylint: disable=W0703
maintenance.on_platformio_exception(e)
if isinstance(e, PlatformioException):
sys_exit("Error: " + str(e))
click.echo("Error: " + str(e))
sys_exit(1)
else:
print format_exc()

120
platformio/app.py Normal file
View File

@ -0,0 +1,120 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import json
from os.path import isfile, join
from platformio import __version__
from platformio.exception import InvalidSettingName, InvalidSettingValue
from platformio.util import get_home_dir
DEFAULT_SETTINGS = {
"check_platformio_interval": {
"description": "Check for the new PlatformIO interval (days)",
"value": 3
},
"check_platforms_interval": {
"description": "Check for the platform updates interval (days)",
"value": 7
},
"check_libraries_interval": {
"description": "Check for the library updates interval (days)",
"value": 7
},
"auto_update_platforms": {
"description": "Automatically update platforms (Yes/No)",
"value": True
},
"auto_update_libraries": {
"description": "Automatically update libraries (Yes/No)",
"value": True
},
"enable_telemetry": {
"description": ("Shares commands, platforms and libraries usage"
" to help us make PlatformIO better (Yes/No)"),
"value": True
},
"enable_prompts": {
"description": (
"Can PlatformIO communicate with you via prompts: "
"propose to install platforms which aren't installed yet, "
"paginate over library search results and etc.)? ATTENTION!!! "
"If you call PlatformIO like subprocess, "
"please disable prompts to avoid blocking (Yes/No)"),
"value": True
}
}
class State(object):
def __init__(self, path=None):
self.path = path
if not self.path:
self.path = join(get_home_dir(), "appstate.json")
self._state = {}
def __enter__(self):
try:
if isfile(self.path):
with open(self.path, "r") as fp:
self._state = json.load(fp)
except ValueError:
self._state = {}
return self._state
def __exit__(self, type_, value, traceback):
with open(self.path, "w") as fp:
if "dev" in __version__:
json.dump(self._state, fp, indent=4)
else:
json.dump(self._state, fp)
def get_state_item(name, default=None):
with State() as data:
return data.get(name, default)
def set_state_item(name, value):
with State() as data:
data[name] = value
def get_setting(name):
if name not in DEFAULT_SETTINGS:
raise InvalidSettingName(name)
with State() as data:
if "settings" in data and name in data['settings']:
return data['settings'][name]
return DEFAULT_SETTINGS[name]['value']
def set_setting(name, value):
if name not in DEFAULT_SETTINGS:
raise InvalidSettingName(name)
defdata = DEFAULT_SETTINGS[name]
try:
if "validator" in defdata:
value = defdata['validator']()
elif (isinstance(defdata['value'], bool)
and not isinstance(value, bool)):
value = str(value).lower() in ("yes", "y", "1")
elif isinstance(defdata['value'], int):
value = int(value)
except Exception:
raise InvalidSettingValue(value, name)
with State() as data:
if "settings" not in data:
data['settings'] = {}
data['settings'][name] = value
def reset_settings():
with State() as data:
if "settings" in data:
del data['settings']

View File

@ -0,0 +1,540 @@
{
"LilyPadUSB": {
"build": {
"board": "AVR_LILYPAD_USB",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega32u4",
"pid": "0x9208",
"usb_product": "LilyPad USB",
"variant": "leonardo",
"vid": "0x1B4F"
},
"name": "LilyPad Arduino USB",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2560,
"maximum_size": 28672,
"protocol": "avr109",
"speed": 57600,
"use_1200bps_touch": true,
"wait_for_upload_port": true
}
},
"atmegangatmega168": {
"build": {
"board": "AVR_NG",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega168",
"variant": "standard"
},
"name": "Arduino NG or older ATmega168",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 14336,
"protocol": "arduino",
"speed": 19200
}
},
"atmegangatmega8": {
"build": {
"board": "AVR_NG",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega8",
"variant": "standard"
},
"name": "Arduino NG or older ATmega8",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 7168,
"protocol": "arduino",
"speed": 19200
}
},
"btatmega168": {
"build": {
"board": "AVR_BT",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega168",
"variant": "eightanaloginputs"
},
"name": "Arduino BT ATmega168",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 1024,
"maximum_size": 14336,
"protocol": "arduino",
"speed": 19200
}
},
"btatmega328": {
"build": {
"board": "AVR_BT",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "eightanaloginputs"
},
"name": "Arduino BT ATmega328",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2048,
"maximum_size": 28672,
"protocol": "arduino",
"speed": 19200
}
},
"diecimilaatmega168": {
"build": {
"board": "AVR_DUEMILANOVE",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega168",
"variant": "standard"
},
"name": "Arduino Duemilanove or Diecimila ATmega168",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 14336,
"protocol": "arduino",
"speed": 19200
}
},
"diecimilaatmega328": {
"build": {
"board": "AVR_DUEMILANOVE",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "standard"
},
"name": "Arduino Duemilanove or Diecimila ATmega328",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 30720,
"protocol": "arduino",
"speed": 57600
}
},
"esplora": {
"build": {
"board": "AVR_ESPLORA",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega32u4",
"pid": "0x803c",
"usb_product": "Arduino Esplora",
"variant": "leonardo",
"vid": "0x2341"
},
"name": "Arduino Esplora",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2560,
"maximum_size": 28672,
"protocol": "avr109",
"speed": 57600,
"use_1200bps_touch": true,
"wait_for_upload_port": true
}
},
"ethernet": {
"build": {
"board": "AVR_ETHERNET",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "ethernet"
},
"name": "Arduino Ethernet",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 32256,
"protocol": "arduino",
"speed": 115200
}
},
"fio": {
"build": {
"board": "AVR_FIO",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega328p",
"variant": "eightanaloginputs"
},
"name": "Arduino Fio",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 30720,
"protocol": "arduino",
"speed": 57600
}
},
"leonardo": {
"build": {
"board": "AVR_LEONARDO",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega32u4",
"pid": "0x8036",
"usb_product": "Arduino Leonardo",
"variant": "leonardo",
"vid": "0x2341"
},
"name": "Arduino Leonardo",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2560,
"maximum_size": 28672,
"protocol": "avr109",
"speed": 57600,
"use_1200bps_touch": true,
"wait_for_upload_port": true
}
},
"lilypadatmega168": {
"build": {
"board": "AVR_LILYPAD",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega168",
"variant": "standard"
},
"name": "LilyPad Arduino ATmega168",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 14336,
"protocol": "arduino",
"speed": 19200
}
},
"lilypadatmega328": {
"build": {
"board": "AVR_LILYPAD",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega328p",
"variant": "standard"
},
"name": "LilyPad Arduino ATmega328",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 30720,
"protocol": "arduino",
"speed": 57600
}
},
"megaADK": {
"build": {
"board": "AVR_ADK",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega2560",
"variant": "mega"
},
"name": "Arduino Mega ADK",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 8192,
"maximum_size": 253952,
"protocol": "wiring",
"speed": 115200
}
},
"megaatmega1280": {
"build": {
"board": "AVR_MEGA",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega1280",
"variant": "mega"
},
"name": "Arduino Mega or Mega 2560 ATmega1280",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 8192,
"maximum_size": 126976,
"protocol": "arduino",
"speed": 57600
}
},
"megaatmega2560": {
"build": {
"board": "AVR_MEGA2560",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega2560",
"variant": "mega"
},
"name": "Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 8192,
"maximum_size": 253952,
"protocol": "wiring",
"speed": 115200
}
},
"micro": {
"build": {
"board": "AVR_MICRO",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega32u4",
"pid": "0x8037",
"usb_product": "Arduino Micro",
"variant": "micro",
"vid": "0x2341"
},
"name": "Arduino Micro",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2560,
"maximum_size": 28672,
"protocol": "avr109",
"speed": 57600,
"use_1200bps_touch": true,
"wait_for_upload_port": true
}
},
"miniatmega168": {
"build": {
"board": "AVR_MINI",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega168",
"variant": "eightanaloginputs"
},
"name": "Arduino Mini ATmega168",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 14336,
"protocol": "arduino",
"speed": 19200
}
},
"miniatmega328": {
"build": {
"board": "AVR_MINI",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "eightanaloginputs"
},
"name": "Arduino Mini ATmega328",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 28672,
"protocol": "arduino",
"speed": 115200
}
},
"nanoatmega168": {
"build": {
"board": "AVR_NANO",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega168",
"variant": "eightanaloginputs"
},
"name": "Arduino Nano ATmega168",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 14336,
"protocol": "arduino",
"speed": 19200
}
},
"nanoatmega328": {
"build": {
"board": "AVR_NANO",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "eightanaloginputs"
},
"name": "Arduino Nano ATmega328",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 30720,
"protocol": "arduino",
"speed": 57600
}
},
"pro16MHzatmega168": {
"build": {
"board": "AVR_PRO",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega168",
"variant": "eightanaloginputs"
},
"name": "Arduino Pro or Pro Mini ATmega168 (5V, 16 MHz)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 14336,
"protocol": "arduino",
"speed": 19200
}
},
"pro16MHzatmega328": {
"build": {
"board": "AVR_PRO",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "eightanaloginputs"
},
"name": "Arduino Pro or Pro Mini ATmega328 (5V, 16 MHz)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 30720,
"protocol": "arduino",
"speed": 57600
}
},
"pro8MHzatmega168": {
"build": {
"board": "AVR_PRO",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega168",
"variant": "eightanaloginputs"
},
"name": "Arduino Pro or Pro Mini ATmega168 (3.3V, 8 MHz)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 14336,
"protocol": "arduino",
"speed": 19200
}
},
"pro8MHzatmega328": {
"build": {
"board": "AVR_PRO",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega328p",
"variant": "eightanaloginputs"
},
"name": "Arduino Pro or Pro Mini ATmega328 (3.3V, 8 MHz)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 30720,
"protocol": "arduino",
"speed": 57600
}
},
"robotControl": {
"build": {
"board": "AVR_ROBOT_CONTROL",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega32u4",
"pid": "0x8038",
"usb_product": "Robot Control",
"variant": "robot_control",
"vid": "0x2341"
},
"name": "Arduino Robot Control",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2560,
"maximum_size": 28672,
"protocol": "avr109",
"speed": 57600,
"use_1200bps_touch": true,
"wait_for_upload_port": true
}
},
"robotMotor": {
"build": {
"board": "AVR_ROBOT_MOTOR",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega32u4",
"pid": "0x8039",
"usb_product": "Robot Motor",
"variant": "robot_motor",
"vid": "0x2341"
},
"name": "Arduino Robot Motor",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2560,
"maximum_size": 28672,
"protocol": "avr109",
"speed": 57600,
"use_1200bps_touch": true,
"wait_for_upload_port": true
}
},
"uno": {
"build": {
"board": "AVR_UNO",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "standard"
},
"name": "Arduino Uno",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 32256,
"protocol": "arduino",
"speed": 115200
}
},
"yun": {
"build": {
"board": "AVR_YUN",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega32u4",
"pid": "0x8041",
"usb_product": "Arduino Yun",
"variant": "yun",
"vid": "0x2341"
},
"name": "Arduino Yun",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2560,
"maximum_size": 28672,
"protocol": "avr109",
"speed": 57600,
"use_1200bps_touch": true,
"via_ssh": true,
"wait_for_upload_port": true
}
}
}

View File

@ -0,0 +1,71 @@
{
"engduinov1": {
"build": {
"board": "AVR_ENGDUINOV1",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega32u4",
"pid": "0x9208",
"usb_product": "EngduinoV1",
"variant": "engduinov1",
"vid": "0x1B4F"
},
"name": "Engduino 1",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2560,
"maximum_size": 28672,
"protocol": "avr109",
"speed": 57600,
"use_1200bps_touch": true,
"wait_for_upload_port": true
}
},
"engduinov2": {
"build": {
"board": "AVR_ENGDUINOV2",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega32u4",
"pid": "0x9208",
"usb_product": "EngduinoV2",
"variant": "engduinov2",
"vid": "0x1B4F"
},
"name": "Engduino 2",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2560,
"maximum_size": 28672,
"protocol": "avr109",
"speed": 57600,
"use_1200bps_touch": true,
"wait_for_upload_port": true
}
},
"engduinov3": {
"build": {
"board": "AVR_ENGDUINOV3",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega32u4",
"pid": "0x9208",
"usb_product": "EngduinoV3",
"variant": "engduinov3",
"vid": "0x1B4F"
},
"name": "Engduino 3",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2560,
"maximum_size": 28672,
"protocol": "avr109",
"speed": 57600,
"use_1200bps_touch": true,
"wait_for_upload_port": true
}
}
}

View File

@ -0,0 +1,160 @@
{
"1284p16m": {
"build": {
"board": "AVR_MICRODUINO_CORE_PLUS",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega1284p",
"variant": "plus"
},
"name": "Microduino Core+ (ATmega1284P@16M,5V)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 16384,
"maximum_size": 130048,
"protocol": "arduino",
"speed": 115200
}
},
"1284p8m": {
"build": {
"board": "AVR_MICRODUINO_CORE_PLUS",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega1284p",
"variant": "plus"
},
"name": "Microduino Core+ (ATmega1284P@8M,3.3V)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 16384,
"maximum_size": 130048,
"protocol": "arduino",
"speed": 57600
}
},
"168pa16m": {
"build": {
"board": "AVR_MICRODUINO_CORE",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega168p",
"variant": "standard"
},
"name": "Microduino Core (Atmega168PA@16M,5V)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 15872,
"protocol": "arduino",
"speed": 115200
}
},
"168pa8m": {
"build": {
"board": "AVR_MICRODUINO_CORE",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega168p",
"variant": "standard"
},
"name": "Microduino Core (Atmega168PA@8M,3.3V)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 15872,
"protocol": "arduino",
"speed": 57600
}
},
"328p16m": {
"build": {
"board": "AVR_MICRODUINO_CORE",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "standard"
},
"name": "Microduino Core (Atmega328P@16M,5V)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 32256,
"protocol": "arduino",
"speed": 115200
}
},
"328p8m": {
"build": {
"board": "AVR_MICRODUINO_CORE",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega328p",
"variant": "standard"
},
"name": "Microduino Core (Atmega328P@8M,3.3V)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 32256,
"protocol": "arduino",
"speed": 57600
}
},
"32u416m": {
"build": {
"board": "AVR_MICRODUINO_CORE_USB",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega32u4",
"pid": "0x8036",
"variant": "32u4",
"vid": "0x2341"
},
"name": "Microduino Core USB (ATmega32U4@16M,5V)",
"platform": "atmelavr",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 2560,
"maximum_size": 28672,
"protocol": "avr109",
"speed": 57600,
"use_1200bps_touch": true,
"wait_for_upload_port": true
}
},
"644pa16m": {
"build": {
"board": "AVR_MICRODUINO_CORE_PLUS",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega644p",
"variant": "plus"
},
"name": "Microduino Core+ (Atmega644PA@16M,5V)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 4096,
"maximum_size": 64512,
"protocol": "arduino",
"speed": 115200
}
},
"644pa8m": {
"build": {
"board": "AVR_MICRODUINO_CORE_PLUS",
"core": "arduino",
"f_cpu": "8000000L",
"mcu": "atmega644p",
"variant": "plus"
},
"name": "Microduino Core+ (Atmega644PA@8M,3.3V)",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 4096,
"maximum_size": 64512,
"protocol": "arduino",
"speed": 57600
}
}
}

View File

@ -0,0 +1,19 @@
{
"raspduino": {
"build": {
"board": "AVR_RASPDUINO",
"core": "arduino",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "standard"
},
"name": "Raspduino",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,
"maximum_size": 30720,
"protocol": "arduino",
"speed": 57600
}
}
}

View File

@ -0,0 +1,107 @@
{
"lpmsp430f5529": {
"build": {
"core": "msp430",
"f_cpu": "16000000L",
"mcu": "msp430f5529",
"variant": "launchpad_f5529"
},
"name": "LaunchPad w/ msp430f5529 (16MHz)",
"platform": "timsp430",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 131072,
"protocol": "tilib"
}
},
"lpmsp430f5529_25": {
"build": {
"core": "msp430",
"f_cpu": "25000000L",
"mcu": "msp430f5529",
"variant": "launchpad_f5529"
},
"name": "LaunchPad w/ msp430f5529 (25MHz)",
"platform": "timsp430",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 131072,
"protocol": "tilib"
}
},
"lpmsp430fr5739": {
"build": {
"core": "msp430",
"f_cpu": "16000000L",
"mcu": "msp430fr5739",
"variant": "fraunchpad"
},
"name": "FraunchPad w/ msp430fr5739",
"platform": "timsp430",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 15872,
"protocol": "rf2500"
}
},
"lpmsp430fr5969": {
"build": {
"core": "msp430",
"f_cpu": "8000000L",
"mcu": "msp430fr5969",
"variant": "launchpad_fr5969"
},
"name": "LaunchPad w/ msp430fr5969",
"platform": "timsp430",
"upload": {
"maximum_ram_size": 1024,
"maximum_size": 65536,
"protocol": "tilib"
}
},
"lpmsp430g2231": {
"build": {
"core": "msp430",
"f_cpu": "1000000L",
"mcu": "msp430g2231",
"variant": "launchpad"
},
"name": "LaunchPad w/ msp430g2231 (1MHz)",
"platform": "timsp430",
"upload": {
"maximum_ram_size": 128,
"maximum_size": 2048,
"protocol": "rf2500"
}
},
"lpmsp430g2452": {
"build": {
"core": "msp430",
"f_cpu": "16000000L",
"mcu": "msp430g2452",
"variant": "launchpad"
},
"name": "LaunchPad w/ msp430g2452 (16MHz)",
"platform": "timsp430",
"upload": {
"maximum_ram_size": 256,
"maximum_size": 8192,
"protocol": "rf2500"
}
},
"lpmsp430g2553": {
"build": {
"core": "msp430",
"f_cpu": "16000000L",
"mcu": "msp430g2553",
"variant": "launchpad"
},
"name": "LaunchPad w/ msp430g2553 (16MHz)",
"platform": "timsp430",
"upload": {
"maximum_ram_size": 512,
"maximum_size": 16384,
"protocol": "rf2500"
}
}
}

View File

@ -0,0 +1,47 @@
{
"lplm4f120h5qr": {
"build": {
"core": "lm4f",
"f_cpu": "80000000L",
"ldscript": "lm4fcpp_blizzard.ld",
"mcu": "cortex-m4",
"variant": "stellarpad"
},
"name": "LaunchPad (Stellaris) w/ lm4f120 (80MHz)",
"platform": "titiva",
"upload": {
"maximum_ram_size": 32768,
"maximum_size": 262144
}
},
"lptm4c1230c3pm": {
"build": {
"core": "lm4f",
"f_cpu": "80000000L",
"ldscript": "lm4fcpp_blizzard.ld",
"mcu": "cortex-m4",
"variant": "stellarpad"
},
"name": "LaunchPad (Tiva C) w/ tm4c123 (80MHz)",
"platform": "titiva",
"upload": {
"maximum_ram_size": 32768,
"maximum_size": 262144
}
},
"lptm4c1294ncpdt": {
"build": {
"core": "lm4f",
"f_cpu": "120000000L",
"ldscript": "lm4fcpp_snowflake.ld",
"mcu": "cortex-m4",
"variant": "launchpad_129"
},
"name": "LaunchPad (Tiva C) w/ tm4c129 (120MHz)",
"platform": "titiva",
"upload": {
"maximum_ram_size": 262144,
"maximum_size": 1048576
}
}
}

View File

@ -2,30 +2,36 @@
# See LICENSE for details.
try:
from platformio.util import get_home_dir
from platformio import util
except ImportError:
import sys
for _path in sys.path:
if "platformio" in _path:
sys.path.insert(0, _path[:_path.rfind("platformio")-1])
break
from platformio.util import get_home_dir
from platformio import util
from os.path import isdir, join
from os.path import join
from SCons.Script import (DefaultEnvironment, Exit, SConscript,
SConscriptChdir, Variables)
from SCons.Script import (DefaultEnvironment, SConscript, SConscriptChdir,
Variables)
from platformio.util import (get_lib_dir, get_pioenvs_dir, get_project_dir,
get_source_dir)
# AllowSubstExceptions()
# allow common variables from INI file
commonvars = Variables(None)
commonvars.AddVariables(
("BUILD_SCRIPT",),
("PIOENV",),
("PLATFORM",),
# package aliases
("PIOPACKAGE_TOOLCHAIN",),
("PIOPACKAGE_UPLOADER",),
("PIOPACKAGE_FRAMEWORK",),
# options
("FRAMEWORK",),
("BUILD_FLAGS",),
("SRCBUILD_FLAGS",),
@ -42,36 +48,47 @@ commonvars.AddVariables(
)
DefaultEnvironment(
tools=["default", "platformio"],
tools=["gcc", "g++", "ar", "gnulink", "platformio"],
toolpath=[join("$PIOBUILDER_DIR", "tools")],
variables=commonvars,
PIOBUILDER_DIR=join(get_source_dir(), "builder"),
PROJECT_DIR=get_project_dir(),
PIOENVS_DIR=get_pioenvs_dir(),
PIOHOME_DIR=util.get_home_dir(),
PROJECT_DIR=util.get_project_dir(),
PIOENVS_DIR=util.get_pioenvs_dir(),
PLATFORMIOHOME_DIR=get_home_dir(),
PLATFORM_DIR=join("$PLATFORMIOHOME_DIR", "$PLATFORM"),
PLATFORMFW_DIR=join("$PLATFORM_DIR", "frameworks", "$FRAMEWORK"),
PLATFORMTOOLS_DIR=join("$PLATFORM_DIR", "tools"),
PIOBUILDER_DIR=join(util.get_source_dir(), "builder"),
PIOPACKAGES_DIR=join("$PIOHOME_DIR", "packages"),
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_FRAMEWORK"),
BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"),
LIBSOURCE_DIRS=[
join("$PROJECT_DIR", "lib"),
get_lib_dir(),
util.get_lib_dir(),
join("$PLATFORMFW_DIR", "libraries"),
]
)
env = DefaultEnvironment()
if not isdir(env['PLATFORMIOHOME_DIR']):
Exit("You haven't installed any platforms yet. Please use "
"`platformio install` command")
elif not isdir(env.subst("$PLATFORM_DIR")):
Exit("An '%s' platform hasn't been installed yet. Please use "
"`platformio install %s` command" % (env['PLATFORM'],
env['PLATFORM']))
if "BOARD" in env:
try:
env.Replace(BOARD_OPTIONS=util.get_boards(env.subst("$BOARD")))
except KeyError:
env.Exit("Error: Unknown board '%s'" % env.subst("$BOARD"))
if "BOARD_MCU" not in env:
env.Replace(BOARD_MCU="${BOARD_OPTIONS['build']['mcu']}")
if "BOARD_F_CPU" not in env:
env.Replace(BOARD_F_CPU="${BOARD_OPTIONS['build']['f_cpu']}")
if "UPLOAD_PROTOCOL" not in env:
env.Replace(UPLOAD_PROTOCOL="${BOARD_OPTIONS['upload']['protocol']}")
if "UPLOAD_SPEED" not in env:
env.Replace(UPLOAD_SPEED="${BOARD_OPTIONS['upload']['speed']}")
env.PrependENVPath(
"PATH",
env.subst(join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN", "bin"))
)
SConscriptChdir(0)
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "${PLATFORM}.py")))
SConscript(env.subst("$BUILD_SCRIPT"))

View File

@ -11,7 +11,7 @@ from time import sleep
from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default,
DefaultEnvironment, Exit)
from platformio.util import reset_serialport
from platformio.util import get_serialports
env = DefaultEnvironment()
@ -41,7 +41,10 @@ env.Replace(
"-mmcu=$BOARD_MCU"
],
CXXFLAGS=["-fno-exceptions"],
CXXFLAGS=[
"-fno-exceptions",
"-fno-threadsafe-statics"
],
CPPDEFINES=[
"F_CPU=$BOARD_F_CPU"
@ -53,13 +56,12 @@ env.Replace(
"-mmcu=$BOARD_MCU"
],
UPLOADER=join("$PLATFORMTOOLS_DIR", "avrdude", "avrdude"),
UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
UPLOADERFLAGS=[
"-V", # do not verify
"-q", # suppress progress output
"-D", # disable auto erase for flash memory
"-p", "$BOARD_MCU",
"-C", join("$PLATFORMTOOLS_DIR", "avrdude", "avrdude.conf"),
"-C", join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude.conf"),
"-c", "$UPLOAD_PROTOCOL",
"-b", "$UPLOAD_SPEED",
"-P", "$UPLOAD_PORT"
@ -101,7 +103,7 @@ env.Append(
)
def reset_device():
def before_upload():
def rpi_sysgpio(path, value):
with open(path, "w") as f:
@ -115,7 +117,19 @@ def reset_device():
rpi_sysgpio("/sys/class/gpio/gpio18/value", 0)
rpi_sysgpio("/sys/class/gpio/unexport", 18)
else:
return reset_serialport(env.subst("$UPLOAD_PORT"))
upload_options = env.get("BOARD_OPTIONS", {}).get("upload", {})
if not upload_options.get("disable_flushing", False):
env.FlushSerialBuffer("$UPLOAD_PORT")
before_ports = [i['port'] for i in get_serialports()]
if (upload_options.get("use_1200bps_touch", False) and
"UPLOAD_PORT" in env):
env.TouchSerialPort("$UPLOAD_PORT", 1200)
if upload_options.get("wait_for_upload_port", False):
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
CORELIBS = env.ProcessGeneral()
@ -147,7 +161,7 @@ else:
#
upload = env.Alias(["upload", "uploadlazy"], target_hex, [
lambda target, source, env: reset_device(), "$UPLOADHEXCMD"])
lambda target, source, env: before_upload(), "$UPLOADHEXCMD"])
AlwaysBuild(upload)
#
@ -155,7 +169,7 @@ AlwaysBuild(upload)
#
uploadeep = env.Alias("uploadeep", target_eep, [
lambda target, source, env: reset_device(), "$UPLOADEEPCMD"])
lambda target, source, env: before_upload(), "$UPLOADEEPCMD"])
AlwaysBuild(uploadeep)
#
@ -164,9 +178,19 @@ AlwaysBuild(uploadeep)
is_uptarget = (set(["upload", "uploadlazy", "uploadeep"]) &
set(COMMAND_LINE_TARGETS))
if is_uptarget and not env.subst("$UPLOAD_PORT"):
Exit("Please specify environment 'upload_port' or use global "
"--upload-port option.")
if is_uptarget:
# try autodetect upload port
if "UPLOAD_PORT" not in env:
for item in get_serialports():
if "VID:PID" in item['hwid']:
print "Auto-detected UPLOAD_PORT: %s" % item['port']
env.Replace(UPLOAD_PORT=item['port'])
break
if "UPLOAD_PORT" not in env:
Exit("Please specify environment 'upload_port' or use global "
"--upload-port option.")
#
# Setup default targets

View File

@ -12,59 +12,48 @@ from SCons.Script import Import, Return
env = None
Import("env")
BOARD_OPTIONS = env.ParseBoardOptions(
join("$PLATFORMFW_DIR", "boards.txt"),
"${BOARD}"
)
ARDUINO_VERSION = int(
open(join(env.subst("$PLATFORMFW_DIR"),
"version.txt")).read().replace(".", "").strip())
# usb flags
ARDUINO_USBDEFINES = []
if "build.usb_product" in BOARD_OPTIONS:
if "usb_product" in env.subst("${BOARD_OPTIONS['build']}"):
ARDUINO_USBDEFINES = [
"USB_VID=%s" % BOARD_OPTIONS['build.vid'],
"USB_PID=%s" % BOARD_OPTIONS['build.pid'],
"USB_PRODUCT=%s" % BOARD_OPTIONS['build.usb_product'].replace('"', "")
"USB_VID=${BOARD_OPTIONS['build']['vid']}",
"USB_PID=${BOARD_OPTIONS['build']['pid']}",
'USB_PRODUCT=\\"%s\\"' % (env.subst(
"${BOARD_OPTIONS['build']['usb_product']}").replace('"', ""))
]
# include board variant
env.VariantDir(
join("$BUILD_DIR", "variant"),
join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant'])
join("$BUILD_DIR", "FrameworkArduinoVariant"),
join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}")
)
env.Append(
CPPDEFINES=[
"ARDUINO_ARCH_%s" % env.subst("$PLATFORM").upper()[-3:],
"ARDUINO=%d" % ARDUINO_VERSION,
"ARDUINO_%s" % BOARD_OPTIONS['build.board']
"ARDUINO_${BOARD_OPTIONS['build']['board']}"
] + ARDUINO_USBDEFINES,
CPPPATH=[
join("$BUILD_DIR", "core"),
join("$BUILD_DIR", "variant")
join("$BUILD_DIR", "FrameworkArduino"),
join("$BUILD_DIR", "FrameworkArduinoVariant")
]
)
if "BOARD_MCU" not in env:
env.Replace(BOARD_MCU=BOARD_OPTIONS['build.mcu'])
if "BOARD_F_CPU" not in env:
env.Replace(BOARD_F_CPU=BOARD_OPTIONS['build.f_cpu'])
if "UPLOAD_PROTOCOL" not in env:
env.Replace(UPLOAD_PROTOCOL=BOARD_OPTIONS['upload.protocol'])
if "UPLOAD_SPEED" not in env:
env.Replace(UPLOAD_SPEED=BOARD_OPTIONS['upload.speed'])
libs = []
#
# Target: Build Core Library
#
libs = []
libs.append(env.BuildLibrary(
join("$BUILD_DIR", "core"),
join("$PLATFORMFW_DIR", "cores", BOARD_OPTIONS['build.core'])
join("$BUILD_DIR", "FrameworkArduino"),
join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}")
))
Return("libs")

View File

@ -12,18 +12,14 @@ from SCons.Script import Import, Return
env = None
Import("env")
BOARD_OPTIONS = env.ParseBoardOptions(
join("$PLATFORMFW_DIR", "boards.txt"),
"${BOARD}"
)
ENERGIA_VERSION = int(
open(join(env.subst("$PLATFORMFW_DIR"),
"version.txt")).read().replace(".", "").strip())
# include board variant
env.VariantDir(
join("$BUILD_DIR", "variant"),
join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant'])
join("$BUILD_DIR", "FrameworkEnergiaVariant"),
join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}")
)
env.Append(
@ -32,36 +28,30 @@ env.Append(
"ENERGIA=%d" % ENERGIA_VERSION
],
CPPPATH=[
join("$BUILD_DIR", "core"),
join("$BUILD_DIR", "variant")
join("$BUILD_DIR", "FrameworkEnergia"),
join("$BUILD_DIR", "FrameworkEnergiaVariant")
]
)
if "BOARD_MCU" not in env:
env.Replace(BOARD_MCU=BOARD_OPTIONS['build.mcu'])
if "BOARD_F_CPU" not in env:
env.Replace(BOARD_F_CPU=BOARD_OPTIONS['build.f_cpu'])
if "UPLOAD_PROTOCOL" not in env and "upload.protocol" in BOARD_OPTIONS:
env.Replace(UPLOAD_PROTOCOL=BOARD_OPTIONS['upload.protocol'])
# specific linker script for TIVA devices
if "ldscript" in BOARD_OPTIONS:
if "ldscript" in env.subst("${BOARD_OPTIONS['build']}"):
env.Append(
LINKFLAGS=["-T", join("$PLATFORMFW_DIR", "cores",
BOARD_OPTIONS['build.core'],
BOARD_OPTIONS['ldscript'])]
LINKFLAGS=["-T", join(
"$PLATFORMFW_DIR", "cores",
"${BOARD_OPTIONS['build']['core']}",
"${BOARD_OPTIONS['build']['ldscript']}")]
)
libs = []
#
# Target: Build Core Library
#
libs = []
libs.append(env.BuildLibrary(
join("$BUILD_DIR", "core"),
join("$PLATFORMFW_DIR", "cores", BOARD_OPTIONS['build.core'])
join("$BUILD_DIR", "FrameworkEnergia"),
join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}")
))
Return("libs")

View File

@ -51,7 +51,7 @@ env.Replace(
"-Wl,-gc-sections,-u,main"
],
UPLOADER=join("$PLATFORMTOOLS_DIR", "mspdebug", "mspdebug"),
UPLOADER=join("$PIOPACKAGES_DIR", "tool-mspdebug", "mspdebug"),
UPLOADERFLAGS=[
"$UPLOAD_PROTOCOL" if system() != "Windows" else "tilib",
"--force-reset"

View File

@ -71,7 +71,7 @@ env.Replace(
"-fsingle-precision-constant"
],
UPLOADER=join("$PLATFORMTOOLS_DIR", "lm4flash", "lm4flash"),
UPLOADER=join("$PIOPACKAGES_DIR", "tool-lm4flash", "lm4flash"),
UPLOADCMD="$UPLOADER $SOURCES"
)

View File

@ -2,11 +2,16 @@
# See LICENSE for details.
import atexit
import platform
import re
from os import getenv, listdir, remove, walk
from os.path import basename, isdir, isfile, join
from time import sleep
from SCons.Script import SConscript, SConscriptChdir
from SCons.Script import Exit, SConscript, SConscriptChdir
from serial import Serial
from platformio.util import get_serialports
def ProcessGeneral(env):
@ -14,14 +19,9 @@ def ProcessGeneral(env):
if "BUILD_FLAGS" in env:
env.MergeFlags(env['BUILD_FLAGS'])
env.PrependENVPath(
"PATH",
join(env.subst("$PLATFORMTOOLS_DIR"), "toolchain", "bin")
)
if "FRAMEWORK" in env:
if env['FRAMEWORK'] in ("arduino", "energia"):
env.ConvertInotoCpp()
env.ConvertInoToCpp()
SConscriptChdir(0)
corelibs = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts",
"frameworks", "${FRAMEWORK}.py")),
@ -34,10 +34,8 @@ def BuildFirmware(env, corelibs):
vdirs = src.VariantDirRecursive(
join("$BUILD_DIR", "src"), join("$PROJECT_DIR", "src"))
# build source's dependent libs
deplibs = []
for vdir in vdirs:
deplibs += src.BuildDependentLibraries(vdir)
# build dependent libs
deplibs = src.BuildDependentLibraries(vdirs)
src.MergeFlags(getenv("PIOSRCBUILD_FLAGS", "$SRCBUILD_FLAGS"))
@ -67,50 +65,70 @@ def BuildLibrary(env, variant_dir, library_dir):
)
def BuildDependentLibraries(env, src_dir):
def BuildDependentLibraries(env, src_dirs):
libs = []
deplibs = env.GetDependentLibraries(src_dir)
deplibs = env.GetDependentLibraries(src_dirs)
env.Append(CPPPATH=[join("$BUILD_DIR", l) for (l, _) in deplibs])
for (libname, lsd_dir) in deplibs:
for (libname, inc_dir) in deplibs:
lib = env.BuildLibrary(
join("$BUILD_DIR", libname), join(lsd_dir, libname))
join("$BUILD_DIR", libname), inc_dir)
env.Clean(libname, lib)
libs.append(lib)
return libs
def GetDependentLibraries(env, src_dir):
def GetDependentLibraries(env, src_dirs):
includes = {}
nodes = []
regexp = re.compile(r"^\s*#include\s+(?:\<|\")([^\>\"\']+)(?:\>|\")", re.M)
for node in env.GlobCXXFiles(src_dir):
for item in src_dirs:
nodes += env.GlobCXXFiles(item)
nodes += env.Glob(join(item, "*.h"))
for node in nodes:
env.ParseIncludesRecurive(regexp, node, includes)
includes = sorted(includes.items(), key=lambda s: s[0])
result = []
for i in includes:
item = (i[1][1], i[1][2])
if item in result:
continue
result.append(item)
items = [(i[1][1], i[1][2])]
if isdir(join(items[0][1], "utility")):
items.append(("%sUtility" % items[0][0],
join(items[0][1], "utility")))
for item in items:
if item in result:
continue
result.append(item)
return result
def ParseIncludesRecurive(env, regexp, source_file, includes):
matches = regexp.findall(source_file.get_text_contents())
for inc_name in matches:
if inc_name in includes:
for inc_fname in matches:
if inc_fname in includes:
continue
for lsd_dir in env['LIBSOURCE_DIRS']:
lsd_dir = env.subst(lsd_dir)
if not isdir(lsd_dir):
continue
for libname in listdir(lsd_dir):
inc_path = join(lsd_dir, libname, inc_name)
if not isfile(inc_path):
inc_dir = join(lsd_dir, libname)
inc_file = join(inc_dir, inc_fname)
if not isfile(inc_file):
# if source code is in "src" dir
inc_dir = join(lsd_dir, libname, "src")
inc_file = join(inc_dir, inc_fname)
if not isfile(inc_file):
continue
includes[inc_name] = (len(includes) + 1, libname, lsd_dir)
env.ParseIncludesRecurive(regexp, env.File(inc_path), includes)
includes[inc_fname] = (len(includes) + 1, libname, inc_dir)
env.ParseIncludesRecurive(regexp, env.File(inc_file), includes)
def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True):
@ -126,39 +144,7 @@ def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True):
return variants
def ParseBoardOptions(env, path, name):
path = env.subst(path)
name = env.subst(name)
if not isfile(path):
env.Exit("Invalid path to boards.txt -> %s" % path)
data = {}
with open(path) as f:
for line in f:
if not line.strip() or line[0] == "#":
continue
_group = line[:line.index(".")]
_cpu = name[len(_group):]
line = line[len(_group)+1:].strip()
if _group != name[:len(_group)]:
continue
elif "menu.cpu." in line:
if _cpu not in line:
continue
else:
line = line[len(_cpu)+10:]
if "=" in line:
opt, value = line.split("=", 1)
data[opt] = value
if not data:
env.Exit("Unknown Board '%s'" % name)
else:
return data
def ConvertInotoCpp(env):
def ConvertInoToCpp(env):
def delete_tmpcpp(files):
for f in files:
@ -173,22 +159,29 @@ def ConvertInotoCpp(env):
continue
ino_contents = item.get_text_contents()
# fetch prototypes
regexp = re.compile(
re_includes = re.compile(r"^(#include\s+(?:\<|\")[^\r\n]+)",
re.M | re.I)
includes = re_includes.findall(ino_contents)
prototypes = re.findall(
r"""^(
(?:\s*[a-z_\d]+){1,2} # return type
\s+[a-z_\d]+\s* # name of prototype
\([a-z_,\.\*\&\[\]\s\d]*\) # args
)\s*\{ # must end with {
""",
ino_contents,
re.X | re.M | re.I
)
prototypes = regexp.findall(ino_contents)
# print prototypes
# print includes, prototypes
# disable previous includes
ino_contents = re_includes.sub(r"//\1", ino_contents)
# create new temporary C++ valid file
with open(cppfile, "w") as f:
f.write("#include <Arduino.h>\n")
if includes:
f.write("%s\n" % "\n".join(includes))
if prototypes:
f.write("%s;\n" % ";\n".join(prototypes))
f.write("#line 1 \"%s\"\n" % basename(item.path))
@ -199,6 +192,47 @@ def ConvertInotoCpp(env):
atexit.register(delete_tmpcpp, tmpcpp)
def FlushSerialBuffer(env, port):
s = Serial(env.subst(port))
s.flushInput()
s.setDTR(False)
s.setRTS(False)
sleep(0.1)
s.setDTR(True)
s.setRTS(True)
s.close()
def TouchSerialPort(env, port, baudrate):
s = Serial(port=env.subst(port), baudrate=baudrate)
s.close()
if platform.system() != "Darwin":
sleep(0.3)
def WaitForNewSerialPort(_, before):
new_port = None
elapsed = 0
while elapsed < 10:
now = [i['port'] for i in get_serialports()]
diff = list(set(now) - set(before))
if diff:
new_port = diff[0]
break
before = now
sleep(0.25)
elapsed += 0.25
if not new_port:
Exit("Error: Couldn't find a board on the selected port. "
"Check that you have the correct port selected. "
"If it is correct, try pressing the board's reset "
"button after initiating the upload.")
return new_port
def exists(_):
return True
@ -212,6 +246,8 @@ def generate(env):
env.AddMethod(GetDependentLibraries)
env.AddMethod(ParseIncludesRecurive)
env.AddMethod(VariantDirRecursive)
env.AddMethod(ParseBoardOptions)
env.AddMethod(ConvertInotoCpp)
env.AddMethod(ConvertInoToCpp)
env.AddMethod(FlushSerialBuffer)
env.AddMethod(TouchSerialPort)
env.AddMethod(WaitForNewSerialPort)
return env

View File

@ -0,0 +1,60 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import json
import click
from platformio.util import get_boards
@click.command("list", short_help="Pre-configured Embedded Boards")
@click.argument("query", required=False)
def cli(query):
BOARDLIST_TPL = ("{type:<30} {mcu:<13} {frequency:<8} "
" {flash:<7} {ram:<6} {name}")
grpboards = {}
for type_, data in get_boards().items():
if data['platform'] not in grpboards:
grpboards[data['platform']] = {}
grpboards[data['platform']][type_] = data
for (platform, boards) in grpboards.items():
if query:
search_data = json.dumps(boards).lower()
if query.lower() not in search_data.lower():
continue
click.echo("\nPlatform: %s" % platform)
click.echo("-" * 75)
click.echo(BOARDLIST_TPL.format(
type=click.style("Type", fg="cyan"), mcu="MCU",
frequency="Frequency", flash="Flash", ram="RAM", name="Name"))
click.echo("-" * 75)
for type_, data in sorted(boards.items(), key=lambda b: b[1]['name']):
if query:
search_data = "%s %s" % (type_, json.dumps(data).lower())
if query.lower() not in search_data.lower():
continue
flash_size = ""
if "maximum_size" in data.get("upload", None):
flash_size = int(data['upload']['maximum_size'])
flash_size = "%dKb" % (flash_size / 1024)
ram_size = ""
if "maximum_ram_size" in data.get("upload", None):
ram_size = int(data['upload']['maximum_ram_size'])
if ram_size >= 1024:
ram_size = "%dKb" % (ram_size / 1024)
else:
ram_size = "%dB" % ram_size
click.echo(BOARDLIST_TPL.format(
type=click.style(type_, fg="cyan"), mcu=data['build']['mcu'],
frequency="%dMhz" % (int(data['build']['f_cpu'][:-1])
/ 1000000),
flash=flash_size, ram=ram_size, name=data['name']))

View File

@ -1,30 +1,96 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os import makedirs
from os import getcwd, makedirs
from os.path import isdir, isfile, join
from shutil import copyfile
from click import command, secho
import click
from platformio.exception import ProjectInitialized
from platformio.util import get_source_dir
from platformio import app
from platformio.exception import ProjectInitialized, UnknownBoard
from platformio.util import get_boards, get_source_dir
@command("init", short_help="Initialize new PlatformIO based project")
def cli():
@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("--disable-auto-uploading", is_flag=True)
def cli(project_dir, board, disable_auto_uploading):
if isfile("platformio.ini") and isdir("src"):
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 ProjectInitialized()
for d in ("lib", "src"):
if not isdir(d):
makedirs(d)
if not isfile("platformio.ini"):
copyfile(join(get_source_dir(), "projectconftpl.ini"),
"platformio.ini")
secho("Project has been initialized!\n"
"Please put your source code to `src` directory, "
"external libraries to `lib` and "
"setup environments in `platformio.ini` file.\n"
"Then process project with `platformio run` command.",
fg="green")
builtin_boards = set(get_boards().keys())
if board and not set(board).issubset(builtin_boards):
raise UnknownBoard(", ".join(set(board).difference(builtin_boards)))
if project_dir == getcwd():
click.secho("The 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"
"You can specify another project directory via\n"
"`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.\n",
fg="yellow"
)
click.echo("The next files/directories will be created in %s" %
click.style(project_dir, fg="cyan"))
click.echo("%s - Project Configuration File" %
click.style("platformio.ini", fg="cyan"))
click.echo("%s - a source directory. Put your source code here" %
click.style("src", fg="cyan"))
click.echo("%s - a directory for the project specific 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!\n"
"Now you can process it with `platformio run` command.",
fg="green"
)
else:
click.secho("Aborted by user", fg="red")
def fill_project_envs(project_file, board_types, disable_auto_uploading):
builtin_boards = get_boards()
content = []
for type_ in board_types:
if type_ not in builtin_boards:
continue
else:
content.append("")
data = builtin_boards[type_]
framework = data.get("build", {}).get("core", None)
if framework in ("msp430", "lm4f"):
framework = "energia"
content.append("[env:autogen_%s]" % type_)
content.append("platform = %s" % data['platform'])
if framework:
content.append("framework = %s" % framework)
content.append("board = %s" % type_)
content.append("%stargets = upload" % ("# " if disable_auto_uploading
else ""))
with open(project_file, "a") as f:
f.write("\n".join(content))

View File

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

View File

@ -3,10 +3,37 @@
import click
from platformio.exception import LibAlreadyInstalledError
from platformio import app, exception
from platformio.libmanager import LibraryManager
from platformio.util import get_api_result, get_lib_dir
LIBLIST_TPL = ("[{id:^14}] {name:<25} {compatibility:<30} "
"\"{authornames}\": {description}")
def echo_liblist_header():
click.echo(LIBLIST_TPL.format(
id=click.style("ID", fg="green"),
name=click.style("Name", fg="cyan"),
compatibility=click.style("Compatibility", fg="yellow"),
authornames="Authors",
description="Description"
))
click.echo("-" * 85)
def echo_liblist_item(item):
click.echo(LIBLIST_TPL.format(
id=click.style(str(item['id']), fg="green"),
name=click.style(item['name'], fg="cyan"),
compatibility=click.style(
", ".join(item['frameworks'] + item['platforms']),
fg="yellow"
),
authornames=", ".join(item['authornames']),
description=item['description']
))
@click.group(short_help="Library Manager")
def cli():
@ -16,27 +43,46 @@ def cli():
@cli.command("search", short_help="Search for library")
@click.option("-a", "--author", multiple=True)
@click.option("-k", "--keyword", multiple=True)
@click.argument("query")
def lib_search(query, author, keyword):
for key, values in dict(author=author, keyword=keyword).iteritems():
@click.option("-f", "--framework", multiple=True)
@click.option("-p", "--platform", multiple=True)
@click.argument("query", required=False)
def lib_search(query, **filters):
if not query:
query = ""
for key, values in filters.iteritems():
for value in values:
query += ' %s:"%s"' % (key, value)
result = get_api_result("/lib/search", dict(query=query))
click.secho("Found %d libraries:" % result['total'],
if result['total'] == 0:
click.secho(
"Nothing has been found by your request\n"
"Try a less-specific search or use truncation (or wildcard) "
"operator", fg="yellow", nl=False)
click.secho(" *", fg="green")
click.secho("For example: DS*, PCA*, DHT* and etc.\n", fg="yellow")
click.echo("For more examples and advanced search syntax, "
"please use documentation:")
click.secho("http://docs.platformio.org"
"/en/latest/userguide/lib/cmd_search.html\n", fg="cyan")
return
click.secho("Found %d libraries:\n" % result['total'],
fg="green" if result['total'] else "yellow")
if result['total']:
echo_liblist_header()
while True:
for item in result['items']:
click.echo("{name:<30} {description}".format(
name=click.style(item['name'], fg="cyan"),
description=item['description']
))
echo_liblist_item(item)
if int(result['page'])*int(result['perpage']) >= int(result['total']):
break
if click.confirm("Show next libraries?"):
if (app.get_setting("enable_prompts") and
click.confirm("Show next libraries?")):
result = get_api_result(
"/lib/search",
dict(query=query, page=str(int(result['page']) + 1))
@ -46,91 +92,114 @@ def lib_search(query, author, keyword):
@cli.command("install", short_help="Install library")
@click.argument("names", nargs=-1)
@click.argument("libid", type=click.INT, nargs=-1, metavar="[LIBRARY_ID]")
@click.option("-v", "--version")
def lib_install_cli(names, version):
lib_install(names, version)
def lib_install(names, version=None):
@click.pass_context
def lib_install(ctx, libid, version):
lm = LibraryManager(get_lib_dir())
for name in names:
click.echo("Installing %s library:" % click.style(name, fg="cyan"))
for id_ in libid:
click.echo(
"Installing library [ %s ]:" % click.style(str(id_), fg="green"))
try:
if lm.install(name, version):
click.secho(
"The library '%s' has been successfully installed!" %
name, fg="green")
info = lm.get_info(name)
if "dependencies" in info:
click.secho("Installing dependencies:", fg="yellow")
lib_install(info['dependencies'])
if not lm.install(id_, version):
continue
except LibAlreadyInstalledError:
info = lm.get_info(id_)
click.secho(
"The library #%s '%s' has been successfully installed!"
% (str(id_), info['name']), fg="green")
if "dependencies" in info:
click.secho("Installing dependencies:", fg="yellow")
_dependencies = info['dependencies']
if not isinstance(_dependencies, list):
_dependencies = [_dependencies]
for item in _dependencies:
try:
lib_install_dependency(ctx, item)
except AssertionError:
raise exception.LibInstallDependencyError(str(item))
except exception.LibAlreadyInstalledError:
click.secho("Already installed", fg="yellow")
def lib_install_dependency(ctx, data):
assert isinstance(data, dict)
query = []
for key in data.keys():
if key in ("authors", "frameworks", "platforms", "keywords"):
values = data[key]
if not isinstance(values, list):
values = [v.strip() for v in values.split(",") if v]
for value in values:
query.append('%s:"%s"' % (key[:-1], value))
elif isinstance(data[key], basestring):
query.append('+"%s"' % data[key])
result = get_api_result("/lib/search", dict(query=" ".join(query)))
assert result['total'] == 1
ctx.invoke(lib_install, libid=[result['items'][0]['id']])
@cli.command("uninstall", short_help="Uninstall libraries")
@click.argument("names", nargs=-1)
def lib_uninstall_cli(names):
lib_uninstall(names)
def lib_uninstall_dependency(dependency):
@click.argument("libid", type=click.INT, nargs=-1)
def lib_uninstall(libid):
lm = LibraryManager(get_lib_dir())
for name in lm.get_installed():
info = lm.get_info(name)
if dependency in info.get("dependencies", []):
return
lib_uninstall([dependency])
def lib_uninstall(names):
lm = LibraryManager(get_lib_dir())
for name in names:
info = lm.get_info(name)
if lm.uninstall(name):
# find dependencies
if "dependencies" in info:
for d in info['dependencies']:
lib_uninstall_dependency(d)
click.secho("The library '%s' has been successfully "
"uninstalled!" % name, fg="green")
for id_ in libid:
info = lm.get_info(id_)
if lm.uninstall(id_):
click.secho("The library #%s '%s' has been successfully "
"uninstalled!" % (str(id_), info['name']), fg="green")
@cli.command("list", short_help="List installed libraries")
def lib_list():
@click.option("--json-output", is_flag=True)
def lib_list(json_output):
lm = LibraryManager(get_lib_dir())
for name in lm.get_installed():
info = lm.get_info(name)
click.echo("{name:<30} {description}".format(
name=click.style(info['name'], fg="cyan"),
description=info['description']
))
items = lm.get_installed().values()
if json_output:
click.echo(items)
return
if not items:
return
echo_liblist_header()
for item in items:
item['authornames'] = [i['name'] for i in item['authors']]
echo_liblist_item(item)
@cli.command("show", short_help="Show details about installed libraries")
@click.argument("name")
def lib_show(name):
@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())
info = lm.get_info(name)
info = lm.get_info(libid)
click.secho(info['name'], fg="cyan")
click.echo("-" * len(info['name']))
if "author" in info:
_authors = []
for author in info['authors']:
_data = []
for k in ("name", "email"):
if k in info['author'] and info['author'][k] is not None:
_value = info['author'][k]
if k == "email":
_value = "<%s>" % _value
_data.append(_value)
click.echo("Author: %s" % " ".join(_data))
for key in ("name", "email", "url", "maintainer"):
if not author[key]:
continue
if key == "email":
_data.append("<%s>" % author[key])
elif key == "maintainer":
_data.append("(maintainer)")
else:
_data.append(author[key])
_authors.append(" ".join(_data))
click.echo("Authors: %s" % ", ".join(_authors))
click.echo("Keywords: %s" % info['keywords'])
click.echo("Keywords: %s" % ", ".join(info['keywords']))
if "frameworks" in info:
click.echo("Frameworks: %s" % ", ".join(info['frameworks']))
if "platforms" in info:
click.echo("Platforms: %s" % ", ".join(info['platforms']))
click.echo("Version: %s" % info['version'])
click.echo()
click.echo(info['description'])
@ -138,18 +207,20 @@ def lib_show(name):
@cli.command("update", short_help="Update installed libraries")
def lib_update():
@click.pass_context
def lib_update(ctx):
lm = LibraryManager(get_lib_dir())
lib_names = lm.get_installed()
versions = get_api_result("/lib/version/" + ",".join(lib_names))
for id_, latest_version in (lm.get_latest_versions() or {}).items():
info = lm.get_info(int(id_))
for name in lib_names:
info = lm.get_info(name)
click.echo("Updating %s library:" % click.style(name, fg="yellow"))
click.echo("Updating [ %s ] %s library:" % (
click.style(id_, fg="yellow"),
click.style(info['name'], fg="cyan")))
current_version = info['version']
latest_version = versions[name]
if latest_version is None:
click.secho("Unknown library", fg="red")
continue
click.echo("Versions: Current=%s, Latest=%s \t " % (
current_version, latest_version), nl=False)
@ -160,13 +231,17 @@ def lib_update():
else:
click.echo("[%s]" % (click.style("Out-of-date", fg="red")))
lib_uninstall([name])
lib_install([name])
ctx.invoke(lib_uninstall, libid=[int(id_)])
ctx.invoke(lib_install, libid=[int(id_)])
@cli.command("register", short_help="Register new library")
@click.argument("config_url")
def lib_register(config_url):
if (not config_url.startswith("http://") and not
config_url.startswith("https://")):
raise exception.InvalidLibConfURL(config_url)
result = get_api_result("/lib/register", data=dict(config_url=config_url))
if "message" in result and result['message']:
click.secho(result['message'], fg="green" if "successed" in result and

View File

@ -1,16 +1,32 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from click import command, echo, style
import click
from platformio.pkgmanager import PackageManager
from platformio.platforms.base import PlatformFactory
@command("list", short_help="List installed platforms")
def cli():
@click.command("list", short_help="List installed platforms")
@click.option("--json-output", is_flag=True)
def cli(json_output):
for name, pkgs in PackageManager.get_installed().items():
echo("{name:<20} with packages: {pkgs}".format(
name=style(name, fg="cyan"),
pkgs=", ".join(pkgs.keys())
))
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(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

@ -1,60 +1,83 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from click import command, echo, option, secho, style
import click
from platformio.exception import (InvalidEnvName, ProjectEnvsNotAvaialable,
UndefinedEnvPlatform, UnknownEnvNames)
from platformio import app, exception, telemetry
from platformio.commands.install import cli as cmd_install
from platformio.platforms.base import PlatformFactory
from platformio.util import get_project_config
@command("run", short_help="Process project environments")
@option("--environment", "-e", multiple=True, metavar="<environment>")
@option("--target", "-t", multiple=True, metavar="<target>")
@option("--upload-port", metavar="<upload port>")
def cli(environment, target, upload_port):
@click.command("run", short_help="Process project environments")
@click.option("--environment", "-e", multiple=True, metavar="<environment>")
@click.option("--target", "-t", multiple=True, metavar="<target>")
@click.option("--upload-port", metavar="<upload port>")
@click.pass_context
def cli(ctx, environment, target, upload_port):
config = get_project_config()
if not config.sections():
raise ProjectEnvsNotAvaialable()
raise exception.ProjectEnvsNotAvailable()
unknown = set(environment) - set([s[4:] for s in config.sections()])
if unknown:
raise UnknownEnvNames(", ".join(unknown))
raise exception.UnknownEnvNames(", ".join(unknown))
for section in config.sections():
if section[:4] != "env:":
raise InvalidEnvName(section)
# skip main configuration section
if section == "platformio":
continue
elif section[:4] != "env:":
raise exception.InvalidEnvName(section)
envname = section[4:]
if environment and envname not in environment:
# echo("Skipped %s environment" % style(envname, fg="yellow"))
continue
echo("Processing %s environment:" % style(envname, fg="cyan"))
click.echo("Processing %s environment:" %
click.style(envname, fg="cyan"))
variables = ["PIOENV=" + envname]
if upload_port:
variables.append("UPLOAD_PORT=%s" % upload_port)
options = {}
for k, v in config.items(section):
k = k.upper()
if k == "TARGETS" or (k == "UPLOAD_PORT" and upload_port):
continue
variables.append("%s=%s" % (k.upper(), v))
options[k] = v
process_environment(ctx, envname, options, target, upload_port)
envtargets = []
if target:
envtargets = [t for t in target]
elif config.has_option(section, "targets"):
envtargets = config.get(section, "targets").split()
if not config.has_option(section, "platform"):
raise UndefinedEnvPlatform(envname)
def process_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))
p = PlatformFactory().newPlatform(config.get(section, "platform"))
result = p.run(variables, envtargets)
secho(result['out'], fg="green")
secho(result['err'],
fg="red" if "Error" in result['err'] else "yellow")
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)
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])
p = PlatformFactory.newPlatform(platform)
result = p.run(variables, envtargets)
click.secho(result['out'], fg="green")
click.secho(result['err'],
fg="red" if "Error" in result['err'] else "yellow")

View File

@ -1,23 +1,25 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from click import argument, command, echo, style
import click
from platformio.platforms.base import PlatformFactory
from platformio.util import get_platforms
@command("search", short_help="Search for development platforms")
@argument("query")
@click.command("search", short_help="Search for development platforms")
@click.argument("query", required=False)
def cli(query):
for platform in get_platforms():
p = PlatformFactory().newPlatform(platform)
for platform in PlatformFactory.get_platforms().keys():
p = PlatformFactory.newPlatform(platform)
name = p.get_name()
shinfo = p.get_short_info()
if query == "all":
query = ""
search_data = "%s %s" % (name, shinfo)
if query != "all" and query.lower() not in search_data.lower():
if query and query.lower() not in search_data.lower():
continue
echo("{name:<20} - {info}".format(name=style(name, fg="cyan"),
info=shinfo))
click.echo("{name:<20} - {info}".format(
name=click.style(name, fg="cyan"), info=shinfo))

View File

@ -3,65 +3,78 @@
import sys
from click import Choice, echo, group, option, secho
import click
from serial.tools import miniterm
from platformio.util import get_serialports
@group(short_help="List or Monitor Serial ports")
@click.group(short_help="List or Monitor Serial ports")
def cli():
pass
@cli.command("list", short_help="List Serial ports")
def serialports_list():
@click.option("--json-output", is_flag=True)
def serialports_list(json_output):
if json_output:
click.echo(get_serialports())
return
for item in get_serialports():
secho(item['port'], fg="cyan")
echo("----------")
echo("Hardware ID: %s" % item['hwid'])
echo("Description: %s" % item['description'])
echo("")
click.secho(item['port'], fg="cyan")
click.echo("----------")
click.echo("Hardware ID: %s" % item['hwid'])
click.echo("Description: %s" % item['description'])
click.echo("")
@cli.command("monitor", short_help="Monitor Serial port")
@option("--port", "-p", help="Port, a number or a device name")
@option("--baud", "-b", type=int, default=9600,
help="Set baud rate, default=9600")
@option("--parity", default="N", type=Choice(["N", "E", "O", "S", "M"]),
help="Set parity, default=N")
@option("--rtscts", is_flag=True,
help="Enable RTS/CTS flow control, default=Off")
@option("--xonxoff", is_flag=True,
help="Enable software flow control, default=Off")
@option("--rts", default="0", type=Choice(["0", "1"]),
help="Set initial RTS line state, default=0")
@option("--dtr", default="0", type=Choice(["0", "1"]),
help="Set initial DTR line state, default=0")
@option("--echo", is_flag=True,
help="Enable local echo, default=Off")
@option("--cr", is_flag=True,
help="Do not send CR+LF, send CR only, default=Off")
@option("--lf", is_flag=True,
help="Do not send CR+LF, send LF only, default=Off")
@option("--debug", "-d", count=True,
help="""Debug received data (escape non-printable chars)
@click.option("--port", "-p", help="Port, a number or a device name")
@click.option("--baud", "-b", type=int, default=9600,
help="Set baud rate, default=9600")
@click.option("--parity", default="N",
type=click.Choice(["N", "E", "O", "S", "M"]),
help="Set parity, default=N")
@click.option("--rtscts", is_flag=True,
help="Enable RTS/CTS flow control, default=Off")
@click.option("--xonxoff", is_flag=True,
help="Enable software flow control, default=Off")
@click.option("--rts", default="0", type=click.Choice(["0", "1"]),
help="Set initial RTS line state, default=0")
@click.option("--dtr", default="0", type=click.Choice(["0", "1"]),
help="Set initial DTR line state, default=0")
@click.option("--echo", is_flag=True,
help="Enable local echo, default=Off")
@click.option("--cr", is_flag=True,
help="Do not send CR+LF, send CR only, default=Off")
@click.option("--lf", is_flag=True,
help="Do not send CR+LF, send LF only, default=Off")
@click.option("--debug", "-d", count=True,
help="""Debug received data (escape non-printable chars)
# --debug can be given multiple times:
# 0: just print what is received
# 1: escape non-printable characters, do newlines as unusual
# 2: escape non-printable characters, newlines too
# 3: hex dump everything""")
@option("--exit-char", type=int, default=0x1d,
help="ASCII code of special character that is used to exit the "
"application, default=0x1d")
@option("--menu-char", type=int, default=0x14,
help="ASCII code of special character that is used to control "
"miniterm (menu), default=0x14")
@option("--quiet", is_flag=True,
help="Diagnostics: suppress non-error messages, default=Off")
def serialports_monitor(**_):
@click.option("--exit-char", type=int, default=0x1d,
help="ASCII code of special character that is used to exit the "
"application, default=0x1d")
@click.option("--menu-char", type=int, default=0x14,
help="ASCII code of special character that is used to control "
"miniterm (menu), default=0x14")
@click.option("--quiet", is_flag=True,
help="Diagnostics: suppress non-error messages, default=Off")
def serialports_monitor(**kwargs):
sys.argv = sys.argv[3:]
if not kwargs['port']:
for item in get_serialports():
if "VID:PID" in item['hwid']:
sys.argv += ["--port", item['port']]
break
try:
miniterm.main()
except: # pylint: disable=W0702

View File

@ -0,0 +1,68 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import click
from platformio import app
@click.group(short_help="Manage PlatformIO settings")
def cli():
pass
@cli.command("get", short_help="Get existing setting/-s")
@click.argument("name", required=False)
def settings_get(name):
list_tpl = "{name:<40} {value:<35} {description}"
click.echo(list_tpl.format(
name=click.style("Name", fg="cyan"),
value=(click.style("Value", fg="green") +
click.style(" [Default]", fg="yellow")),
description="Description"
))
click.echo("-" * 90)
for _name, _data in sorted(app.DEFAULT_SETTINGS.items()):
if name and name != _name:
continue
_value = app.get_setting(_name)
_value_str = str(_value)
if isinstance(_value, bool):
_value_str = "Yes" if _value else "No"
_value_str = click.style(_value_str, fg="green")
if _value != _data['value']:
_defvalue_str = str(_data['value'])
if isinstance(_data['value'], bool):
_defvalue_str = "Yes" if _data['value'] else "No"
_value_str += click.style(" [%s]" % _defvalue_str, fg="yellow")
else:
_value_str += click.style(" ", fg="yellow")
click.echo(list_tpl.format(
name=click.style(_name, fg="cyan"),
value=_value_str,
description=_data['description']
))
@cli.command("set", short_help="Set new value for the setting")
@click.argument("name")
@click.argument("value")
@click.pass_context
def settings_set(ctx, name, value):
app.set_setting(name, value)
click.secho("The new value for the setting has been set!", fg="green")
ctx.invoke(settings_get, name=name)
@cli.command("reset", short_help="Reset settings to default")
@click.pass_context
def settings_reset(ctx):
app.reset_settings()
click.secho("The settings have been reseted!", fg="green")
ctx.invoke(settings_get)

View File

@ -1,32 +1,45 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os.path import join
from datetime import datetime
from click import argument, command, echo, style
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
@command("show", short_help="Show details about installed platforms")
@argument("platform")
def cli(platform):
p = PlatformFactory().newPlatform(platform)
if platform not in PackageManager.get_installed():
raise PlatformNotInstalledYet(platform)
@click.command("show", short_help="Show details about installed platforms")
@click.argument("platform")
@click.pass_context
def cli(ctx, platform):
# print info about platform
echo("{name:<20} - {info}".format(name=style(p.get_name(), fg="cyan"),
info=p.get_short_info()))
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
pm = PackageManager(platform)
for name, data in pm.get_installed(platform).items():
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} - {info}".format(
name=click.style(p.get_name(), fg="cyan"), info=p.get_short_info()))
installed_packages = PackageManager.get_installed()
for name in p.get_installed_packages():
data = installed_packages[name]
pkgalias = p.get_pkg_alias(name)
echo("----------")
echo("Package: %s" % style(name, fg="yellow"))
click.echo("----------")
click.echo("Package: %s" % click.style(name, fg="yellow"))
if pkgalias:
echo("Alias: %s" % pkgalias)
echo("Location: %s" % join(pm.get_platform_dir(), data['path']))
echo("Version: %d" % int(data['version']))
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,23 +1,17 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from click import argument, command, secho
import click
from platformio.exception import PlatformNotInstalledYet
from platformio.pkgmanager import PackageManager
from platformio.platforms.base import PlatformFactory
@command("uninstall", short_help="Uninstall platforms")
@argument("platforms", nargs=-1)
@click.command("uninstall", short_help="Uninstall platforms")
@click.argument("platforms", nargs=-1)
def cli(platforms):
for platform in platforms:
if platform not in PackageManager.get_installed():
raise PlatformNotInstalledYet(platform)
p = PlatformFactory().newPlatform(platform)
p = PlatformFactory.newPlatform(platform)
if p.uninstall():
secho("The platform '%s' has been successfully "
"uninstalled!" % platform, fg="green")
click.secho("The platform '%s' has been successfully "
"uninstalled!" % platform, fg="green")

View File

@ -1,17 +1,20 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from click import command, echo, style
import click
from platformio.pkgmanager import PackageManager
from platformio.platforms.base import PlatformFactory
@command("update", short_help="Update installed platforms")
@click.command("update", short_help="Update installed platforms")
def cli():
for platform in PackageManager.get_installed().keys():
echo("\nPlatform %s" % style(platform, fg="cyan"))
echo("--------")
p = PlatformFactory().newPlatform(platform)
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

@ -1,15 +1,16 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from click import command, secho
from requests import get
import click
import requests
from platformio import __version__
from platformio.exception import GetLatestVersionError
from platformio.util import exec_command
@command("upgrade", short_help="Upgrade PlatformIO to the latest version")
@click.command("upgrade",
short_help="Upgrade PlatformIO to the latest version")
def cli():
try:
last = get_latest_version()
@ -17,14 +18,17 @@ def cli():
raise GetLatestVersionError()
if __version__ == last:
return secho("You're up-to-date!\nPlatformIO %s is currently the "
"newest version available." % __version__, fg="green")
return click.secho(
"You're up-to-date!\nPlatformIO %s is currently the "
"newest version available." % __version__, fg="green"
)
else:
result = exec_command(["pip", "install", "--upgrade", "platformio"])
secho(result['out'], fg="green")
secho(result['err'], fg="red")
click.secho(result['out'], fg="green")
click.secho(result['err'], fg="red")
def get_latest_version():
pkgdata = get("https://pypi.python.org/pypi/platformio/json").json()
pkgdata = requests.get(
"https://pypi.python.org/pypi/platformio/json").json()
return pkgdata['info']['version']

View File

@ -67,17 +67,17 @@ class FileDownloader(object):
dlsha1 = None
try:
res = check_output(["sha1sum", self._destination])
dlsha1 = res[:40]
dlsha1 = check_output(["sha1sum", self._destination])
except OSError:
try:
res = check_output(["shasum", "-a", "1", self._destination])
dlsha1 = res[:40]
dlsha1 = check_output(["shasum", "-a", "1", self._destination])
except OSError:
pass
if dlsha1 and sha1 != dlsha1:
raise FDSHASumMismatch(dlsha1, self._fname, sha1)
if dlsha1:
dlsha1 = dlsha1[1:41] if dlsha1.startswith("\\") else dlsha1[:40]
if sha1 != dlsha1:
raise FDSHASumMismatch(dlsha1, self._fname, sha1)
def _preserve_filemtime(self, lmdate):
timedata = parsedate_tz(lmdate)

View File

@ -26,7 +26,13 @@ class PlatformNotInstalledYet(PlatformioException):
class UnknownCLICommand(PlatformioException):
MESSAGE = "Unknown command '%s'"
MESSAGE = ("Unknown command '%s'. Please use `platformio --help`"
" to see all available commands")
class UnknownBoard(PlatformioException):
MESSAGE = "Unknown board type '%s'"
class UnknownPackage(PlatformioException):
@ -63,7 +69,7 @@ class FDSHASumMismatch(PlatformioException):
class NotPlatformProject(PlatformioException):
MESSAGE = "Not a PlatformIO project. Use `platformio init` command"
MESSAGE = "Not a PlatformIO project (%s). Use `platformio init` command"
class UndefinedEnvPlatform(PlatformioException):
@ -82,7 +88,7 @@ class ProjectInitialized(PlatformioException):
"Process it with `platformio run` command")
class ProjectEnvsNotAvaialable(PlatformioException):
class ProjectEnvsNotAvailable(PlatformioException):
MESSAGE = "Please setup environments in `platformio.ini` file."
@ -118,4 +124,43 @@ class LibAlreadyInstalledError(PlatformioException):
class LibNotInstalledError(PlatformioException):
MESSAGE = "Library '%s' has not been installed yet"
MESSAGE = "Library #%d has not been installed yet"
class LibInstallDependencyError(PlatformioException):
MESSAGE = "Error has been occurred for library dependency '%s'"
class InvalidLibConfURL(PlatformioException):
MESSAGE = "Invalid library config URL '%s'"
class BuildScriptNotFound(PlatformioException):
MESSAGE = "Invalid path '%s' to build script"
class InvalidSettingName(PlatformioException):
MESSAGE = "Invalid setting with the name '%s'"
class InvalidSettingValue(PlatformioException):
MESSAGE = "Invalid value '%s' for the setting '%s'"
class UpgraderFailed(PlatformioException):
MESSAGE = "An error occurred while upgrading PlatformIO"
class SConsNotInstalled(PlatformioException):
MESSAGE = (
"The PlatformIO and `scons` aren't installed properly. "
"Please use official installation manual: "
"http://docs.platformio.org/en/latest/installation.html"
)

View File

@ -2,11 +2,13 @@
# See LICENSE for details.
import json
from os import listdir, makedirs, remove
import re
from os import listdir, makedirs, remove, rename
from os.path import isdir, isfile, join
from shutil import rmtree
from tempfile import gettempdir
from platformio import telemetry
from platformio.downloader import FileDownloader
from platformio.exception import LibAlreadyInstalledError, LibNotInstalledError
from platformio.unpacker import FileUnpacker
@ -15,7 +17,7 @@ from platformio.util import get_api_result
class LibraryManager(object):
CONFIG_NAME = "library.json"
CONFIG_NAME = ".library.json"
def __init__(self, lib_dir):
self.lib_dir = lib_dir
@ -32,44 +34,78 @@ class LibraryManager(object):
return fu.start()
def get_installed(self):
items = []
for item in listdir(self.lib_dir):
conf_path = join(self.lib_dir, item, self.CONFIG_NAME)
if isfile(conf_path):
items.append(item)
items = {}
if not isdir(self.lib_dir):
return items
for dirname in listdir(self.lib_dir):
conf_path = join(self.lib_dir, dirname, self.CONFIG_NAME)
if not isfile(conf_path):
continue
with open(conf_path, "r") as f:
items[dirname] = json.load(f)
return items
def get_info(self, name):
conf_path = join(self.lib_dir, name, self.CONFIG_NAME)
if not isfile(conf_path):
raise LibNotInstalledError(name)
with open(conf_path, "r") as f:
return json.load(f)
def get_latest_versions(self):
lib_ids = [str(item['id']) for item in self.get_installed().values()]
if not lib_ids:
return None
return get_api_result("/lib/version/" + str(",".join(lib_ids)))
def is_installed(self, name):
return isfile(join(self.lib_dir, name, self.CONFIG_NAME))
def get_outdated(self):
outdated = []
for id_, latest_version in (self.get_latest_versions() or {}).items():
info = self.get_info(int(id_))
if latest_version != info['version']:
outdated.append(info['name'])
return outdated
def install(self, name, version=None):
if self.is_installed(name):
def get_info(self, id_):
for item in self.get_installed().values():
if "id" in item and item['id'] == id_:
return item
raise LibNotInstalledError(id_)
def is_installed(self, id_):
try:
return int(self.get_info(id_)['id']) == id_
except LibNotInstalledError:
return False
def install(self, id_, version=None):
if self.is_installed(id_):
raise LibAlreadyInstalledError()
_lib_dir = join(self.lib_dir, name)
if not isdir(_lib_dir):
makedirs(_lib_dir)
dlinfo = get_api_result("/lib/download/" + name, dict(version=version)
if version else None)
dlinfo = get_api_result("/lib/download/" + str(id_),
dict(version=version) if version else None)
dlpath = None
tmplib_dir = join(self.lib_dir, str(id_))
try:
dlpath = self.download(dlinfo['url'], gettempdir())
self.unpack(dlpath, _lib_dir)
if not isdir(tmplib_dir):
makedirs(tmplib_dir)
self.unpack(dlpath, tmplib_dir)
finally:
remove(dlpath)
if dlpath:
remove(dlpath)
return self.is_installed(name)
info = self.get_info(id_)
rename(tmplib_dir, join(self.lib_dir, "%s_ID%d" % (
re.sub(r"[^\da-z]+", "_", info['name'], flags=re.I), id_)))
def uninstall(self, name):
if self.is_installed(name):
rmtree(join(self.lib_dir, name))
return True
else:
raise LibNotInstalledError(name)
telemetry.on_event(
category="LibraryManager", action="Install",
label="#%d %s" % (id_, info['name'])
)
return True
def uninstall(self, id_):
for libdir, item in self.get_installed().iteritems():
if "id" in item and item['id'] == id_:
rmtree(join(self.lib_dir, libdir))
telemetry.on_event(
category="LibraryManager", action="Uninstall",
label="#%d %s" % (id_, item['name'])
)
return True
raise LibNotInstalledError(id_)

187
platformio/maintenance.py Normal file
View File

@ -0,0 +1,187 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import re
from os import remove
from os.path import isdir, isfile, join
from shutil import rmtree
from time import time
import click
from platformio import __version__, app, telemetry
from platformio.commands.install import cli as cmd_install
from platformio.commands.lib import lib_update as cmd_libraries_update
from platformio.commands.update import cli as cli_platforms_update
from platformio.commands.upgrade import get_latest_version
from platformio.exception import UpgraderFailed
from platformio.libmanager import LibraryManager
from platformio.platforms.base import PlatformFactory
from platformio.util import get_home_dir, get_lib_dir
def on_platformio_start(ctx):
telemetry.on_command(ctx)
after_upgrade(ctx)
check_platformio_upgrade()
check_internal_updates(ctx, "platforms")
check_internal_updates(ctx, "libraries")
def on_platformio_end(ctx, result): # pylint: disable=W0613
pass
def on_platformio_exception(e):
telemetry.on_exception(e)
class Upgrader(object):
def __init__(self, from_version, to_version):
self.from_version = self.version_to_int(from_version)
self.to_version = self.version_to_int(to_version)
@staticmethod
def version_to_int(version):
return int(re.sub(r"[^\d]+", "", version))
def run(self, ctx):
if self.from_version > self.to_version:
return True
result = [True]
for v in (90, ):
if self.from_version >= v:
continue
result.append(getattr(self, "_upgrade_to_%d" % v)(ctx))
return all(result)
def _upgrade_to_90(self, ctx): # pylint: disable=R0201
prev_platforms = []
# remove platform's folder (obsoleted package structure)
for name in PlatformFactory.get_platforms().keys():
pdir = join(get_home_dir(), name)
if not isdir(pdir):
continue
prev_platforms.append(name)
rmtree(pdir)
# remove unused files
for fname in (".pioupgrade", "installed.json"):
if isfile(join(get_home_dir(), fname)):
remove(join(get_home_dir(), fname))
if prev_platforms:
ctx.invoke(cmd_install, platforms=prev_platforms)
return True
def after_upgrade(ctx):
if app.get_state_item("last_version", None) == __version__:
return
# promotion
click.echo("\nIf you like %s, please:" % (
click.style("PlatformIO", fg="cyan")
))
click.echo(
"- %s us on Twitter to stay up-to-date "
"on the latest project news > %s" %
(click.style("follow", fg="cyan"),
click.style("https://twitter.com/PlatformIO_Org", fg="cyan"))
)
click.echo("- %s us a star on GitHub > %s" % (
click.style("give", fg="cyan"),
click.style("https://github.com/ivankravets/platformio", fg="cyan")
))
click.secho("Thanks a lot!\n", fg="green")
if not isdir(get_home_dir()):
return
click.secho("Please wait while upgrading PlatformIO ...",
fg="yellow")
last_version = app.get_state_item("last_version", "0.0.0")
u = Upgrader(last_version, __version__)
if u.run(ctx):
app.set_state_item("last_version", __version__)
click.secho("PlatformIO has been successfully upgraded to %s!\n" %
__version__, fg="green")
telemetry.on_event(category="Auto", action="Upgrade",
label="%s > %s" % (last_version, __version__))
else:
raise UpgraderFailed()
click.echo("")
def check_platformio_upgrade():
last_check = app.get_state_item("last_check", {})
interval = int(app.get_setting("check_platformio_interval")) * 3600 * 24
if (time() - interval) < last_check.get("platformio_upgrade", 0):
return
last_check['platformio_upgrade'] = int(time())
app.set_state_item("last_check", last_check)
latest_version = get_latest_version()
if (latest_version == __version__ or
Upgrader.version_to_int(latest_version) <
Upgrader.version_to_int(__version__)):
return
click.secho("There is a new version %s of PlatformIO available.\n"
"Please upgrade it via " % latest_version,
fg="yellow", nl=False)
click.secho("platformio upgrade", fg="cyan", nl=False)
click.secho(" command.\nChanges: ", fg="yellow", nl=False)
click.secho("http://docs.platformio.org/en/latest/history.html\n",
fg="cyan")
def check_internal_updates(ctx, what):
last_check = app.get_state_item("last_check", {})
interval = int(app.get_setting("check_%s_interval" % what)) * 3600 * 24
if (time() - interval) < last_check.get(what + "_update", 0):
return
last_check[what + '_update'] = int(time())
app.set_state_item("last_check", last_check)
outdated_items = []
if what == "platforms":
for platform in PlatformFactory.get_platforms(installed=True).keys():
p = PlatformFactory.newPlatform(platform)
if p.is_outdated():
outdated_items.append(platform)
elif what == "libraries":
lm = LibraryManager(get_lib_dir())
outdated_items = lm.get_outdated()
if not outdated_items:
return
click.secho("There are the new updates for %s (%s)" %
(what, ", ".join(outdated_items)), fg="yellow")
if not app.get_setting("auto_update_" + what):
click.secho("Please update them via ", fg="yellow", nl=False)
click.secho("`platformio %supdate`" %
("lib " if what == "libraries" else ""),
fg="cyan", nl=False)
click.secho(" command.\n", fg="yellow")
else:
click.secho("Please wait while updating %s ..." % what, fg="yellow")
if what == "platforms":
ctx.invoke(cli_platforms_update)
elif what == "libraries":
ctx.invoke(cmd_libraries_update)
click.echo()
telemetry.on_event(category="Auto", action="Update",
label=what.title())

View File

@ -1,40 +1,35 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import json
from os import makedirs, remove
from os.path import isdir, isfile, join
from os.path import isdir, join
from shutil import rmtree
from time import time
from click import echo, secho, style
from requests import get
from requests.utils import default_user_agent
import click
from platformio import __pkgmanifesturl__, __version__
from platformio import exception, telemetry
from platformio.app import get_state_item, set_state_item
from platformio.downloader import FileDownloader
from platformio.exception import (InvalidPackageVersion, NonSystemPackage,
UnknownPackage)
from platformio.unpacker import FileUnpacker
from platformio.util import get_home_dir, get_systype
from platformio.util import get_api_result, get_home_dir, get_systype
class PackageManager(object):
DBFILE_PATH = join(get_home_dir(), "installed.json")
def __init__(self):
self._package_dir = join(get_home_dir(), "packages")
if not isdir(self._package_dir):
makedirs(self._package_dir)
assert isdir(self._package_dir)
def __init__(self, platform_name):
self._platform_name = platform_name
@staticmethod
def get_manifest():
@classmethod
def get_manifest(cls):
try:
return PackageManager._cached_manifest
return cls._cached_manifest
except AttributeError:
headers = {"User-Agent": "PlatformIO/%s %s" % (
__version__, default_user_agent())}
PackageManager._cached_manifest = get(__pkgmanifesturl__,
headers=headers).json()
return PackageManager._cached_manifest
cls._cached_manifest = get_api_result("/packages")
return cls._cached_manifest
@staticmethod
def download(url, dest_dir, sha1=None):
@ -49,112 +44,107 @@ class PackageManager(object):
return fu.start()
@staticmethod
def get_installed(platform=None):
data = {}
if isfile(PackageManager.DBFILE_PATH):
with open(PackageManager.DBFILE_PATH) as fp:
data = json.load(fp)
return data.get(platform, None) if platform else data
def get_installed():
return get_state_item("installed_packages", {})
def get_platform_dir(self):
return join(get_home_dir(), self._platform_name)
def get_outdated(self):
outdated = []
for name, data in self.get_installed().items():
if data['version'] != self.get_info(name)['version']:
outdated.append(name)
return outdated
def is_installed(self, name):
installed = self.get_installed()
return (self._platform_name in installed and name in
installed[self._platform_name])
return name in self.get_installed()
def get_info(self, name, version=None):
manifest = self.get_manifest()
if name not in manifest:
raise UnknownPackage(name)
raise exception.UnknownPackage(name)
# check system platform
systype = get_systype()
builds = ([b for b in manifest[name] if b['system'] == "all" or systype
in b['system']])
if not builds:
raise NonSystemPackage(name, systype)
raise exception.NonSystemPackage(name, systype)
if version:
for b in builds:
if b['version'] == version:
return b
raise InvalidPackageVersion(name, version)
raise exception.InvalidPackageVersion(name, version)
else:
return sorted(builds, key=lambda s: s['version'])[-1]
def install(self, name, path):
echo("Installing %s package:" % style(name, fg="cyan"))
def install(self, name):
click.echo("Installing %s package:" % click.style(name, fg="cyan"))
if self.is_installed(name):
secho("Already installed", fg="yellow")
return
click.secho("Already installed", fg="yellow")
return False
info = self.get_info(name)
pkg_dir = join(self.get_platform_dir(), path)
pkg_dir = join(self._package_dir, name)
if not isdir(pkg_dir):
makedirs(pkg_dir)
dlpath = self.download(info['url'], pkg_dir, info['sha1'])
if self.unpack(dlpath, pkg_dir):
self._register(name, info['version'], path)
self._register(name, info['version'])
# remove archive
remove(dlpath)
def uninstall(self, name, path):
echo("Uninstalling %s package: \t" % style(name, fg="cyan"),
nl=False)
rmtree(join(self.get_platform_dir(), path))
telemetry.on_event(
category="PackageManager", action="Install", label=name)
def uninstall(self, name):
click.echo("Uninstalling %s package: \t" %
click.style(name, fg="cyan"), nl=False)
if not self.is_installed(name):
click.secho("Not installed", fg="yellow")
return False
rmtree(join(self._package_dir, name))
self._unregister(name)
echo("[%s]" % style("OK", fg="green"))
click.echo("[%s]" % click.style("OK", fg="green"))
# report usage
telemetry.on_event(
category="PackageManager", action="Uninstall", label=name)
def update(self, name):
echo("Updating %s package:" % style(name, fg="yellow"))
click.echo("Updating %s package:" % click.style(name, fg="yellow"))
installed = self.get_installed(self._platform_name)
installed = self.get_installed()
current_version = installed[name]['version']
latest_version = self.get_info(name)['version']
echo("Versions: Current=%d, Latest=%d \t " % (
current_version, latest_version), nl=False)
click.echo("Versions: Current=%d, Latest=%d \t " %
(current_version, latest_version), nl=False)
if current_version == latest_version:
echo("[%s]" % (style("Up-to-date", fg="green")))
click.echo("[%s]" % (click.style("Up-to-date", fg="green")))
return True
else:
echo("[%s]" % (style("Out-of-date", fg="red")))
click.echo("[%s]" % (click.style("Out-of-date", fg="red")))
self.uninstall(name, installed[name]['path'])
self.install(name, installed[name]['path'])
self.uninstall(name)
self.install(name)
def register_platform(self, name):
telemetry.on_event(
category="PackageManager", action="Update", label=name)
def _register(self, name, version):
data = self.get_installed()
if name not in data:
data[name] = {}
self._update_db(data)
return data
def unregister_platform(self, name):
data = self.get_installed()
del data[name]
self._update_db(data)
def _register(self, name, version, path):
data = self.get_installed()
if self._platform_name not in data:
data = self.register_platform(self._platform_name)
data[self._platform_name][name] = {
data[name] = {
"version": version,
"path": path
"time": int(time())
}
self._update_db(data)
set_state_item("installed_packages", data)
def _unregister(self, name):
data = self.get_installed()
del data[self._platform_name][name]
self._update_db(data)
def _update_db(self, data):
with open(self.DBFILE_PATH, "w") as fp:
json.dump(data, fp)
del data[name]
set_state_item("installed_packages", data)

View File

@ -1,8 +1,6 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os.path import join
from platformio.platforms.base import BasePlatform
@ -15,26 +13,21 @@ class AtmelavrPlatform(BasePlatform):
PACKAGES = {
"toolchain-atmelavr": {
"path": join("tools", "toolchain"),
"alias": "toolchain",
"default": True
},
"tool-avrdude": {
"path": join("tools", "avrdude"),
"alias": "uploader",
"default": True
},
"framework-arduinoavr": {
"path": join("frameworks", "arduino"),
"alias": "framework",
"default": True
}
}
def get_name(self):
return "atmelavr"
def after_run(self, result):
# fix STDERR "flash written" for avrdude
if "flash written" in result['err']:

View File

@ -1,29 +1,75 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os.path import join
from shutil import rmtree
from imp import load_source
from os import listdir
from os.path import isdir, isfile, join
from platformio.exception import UnknownPackage, UnknownPlatform
from platformio import exception
from platformio.app import get_state_item, set_state_item
from platformio.pkgmanager import PackageManager
from platformio.util import exec_command, get_platforms, get_source_dir
from platformio.util import exec_command, get_home_dir, get_source_dir
class PlatformFactory(object):
@staticmethod
def newPlatform(name):
clsname = "%sPlatform" % name.title()
try:
assert name in get_platforms()
mod = __import__("platformio.platforms." + name.lower(),
None, None, [clsname])
except (AssertionError, ImportError):
raise UnknownPlatform(name)
def get_clsname(name):
return "%sPlatform" % name.title()
obj = getattr(mod, clsname)()
assert isinstance(obj, BasePlatform)
return obj
@staticmethod
def load_module(name, path):
module = None
try:
module = load_source(
"platformio.platforms.%s" % name, path)
except ImportError:
raise exception.UnknownPlatform(name)
return module
@classmethod
def get_platforms(cls, installed=False):
platforms = {}
for d in (get_home_dir(), get_source_dir()):
pdir = join(d, "platforms")
if not isdir(pdir):
continue
for p in listdir(pdir):
if p in ("__init__.py", "base.py") or not p.endswith(".py"):
continue
name = p[:-3]
path = join(pdir, p)
try:
isplatform = hasattr(
cls.load_module(name, path),
cls.get_clsname(name)
)
if isplatform:
platforms[name] = path
except exception.UnknownPlatform:
pass
if not installed:
return platforms
installed_platforms = {}
for name in get_state_item("installed_platforms", []):
if name in platforms:
installed_platforms[name] = platforms[name]
return installed_platforms
@classmethod
def newPlatform(cls, name):
platforms = cls.get_platforms()
if name not in platforms:
raise exception.UnknownPlatform(name)
_instance = getattr(
cls.load_module(name, platforms[name]),
cls.get_clsname(name)
)()
assert isinstance(_instance, BasePlatform)
return _instance
class BasePlatform(object):
@ -31,6 +77,13 @@ class BasePlatform(object):
PACKAGES = {}
def get_name(self):
return self.__class__.__name__[:-8].lower()
def get_build_script(self):
builtin = join(get_source_dir(), "builder", "scripts", "%s.py" %
self.get_name())
if isfile(builtin):
return builtin
raise NotImplementedError()
def get_short_info(self):
@ -40,6 +93,9 @@ class BasePlatform(object):
else:
raise NotImplementedError()
def get_packages(self):
return self.PACKAGES
def get_pkg_alias(self, pkgname):
return self.PACKAGES[pkgname].get("alias", None)
@ -47,67 +103,124 @@ class BasePlatform(object):
names = []
for alias in aliases:
name = alias
# lookup by packages alias
if name not in self.PACKAGES:
for _name, _opts in self.PACKAGES.items():
if _opts.get("alias", None) == alias:
name = _name
break
# lookup by package aliases
for _name, _opts in self.get_packages().items():
if _opts.get("alias", None) == alias:
name = _name
break
names.append(name)
return names
def get_installed_packages(self):
pm = PackageManager()
return [n for n in self.get_packages().keys() if pm.is_installed(n)]
def install(self, with_packages, without_packages, skip_default_packages):
with_packages = set(self.pkg_aliases_to_names(with_packages))
without_packages = set(self.pkg_aliases_to_names(without_packages))
upkgs = with_packages | without_packages
ppkgs = set(self.PACKAGES.keys())
ppkgs = set(self.get_packages().keys())
if not upkgs.issubset(ppkgs):
raise UnknownPackage(", ".join(upkgs - ppkgs))
raise exception.UnknownPackage(", ".join(upkgs - ppkgs))
requirements = []
for name, opts in self.PACKAGES.items():
for name, opts in self.get_packages().items():
if name in without_packages:
continue
elif (name in with_packages or (not skip_default_packages and
opts['default'])):
requirements.append((name, opts['path']))
requirements.append(name)
pm = PackageManager()
for name in requirements:
pm.install(name)
# register installed platform
data = get_state_item("installed_platforms", [])
if self.get_name() not in data:
data.append(self.get_name())
set_state_item("installed_platforms", data)
pm = PackageManager(self.get_name())
for (package, path) in requirements:
pm.install(package, path)
return len(requirements)
def uninstall(self):
platform = self.get_name()
pm = PackageManager(platform)
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
for package, data in pm.get_installed(platform).items():
pm.uninstall(package, data['path'])
if platform not in installed_platforms:
raise exception.PlatformNotInstalledYet(platform)
deppkgs = set()
for item in installed_platforms:
if item == platform:
continue
p = PlatformFactory.newPlatform(item)
deppkgs = deppkgs.union(set(p.get_packages().keys()))
pm = PackageManager()
for name in self.get_packages().keys():
if not pm.is_installed(name) or name in deppkgs:
continue
pm.uninstall(name)
# unregister installed platform
installed_platforms.remove(platform)
set_state_item("installed_platforms", installed_platforms)
pm.unregister_platform(platform)
rmtree(pm.get_platform_dir())
return True
def update(self):
platform = self.get_name()
pm = PackageManager(platform)
for package in pm.get_installed(platform).keys():
pm.update(package)
pm = PackageManager()
for name in self.get_installed_packages():
pm.update(name)
def is_outdated(self):
pm = PackageManager()
obsolated = pm.get_outdated()
return not set(self.get_packages().keys()).isdisjoint(set(obsolated))
def run(self, variables, targets):
assert isinstance(variables, list)
assert isinstance(targets, list)
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
installed_packages = PackageManager.get_installed()
if self.get_name() not in installed_platforms:
raise exception.PlatformNotInstalledYet(self.get_name())
if "clean" in targets:
targets.remove("clean")
targets.append("-c")
result = exec_command([
"scons",
"-Q",
"-f", join(get_source_dir(), "builder", "main.py")
] + variables + targets)
if not any([v.startswith("BUILD_SCRIPT=") for v in variables]):
variables.append("BUILD_SCRIPT=%s" % self.get_build_script())
for v in variables:
if not v.startswith("BUILD_SCRIPT="):
continue
_, path = v.split("=", 2)
if not isfile(path):
raise exception.BuildScriptNotFound(path)
# append aliases of the installed packages
for name, options in self.get_packages().items():
if name not in installed_packages:
continue
variables.append(
"PIOPACKAGE_%s=%s" % (options['alias'].upper(), name))
try:
result = exec_command([
"scons",
"-Q",
"-f", join(get_source_dir(), "builder", "main.py")
] + variables + targets)
except OSError:
raise exception.SConsNotInstalled()
return self.after_run(result)

View File

@ -1,8 +1,6 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os.path import join
from platformio.platforms.base import BasePlatform
@ -15,22 +13,17 @@ class Timsp430Platform(BasePlatform):
PACKAGES = {
"toolchain-timsp430": {
"path": join("tools", "toolchain"),
"alias": "toolchain",
"default": True
},
"tool-mspdebug": {
"path": join("tools", "mspdebug"),
"alias": "uploader",
"default": True
},
"framework-energiamsp430": {
"path": join("frameworks", "energia"),
"alias": "framework",
"default": True
}
}
def get_name(self):
return "timsp430"

View File

@ -1,8 +1,6 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os.path import join
from platformio.platforms.base import BasePlatform
@ -15,22 +13,17 @@ class TitivaPlatform(BasePlatform):
PACKAGES = {
"toolchain-gccarmnoneeabi": {
"path": join("tools", "toolchain"),
"alias": "toolchain",
"default": True
},
"tool-lm4flash": {
"path": join("tools", "lm4flash"),
"alias": "uploader",
"default": True
},
"framework-energiativa": {
"path": join("frameworks", "energia"),
"alias": "framework",
"default": True
}
}
def get_name(self):
return "titiva"

View File

@ -1,13 +1,18 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
#
# Project Configuration File
#
# A detailed documentation with EXAMPLES is located here:
# http://docs.platformio.ikravets.com/en/latest/projectconf.html
# 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%
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload

266
platformio/telemetry.py Normal file
View File

@ -0,0 +1,266 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import atexit
import platform
import re
import threading
import uuid
from sys import argv as sys_argv
from time import time
import click
import requests
from platformio import __version__, app
from platformio.util import exec_command, get_systype
class TelemetryBase(object):
MACHINE_ID = str(uuid.uuid5(uuid.NAMESPACE_OID, str(uuid.getnode())))
def __init__(self):
self._params = {}
def __getitem__(self, name):
return self._params.get(name, None)
def __setitem__(self, name, value):
self._params[name] = value
def __delitem__(self, name):
if name in self._params:
del self._params[name]
def send(self, hittype):
raise NotImplementedError()
class MeasurementProtocol(TelemetryBase):
TRACKING_ID = "UA-1768265-9"
PARAMS_MAP = {
"screen_name": "cd",
"event_category": "ec",
"event_action": "ea",
"event_label": "el",
"event_value": "ev"
}
def __init__(self):
TelemetryBase.__init__(self)
self['v'] = 1
self['tid'] = self.TRACKING_ID
self['cid'] = self.MACHINE_ID
self['sr'] = "%dx%d" % click.get_terminal_size()
self._prefill_screen_name()
self._prefill_appinfo()
self._prefill_custom_data()
def __getitem__(self, name):
if name in self.PARAMS_MAP:
name = self.PARAMS_MAP[name]
return TelemetryBase.__getitem__(self, name)
def __setitem__(self, name, value):
if name in self.PARAMS_MAP:
name = self.PARAMS_MAP[name]
TelemetryBase.__setitem__(self, name, value)
def _prefill_appinfo(self):
self['av'] = __version__
# gather dependent packages
dpdata = []
dpdata.append("Click/%s" % click.__version__)
# dpdata.append("Requests/%s" % requests.__version__)
try:
result = exec_command(["scons", "--version"])
match = re.search(r"engine: v([\d\.]+)", result['out'])
if match:
dpdata.append("SCons/%s" % match.group(1))
except: # pylint: disable=W0702
pass
self['an'] = " ".join(dpdata)
def _prefill_custom_data(self):
self['cd1'] = get_systype()
self['cd2'] = "Python/%s %s" % (platform.python_version(),
platform.platform())
def _prefill_screen_name(self):
args = [str(s).lower() for s in sys_argv[1:]]
if not args:
return
if args[0] in ("lib", "serialports", "settings"):
cmd_path = args[:2]
else:
cmd_path = args[:1]
self['screen_name'] = " ".join([p.title() for p in cmd_path])
self['cd3'] = " ".join(args)
def send(self, hittype):
if not app.get_setting("enable_telemetry"):
return
self['t'] = hittype
# correct queue time
if "qt" in self._params and isinstance(self['qt'], float):
self['qt'] = int((time() - self['qt']) * 1000)
MPDataPusher.get_instance().push(self._params)
class MPDataPusher(threading.Thread):
@classmethod
def get_instance(cls):
try:
return cls._thinstance
except AttributeError:
cls._event = threading.Event()
cls._thinstance = cls()
cls._thinstance.start()
return cls._thinstance
@classmethod
def http_session(cls):
try:
return cls._http_session
except AttributeError:
cls._http_session = requests.Session()
return cls._http_session
def __init__(self):
threading.Thread.__init__(self)
self._terminate = False
self._server_online = False
self._stack = []
def run(self):
while not self._terminate:
self._event.wait()
if self._terminate or not self._stack:
return
self._event.clear()
data = self._stack.pop()
try:
r = self.http_session().post(
"https://ssl.google-analytics.com/collect",
data=data,
timeout=3
)
r.raise_for_status()
self._server_online = True
except: # pylint: disable=W0702
self._server_online = False
self._stack.append(data)
def push(self, data):
self._stack.append(data)
self._event.set()
def is_server_online(self):
return self._server_online
def get_stack_data(self):
return self._stack
def join(self, timeout=0.1):
self._terminate = True
self._event.set()
self.http_session().close()
threading.Thread.join(self, timeout)
@atexit.register
def _finalize():
MAX_RESEND_REPORTS = 10
mpdp = MPDataPusher.get_instance()
backup_reports(mpdp.get_stack_data())
resent_nums = 0
while mpdp.is_server_online() and resent_nums < MAX_RESEND_REPORTS:
if not resend_backuped_report():
break
resent_nums += 1
def on_command(ctx): # pylint: disable=W0613
mp = MeasurementProtocol()
mp.send("screenview")
def on_run_environment(options, targets):
opts = ["%s=%s" % (opt, value) for opt, value in sorted(options.items())]
targets = [t.title() for t in targets or ["run"]]
on_event("Env", " ".join(targets), "&".join(opts))
def on_event(category, action, label=None, value=None, screen_name=None):
mp = MeasurementProtocol()
mp['event_category'] = category[:150]
mp['event_action'] = action[:500]
if label:
mp['event_label'] = label[:500]
if value:
mp['event_value'] = int(value)
if screen_name:
mp['screen_name'] = screen_name[:2048]
mp.send("event")
def on_exception(e):
mp = MeasurementProtocol()
mp['exd'] = "%s: %s" % (type(e).__name__, e)
mp['exf'] = 1
mp.send("exception")
def backup_reports(data):
if not data:
return
KEEP_MAX_REPORTS = 1000
tm = app.get_state_item("telemetry", {})
if "backup" not in tm:
tm['backup'] = []
for params in data:
# skip static options
for key in params.keys():
if key in ("v", "tid", "cid", "cd1", "cd2", "sr", "an"):
del params[key]
# store time in UNIX format
if "qt" not in params:
params['qt'] = time()
elif not isinstance(params['qt'], float):
params['qt'] = time() - (params['qt'] / 1000)
tm['backup'].append(params)
tm['backup'] = tm['backup'][KEEP_MAX_REPORTS*-1:]
app.set_state_item("telemetry", tm)
def resend_backuped_report():
tm = app.get_state_item("telemetry", {})
if "backup" not in tm or not tm['backup']:
return False
report = tm['backup'].pop()
app.set_state_item("telemetry", tm)
mp = MeasurementProtocol()
for key, value in report.items():
mp[key] = value
mp.send(report['t'])
return True

View File

@ -1,17 +1,14 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import json
from os import name as os_name
from os import getcwd, getenv, listdir, utime
from os.path import dirname, expanduser, isfile, join, realpath
from os import getcwd, getenv, listdir, makedirs, utime
from os.path import dirname, expanduser, isdir, isfile, join, realpath
from platform import system, uname
from subprocess import PIPE, Popen
from time import sleep
from requests import get, post
from requests.exceptions import ConnectionError, HTTPError
from requests.utils import default_user_agent
from serial import Serial
import requests
from platformio import __apiurl__, __version__
from platformio.exception import (APIRequestError, GetSerialPortsError,
@ -24,21 +21,29 @@ except ImportError:
def get_systype():
if system() == "Windows":
return "windows"
data = uname()
return ("%s_%s" % (data[0], data[4])).lower()
def get_home_dir():
home_dir = None
try:
config = get_project_config()
if (config.has_section("platformio") and
config.has_option("platformio", "home_dir")):
return config.get("platformio", "home_dir")
home_dir = config.get("platformio", "home_dir")
except NotPlatformProject:
pass
return expanduser("~/.platformio")
if not home_dir:
home_dir = expanduser("~/.platformio")
if not isdir(home_dir):
makedirs(home_dir)
assert isdir(home_dir)
return home_dir
def get_lib_dir():
@ -46,7 +51,11 @@ def get_lib_dir():
config = get_project_config()
if (config.has_section("platformio") and
config.has_option("platformio", "lib_dir")):
return config.get("platformio", "lib_dir")
lib_dir = config.get("platformio", "lib_dir")
if lib_dir.startswith("~"):
return expanduser(lib_dir)
else:
return lib_dir
except NotPlatformProject:
pass
return join(get_home_dir(), "lib")
@ -67,21 +76,12 @@ def get_pioenvs_dir():
def get_project_config():
path = join(get_project_dir(), "platformio.ini")
if not isfile(path):
raise NotPlatformProject()
raise NotPlatformProject(get_project_dir())
cp = ConfigParser()
cp.read(path)
return cp
def get_platforms():
platforms = []
for p in listdir(join(get_source_dir(), "platforms")):
if p in ("__init__.py", "base.py") or not p.endswith(".py"):
continue
platforms.append(p[:-3])
return platforms
def change_filemtime(path, time):
utime(path, (time, time))
@ -93,17 +93,6 @@ def exec_command(args):
return dict(out=out.strip(), err=err.strip())
def reset_serialport(port):
s = Serial(port)
s.flushInput()
s.setDTR(False)
s.setRTS(False)
sleep(0.1)
s.setDTR(True)
s.setRTS(True)
s.close()
def get_serialports():
if os_name == "nt":
from serial.tools.list_ports_windows import comports
@ -117,26 +106,50 @@ def get_serialports():
def get_api_result(path, params=None, data=None):
result = None
r = None
try:
requests.packages.urllib3.disable_warnings()
headers = {"User-Agent": "PlatformIO/%s %s" % (
__version__, default_user_agent())}
if data:
r = post(__apiurl__ + path, params=params, data=data,
headers=headers)
__version__, requests.utils.default_user_agent())}
# if packages - redirect to SF
if path == "/packages":
r = requests.get(
"http://sourceforge.net/projects/platformio-storage/files/"
"packages/manifest.json", params=params, headers=headers)
elif data:
r = requests.post(__apiurl__ + path, params=params, data=data,
headers=headers)
else:
r = get(__apiurl__ + path, params=params, headers=headers)
r = requests.get(__apiurl__ + path, params=params, headers=headers)
result = r.json()
r.raise_for_status()
except HTTPError as e:
except requests.exceptions.HTTPError as e:
if result and "errors" in result:
raise APIRequestError(result['errors'][0]['title'])
else:
raise APIRequestError(e)
except ConnectionError:
raise APIRequestError("Could not connect to PlatformIO API Service")
except requests.exceptions.ConnectionError:
raise APIRequestError(
"Could not connect to PlatformIO Registry Service")
except ValueError:
raise APIRequestError("Invalid response: %s" % r.text)
finally:
if r:
r.close()
return result
def get_boards(type_=None):
boards = {}
bdirs = [join(get_source_dir(), "boards")]
if isdir(join(get_home_dir(), "boards")):
bdirs.append(join(get_home_dir(), "boards"))
for bdir in bdirs:
for json_file in listdir(bdir):
if not json_file.endswith(".json"):
continue
with open(join(bdir, json_file)) as f:
boards.update(json.load(f))
return boards[type_] if type_ is not None else boards

View File

@ -1,5 +1,5 @@
click==3.3
colorama==0.3.1
colorama==0.3.2
pyserial==2.7
requests==2.4.1
requests==2.5.1
scons==2.3.0

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