Compare commits

..

4 Commits

Author SHA1 Message Date
Ivan Kravets
e48c6744ed Merge branch 'release/v0.6.0' 2014-08-09 23:21:02 +03:00
Ivan Kravets
26e70ad2f9 Merge branch 'release/v0.5.0' 2014-08-04 11:56:43 +03:00
Ivan Kravets
693191770b Merge branch 'release/v0.4.0' 2014-07-31 16:26:35 +03:00
Ivan Kravets
7b2bc740ba Merge branch 'hotfix/v0.3.1' 2014-06-21 23:10:39 +03:00
95 changed files with 778 additions and 4679 deletions

1
.gitignore vendored
View File

@@ -6,4 +6,3 @@
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,R0922
disable=C0103,C0111,E0611,F0401,I0011,R0801,R0903
[REPORTS]

View File

@@ -1,107 +1,10 @@
Release History
===============
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] <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 `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>`_)
* Implemented ``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
@@ -113,31 +16,27 @@ 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 <http://docs.platformio.org/en/latest/userguide/cmd_upgrade.html>`_
command and "auto-check" for the latest
with external library (Adafruit CC3000)
* Implemented ``platformio upgrade`` 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 `platformio serialports <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html>`_ command
* Implemented ``serialports`` command
* Allowed to put special build flags only for ``src`` files via
`srcbuild_flags <http://docs.platformio.org/en/latest/projectconf.html#srcbuild-flags>`_
environment option
``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 <http://docs.platformio.org/en/latest/userguide/cmd_run.html#cmdoption--upload-port>`__ command
* Added ``--upload-port`` option for ``platformio run`` command
* Implemented (especially for `SmartAnthill <http://smartanthill.ikravets.com/>`_)
`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
``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
0.3.1 (2014-06-21)

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2014-2015 Ivan Kravets
Copyright (c) 2014 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,112 +17,65 @@ PlatformIO
:target: https://pypi.python.org/pypi/platformio/
:alt: License
`Website + Library Search <http://platformio.org>`_ |
`Documentation <http://docs.platformio.org>`_ |
`Documentation <http://docs.platformio.ikravets.com>`_ /
`PDF <https://media.readthedocs.org/pdf/platformio/latest/platformio.pdf>`_ |
`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/PlatformIO_Org>`_
`Twitter <https://twitter.com/smartanthill>`_
.. image:: https://raw.githubusercontent.com/ivankravets/platformio/develop/docs/_static/platformio-logo.png
:target: http://platformio.org
**PlatformIO** is a cross-platform code builder and library manager.
`PlatformIO <http://platformio.org>`_ is a cross-platform code builder
and the missing library manager.
* `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>`_
* `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*
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.
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>`_.
**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>`_.
This happens due to
`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).
`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
It has support for many popular embedded platforms like these:
* ``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)
* ``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>`_)
Licence
-------
Copyright (C) 2014-2015 Ivan Kravets
Copyright (C) 2014 Ivan Kravets
Licenced under the MIT Licence.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

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-2015, Ivan Kravets'
copyright = u'2014, 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,5 +274,4 @@ 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 = 10
linkcheck_anchors = False
linkcheck_timeout = 30

View File

@@ -3,37 +3,14 @@
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,15 +1,11 @@
PlatformIO: A cross-platform code builder and the missing library manager
=========================================================================
PlatformIO: A cross-platform code builder and library manager
=============================================================
.. 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>`_ |
`Issues <https://github.com/ivankravets/platformio/issues>`_ |
`Bugs/Questions <https://github.com/ivankravets/platformio/issues>`_ |
`Blog <http://www.ikravets.com/category/computer-life/platformio>`_ |
`Twitter <https://twitter.com/PlatformIO_Org>`_
`Twitter <https://twitter.com/smartanthill>`_
You have no need to install any *IDE* or compile any tool chains. *PlatformIO*
has pre-built different development platforms including: compiler, debugger,
@@ -30,7 +26,9 @@ instruments.
* Automatically analyse dependency
* Reliably detect build changes
* Build framework or library source code to static library
* Lookup for external libraries which are installed via :ref:`librarymanager`
* Build *ELF* (executable and linkable firmware)
* Convert *ELF* to *HEX* or *BIN* file
* Extract *EEPROM* data
* Upload firmware to your device
@@ -44,7 +42,6 @@ Contents
installation
projectconf
platforms/index
librarymanager/index
userguide/index
ide
history

View File

@@ -3,56 +3,37 @@
Installation
============
*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/>`_
*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).
All commands below should be executed in
`Command-line <http://en.wikipedia.org/wiki/Command-line_interface>`_
application:
application in your *OS*:
* *Mac OS X / Linux* this is *Terminal* application.
* *Unix/Linux/OS X* 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.
Please *choose one of* the following:
Super-Quick (Mac / Linux)
-------------------------
To install or upgrade *PlatformIO* paste that at a *Terminal* prompt
(you might need to run ``sudo`` first):
.. code-block:: bash
python -c "$(curl -fsSL https://raw.githubusercontent.com/ivankravets/platformio/master/scripts/get-platformio.py)"
Installer Script (Mac / Linux / Windows)
----------------------------------------
Super-Quick
-----------
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):
`get-platformio.py <https://raw.githubusercontent.com/ivankravets/platformio/develop/scripts/get-platformio.py>`_ script.
Then run the following (which may require administrator access):
.. code-block:: bash
python get-platformio.py
$ python get-platformio.py
An alternative short version for *Mac/Linux* users:
.. code-block:: bash
$ curl -L http://bit.ly/1lpanta | python
On *Windows OS* it may look like:
@@ -62,11 +43,9 @@ On *Windows OS* it may look like:
C:\Python27\python.exe get-platformio.py
.. warning::
**Mac OS Users**: If you have an error ``pkg_resources.DistributionNotFound`` please
upgrade *SetupTools* package: ``$ [sudo] pip uninstall setuptools``
and ``$ [sudo] pip install setuptools``.
Then re-install *PlatformIO*: ``$ [sudo] pip uninstall platformio``
and ``$ [sudo] pip install platformio``.
If you have an error ``pkg_resources.DistributionNotFound`` try to
uninstall *PlatformIO* ``$ pip uninstall platformio``, then install it via
``$ easy_install platformio``.
Full Guide

View File

@@ -1,307 +0,0 @@
.. |PIOAPICR| replace:: *PlatformIO Library Registry Crawler*
.. _library_config:
library.json
============
``library.json`` is a manifest file of development library.
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::
.. _libjson_name:
``name``
--------
**Required** | Type: ``String`` | Max. Length: 50
A name of the library.
* Must be unique.
* Should be slug style for simplicity, consistency and compatibility.
Example: *Arduino-SPI*
* Title Case, Aa-z, can contain digits and dashes (but not start/end
with them).
* Consecutive dashes are not allowed.
.. _libjson_description:
``description``
---------------
**Required** | Type: ``String`` | Max. Length: 255
The field helps users to identify and search for your library with a brief
description. Describe the hardware devices (sensors, boards and etc.) which
are suitable with it.
.. _libjson_keywords:
``keywords``
------------
**Required** | Type: ``String`` | Max. Length: 255
Used for search by keyword. Helps to make your library easier to discover
without people needing to know its name.
The keyword should be lowercased, can contain a-z, digits and dash (but not
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``
-----------
*Required* if :ref:`libjson_repository` field is not defined | Type: ``String``
| Max. Length: 20
A version of the current library source code.
* Can contain a-z, digits, dots or dash.
* `Semantic Versioning <http://semver.org>`_ is recommended.
* A `CVS <http://en.wikipedia.org/wiki/Concurrent_Versions_System>`_
revision from the latest commit. Example: ``13`` (*SVN*) or first 10
chars of *SHA* digest ``e4564b7da4`` (*Git*).
.. note::
You can omit :ref:`libjson_version` field and define
:ref:`libjson_repository` field. In this case
|PIOAPICR| will use the *CVS*-revision from the latest commit.
.. _libjson_include:
``include``
-----------
*Optional* | Type: ``String`` or ``Array`` |
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
If :ref:`libjson_include` field is a type of ``String``, then
|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.
.. code-block:: javascript
"include": "some/child/dir/LibrarySourceCodeHere"
If :ref:`libjson_include` field is a type of ``Array``, then
|PIOAPICR| firstly will apply :ref:`libjson_exclude` filter and
then include only directories/files which match with :ref:`libjson_include`
patterns.
Example:
.. code-block:: javascript
"include":
[
"dir/*.[ch]pp",
"dir/examples/*",
"*/*/*.h"
]
Pattern Meaning
.. list-table::
:header-rows: 1
* - Pattern
- Meaning
* - ``*``
- matches everything
* - ``?``
- matches any single character
* - ``[seq]``
- matches any character in seq
* - ``[!seq]``
- matches any character not in seq
.. _libjson_exclude:
``exclude``
-----------
*Optional* | Type: ``String`` or ``Array`` |
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
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`` 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":
[
{
"name": "Library-Foo",
"authors":
[
"Jhon Smith",
"Andrew Smith"
]
},
{
"name": "Library-Bar",
"frameworks": "FrameworkFoo, FrameworkBar"
}
]
.. _libjson_examples:
``examples``
----------------
*Optional* | Type: ``String`` or ``Array`` |
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_
A list of example patterns. This field is predefined with default value:
.. code-block:: javascript
"examples": [
"[Ee]xamples/*/*.ini",
"[Ee]xamples/*/*.pde"
]

View File

@@ -1,136 +0,0 @@
.. _library_creating:
.. |PIOAPICR| replace:: *PlatformIO Library Registry Crawler*
Creating Library
================
*PlatformIO* :ref:`librarymanager` doesn't have any requirements to a library
source code structure. The only one requirement is library's manifest file -
:ref:`library_config`. It can be located inside your library or in the another
location where |PIOAPICR| will have *HTTP* access.
.. contents::
Source Code Location
--------------------
There are a several ways how to share your library with the whole world
(see `examples <https://github.com/ivankravets/platformio-libmirror/tree/master/configs>`_).
You can hold a lot of libraries (split into separated folders) inside one of
the repository/archive. In this case please use :ref:`libjson_include`
field to specify the relative path to your library's source code.
At GitHub
^^^^^^^^^
**Recommended**
If a library source code is located at `GitHub <https://github.com>`_, then
you **need to specify** only these fields in the :ref:`library_config`:
* :ref:`libjson_name`
* :ref:`libjson_keywords`
* :ref:`libjson_description`
* :ref:`libjson_repository`
|PIOAPICR| will populate the rest fields, like :ref:`libjson_version` or
:ref:`libjson_authors` with an actual information from *GitHub*.
Example:
.. code-block:: javascript
{
"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)
^^^^^^^^^^^^^^^^^^^
|PIOAPICR| can operate with a library source code that is under *CVS* control.
The list of **required** fields in the :ref:`library_config` will look like:
* :ref:`libjson_name`
* :ref:`libjson_keywords`
* :ref:`libjson_description`
* :ref:`libjson_authors`
* :ref:`libjson_repository`
Example:
.. code-block:: javascript
{
"name": "XBee",
"keywords": "xbee, protocol, radio",
"description": "Arduino library for communicating with XBees in API mode",
"authors":
{
"name": "Andrew Rapp",
"email": "andrew.rapp@gmail.com",
"url": "https://code.google.com/u/andrew.rapp@gmail.com/"
},
"repository":
{
"type": "git",
"url": "https://code.google.com/p/xbee-arduino/"
},
"frameworks": "arduino",
"platforms": "atmelavr"
}
Self-hosted
^^^^^^^^^^^
You can manually archive (*Zip, Tar.Gz*) your library source code and host it
in the *Internet*. Then you should specify the additional fields,
like :ref:`libjson_version` and :ref:`libjson_downloadurl`. The final list
of **required** fields in the :ref:`library_config` will look like:
* :ref:`libjson_name`
* :ref:`libjson_keywords`
* :ref:`libjson_description`
* :ref:`libjson_authors`
* :ref:`libjson_version`
* :ref:`libjson_downloadurl`
.. code-block:: javascript
{
"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)",
"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",
"frameworks": "arduino",
"platforms": "atmelavr"
}
Register
--------
The registration requirements:
* A library must adhere to the :ref:`library_config` specification.
* There must be public *HTTP* access to the library :ref:`library_config` file.
Now, you can :ref:`register <cmd_lib_register>` your library and allow others
to :ref:`install <cmd_lib_install>` it.

View File

@@ -1,25 +0,0 @@
.. _librarymanager:
Library Manager
===============
..
*"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 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.
.. toctree::
:maxdepth: 2
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,9 +59,8 @@ Boards
------
.. note::
* You can list pre-configured boards by :ref:`cmd_boards` command
* For more detailed ``board`` information please scroll tables below by
horizontal.
For more detailed ``board`` information please scroll tables below by
horizontal.
Arduino
~~~~~~~
@@ -219,41 +218,6 @@ 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
~~~~~~~~~~
@@ -335,8 +299,8 @@ More detailed information you can find here
`Microduino boards <http://www.microduino.cc/wiki/index.php?title=Main_Page>`_.
Raspduino
~~~~~~~~~
Miscellaneous
~~~~~~~~~~~~~
.. list-table::
:header-rows: 1
@@ -354,6 +318,3 @@ Raspduino
- 16 MHz ``16000000L``
- 32 Kb
- 2 Kb
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 OS X, Linux (+ARMv6) 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,
Linux 32/64/ARM 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,9 +56,8 @@ Boards
------
.. note::
* You can list pre-configured boards by :ref:`cmd_boards` command
* For more detailed ``board`` information please scroll tables below by
horizontal.
For more detailed ``board`` information please scroll table 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,9 +56,8 @@ Boards
------
.. note::
* You can list pre-configured boards by :ref:`cmd_boards` command
* For more detailed ``board`` information please scroll tables below by
horizontal.
For more detailed ``board`` information please scroll table below by
horizontal.
.. list-table::
:header-rows: 1

View File

@@ -8,38 +8,12 @@ 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 indicates a comment. Comment lines are ignored.
line indicate a comment. Comment lines are ignored.
The sections and their allowable values are described below.
.. contents::
[platformio]
------------
A ``platformio`` section is used for overriding default configuration options
Options
~~~~~~~
``home_dir``
^^^^^^^^^^^^
A ``$PIO_HOME_DIR`` is used to store platform tool chains, frameworks,
external libraries, service data and etc.
A default value is user's home directory: *Unix* - ``~/.platformio``,
Windows - ``%HOMEPATH%\.platformio``.
``lib_dir``
^^^^^^^^^^^^
This directory is used to store external libraries downloaded by
:ref:`librarymanager`.
A default value is ``$PIO_HOME_DIR/lib``.
[env:NAME]
----------
@@ -58,24 +32,18 @@ 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``
^^^^^^^^^
@@ -119,9 +87,6 @@ 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.
@@ -151,8 +116,6 @@ When no targets are defined, *PlatformIO* will build only sources by default.
(``targets = upload``).
.. _projectconf_build_flags:
``build_flags``
^^^^^^^^^^^^^^^
@@ -243,8 +206,6 @@ 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
--------
@@ -252,53 +213,24 @@ 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
# enable auto-uploading
targets = upload
2. :ref:`platform_atmelavr`: Microduino Core (ATmega168P, 3.3V) board with
auto pre-configured ``board_*`` and ``upload_*`` options (use only
``board`` option) and Arduino Wiring-based Framework
.. code-block:: ini
[env:atmelavr_microduino_core_board]
platform = atmelavr
framework = arduino
board = 168pa8m
upload_port = /dev/ ttyUSB0
# upload_port = COM3 # for Windows OS
# enable auto-uploading
targets = upload
3. :ref:`platform_atmelavr`: Raspduino board with
auto pre-configured ``board_*`` and ``upload_*`` options (use only
``board`` option) and Arduino Wiring-based Framework
.. code-block:: ini
[env:atmelavr_raspduino_board]
platform = atmelavr
framework = arduino
board = raspduino
upload_port = /dev/ttyS0
# enable auto-uploading
targets = upload
4. :ref:`platform_atmelavr`: Embedded board that is based on ATmega168 MCU with
2. :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
@@ -306,8 +238,7 @@ Examples
board_f_cpu = 16000000L
upload_port = /dev/ttyUSB0
# for Windows OS
# upload_port = COM3
# upload_port = COM3 # for Windows OS
upload_protocol = arduino
upload_speed = 19200
@@ -315,23 +246,11 @@ Examples
targets = upload
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
3. :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
@@ -339,9 +258,9 @@ Examples
board = lpmsp430g2553
7. :ref:`platform_timsp430`: Embedded board that is based on MSP430G2553 MCU
4. :ref:`platform_timsp430`: Embedded board that is based on MSP430G2553 MCU
.. code-block:: ini
.. code-block:: ini
[env:timsp430_g2553_board]
platform = timsp430
@@ -354,11 +273,11 @@ Examples
targets = upload
8. :ref:`platform_titiva`: TI Tiva C ARM Series TM4C123G LaunchPad with auto
5. :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,54 +3,50 @@
Quickstart
==========
.. note::
Please read `Get Started <http://platformio.org/#!/get-started>`_
article from the official WebSite.
First, :ref:`Install PlatformIO <installation>`.
1. :ref:`Install PlatformIO <installation>`.
2. Find board ``type`` from :ref:`platforms` (you can choose multiple board
types).
3. Initialize new PlatformIO based project with the pre-configured
environments for your boards:
Print all available development platforms for installing
.. code-block:: bash
$ platformio init --board=TYPE1 --board=TYPE2
$ platformio search all
[ ... ]
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.
Install new development platform
More detailed information about this command is here :ref:`cmd_init`.
.. code-block:: bash
4. Process the project's environments.
$ 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.
Process the project's environments
.. code-block:: bash
$ platformio run
# if you don't have specified `targets = upload` option for environment,
# then you can upload firmware manually with this command:
# if embedded project then upload firmware
$ 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>`_.
Also, for more detailed information as for commands please go to
:ref:`userguide` sections.
For more detailed information please go to :ref:`userguide` sections.

View File

@@ -1,86 +0,0 @@
.. _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 [OPTIONS]
platformio init
Description
@@ -21,85 +21,22 @@ Initialize new PlatformIO based project.
This command will create:
* :ref:`projectconf`
* ``src`` - a source directory. Put your source code here
* ``lib`` - a directory for the project specific libraries. PlatformIO will
* ``.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`
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
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.
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.

View File

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

View File

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

View File

@@ -171,7 +171,7 @@ Diagnostics: suppress non-error messages, default ``Off``
Examples
~~~~~~~~
1. Show available options for *monitor*
1. Show available option for command
.. code-block:: bash

View File

@@ -1,114 +0,0 @@
.. _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,15 +14,12 @@ To print all available commands and options use:
.. toctree::
:maxdepth: 2
cmd_boards
cmd_init
cmd_install
platformio lib <lib/index>
cmd_list
cmd_run
cmd_search
cmd_serialports
cmd_settings
cmd_show
cmd_uninstall
cmd_update

View File

@@ -1,72 +0,0 @@
.. _cmd_lib_install:
platformio lib install
======================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib install [OPTIONS] [LIBRARY_ID]
Description
-----------
Install new library by specified
`PlatformIO Library Registry ID <http://platformio.org/#!/lib>`_.
Options
-------
.. option::
-v, --version
Install specified version of library
Examples
--------
1. Install the latest version of library
.. code-block:: bash
# 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
# 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
# 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

@@ -1,39 +0,0 @@
.. _cmd_lib_list:
platformio lib list
===================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib list
Description
-----------
List installed libraries
Examples
--------
.. code-block:: bash
$ platformio lib list
#
# [ 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

@@ -1,26 +0,0 @@
.. _cmd_lib_register:
platformio lib register
=======================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib regiter [HTTP_URL_TO_LIBRARY.JSON]
Description
-----------
Register new library and allow others to install it.
Examples
--------
.. code-block:: bash
$ platformio lib register http://my.example.com/library.json

View File

@@ -1,213 +0,0 @@
.. _cmd_lib_search:
platformio lib search
=====================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib search [OPTIONS] [QUERY]
Description
-----------
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:
.. list-table::
:header-rows: 1
* - Operator
- Description
* - ``+``
- A leading or trailing plus sign indicates that this word must be present
in library fields (see above) that is returned.
* - ``-``
- A leading or trailing minus sign indicates that this word must not be
present in any of the libraries that are returned.
* - ``(no operator)``
- By default (when neither ``+`` nor ``-`` is specified), the
word is optional, but the libraries that contain it are rated higher.
* - ``> <``
- These two operators are used to change a word's contribution to the
relevance value that is assigned to a library. The ``>`` operator
increases the contribution and the ``<`` operator decreases it.
* - ``( )``
- Parentheses group words into subexpressions. Parenthesized groups can
be nested.
* - ``~``
- A leading tilde acts as a negation operator, causing the word's
contribution to the library's relevance to be negative. This is useful for
marking "noise" words. A library containing such a word is rated lower than
others, but is not excluded altogether, as it would be with the ``-`` operator.
* - ``*``
- The asterisk serves as the truncation (or wildcard) operator. Unlike the
other operators, it is appended to the word to be affected. Words match if
they begin with the word preceding the ``*`` operator.
* - ``"``
- A phrase that is enclosed within double quote (``"``) characters matches
only libraries that contain the phrase literally, as it was typed.
For more detail information please go to
`MySQL Boolean Full-Text Searches <http://dev.mysql.com/doc/refman/5.6/en/fulltext-boolean.html>`_.
Options
-------
.. option::
-a, --author
Filter libraries by specified author
.. option::
-k, --keyword
Filter libraries by specified keyword
.. option::
-f, --framework
Filter libraries by specified framework
.. option::
-p, --platform
Filter libraries by specified keyword
Examples
--------
1. List all libraries
.. code-block:: bash
$ 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 `1-Wire libraries <http://platformio.org/#!/lib/search?query=%25221-wire%2522>`_
.. code-block:: bash
$ 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 `Arduino-based "I2C" libraries <http://platformio.org/#!/lib/search?query=framework%253Aarduino%2520i2c>`_
.. code-block:: bash
$ 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 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 --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 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:
#
# [ 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)
# ...
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 "+(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

@@ -1,37 +0,0 @@
.. _cmd_lib_show:
platformio lib show
===================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib show ID
Description
-----------
Show details about the installed library
Examples
--------
.. code-block:: bash
# 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

@@ -1,29 +0,0 @@
.. _cmd_lib_uninstall:
platformio lib uninstall
========================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib uninstall ID
Description
-----------
Uninstall specified library
Examples
--------
.. code-block:: bash
# XBee: http://platformio.org/#!/lib/show/6/XBee
$ platformio lib uninstall 6
# The library #6 'XBee' has been successfully uninstalled!

View File

@@ -1,43 +0,0 @@
.. _cmd_lib_update:
platformio lib update
=====================
.. contents::
Usage
-----
.. code-block:: bash
platformio lib update
Description
-----------
Check or update installed libraries
Examples
--------
.. code-block:: bash
$ platformio lib update
# 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,23 +0,0 @@
.. _userguide_lib:
Library Manager
===============
To print all available commands and options use:
.. code-block:: bash
$ platformio lib --help
$ platformio lib COMMAND --help
.. toctree::
:maxdepth: 2
cmd_install
cmd_list
cmd_register
cmd_search
cmd_show
cmd_uninstall
cmd_update

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_platformio_build_arduino_uno.png
.. image:: http://www.ikravets.com/wp-content/uploads/2014/06/eclipse_build_arduino_pro5v-1024x822.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,5 +1,7 @@
<?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">
@@ -11,46 +13,41 @@
<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 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"/>
<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"/>
<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" 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 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>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.922107295" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.922107295" 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" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1096940598" 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" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1198905600" 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" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.41298875" 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" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.884639970" 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"/>
@@ -77,5 +74,4 @@
<resource resourceType="PROJECT" workspacePath="/arduino_pro5"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>

View File

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

View File

@@ -4,4 +4,5 @@
[env:arduino_pro5v]
platform = atmelavr
framework = arduino
board = pro16MHzatmega168
board = pro16MHzatmega168
upload_port = /dev/tty.SLAB_USBtoUART

View File

@@ -1,5 +1,7 @@
<?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">
@@ -11,19 +13,18 @@
<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 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"/>
<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"/>
<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/packages/toolchain-atmelavr/avr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/atmelavr/tools/toolchain/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__"/>
@@ -33,7 +34,6 @@
<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,7 +43,6 @@
<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

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

View File

@@ -6,9 +6,7 @@ platform = atmelavr
board_mcu = atmega168
board_f_cpu = 16000000L
# Allow autodetection for upload port or uncomment line below
# upload_port = /dev/ttyUSB0
upload_port = /dev/tty.SLAB_USBtoUART
# upload_port = COM3
upload_protocol = arduino
upload_speed = 19200
upload_speed = 19200

View File

@@ -1,5 +1,7 @@
<?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">
@@ -11,36 +13,30 @@
<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 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"/>
<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"/>
<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/packages/toolchain-timsp430/msp430/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-energiamsp430/cores/msp430&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/timsp430/tools/toolchain/msp430/include&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>
@@ -61,9 +57,5 @@
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Default">
<resource resourceType="PROJECT" workspacePath="/tilaunchpad_msp430g2"/>
</configuration>
</storageModule>
<storageModule moduleId="refreshScope"/>
</cproject>

View File

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

View File

@@ -1,5 +1,7 @@
<?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">
@@ -11,34 +13,33 @@
<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 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"/>
<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"/>
<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/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-energiativa/cores/lm4f&quot;"/>
<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;"/>
</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/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-energiativa/cores/lm4f&quot;"/>
<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;"/>
</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/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${HOME}/.platformio/packages/framework-energiativa/cores/lm4f&quot;"/>
<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;"/>
</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

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

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,21 +16,27 @@ typedef int bool;
#define LED_BLUE GPIO_PIN_2
#define LED_GREEN GPIO_PIN_3
void setup() {
int main(void)
{
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;
}
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);
}
// hook for Energia main.cpp where these methods are defined
void setup() {}
void loop() {}

View File

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

View File

@@ -1,19 +1,21 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os import listdir
from os.path import join
from os import listdir, makedirs
from os.path import getmtime, isdir, isfile, join
from sys import exit as sys_exit
from time import time
from traceback import format_exc
import click
from click import command, MultiCommand, secho, version_option
from platformio import __version__, maintenance
from platformio import __version__
from platformio.commands.upgrade import get_latest_version
from platformio.exception import PlatformioException, UnknownCLICommand
from platformio.util import get_source_dir
from platformio.util import get_home_dir, get_source_dir
class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
class PlatformioCLI(MultiCommand):
def list_commands(self, ctx):
cmds = []
@@ -26,7 +28,6 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
return cmds
def get_command(self, ctx, name):
mod = None
try:
mod = __import__("platformio.commands." + name,
None, None, ["cli"])
@@ -35,27 +36,35 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
return mod.cli
@click.command(cls=PlatformioCLI)
@click.version_option(__version__, prog_name="PlatformIO")
@click.pass_context
def cli(ctx):
maintenance.on_platformio_start(ctx)
@command(cls=PlatformioCLI)
@version_option(__version__, prog_name="PlatformIO")
def cli():
pass
@cli.resultcallback()
@click.pass_context
def process_result(ctx, result):
maintenance.on_platformio_end(ctx, result)
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__
def main():
try:
cli(None)
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()
except Exception as e: # pylint: disable=W0703
maintenance.on_platformio_exception(e)
if isinstance(e, PlatformioException):
click.echo("Error: " + str(e))
sys_exit(1)
sys_exit("Error: " + str(e))
else:
print format_exc()

View File

@@ -1,120 +0,0 @@
# 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

@@ -1,540 +0,0 @@
{
"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

@@ -1,71 +0,0 @@
{
"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

@@ -1,160 +0,0 @@
{
"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

@@ -1,19 +0,0 @@
{
"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

@@ -1,107 +0,0 @@
{
"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

@@ -1,47 +0,0 @@
{
"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,36 +2,29 @@
# See LICENSE for details.
try:
from platformio import util
from platformio.util import get_home_dir
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 import util
from platformio.util import get_home_dir
from os.path import join
from os.path import isdir, join
from SCons.Script import (DefaultEnvironment, SConscript, SConscriptChdir,
Variables)
from SCons.Script import (DefaultEnvironment, Exit, SConscript,
SConscriptChdir, Variables)
from platformio.util import 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",),
@@ -48,47 +41,35 @@ commonvars.AddVariables(
)
DefaultEnvironment(
tools=["gcc", "g++", "ar", "gnulink", "platformio"],
tools=["default", "platformio"],
toolpath=[join("$PIOBUILDER_DIR", "tools")],
variables=commonvars,
PIOHOME_DIR=util.get_home_dir(),
PROJECT_DIR=util.get_project_dir(),
PIOENVS_DIR=util.get_pioenvs_dir(),
PIOBUILDER_DIR=join(get_source_dir(), "builder"),
PROJECT_DIR=get_project_dir(),
PIOENVS_DIR=get_pioenvs_dir(),
PIOBUILDER_DIR=join(util.get_source_dir(), "builder"),
PIOPACKAGES_DIR=join("$PIOHOME_DIR", "packages"),
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_FRAMEWORK"),
PLATFORMIOHOME_DIR=get_home_dir(),
PLATFORM_DIR=join("$PLATFORMIOHOME_DIR", "$PLATFORM"),
PLATFORMFW_DIR=join("$PLATFORM_DIR", "frameworks", "$FRAMEWORK"),
PLATFORMTOOLS_DIR=join("$PLATFORM_DIR", "tools"),
BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"),
LIBSOURCE_DIRS=[
join("$PROJECT_DIR", "lib"),
util.get_lib_dir(),
join("$PLATFORMFW_DIR", "libraries"),
]
)
env = DefaultEnvironment()
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"))
)
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']))
SConscriptChdir(0)
SConscript(env.subst("$BUILD_SCRIPT"))
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "${PLATFORM}.py")))

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 get_serialports
from platformio.util import reset_serialport
env = DefaultEnvironment()
@@ -41,10 +41,7 @@ env.Replace(
"-mmcu=$BOARD_MCU"
],
CXXFLAGS=[
"-fno-exceptions",
"-fno-threadsafe-statics"
],
CXXFLAGS=["-fno-exceptions"],
CPPDEFINES=[
"F_CPU=$BOARD_F_CPU"
@@ -56,12 +53,13 @@ env.Replace(
"-mmcu=$BOARD_MCU"
],
UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
UPLOADER=join("$PLATFORMTOOLS_DIR", "avrdude", "avrdude"),
UPLOADERFLAGS=[
"-V", # do not verify
"-q", # suppress progress output
"-D", # disable auto erase for flash memory
"-p", "$BOARD_MCU",
"-C", join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude.conf"),
"-C", join("$PLATFORMTOOLS_DIR", "avrdude", "avrdude.conf"),
"-c", "$UPLOAD_PROTOCOL",
"-b", "$UPLOAD_SPEED",
"-P", "$UPLOAD_PORT"
@@ -103,7 +101,7 @@ env.Append(
)
def before_upload():
def reset_device():
def rpi_sysgpio(path, value):
with open(path, "w") as f:
@@ -117,19 +115,7 @@ def before_upload():
rpi_sysgpio("/sys/class/gpio/gpio18/value", 0)
rpi_sysgpio("/sys/class/gpio/unexport", 18)
else:
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))
return reset_serialport(env.subst("$UPLOAD_PORT"))
CORELIBS = env.ProcessGeneral()
@@ -161,7 +147,7 @@ else:
#
upload = env.Alias(["upload", "uploadlazy"], target_hex, [
lambda target, source, env: before_upload(), "$UPLOADHEXCMD"])
lambda target, source, env: reset_device(), "$UPLOADHEXCMD"])
AlwaysBuild(upload)
#
@@ -169,7 +155,7 @@ AlwaysBuild(upload)
#
uploadeep = env.Alias("uploadeep", target_eep, [
lambda target, source, env: before_upload(), "$UPLOADEEPCMD"])
lambda target, source, env: reset_device(), "$UPLOADEEPCMD"])
AlwaysBuild(uploadeep)
#
@@ -178,19 +164,9 @@ AlwaysBuild(uploadeep)
is_uptarget = (set(["upload", "uploadlazy", "uploadeep"]) &
set(COMMAND_LINE_TARGETS))
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.")
if is_uptarget and not env.subst("$UPLOAD_PORT"):
Exit("Please specify environment 'upload_port' or use global "
"--upload-port option.")
#
# Setup default targets

View File

@@ -12,48 +12,59 @@ 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 "usb_product" in env.subst("${BOARD_OPTIONS['build']}"):
if "build.usb_product" in BOARD_OPTIONS:
ARDUINO_USBDEFINES = [
"USB_VID=${BOARD_OPTIONS['build']['vid']}",
"USB_PID=${BOARD_OPTIONS['build']['pid']}",
'USB_PRODUCT=\\"%s\\"' % (env.subst(
"${BOARD_OPTIONS['build']['usb_product']}").replace('"', ""))
"USB_VID=%s" % BOARD_OPTIONS['build.vid'],
"USB_PID=%s" % BOARD_OPTIONS['build.pid'],
"USB_PRODUCT=%s" % BOARD_OPTIONS['build.usb_product'].replace('"', "")
]
# include board variant
env.VariantDir(
join("$BUILD_DIR", "FrameworkArduinoVariant"),
join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}")
join("$BUILD_DIR", "variant"),
join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant'])
)
env.Append(
CPPDEFINES=[
"ARDUINO_ARCH_%s" % env.subst("$PLATFORM").upper()[-3:],
"ARDUINO=%d" % ARDUINO_VERSION,
"ARDUINO_${BOARD_OPTIONS['build']['board']}"
"ARDUINO_%s" % BOARD_OPTIONS['build.board']
] + ARDUINO_USBDEFINES,
CPPPATH=[
join("$BUILD_DIR", "FrameworkArduino"),
join("$BUILD_DIR", "FrameworkArduinoVariant")
join("$BUILD_DIR", "core"),
join("$BUILD_DIR", "variant")
]
)
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", "FrameworkArduino"),
join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}")
join("$BUILD_DIR", "core"),
join("$PLATFORMFW_DIR", "cores", BOARD_OPTIONS['build.core'])
))
Return("libs")

View File

@@ -12,14 +12,18 @@ 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", "FrameworkEnergiaVariant"),
join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}")
join("$BUILD_DIR", "variant"),
join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant'])
)
env.Append(
@@ -28,30 +32,36 @@ env.Append(
"ENERGIA=%d" % ENERGIA_VERSION
],
CPPPATH=[
join("$BUILD_DIR", "FrameworkEnergia"),
join("$BUILD_DIR", "FrameworkEnergiaVariant")
join("$BUILD_DIR", "core"),
join("$BUILD_DIR", "variant")
]
)
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 env.subst("${BOARD_OPTIONS['build']}"):
if "ldscript" in BOARD_OPTIONS:
env.Append(
LINKFLAGS=["-T", join(
"$PLATFORMFW_DIR", "cores",
"${BOARD_OPTIONS['build']['core']}",
"${BOARD_OPTIONS['build']['ldscript']}")]
LINKFLAGS=["-T", join("$PLATFORMFW_DIR", "cores",
BOARD_OPTIONS['build.core'],
BOARD_OPTIONS['ldscript'])]
)
libs = []
#
# Target: Build Core Library
#
libs = []
libs.append(env.BuildLibrary(
join("$BUILD_DIR", "FrameworkEnergia"),
join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}")
join("$BUILD_DIR", "core"),
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("$PIOPACKAGES_DIR", "tool-mspdebug", "mspdebug"),
UPLOADER=join("$PLATFORMTOOLS_DIR", "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("$PIOPACKAGES_DIR", "tool-lm4flash", "lm4flash"),
UPLOADER=join("$PLATFORMTOOLS_DIR", "lm4flash", "lm4flash"),
UPLOADCMD="$UPLOADER $SOURCES"
)

View File

@@ -2,16 +2,11 @@
# 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 Exit, SConscript, SConscriptChdir
from serial import Serial
from platformio.util import get_serialports
from SCons.Script import SConscript, SConscriptChdir
def ProcessGeneral(env):
@@ -19,9 +14,14 @@ 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,7 +34,7 @@ def BuildFirmware(env, corelibs):
vdirs = src.VariantDirRecursive(
join("$BUILD_DIR", "src"), join("$PROJECT_DIR", "src"))
# build dependent libs
# build source's dependent libs
deplibs = []
for vdir in vdirs:
deplibs += src.BuildDependentLibraries(vdir)
@@ -72,9 +72,9 @@ def BuildDependentLibraries(env, src_dir):
deplibs = env.GetDependentLibraries(src_dir)
env.Append(CPPPATH=[join("$BUILD_DIR", l) for (l, _) in deplibs])
for (libname, inc_dir) in deplibs:
for (libname, lsd_dir) in deplibs:
lib = env.BuildLibrary(
join("$BUILD_DIR", libname), inc_dir)
join("$BUILD_DIR", libname), join(lsd_dir, libname))
env.Clean(libname, lib)
libs.append(lib)
return libs
@@ -83,46 +83,34 @@ def BuildDependentLibraries(env, src_dir):
def GetDependentLibraries(env, src_dir):
includes = {}
regexp = re.compile(r"^\s*#include\s+(?:\<|\")([^\>\"\']+)(?:\>|\")", re.M)
nodes = env.GlobCXXFiles(src_dir) + env.Glob(join(src_dir, "*.h"))
for node in nodes:
for node in env.GlobCXXFiles(src_dir):
env.ParseIncludesRecurive(regexp, node, includes)
includes = sorted(includes.items(), key=lambda s: s[0])
result = []
for i in includes:
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)
item = (i[1][1], i[1][2])
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_fname in matches:
if inc_fname in includes:
for inc_name in matches:
if inc_name 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_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):
inc_path = join(lsd_dir, libname, inc_name)
if not isfile(inc_path):
continue
includes[inc_fname] = (len(includes) + 1, libname, inc_dir)
env.ParseIncludesRecurive(regexp, env.File(inc_file), includes)
includes[inc_name] = (len(includes) + 1, libname, lsd_dir)
env.ParseIncludesRecurive(regexp, env.File(inc_path), includes)
def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True):
@@ -138,44 +126,68 @@ def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True):
return variants
def ConvertInoToCpp(env):
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 delete_tmpcpp(files):
for f in files:
remove(f)
tmpcpp = []
items = (env.Glob(join("$PROJECT_DIR", "src", "*.ino")) +
env.Glob(join("$PROJECT_DIR", "src", "*.pde")))
for item in items:
for item in env.Glob(join("$PROJECT_DIR", "src", "*.ino")):
cppfile = item.get_path()[:-3] + "cpp"
if isfile(cppfile):
continue
ino_contents = item.get_text_contents()
re_includes = re.compile(r"^(#include\s+(?:\<|\")[^\r\n]+)",
re.M | re.I)
includes = re_includes.findall(ino_contents)
prototypes = re.findall(
# fetch prototypes
regexp = re.compile(
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
)
# print includes, prototypes
# disable previous includes
ino_contents = re_includes.sub(r"//\1", ino_contents)
prototypes = regexp.findall(ino_contents)
# print prototypes
# 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))
@@ -186,47 +198,6 @@ 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
@@ -240,8 +211,6 @@ def generate(env):
env.AddMethod(GetDependentLibraries)
env.AddMethod(ParseIncludesRecurive)
env.AddMethod(VariantDirRecursive)
env.AddMethod(ConvertInoToCpp)
env.AddMethod(FlushSerialBuffer)
env.AddMethod(TouchSerialPort)
env.AddMethod(WaitForNewSerialPort)
env.AddMethod(ParseBoardOptions)
env.AddMethod(ConvertInotoCpp)
return env

View File

@@ -1,60 +0,0 @@
# 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,96 +1,30 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os import getcwd, makedirs
from os import makedirs
from os.path import isdir, isfile, join
from shutil import copyfile
import click
from click import command, secho
from platformio import app
from platformio.exception import ProjectInitialized, UnknownBoard
from platformio.util import get_boards, get_source_dir
from platformio.exception import ProjectInitialized
from platformio.util import get_source_dir
@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):
@command("init", short_help="Initialize new PlatformIO based project")
def cli():
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)]):
if isfile("platformio.ini") and isdir("src"):
raise ProjectInitialized()
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))
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")

View File

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

View File

@@ -1,242 +0,0 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import click
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():
pass
@cli.command("search", short_help="Search for library")
@click.option("-a", "--author", multiple=True)
@click.option("-k", "--keyword", multiple=True)
@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))
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']:
echo_liblist_item(item)
if int(result['page'])*int(result['perpage']) >= int(result['total']):
break
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))
)
else:
break
@cli.command("install", short_help="Install library")
@click.argument("libid", type=click.INT, nargs=-1, metavar="[LIBRARY_ID]")
@click.option("-v", "--version")
@click.pass_context
def lib_install(ctx, libid, version):
lm = LibraryManager(get_lib_dir())
for id_ in libid:
click.echo(
"Installing library [ %s ]:" % click.style(str(id_), fg="green"))
try:
if not lm.install(id_, version):
continue
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("libid", type=click.INT, nargs=-1)
def lib_uninstall(libid):
lm = LibraryManager(get_lib_dir())
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():
lm = LibraryManager(get_lib_dir())
items = lm.get_installed().values()
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 library")
@click.argument("libid", type=click.INT)
def lib_show(libid):
lm = LibraryManager(get_lib_dir())
info = lm.get_info(libid)
click.secho(info['name'], fg="cyan")
click.echo("-" * len(info['name']))
_authors = []
for author in info['authors']:
_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" % ", ".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'])
click.echo()
@cli.command("update", short_help="Update installed libraries")
@click.pass_context
def lib_update(ctx):
lm = LibraryManager(get_lib_dir())
for id_, latest_version in (lm.get_latest_versions() or {}).items():
info = lm.get_info(int(id_))
click.echo("Updating [ %s ] %s library:" % (
click.style(id_, fg="yellow"),
click.style(info['name'], fg="cyan")))
current_version = info['version']
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)
if current_version == latest_version:
click.echo("[%s]" % (click.style("Up-to-date", fg="green")))
continue
else:
click.echo("[%s]" % (click.style("Out-of-date", fg="red")))
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
result['successed'] else "red")

View File

@@ -1,21 +1,16 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import click
from click import command, echo, style
from platformio.platforms.base import PlatformFactory
from platformio.pkgmanager import PackageManager
@click.command("list", short_help="List installed platforms")
@command("list", short_help="List installed platforms")
def cli():
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
installed_platforms.sort()
for platform in installed_platforms:
p = PlatformFactory.newPlatform(platform)
click.echo("{name:<20} with packages: {pkgs}".format(
name=click.style(p.get_name(), fg="cyan"),
pkgs=", ".join(p.get_installed_packages())
for name, pkgs in PackageManager.get_installed().items():
echo("{name:<20} with packages: {pkgs}".format(
name=style(name, fg="cyan"),
pkgs=", ".join(pkgs.keys())
))

View File

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

View File

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

View File

@@ -3,13 +3,13 @@
import sys
import click
from click import Choice, echo, group, option, secho
from serial.tools import miniterm
from platformio.util import get_serialports
@click.group(short_help="List or Monitor Serial ports")
@group(short_help="List or Monitor Serial ports")
def cli():
pass
@@ -18,58 +18,50 @@ def cli():
def serialports_list():
for item in get_serialports():
click.secho(item['port'], fg="cyan")
click.echo("----------")
click.echo("Hardware ID: %s" % item['hwid'])
click.echo("Description: %s" % item['description'])
click.echo("")
secho(item['port'], fg="cyan")
echo("----------")
echo("Hardware ID: %s" % item['hwid'])
echo("Description: %s" % item['description'])
echo("")
@cli.command("monitor", short_help="Monitor Serial port")
@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)
@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)
# --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""")
@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):
@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(**_):
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

@@ -1,68 +0,0 @@
# 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,45 +1,32 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from datetime import datetime
from os.path import join
import click
from click import argument, command, echo, style
from platformio import app
from platformio.commands.install import cli as cmd_install
from platformio.exception import PlatformNotInstalledYet
from platformio.pkgmanager import PackageManager
from platformio.platforms.base import PlatformFactory
@click.command("show", short_help="Show details about installed platforms")
@click.argument("platform")
@click.pass_context
def cli(ctx, platform):
@command("show", short_help="Show details about an installed platforms")
@argument("platform")
def cli(platform):
p = PlatformFactory().newPlatform(platform)
if platform not in PackageManager.get_installed():
raise PlatformNotInstalledYet(platform)
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
# print info about platform
echo("{name:<20} - {info}".format(name=style(p.get_name(), fg="cyan"),
info=p.get_short_info()))
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]
pm = PackageManager(platform)
for name, data in pm.get_installed(platform).items():
pkgalias = p.get_pkg_alias(name)
click.echo("----------")
click.echo("Package: %s" % click.style(name, fg="yellow"))
echo("----------")
echo("Package: %s" % style(name, fg="yellow"))
if pkgalias:
click.echo("Alias: %s" % pkgalias)
click.echo("Version: %d" % int(data['version']))
click.echo("Installed: %s" % datetime.fromtimestamp(
data['time']).strftime("%Y-%m-%d %H:%M:%S"))
echo("Alias: %s" % pkgalias)
echo("Location: %s" % join(pm.get_platform_dir(), data['path']))
echo("Version: %d" % int(data['version']))

View File

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

View File

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

View File

@@ -1,16 +1,15 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import click
import requests
from click import command, secho
from requests import get
from platformio import __version__
from platformio.exception import GetLatestVersionError
from platformio.util import exec_command
@click.command("upgrade",
short_help="Upgrade PlatformIO to the latest version")
@command("upgrade", short_help="Upgrade PlatformIO to the latest version")
def cli():
try:
last = get_latest_version()
@@ -18,17 +17,14 @@ def cli():
raise GetLatestVersionError()
if __version__ == last:
return click.secho(
"You're up-to-date!\nPlatformIO %s is currently the "
"newest version available." % __version__, fg="green"
)
return 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"])
click.secho(result['out'], fg="green")
click.secho(result['err'], fg="red")
secho(result['out'], fg="green")
secho(result['err'], fg="red")
def get_latest_version():
pkgdata = requests.get(
"https://pypi.python.org/pypi/platformio/json").json()
pkgdata = 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:
dlsha1 = check_output(["sha1sum", self._destination])
res = check_output(["sha1sum", self._destination])
dlsha1 = res[:40]
except OSError:
try:
dlsha1 = check_output(["shasum", "-a", "1", self._destination])
res = check_output(["shasum", "-a", "1", self._destination])
dlsha1 = res[:40]
except OSError:
pass
if dlsha1:
dlsha1 = dlsha1[1:41] if dlsha1.startswith("\\") else dlsha1[:40]
if sha1 != dlsha1:
raise FDSHASumMismatch(dlsha1, self._fname, sha1)
if dlsha1 and sha1 != dlsha1:
raise FDSHASumMismatch(dlsha1, self._fname, sha1)
def _preserve_filemtime(self, lmdate):
timedata = parsedate_tz(lmdate)

View File

@@ -26,13 +26,7 @@ class PlatformNotInstalledYet(PlatformioException):
class UnknownCLICommand(PlatformioException):
MESSAGE = ("Unknown command '%s'. Please use `platformio --help`"
" to see all available commands")
class UnknownBoard(PlatformioException):
MESSAGE = "Unknown board type '%s'"
MESSAGE = "Unknown command '%s'"
class UnknownPackage(PlatformioException):
@@ -69,7 +63,7 @@ class FDSHASumMismatch(PlatformioException):
class NotPlatformProject(PlatformioException):
MESSAGE = "Not a PlatformIO project (%s). Use `platformio init` command"
MESSAGE = "Not a PlatformIO project. Use `platformio init` command"
class UndefinedEnvPlatform(PlatformioException):
@@ -88,7 +82,7 @@ class ProjectInitialized(PlatformioException):
"Process it with `platformio run` command")
class ProjectEnvsNotAvailable(PlatformioException):
class ProjectEnvsNotAvaialable(PlatformioException):
MESSAGE = "Please setup environments in `platformio.ini` file."
@@ -111,56 +105,3 @@ class GetSerialPortsError(PlatformioException):
class GetLatestVersionError(PlatformioException):
MESSAGE = "Can't retrieve latest PlatformIO version"
class APIRequestError(PlatformioException):
MESSAGE = "[API] %s"
class LibAlreadyInstalledError(PlatformioException):
pass
class LibNotInstalledError(PlatformioException):
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

@@ -1,111 +0,0 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import json
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
from platformio.util import get_api_result
class LibraryManager(object):
CONFIG_NAME = ".library.json"
def __init__(self, lib_dir):
self.lib_dir = lib_dir
@staticmethod
def download(url, dest_dir):
fd = FileDownloader(url, dest_dir)
fd.start()
return fd.get_filepath()
@staticmethod
def unpack(pkgpath, dest_dir):
fu = FileUnpacker(pkgpath, dest_dir)
return fu.start()
def get_installed(self):
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_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 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 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()
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())
if not isdir(tmplib_dir):
makedirs(tmplib_dir)
self.unpack(dlpath, tmplib_dir)
finally:
if dlpath:
remove(dlpath)
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_)))
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_)

View File

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

View File

@@ -1,6 +1,8 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os.path import join
from platformio.platforms.base import BasePlatform
@@ -13,21 +15,26 @@ 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": {
"alias": "framework",
"path": join("frameworks", "arduino"),
"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,75 +1,29 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from imp import load_source
from os import listdir
from os.path import isdir, isfile, join
from os.path import join
from shutil import rmtree
from platformio import exception
from platformio.app import get_state_item, set_state_item
from platformio.exception import UnknownPackage, UnknownPlatform
from platformio.pkgmanager import PackageManager
from platformio.util import exec_command, get_home_dir, get_source_dir
from platformio.util import exec_command, get_platforms, get_source_dir
class PlatformFactory(object):
@staticmethod
def get_clsname(name):
return "%sPlatform" % name.title()
@staticmethod
def load_module(name, path):
module = None
def newPlatform(name):
clsname = "%sPlatform" % name.title()
try:
module = load_source(
"platformio.platforms.%s" % name, path)
except ImportError:
raise exception.UnknownPlatform(name)
return module
assert name in get_platforms()
mod = __import__("platformio.platforms." + name.lower(),
None, None, [clsname])
except (AssertionError, ImportError):
raise UnknownPlatform(name)
@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
obj = getattr(mod, clsname)()
assert isinstance(obj, BasePlatform)
return obj
class BasePlatform(object):
@@ -77,13 +31,6 @@ 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):
@@ -93,9 +40,6 @@ 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)
@@ -103,124 +47,67 @@ class BasePlatform(object):
names = []
for alias in aliases:
name = alias
# lookup by package aliases
for _name, _opts in self.get_packages().items():
if _opts.get("alias", None) == alias:
name = _name
break
# 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
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.get_packages().keys())
ppkgs = set(self.PACKAGES.keys())
if not upkgs.issubset(ppkgs):
raise exception.UnknownPackage(", ".join(upkgs - ppkgs))
raise UnknownPackage(", ".join(upkgs - ppkgs))
requirements = []
for name, opts in self.get_packages().items():
for name, opts in self.PACKAGES.items():
if name in without_packages:
continue
elif (name in with_packages or (not skip_default_packages and
opts['default'])):
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)
requirements.append((name, opts['path']))
pm = PackageManager(self.get_name())
for (package, path) in requirements:
pm.install(package, path)
return len(requirements)
def uninstall(self):
platform = self.get_name()
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
pm = PackageManager(platform)
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)
for package, data in pm.get_installed(platform).items():
pm.uninstall(package, data['path'])
pm.unregister_platform(platform)
rmtree(pm.get_platform_dir())
return True
def update(self):
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))
platform = self.get_name()
pm = PackageManager(platform)
for package in pm.get_installed(platform).keys():
pm.update(package)
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")
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()
result = exec_command([
"scons",
"-Q",
"-f", join(get_source_dir(), "builder", "main.py")
] + variables + targets)
return self.after_run(result)

View File

@@ -1,6 +1,8 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os.path import join
from platformio.platforms.base import BasePlatform
@@ -13,17 +15,22 @@ 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": {
"alias": "framework",
"path": join("frameworks", "energia"),
"default": True
}
}
def get_name(self):
return "timsp430"

View File

@@ -1,6 +1,8 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os.path import join
from platformio.platforms.base import BasePlatform
@@ -13,17 +15,22 @@ 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": {
"alias": "framework",
"path": join("frameworks", "energia"),
"default": True
}
}
def get_name(self):
return "titiva"

View File

@@ -1,18 +1,13 @@
# 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 detailed documentation with EXAMPLES is located here:
# http://docs.platformio.ikravets.com/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:mybaseenv]
#platform = %INSTALLED_PLATFORM_NAME_HERE%

View File

@@ -1,266 +0,0 @@
# 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,18 +1,16 @@
# 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, makedirs, utime
from os.path import dirname, expanduser, isdir, isfile, join, realpath
from os import getcwd, getenv, listdir, utime
from os.path import dirname, expanduser, isfile, join, realpath
from platform import system, uname
from subprocess import PIPE, Popen
from time import sleep
import requests
from serial import Serial
from platformio import __apiurl__, __version__
from platformio.exception import (APIRequestError, GetSerialPortsError,
NotPlatformProject)
from platformio.exception import GetSerialPortsError, NotPlatformProject
try:
from configparser import ConfigParser
@@ -21,44 +19,14 @@ 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")):
home_dir = config.get("platformio", "home_dir")
except NotPlatformProject:
pass
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():
try:
config = get_project_config()
if (config.has_section("platformio") and
config.has_option("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")
return expanduser("~/.platformio")
def get_source_dir():
@@ -76,12 +44,21 @@ def get_pioenvs_dir():
def get_project_config():
path = join(get_project_dir(), "platformio.ini")
if not isfile(path):
raise NotPlatformProject(get_project_dir())
raise NotPlatformProject()
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,6 +70,17 @@ 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
@@ -101,55 +89,3 @@ def get_serialports():
else:
raise GetSerialPortsError(os_name)
return[{"port": p, "description": d, "hwid": h} for p, d, h in comports()]
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__, 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 = requests.get(__apiurl__ + path, params=params, headers=headers)
result = r.json()
r.raise_for_status()
except requests.exceptions.HTTPError as e:
if result and "errors" in result:
raise APIRequestError(result['errors'][0]['title'])
else:
raise APIRequestError(e)
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.2
click==2.5
colorama==0.3.1
pyserial==2.7
requests==2.5.1
requests==2.3.0
scons==2.3.0

View File

@@ -73,20 +73,16 @@ def install_pip():
def install_pypi_packages(packages):
for pipargs in packages:
print (exec_python_cmd(["-m", "pip", "install", "-U"] + pipargs))
for p in packages:
print (exec_python_cmd(["-m", "pip", "install", "-U"] + p.split()))
def main():
steps = [
("Fixing Windows %PATH% Environment", fix_winpython_pathenv, []),
("Installing Python Package Manager", install_pip, []),
("Installing PlatformIO and dependencies", install_pypi_packages, [
[["platformio"], [
"--egg",
"http://sourceforge.net/projects/scons/files/latest/download"
]]
])
("Installing PlatformIO and dependencies", install_pypi_packages,
(["platformio", "--egg scons"],)),
]
if not IS_WINDOWS:

View File

@@ -24,7 +24,7 @@ setup(
# "SCons"
] + (["colorama"] if system() == "Windows" else []),
packages=find_packages(),
package_data={"platformio": ["projectconftpl.ini", "boards/*.json"]},
package_data={"platformio": ["*.ini"]},
entry_points={
"console_scripts": [
"platformio = platformio.__main__:main"

View File

@@ -15,7 +15,7 @@ deps =
isort
flake8
commands =
pip install --egg http://sourceforge.net/projects/scons/files/latest/download
pip install --egg scons
[testenv:docs]
deps =
@@ -23,8 +23,8 @@ deps =
sphinx_rtd_theme
commands =
sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html
sphinx-build -W -b latex -d {envtmpdir}/doctrees docs docs/_build/latex
/bin/bash -c "if [[ $CI != \\"true\\" ]]; then sphinx-build -W -b linkcheck docs docs/_build/html; fi"
sphinx-build -W -b latex -d {envtmpdir}/doctrees docs docs/_build/latex
/bin/bash -c "if [[ $CI != \\"true\\" ]]; then sphinx-build -W -b linkcheck docs docs/_build/html; fi"
[testenv:lint]
deps =