Compare commits
129 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
429722724f | ||
|
|
6a7a9a78ae | ||
|
|
49842df368 | ||
|
|
5cee4463e0 | ||
|
|
e0f0ee0f1a | ||
|
|
76ddcb9d37 | ||
|
|
a7f8b65356 | ||
|
|
d3a4a04a6d | ||
|
|
3a82d4a804 | ||
|
|
274b04c08f | ||
|
|
41fc7dffaf | ||
|
|
66ac453c0f | ||
|
|
251cab64f3 | ||
|
|
963b182cb9 | ||
|
|
3af709e95b | ||
|
|
9136fe9a8b | ||
|
|
e15efa7e08 | ||
|
|
1f2b31f174 | ||
|
|
352fb01068 | ||
|
|
1a9cfc3311 | ||
|
|
77838f2938 | ||
|
|
a1cc5f4282 | ||
|
|
afdc28df80 | ||
|
|
49c389ce70 | ||
|
|
92bfa8f36d | ||
|
|
fd39a88b26 | ||
|
|
dd4fa733e1 | ||
|
|
5d54727139 | ||
|
|
18d4b3fc1b | ||
|
|
82a0ec0d2b | ||
|
|
6a4843c258 | ||
|
|
f414b91b08 | ||
|
|
8a6fe2692c | ||
|
|
8673bc15bc | ||
|
|
c7b034b154 | ||
|
|
4a132941f6 | ||
|
|
c933c1edea | ||
|
|
ccfc9afba7 | ||
|
|
0652d439e5 | ||
|
|
49aea2fcf4 | ||
|
|
10a7e38e13 | ||
|
|
5bc2cc6325 | ||
|
|
b62ac20180 | ||
|
|
c827c12710 | ||
|
|
8453d2431c | ||
|
|
7b60d595a7 | ||
|
|
b8a9afb6fb | ||
|
|
91be0fad5d | ||
|
|
e7ac08df30 | ||
|
|
7b6014c47a | ||
|
|
5de7644493 | ||
|
|
6e9418f583 | ||
|
|
84795fb9f4 | ||
|
|
4ce09f1d43 | ||
|
|
96b06db5ef | ||
|
|
49562a152e | ||
|
|
9c4960ab2f | ||
|
|
e960302b6d | ||
|
|
40322e0f9b | ||
|
|
72ebe0ec1b | ||
|
|
1a39781cff | ||
|
|
44eaf1db22 | ||
|
|
8133a12dc3 | ||
|
|
a1bad33d9d | ||
|
|
510c4decb7 | ||
|
|
7822a929f3 | ||
|
|
19b7c730ae | ||
|
|
92e81ee619 | ||
|
|
eeeed1ba08 | ||
|
|
04f246ea9d | ||
|
|
945b1324af | ||
|
|
5469b98057 | ||
|
|
f001c087ec | ||
|
|
661ca2d27e | ||
|
|
440a2b9bc8 | ||
|
|
125c7b2aba | ||
|
|
424e87a811 | ||
|
|
7391dfa936 | ||
|
|
0a474d34d8 | ||
|
|
ab9a7e05c8 | ||
|
|
6967e936a6 | ||
|
|
47903a7ac9 | ||
|
|
cd842d5a86 | ||
|
|
7b80e17664 | ||
|
|
bdcf89bf32 | ||
|
|
0d19f021f1 | ||
|
|
49bd13adc4 | ||
|
|
5a162b6341 | ||
|
|
2206ec50a5 | ||
|
|
60dc02682b | ||
|
|
3657891833 | ||
|
|
1033e827c0 | ||
|
|
c14b436aec | ||
|
|
8b8d5c360c | ||
|
|
97d229232d | ||
|
|
36ad6efa25 | ||
|
|
0bf7e68ea5 | ||
|
|
d415cbbe45 | ||
|
|
c79114c345 | ||
|
|
6fd07e1e56 | ||
|
|
97044bf5a5 | ||
|
|
31a2880c3c | ||
|
|
476de84dc5 | ||
|
|
0d648074e4 | ||
|
|
47b8a4dd69 | ||
|
|
60863a4304 | ||
|
|
4d8cbc1349 | ||
|
|
5af3b9b7c9 | ||
|
|
84354edcc1 | ||
|
|
2198e317ff | ||
|
|
9c318c1d34 | ||
|
|
c8af9aacbb | ||
|
|
71261023de | ||
|
|
4cde47af75 | ||
|
|
ee962c1919 | ||
|
|
3f52ba3d05 | ||
|
|
2c0693fa72 | ||
|
|
1cf026d956 | ||
|
|
07022bb3be | ||
|
|
b52ff11d3c | ||
|
|
333e1d05f5 | ||
|
|
a9942e675f | ||
|
|
8d75194884 | ||
|
|
bf0f4c8de4 | ||
|
|
3a08fb89b2 | ||
|
|
7918f912c4 | ||
|
|
b26856e04d | ||
|
|
0234fcd2e3 | ||
|
|
6f2441f0fe |
@@ -1,3 +1,3 @@
|
||||
[settings]
|
||||
line_length=79
|
||||
known_third_party=click,requests,serial,SCons,pytest
|
||||
known_third_party=click,requests,serial,SCons,pytest,bottle
|
||||
|
||||
73
HISTORY.rst
@@ -1,6 +1,74 @@
|
||||
Release History
|
||||
===============
|
||||
|
||||
2.0.0 (2015-05-22)
|
||||
------------------
|
||||
|
||||
* PlatformIO as :ref:`ci` (CI) tool for embedded projects
|
||||
(`issue #108 <https://github.com/platformio/platformio/issues/108>`_)
|
||||
* Initialise PlatformIO project for the specified IDE
|
||||
(`issue #151 <https://github.com/platformio/platformio/issues/151>`_)
|
||||
* PlatformIO CLI 2.0: "platform" related commands have been
|
||||
moved to ``platformio platforms`` subcommand
|
||||
(`issue #158 <https://github.com/platformio/platformio/issues/158>`_)
|
||||
* Created `PlatformIO gitter.im <https://gitter.im/platformio/platformio>`_ room
|
||||
(`issue #174 <https://github.com/platformio/platformio/issues/174>`_)
|
||||
* Global ``-f, --force`` option which will force to accept any
|
||||
confirmation prompts
|
||||
(`issue #152 <https://github.com/platformio/platformio/issues/152>`_)
|
||||
* Run project with `platformio run --project-dir <http://docs.platformio.org/en/latest/userguide/cmd_run.html#cmdoption--project-dir>`_ option without changing the current working
|
||||
directory
|
||||
(`issue #192 <https://github.com/platformio/platformio/issues/192>`_)
|
||||
* Control verbosity of `platformio run <http://docs.platformio.org/en/latest/userguide/cmd_run.html#cmdoption-platformio-run-v>`_ command via ``-v/--verbose`` option
|
||||
* Add library dependencies for build environment using
|
||||
`install_libs <http://docs.platformio.org/en/latest/projectconf.html#install-libs>`_
|
||||
option in ``platformio.ini``
|
||||
(`issue #134 <https://github.com/platformio/platformio/issues/134>`_)
|
||||
* Specify libraries which are compatible with build environment using
|
||||
`use_libs <http://docs.platformio.org/en/latest/projectconf.html#use-libs>`_
|
||||
option in ``platformio.ini``
|
||||
(`issue #148 <https://github.com/platformio/platformio/issues/148>`_)
|
||||
* Add more boards to PlatformIO project with
|
||||
`platformio init --board <http://docs.platformio.org/en/latest/userguide/cmd_init.html#cmdoption--board>`__
|
||||
command
|
||||
(`issue #167 <https://github.com/platformio/platformio/issues/167>`_)
|
||||
* Choose which library to update
|
||||
(`issue #168 <https://github.com/platformio/platformio/issues/168>`_)
|
||||
* Specify `platformio init --env-prefix <http://docs.platformio.org/en/latest/userguide/cmd_init.html#cmdoption--env-prefix>`__ when initialise/update project
|
||||
(`issue #182 <https://github.com/platformio/platformio/issues/182>`_)
|
||||
* Added new Armstrap boards
|
||||
(`issue #204 <https://github.com/platformio/platformio/issues/204>`_)
|
||||
* Updated SDK for `espressif <http://docs.platformio.org/en/latest/platforms/espressif.html>`__
|
||||
development platform to v1.1
|
||||
(`issue #179 <https://github.com/platformio/platformio/issues/179>`_)
|
||||
* Disabled automatic updates by default for platforms, packages and libraries
|
||||
(`issue #171 <https://github.com/platformio/platformio/issues/171>`_)
|
||||
* Fixed bug with creating copies of source files
|
||||
(`issue #177 <https://github.com/platformio/platformio/issues/177>`_)
|
||||
|
||||
1.5.0 (2015-05-15)
|
||||
------------------
|
||||
|
||||
* Added support of `Framework mbed <http://platformio.org/#!/frameworks/mbed>`_
|
||||
for Teensy 3.1
|
||||
(`issue #183 <https://github.com/platformio/platformio/issues/183>`_)
|
||||
* Added GDB as alternative uploader to `ststm32 <http://docs.platformio.org/en/latest/platforms/ststm32.html>`__ platform
|
||||
(`issue #175 <https://github.com/platformio/platformio/issues/174>`_)
|
||||
* Added `examples <https://github.com/platformio/platformio/tree/develop/examples>`__
|
||||
with preconfigured IDE projects
|
||||
(`issue #154 <https://github.com/platformio/platformio/issues/154>`_)
|
||||
* Fixed firmware uploading under Linux OS for Arduino Leonardo board
|
||||
(`issue #178 <https://github.com/platformio/platformio/issues/178>`_)
|
||||
* Fixed invalid "mbed" firmware for Nucleo F411RE
|
||||
(`issue #185 <https://github.com/platformio/platformio/issues/185>`_)
|
||||
* Fixed parsing of includes for PlatformIO Library Dependency Finder
|
||||
(`issue #189 <https://github.com/platformio/platformio/issues/189>`_)
|
||||
* Fixed handling symbolic links within source code directory
|
||||
(`issue #190 <https://github.com/platformio/platformio/issues/190>`_)
|
||||
* Fixed cancelling any previous definition of name, either built in or provided
|
||||
with a ``-D`` option
|
||||
(`issue #191 <https://github.com/platformio/platformio/issues/191>`_)
|
||||
|
||||
1.4.0 (2015-04-11)
|
||||
------------------
|
||||
|
||||
@@ -19,8 +87,9 @@ Release History
|
||||
1.6.3 version (`issue #156 <https://github.com/platformio/platformio/issues/156>`_)
|
||||
* Upgraded `Energia Framework <http://docs.platformio.org/en/latest/frameworks/energia.html>`__ to
|
||||
0101E0015 version (`issue #146 <https://github.com/platformio/platformio/issues/146>`_)
|
||||
* Upgraded `Arduino Framework with Teensy Core <http://docs.platformio.org/en/latest/frameworks/arduino.html>`_ to
|
||||
1.22 version (`issue #162 <https://github.com/platformio/platformio/issues/162>`_,
|
||||
* Upgraded `Arduino Framework with Teensy Core <http://docs.platformio.org/en/latest/frameworks/arduino.html>`_
|
||||
to 1.22 version
|
||||
(`issue #162 <https://github.com/platformio/platformio/issues/162>`_,
|
||||
`issue #170 <https://github.com/platformio/platformio/issues/170>`_)
|
||||
* Fixed exceptions with PlatformIO auto-updates when Internet connection isn't
|
||||
active
|
||||
|
||||
21
README.rst
@@ -4,11 +4,11 @@ PlatformIO
|
||||
.. image:: https://travis-ci.org/platformio/platformio.svg?branch=develop
|
||||
:target: https://travis-ci.org/platformio/platformio
|
||||
:alt: Travis.CI Build Status
|
||||
.. image:: https://ci.appveyor.com/api/projects/status/ee26e58de798rctd/branch/develop?svg=true
|
||||
.. image:: https://ci.appveyor.com/api/projects/status/dku0h2rutfj0ctls/branch/develop?svg=true
|
||||
:target: https://ci.appveyor.com/project/ivankravets/platformio
|
||||
:alt: AppVeyor.CI Build Status
|
||||
.. image:: https://gemnasium.com/ivankravets/platformio.png
|
||||
:target: https://gemnasium.com/ivankravets/platformio
|
||||
:alt: AppVeyor.CI Build Status
|
||||
.. image:: https://gemnasium.com/platformio/platformio.png
|
||||
:target: https://gemnasium.com/platformio/platformio
|
||||
:alt: Dependency Status
|
||||
.. image:: https://pypip.in/version/platformio/badge.png?style=flat
|
||||
:target: https://pypi.python.org/pypi/platformio/
|
||||
@@ -19,6 +19,9 @@ PlatformIO
|
||||
.. image:: https://pypip.in/license/platformio/badge.png?style=flat
|
||||
:target: https://pypi.python.org/pypi/platformio/
|
||||
:alt: License
|
||||
.. image:: https://badges.gitter.im/Join%20Chat.svg
|
||||
:alt: Join the chat at https://gitter.im/platformio/platformio
|
||||
:target: https://gitter.im/platformio/platformio
|
||||
|
||||
`Website + Library Search <http://platformio.org>`_ |
|
||||
`Documentation <http://docs.platformio.org>`_ |
|
||||
@@ -27,8 +30,8 @@ PlatformIO
|
||||
`Reddit <http://www.reddit.com/r/platformio/>`_ |
|
||||
`Twitter <https://twitter.com/PlatformIO_Org>`_
|
||||
|
||||
*Atmel AVR & SAM, Freescale Kinetis, Nordic nRF51, NXP LPC, ST STM32,
|
||||
TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.*
|
||||
*Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC,
|
||||
ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.*
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-logo.png
|
||||
:target: http://platformio.org
|
||||
@@ -43,6 +46,7 @@ and the missing library manager.
|
||||
* `Embedded Boards Explorer <http://platformio.org/#!/boards>`_
|
||||
* `Library Manager <http://docs.platformio.org/en/latest/librarymanager/index.html>`_
|
||||
* `User Guide <http://docs.platformio.org/en/latest/userguide/index.html>`_
|
||||
* `Continuous Integration <http://docs.platformio.org/en/latest/ci/index.html>`_
|
||||
* `IDE Integration <http://docs.platformio.org/en/latest/ide.html>`_
|
||||
* `Articles about us <http://docs.platformio.org/en/latest/articles.html>`_
|
||||
* `FAQ <http://docs.platformio.org/en/latest/faq.html>`_
|
||||
@@ -72,7 +76,7 @@ settings for most popular `Embedded Boards <http://platformio.org/#!/boards>`_.
|
||||
* Configurable `build -flags/-options <http://docs.platformio.org/en/latest/projectconf.html#build-flags>`_
|
||||
* Automatic **firmware uploading**
|
||||
* Integration with `development environments (IDE) <http://docs.platformio.org/en/latest/ide.html>`_
|
||||
* Ready for **Cloud Compiling** and **Continuous Integration**
|
||||
* Ready for **Cloud Compiling** and `Continuous Integration <http://docs.platformio.org/en/latest/ci/index.html>`_
|
||||
* Pre-built tool chains, frameworks for the popular `Hardware Platforms <http://platformio.org/#!/platforms>`_
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/platformio/platformio-web/develop/app/images/platformio-embedded-development.png
|
||||
@@ -127,9 +131,10 @@ It has support for the most popular embedded platforms:
|
||||
|
||||
* `Atmel AVR <http://platformio.org/#!/platforms/atmelavr>`_
|
||||
* `Atmel SAM <http://platformio.org/#!/platforms/atmelsam>`_
|
||||
* `Espressif <http://platformio.org/#!/platforms/espressif>`_
|
||||
* `Freescale Kinetis <http://platformio.org/#!/platforms/freescalekinetis>`_
|
||||
* `Nordic nRF51 <http://platformio.org/#!/platforms/nordicnrf51>`_
|
||||
* `NXP LPC. <http://platformio.org/#!/platforms/nxplpc>`_
|
||||
* `NXP LPC <http://platformio.org/#!/platforms/nxplpc>`_
|
||||
* `ST STM32 <http://platformio.org/#!/platforms/ststm32>`_
|
||||
* `Teensy <http://platformio.org/#!/platforms/teensy>`_
|
||||
* `TI MSP430 <http://platformio.org/#!/platforms/timsp430>`_
|
||||
|
||||
BIN
docs/_static/droneci-platformio-integration-1.png
vendored
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
docs/_static/droneci-platformio-integration-2.png
vendored
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
docs/_static/ide-platformio-qtcreator-1.png
vendored
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
docs/_static/ide-platformio-qtcreator-2.png
vendored
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
docs/_static/ide-platformio-qtcreator-3.png
vendored
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
docs/_static/ide-platformio-qtcreator-4.png
vendored
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
docs/_static/ide-platformio-qtcreator-5.png
vendored
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
docs/_static/ide-platformio-qtcreator-6.png
vendored
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
docs/_static/ide-platformio-qtcreator-7.png
vendored
Normal file
|
After Width: | Height: | Size: 100 KiB |
@@ -4,13 +4,16 @@ Articles about us
|
||||
=================
|
||||
|
||||
.. note::
|
||||
If you've writeen article about PlatformIO and would like it listed on
|
||||
If you've written article about PlatformIO and would like it listed on
|
||||
this page, `please edit this page <https://github.com/platformio/platformio/blob/develop/docs/articles.rst>`_.
|
||||
|
||||
Here are recent articles about PlatformIO:
|
||||
|
||||
* May 11, 2015 - **IT Hare** - `From Web Developer to Embedded One: Interview with Ivan Kravets, The Guy Behind PlatformIO. Part II <http://ithare.com/from-web-developer-to-embedded-one-interview-with-ivan-kravets-the-guy-behind-platformio-part-ii/>`_
|
||||
* May 4, 2015 - **IT Hare** - `From Web Developer to Embedded One: Interview with Ivan Kravets, The Guy Behind PlatformIO. Part I <http://ithare.com/from-web-development-to-embedded-one-interview-with-ivan-kravets-the-guy-behind-platformio-part-i/>`_
|
||||
* April 17, 2015 - **Michael Ball** - `PlatformIO - A Cross-Platform Code Builder and Missing Library Manager <http://arduino-pi.blogspot.com.es/2015/04/platformio-cross-platform-code-builder.html>`_
|
||||
* March 23, 2015 - **Atmel** - `Cross-board and cross-vendor embedded development with PlatformIO <http://blog.atmel.com/2015/03/23/cross-board-and-cross-vendor-embedded-development-with-platformio/>`_
|
||||
* March 22, 2015 - **Mark VandeWettering** - `Discovered a new tool for embedded development: PlatformIO <http://brainwagon.org/2015/03/22/discovered-a-new-tool-for-embedded-development-platformio/>`_
|
||||
* October 7, 2014 - **Ivan Kravets** - `Integration of PlatformIO library manager to Arduino and Energia IDEs <http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides>`_
|
||||
* June 20, 2014 - **Ivan Kravets** - `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO <http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio>`_
|
||||
* June 17, 2014 - **Ivan Kravets** - `How was PlatformIO born or why I love Python World <http://www.ikravets.com/computer-life/programming/2014/06/17/how-was-platformio-born-or-why-i-love-python-world>`_
|
||||
* June 17, 2014 - **Ivan Kravets** - `How was PlatformIO born or why I love Python World <http://www.ikravets.com/computer-life/programming/2014/06/17/how-was-platformio-born-or-why-i-love-python-world>`_
|
||||
|
||||
213
docs/ci/appveyor.rst
Normal file
@@ -0,0 +1,213 @@
|
||||
.. _ci_appveyor:
|
||||
|
||||
AppVeyor
|
||||
========
|
||||
|
||||
`AppVeyor <http://www.appveyor.com/about>`_ is an open-source hosted,
|
||||
distributed continuous integration service used to build and test projects
|
||||
hosted at `GitHub <http://en.wikipedia.org/wiki/GitHub>`_ on Windows family
|
||||
systems.
|
||||
|
||||
AppVeyor is configured by adding a file named ``appveyor.yml``, which is a
|
||||
`YAML <http://en.wikipedia.org/wiki/YAML>`_ format text file, to the root
|
||||
directory of the GitHub repository.
|
||||
|
||||
AppVeyor automatically detects when a commit has been made and pushed to a
|
||||
GitHub repository that is using AppVeyor, and each time this happens, it will
|
||||
try to build the project using :ref:`cmd_ci` command. This includes commits to
|
||||
all branches, not just to the master branch. AppVeyor will also build and run
|
||||
pull requests. When that process has completed, it will notify a developer in
|
||||
the way it has been configured to do so — for example, by sending an email
|
||||
containing the build results (showing success or failure), or by posting a
|
||||
message on an IRC channel. It can be configured to build project on a range of
|
||||
different :ref:`platforms`.
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
Put ``appveyor.yml`` to the root directory of the GitHub repository.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
build: off
|
||||
environment:
|
||||
global:
|
||||
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\scripts\\appveyor\\run_with_compiler.cmd"
|
||||
matrix:
|
||||
- PLATFORMIO_CI_SRC: "path\\to\\source\\file.c"
|
||||
PLATFORMIO_CI_SRC: "path\\to\\source\\file.ino"
|
||||
PLATFORMIO_CI_SRC: "path\\to\\source\\directory"
|
||||
WINDOWS_SDK_VERSION: "v7.0"
|
||||
PYTHON_HOME: "C:\\Python27-x64"
|
||||
PYTHON_VERSION: "2.7"
|
||||
PYTHON_ARCH: "64"
|
||||
install:
|
||||
- "git submodule update --init --recursive"
|
||||
- "powershell scripts\\appveyor\\install.ps1"
|
||||
before_test:
|
||||
- cmd: SET PATH=%PATH%;%PYTHON_HOME%;%PYTHON_HOME%\Scripts
|
||||
test_script:
|
||||
- '%WITH_COMPILER% %PYTHON_HOME%\\Scripts\\platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N'
|
||||
|
||||
|
||||
Then create ``scripts/appveyor`` folder and put these 2 scripts (they are the
|
||||
same for the all projects, don't need to modify them):
|
||||
|
||||
1. ``scripts/appveyor/install.ps1``:
|
||||
|
||||
.. code-block:: PowerShell
|
||||
|
||||
$BASE_URL = "https://www.python.org/ftp/python/"
|
||||
$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
|
||||
$GET_PIP_PATH = "C:\get-pip.py"
|
||||
|
||||
|
||||
function DownloadPython ($python_version, $platform_suffix) {
|
||||
$webclient = New-Object System.Net.WebClient
|
||||
$filename = "python-" + $python_version + $platform_suffix + ".msi"
|
||||
$url = $BASE_URL + $python_version + "/" + $filename
|
||||
|
||||
$basedir = $pwd.Path + "\"
|
||||
$filepath = $basedir + $filename
|
||||
if (Test-Path $filename) {
|
||||
Write-Host "Reusing" $filepath
|
||||
return $filepath
|
||||
}
|
||||
|
||||
# Download and retry up to 5 times in case of network transient errors.
|
||||
Write-Host "Downloading" $filename "from" $url
|
||||
$retry_attempts = 3
|
||||
for($i=0; $i -lt $retry_attempts; $i++){
|
||||
try {
|
||||
$webclient.DownloadFile($url, $filepath)
|
||||
break
|
||||
}
|
||||
Catch [Exception]{
|
||||
Start-Sleep 1
|
||||
}
|
||||
}
|
||||
Write-Host "File saved at" $filepath
|
||||
return $filepath
|
||||
}
|
||||
|
||||
|
||||
function InstallPython ($python_version, $architecture, $python_home) {
|
||||
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
|
||||
if (Test-Path $python_home) {
|
||||
Write-Host $python_home "already exists, skipping."
|
||||
return $false
|
||||
}
|
||||
if ($architecture -eq "32") {
|
||||
$platform_suffix = ""
|
||||
} else {
|
||||
$platform_suffix = ".amd64"
|
||||
}
|
||||
$filepath = DownloadPython $python_version $platform_suffix
|
||||
Write-Host "Installing" $filepath "to" $python_home
|
||||
$args = "/qn /i $filepath TARGETDIR=$python_home"
|
||||
Write-Host "msiexec.exe" $args
|
||||
Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthru
|
||||
Write-Host "Python $python_version ($architecture) installation complete"
|
||||
return $true
|
||||
}
|
||||
|
||||
|
||||
function InstallPip ($python_home) {
|
||||
$pip_path = $python_home + "/Scripts/pip.exe"
|
||||
$python_path = $python_home + "/python.exe"
|
||||
if (-not(Test-Path $pip_path)) {
|
||||
Write-Host "Installing pip..."
|
||||
$webclient = New-Object System.Net.WebClient
|
||||
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
|
||||
Write-Host "Executing:" $python_path $GET_PIP_PATH
|
||||
Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
|
||||
} else {
|
||||
Write-Host "pip already installed."
|
||||
}
|
||||
}
|
||||
|
||||
function InstallPackage ($python_home, $pkg) {
|
||||
$pip_path = $python_home + "/Scripts/pip.exe"
|
||||
& $pip_path install -U $pkg
|
||||
}
|
||||
|
||||
function InstallScons ($python_home) {
|
||||
Write-Host "Start installing Scons"
|
||||
$pip_path = $python_home + "/Scripts/pip.exe"
|
||||
& $pip_path install --egg "http://sourceforge.net/projects/scons/files/latest/download"
|
||||
Write-Host "Scons installed"
|
||||
}
|
||||
|
||||
function main () {
|
||||
InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON_HOME
|
||||
InstallPip $env:PYTHON_HOME
|
||||
InstallPackage $env:PYTHON_HOME setuptools
|
||||
InstallPackage $env:PYTHON_HOME platformio
|
||||
InstallScons $env:PYTHON_HOME
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
2. ``scripts/appveyor/run_with_compiler.cmd``:
|
||||
|
||||
.. code-block:: guess
|
||||
|
||||
@ECHO OFF
|
||||
|
||||
SET COMMAND_TO_RUN=%*
|
||||
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
|
||||
|
||||
SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%"
|
||||
IF %MAJOR_PYTHON_VERSION% == "2" (
|
||||
SET WINDOWS_SDK_VERSION="v7.0"
|
||||
) ELSE IF %MAJOR_PYTHON_VERSION% == "3" (
|
||||
SET WINDOWS_SDK_VERSION="v7.1"
|
||||
) ELSE (
|
||||
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
|
||||
EXIT 1
|
||||
)
|
||||
|
||||
IF "%PYTHON_ARCH%"=="64" (
|
||||
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
|
||||
SET DISTUTILS_USE_SDK=1
|
||||
SET MSSdk=1
|
||||
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
|
||||
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
|
||||
ECHO Executing: %COMMAND_TO_RUN%
|
||||
call %COMMAND_TO_RUN% || EXIT 1
|
||||
) ELSE (
|
||||
ECHO Using default MSVC build environment for 32 bit architecture
|
||||
ECHO Executing: %COMMAND_TO_RUN%
|
||||
call %COMMAND_TO_RUN% || EXIT 1
|
||||
)
|
||||
|
||||
For more details as for PlatformIO build process please look into :ref:`cmd_ci`
|
||||
command.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
1. Integration for `USB_Host_Shield_2.0 <https://github.com/felis/USB_Host_Shield_2.0>`_
|
||||
project. The ``appveyor.yml`` configuration file:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
build: off
|
||||
environment:
|
||||
global:
|
||||
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\scripts\\appveyor\\run_with_compiler.cmd"
|
||||
matrix:
|
||||
- PLATFORMIO_CI_SRC: "examples\\Bluetooth\\PS3SPP\\PS3SPP.ino"
|
||||
PLATFORMIO_CI_SRC: "examples\\pl2303\\pl2303_gps\\pl2303_gps.ino"
|
||||
WINDOWS_SDK_VERSION: "v7.0"
|
||||
PYTHON_HOME: "C:\\Python27-x64"
|
||||
PYTHON_VERSION: "2.7"
|
||||
PYTHON_ARCH: "64"
|
||||
install:
|
||||
- "git submodule update --init --recursive"
|
||||
- "powershell scripts\\appveyor\\install.ps1"
|
||||
before_test:
|
||||
- cmd: SET PATH=%PATH%;%PYTHON_HOME%;%PYTHON_HOME%\Scripts
|
||||
- cmd: git clone https://github.com/xxxajk/spi4teensy3.git c:\spi4teensy
|
||||
test_script:
|
||||
- '%WITH_COMPILER% %PYTHON_HOME%\\Scripts\\platformio ci --lib="." --lib="c:\spi4teensy" --board=uno --board=teensy31 --board=due'
|
||||
72
docs/ci/circleci.rst
Normal file
@@ -0,0 +1,72 @@
|
||||
.. _ci_circleci:
|
||||
|
||||
Circle CI
|
||||
=========
|
||||
|
||||
`Circle CI <https://circleci.com/about>`_ is a hosted cloud
|
||||
platform that provides hosted continuous integration, deployment, and testing
|
||||
to `GitHub <http://en.wikipedia.org/wiki/GitHub>`_ repositories.
|
||||
|
||||
Circle CI is configured by adding a file named ``circle.yml``, which is a
|
||||
`YAML <http://en.wikipedia.org/wiki/YAML>`_ format text file, to the root
|
||||
directory of the GitHub repository.
|
||||
|
||||
Circle CI automatically detects when a commit has been made and pushed to a
|
||||
GitHub repository that is using Circle CI, and each time this happens, it will
|
||||
try to build the project using :ref:`cmd_ci` command. This includes commits to
|
||||
all branches, not just to the master branch. Circle CI will also build and run
|
||||
pull requests. When that process has completed, it will notify a developer in
|
||||
the way it has been configured to do so — for example, by sending an email
|
||||
containing the build results (showing success or failure), or by posting a
|
||||
message on an IRC channel. It can be configured to build project on a range of
|
||||
different :ref:`platforms`.
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
Put ``circle.yml`` to the root directory of the GitHub repository.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
machine:
|
||||
environment:
|
||||
- PLATFORMIO_CI_SRC=path/to/source/file.c
|
||||
- PLATFORMIO_CI_SRC=path/to/source/file.ino
|
||||
- PLATFORMIO_CI_SRC=path/to/source/directory
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
- sudo apt-get install python2.7-dev
|
||||
- sudo python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
|
||||
|
||||
test:
|
||||
override:
|
||||
- platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
||||
|
||||
|
||||
For more details as for PlatformIO build process please look into :ref:`cmd_ci`
|
||||
command.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
1. Integration for `USB_Host_Shield_2.0 <https://github.com/felis/USB_Host_Shield_2.0>`_
|
||||
project. The ``circle.yml`` configuration file:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
machine:
|
||||
environment:
|
||||
PLATFORMIO_CI_SRC: examples/Bluetooth/PS3SPP/PS3SPP.ino
|
||||
PLATFORMIO_CI_SRC: examples/pl2303/pl2303_gps/pl2303_gps.ino
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
- sudo apt-get install python2.7-dev
|
||||
- sudo python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
|
||||
- wget https://github.com/xxxajk/spi4teensy3/archive/master.zip -O /tmp/spi4teensy3.zip
|
||||
- unzip /tmp/spi4teensy3.zip -d /tmp
|
||||
|
||||
test:
|
||||
override:
|
||||
- platformio ci --lib="." --lib="/tmp/spi4teensy3-master" --board=uno --board=teensy31 --board=due
|
||||
70
docs/ci/drone.rst
Normal file
@@ -0,0 +1,70 @@
|
||||
.. _ci_drone:
|
||||
|
||||
Drone
|
||||
=====
|
||||
|
||||
`Drone <https://drone.io>`_ is a hosted continuous integration service.
|
||||
It enables you to conveniently set up projects to automatically build, test,
|
||||
and deploy as you make changes to your code to
|
||||
`GitHub <http://en.wikipedia.org/wiki/GitHub>`_ and
|
||||
`BitBucket <http://en.wikipedia.org/wiki/Bitbucket>`_ repositories.
|
||||
|
||||
Drone is configured by modifying settings in your project control panel.
|
||||
|
||||
Drone automatically detects when a commit has been made and pushed to a
|
||||
GitHub repository that is using Drone, and each time this happens, it will
|
||||
try to build the project using :ref:`cmd_ci` command. This includes commits to
|
||||
all branches, not just to the master branch. Drone will also build and run
|
||||
pull requests. When that process has completed, it will notify a developer in
|
||||
the way it has been configured to do so — for example, by sending an email
|
||||
containing the build results (showing success or failure). It can be
|
||||
configured to build project on a range of different :ref:`platforms`.
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
Please fill all fields for your project in the Drone control panel:
|
||||
|
||||
`Environment Variables`:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
PLATFORMIO_CI_SRC=path/to/source/file.c
|
||||
PLATFORMIO_CI_SRC=path/to/source/file.ino
|
||||
PLATFORMIO_CI_SRC=path/to/source/directory
|
||||
|
||||
`Commands`:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
|
||||
platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
||||
|
||||
.. image:: ../_static/droneci-platformio-integration-1.png
|
||||
|
||||
For more details as for PlatformIO build process please look into :ref:`cmd_ci`
|
||||
command.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
1. Integration for `USB_Host_Shield_2.0 <https://github.com/felis/USB_Host_Shield_2.0>`_
|
||||
project. The ``circle.yml`` configuration file:
|
||||
|
||||
`Environment Variables`:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
PLATFORMIO_CI_SRC=examples/Bluetooth/PS3SPP/PS3SPP.ino
|
||||
PLATFORMIO_CI_SRC=examples/pl2303/pl2303_gps/pl2303_gps.ino
|
||||
|
||||
`Commands`:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
|
||||
wget https://github.com/xxxajk/spi4teensy3/archive/master.zip -O /tmp/spi4teensy3.zip
|
||||
unzip /tmp/spi4teensy3.zip -d /tmp
|
||||
platformio ci --lib="." --lib="/tmp/spi4teensy3-master" --board=uno --board=teensy31 --board=due
|
||||
|
||||
.. image:: ../_static/droneci-platformio-integration-2.png
|
||||
24
docs/ci/index.rst
Normal file
@@ -0,0 +1,24 @@
|
||||
.. _ci:
|
||||
|
||||
Continuous Integration
|
||||
======================
|
||||
|
||||
`Continuous Integration (CI, wiki) <http://en.wikipedia.org/wiki/Continuous_integration>`_
|
||||
is the practice, in software engineering, of merging all developer working
|
||||
copies with a shared mainline several times a day.
|
||||
|
||||
:ref:`cmd_ci` command is intended to be used in combination with the build
|
||||
servers and the popular
|
||||
`Continuous Integration Software <http://en.wikipedia.org/wiki/Comparison_of_continuous_integration_software>`_.
|
||||
|
||||
By integrating regularly, you can detect errors quickly, and locate them more
|
||||
easily.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
appveyor
|
||||
circleci
|
||||
drone
|
||||
shippable
|
||||
travis
|
||||
76
docs/ci/shippable.rst
Normal file
@@ -0,0 +1,76 @@
|
||||
.. _ci_shippable:
|
||||
|
||||
Shippable
|
||||
=========
|
||||
|
||||
`Shippable <http://en.wikipedia.org/wiki/Shippable>`_ is a hosted cloud
|
||||
platform that provides hosted continuous integration, deployment, and testing
|
||||
to `GitHub <http://en.wikipedia.org/wiki/GitHub>`_ and
|
||||
`BitBucket <http://en.wikipedia.org/wiki/Bitbucket>`_ repositories.
|
||||
Shippable's continuous integration service is built using Docker.
|
||||
|
||||
Shippable is configured by adding a file named ``shippable.yml``, which is a
|
||||
`YAML <http://en.wikipedia.org/wiki/YAML>`_ format text file, to the root
|
||||
directory of the GitHub repository or you can use your Travis CI configuration
|
||||
file ``.travis.yml``.
|
||||
|
||||
Shippable automatically detects when a commit has been made and pushed to a
|
||||
GitHub repository that is using Shippable, and each time this happens, it will
|
||||
try to build the project using :ref:`cmd_ci` command. This includes commits to
|
||||
all branches, not just to the master branch. Shippable will also build and run
|
||||
pull requests. When that process has completed, it will notify a developer in
|
||||
the way it has been configured to do so — for example, by sending an email
|
||||
containing the build results (showing success or failure), or by posting a
|
||||
message on an IRC channel. It can be configured to build project on a range of
|
||||
different :ref:`platforms`.
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
Please put ``shippable.yml`` or ``.travis.yml`` to the root directory of the
|
||||
GitHub repository.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
|
||||
env:
|
||||
- PLATFORMIO_CI_SRC=path/to/source/file.c
|
||||
- PLATFORMIO_CI_SRC=path/to/source/file.ino
|
||||
- PLATFORMIO_CI_SRC=path/to/source/directory
|
||||
|
||||
install:
|
||||
- python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
|
||||
|
||||
script:
|
||||
- platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
||||
|
||||
|
||||
For more details as for PlatformIO build process please look into :ref:`cmd_ci`
|
||||
command.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
1. Integration for `USB_Host_Shield_2.0 <https://github.com/felis/USB_Host_Shield_2.0>`_
|
||||
project. The ``shippable.yml`` or ``.travis.yml`` configuration file:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
|
||||
env:
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/PS3SPP/PS3SPP.ino
|
||||
- PLATFORMIO_CI_SRC=examples/pl2303/pl2303_gps/pl2303_gps.ino
|
||||
|
||||
install:
|
||||
- python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
|
||||
- wget https://github.com/xxxajk/spi4teensy3/archive/master.zip -O /tmp/spi4teensy3.zip
|
||||
- unzip /tmp/spi4teensy3.zip -d /tmp
|
||||
|
||||
script:
|
||||
- platformio ci --lib="." --lib="/tmp/spi4teensy3-master" --board=uno --board=teensy31 --board=due
|
||||
72
docs/ci/travis.rst
Normal file
@@ -0,0 +1,72 @@
|
||||
.. _ci_travis:
|
||||
|
||||
Travis CI
|
||||
=========
|
||||
|
||||
`Travis CI <http://en.wikipedia.org/wiki/Travis_CI>`_ is an open-source hosted,
|
||||
distributed continuous integration service used to build and test projects
|
||||
hosted at `GitHub <http://en.wikipedia.org/wiki/GitHub>`_.
|
||||
|
||||
Travis CI is configured by adding a file named ``.travis.yml``, which is a
|
||||
`YAML <http://en.wikipedia.org/wiki/YAML>`_ format text file, to the root
|
||||
directory of the GitHub repository.
|
||||
|
||||
Travis CI automatically detects when a commit has been made and pushed to a
|
||||
GitHub repository that is using Travis CI, and each time this happens, it will
|
||||
try to build the project using :ref:`cmd_ci` command. This includes commits to
|
||||
all branches, not just to the master branch. Travis CI will also build and run
|
||||
pull requests. When that process has completed, it will notify a developer in
|
||||
the way it has been configured to do so — for example, by sending an email
|
||||
containing the build results (showing success or failure), or by posting a
|
||||
message on an IRC channel. It can be configured to build project on a range of
|
||||
different :ref:`platforms`.
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
Please put ``.travis.yml`` to the root directory of the GitHub repository.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
|
||||
env:
|
||||
- PLATFORMIO_CI_SRC=path/to/source/file.c
|
||||
- PLATFORMIO_CI_SRC=path/to/source/file.ino
|
||||
- PLATFORMIO_CI_SRC=path/to/source/directory
|
||||
|
||||
install:
|
||||
- python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
|
||||
|
||||
script:
|
||||
- platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
||||
|
||||
|
||||
For more details as for PlatformIO build process please look into :ref:`cmd_ci`
|
||||
command.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
1. Integration for `USB_Host_Shield_2.0 <https://github.com/felis/USB_Host_Shield_2.0>`_
|
||||
project. The ``.travis.yml`` configuration file:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
|
||||
env:
|
||||
- PLATFORMIO_CI_SRC=examples/Bluetooth/PS3SPP/PS3SPP.ino
|
||||
- PLATFORMIO_CI_SRC=examples/pl2303/pl2303_gps/pl2303_gps.ino
|
||||
|
||||
install:
|
||||
- python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
|
||||
- wget https://github.com/xxxajk/spi4teensy3/archive/master.zip -O /tmp/spi4teensy3.zip
|
||||
- unzip /tmp/spi4teensy3.zip -d /tmp
|
||||
|
||||
script:
|
||||
- platformio ci --lib="." --lib="/tmp/spi4teensy3-master" --board=uno --board=teensy31 --board=due
|
||||
@@ -69,6 +69,7 @@ If you are going to run *PlatformIO* from **subprocess**, you **MUST
|
||||
DISABLE** all prompts. It will allow you to avoid blocking.
|
||||
There are a few options:
|
||||
|
||||
- using :option:`platformio --force` option before each command
|
||||
- using environment variable :ref:`PLATFORMIO_SETTING_ENABLE_PROMPTS=No <envvar_PLATFORMIO_SETTING_ENABLE_PROMPTS>`
|
||||
- disable global setting ``enable_prompts`` via :ref:`cmd_settings` command
|
||||
- masking under Continuous Integration system via environment variable
|
||||
@@ -86,8 +87,8 @@ Serial does not work with panStampAVR board
|
||||
Answered in `issue #144 <https://github.com/platformio/platformio/issues/144#issuecomment-87388038>`_.
|
||||
|
||||
|
||||
An error ``pkg_resources.DistributionNotFound``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
PlatformIO: command not found || An error ``pkg_resources.DistributionNotFound``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Please upgrade *SetupTools* package:
|
||||
|
||||
|
||||
@@ -27,6 +27,40 @@ Boards
|
||||
`PlatformIO Boards Explorer <http://platformio.org/#!/boards>`_
|
||||
* For more detailed ``board`` information please scroll tables below by horizontal.
|
||||
|
||||
Armstrap
|
||||
~~~~~~~~
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Type ``board``
|
||||
- Name
|
||||
- Microcontroller
|
||||
- Frequency
|
||||
- Flash
|
||||
- RAM
|
||||
|
||||
* - ``armstrap_eagle1024``
|
||||
- `Armstrap Eagle 1024 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
|
||||
- STM32F417VGT6
|
||||
- 168 MHz
|
||||
- 1024 Kb
|
||||
- 192 Kb
|
||||
|
||||
* - ``armstrap_eagle2048``
|
||||
- `Armstrap Eagle 2048 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
|
||||
- STM32F427VIT6
|
||||
- 168 MHz
|
||||
- 2048 Kb
|
||||
- 256 Kb
|
||||
|
||||
* - ``armstrap_eagle512``
|
||||
- `Armstrap Eagle 512 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
|
||||
- STM32F407VET6
|
||||
- 168 MHz
|
||||
- 512 Kb
|
||||
- 192 Kb
|
||||
|
||||
ST
|
||||
~~
|
||||
|
||||
|
||||
@@ -527,6 +527,26 @@ Switch Science
|
||||
- 32 Kb
|
||||
- 4 Kb
|
||||
|
||||
Teensy
|
||||
~~~~~~
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Type ``board``
|
||||
- Name
|
||||
- Microcontroller
|
||||
- Frequency
|
||||
- Flash
|
||||
- RAM
|
||||
|
||||
* - ``teensy31``
|
||||
- `Teensy 3.1 <https://www.pjrc.com/store/teensy31.html>`_
|
||||
- MK20DX256
|
||||
- 72 MHz
|
||||
- 256 Kb
|
||||
- 64 Kb
|
||||
|
||||
u-blox
|
||||
~~~~~~
|
||||
|
||||
|
||||
@@ -27,6 +27,40 @@ Boards
|
||||
`PlatformIO Boards Explorer <http://platformio.org/#!/boards>`_
|
||||
* For more detailed ``board`` information please scroll tables below by horizontal.
|
||||
|
||||
Armstrap
|
||||
~~~~~~~~
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Type ``board``
|
||||
- Name
|
||||
- Microcontroller
|
||||
- Frequency
|
||||
- Flash
|
||||
- RAM
|
||||
|
||||
* - ``armstrap_eagle1024``
|
||||
- `Armstrap Eagle 1024 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
|
||||
- STM32F417VGT6
|
||||
- 168 MHz
|
||||
- 1024 Kb
|
||||
- 192 Kb
|
||||
|
||||
* - ``armstrap_eagle2048``
|
||||
- `Armstrap Eagle 2048 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
|
||||
- STM32F427VIT6
|
||||
- 168 MHz
|
||||
- 2048 Kb
|
||||
- 256 Kb
|
||||
|
||||
* - ``armstrap_eagle512``
|
||||
- `Armstrap Eagle 512 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
|
||||
- STM32F407VET6
|
||||
- 168 MHz
|
||||
- 512 Kb
|
||||
- 192 Kb
|
||||
|
||||
ST
|
||||
~~
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ IDE Integration
|
||||
ide/arduino
|
||||
ide/eclipse
|
||||
ide/energia
|
||||
ide/qtcreator
|
||||
ide/sublimetext
|
||||
ide/vim
|
||||
ide/visualstudio
|
||||
|
||||
@@ -15,15 +15,34 @@ registers, and disassembly viewers.
|
||||
|
||||
This software can be used with:
|
||||
|
||||
* all availalbe :ref:`platforms`
|
||||
* all availalbe :ref:`frameworks`
|
||||
* all available :ref:`platforms`
|
||||
* all available :ref:`frameworks`
|
||||
|
||||
Refer to the `CDT Documentation <https://eclipse.org/cdt/documentation.php>`_
|
||||
page for more detailed information.
|
||||
|
||||
.. contents::
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
Project Generator
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
Since PlatformIO 2.0 you can generate Eclipse compatible project using
|
||||
:option:`platformio init --ide` command:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
platformio init --ide eclipse
|
||||
|
||||
Then import this project via ``File > Import... > General > Existing Projects
|
||||
into Workspace > Next`` and specify root directory where is located
|
||||
:ref:`projectconf`.
|
||||
|
||||
Manual Integration
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
More detailed information is located in PlatformIO blog: `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO <http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio>`_.
|
||||
|
||||
`More examples (TI MSP430, TI TIVA, etc.) <https://github.com/platformio/platformio/tree/develop/examples/ide-eclipse>`_
|
||||
|
||||
129
docs/ide/qtcreator.rst
Normal file
@@ -0,0 +1,129 @@
|
||||
.. _ide_qtcreator:
|
||||
|
||||
Qt Creator
|
||||
==========
|
||||
|
||||
The `Qt Creator <https://github.com/qtproject/qt-creator>`_ is an open source cross-platform integrated development environment. The editor includes such features as syntax highlighting for various languages, project manager, integrated version control systems, rapid code navigation tools and code autocompletion.
|
||||
|
||||
This software can be used with:
|
||||
|
||||
* all available :ref:`platforms`
|
||||
* all available :ref:`frameworks`
|
||||
|
||||
Refer to the `Qt-creator Manual <http://doc.qt.io/qtcreator/>`_
|
||||
page for more detailed information.
|
||||
|
||||
.. contents::
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
Project Generator
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
Since PlatformIO 2.0 you can generate Eclipse compatible project using
|
||||
:option:`platformio init --ide` command:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
platformio init --ide qtcreator
|
||||
|
||||
Then import this project via ``File > New File or Project > Import Project``
|
||||
and specify root directory where is located :ref:`projectconf`.
|
||||
|
||||
Manual Integration
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Setup New Project
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
First of all, let's create new project from Qt Creator Start Page: ``New Project`` or using ``Menu: File > New File or Project``, then select project with ``Empty Qt Project`` type (``Other Project > Empty Qt Project``), fill ``Name``, ``Create in``.
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-1.png
|
||||
|
||||
On the next steps select any available kit and click Finish button.
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-2.png
|
||||
|
||||
Secondly, we need to configure project with PlatformIO source code builder (click on Projects label on left menu or ``Ctrl+5`` shortcut):
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-3.png
|
||||
|
||||
Thirdly, change project file by adding path to directories with header files. Please edit project file to match the following contents:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
win32 {
|
||||
HOMEDIR += $$(USERPROFILE)
|
||||
}
|
||||
else {
|
||||
HOMEDIR += $$(PWD)
|
||||
}
|
||||
|
||||
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/framework-arduinoavr/cores/arduino"
|
||||
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/toolchain-atmelavr/avr/include"
|
||||
|
||||
win32:INCLUDEPATH ~= s,/,\\,g
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-4.png
|
||||
|
||||
First program in Qt Creator
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Simple "Blink" project will consist from two files:
|
||||
1. In the console, navigate to the root of your project folder and initialize platformio project with ``platformio init``
|
||||
2. The main "C" source file named ``main.c`` must be located in the ``src`` directory.
|
||||
Let's create new text file named ``main.c`` using ``Menu: New File or Project > General > Text File``:
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-5.png
|
||||
|
||||
Copy the source code which is described below to file ``main.c``.
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
#include "Arduino.h"
|
||||
#define WLED 13 // Most Arduino boards already have an LED attached to pin 13 on the board itself
|
||||
|
||||
void setup()
|
||||
{
|
||||
pinMode(WLED, OUTPUT); // set pin as output
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
digitalWrite(WLED, HIGH); // set the LED on
|
||||
delay(1000); // wait for a second
|
||||
digitalWrite(WLED, LOW); // set the LED off
|
||||
delay(1000); // wait for a second
|
||||
}
|
||||
|
||||
3. Locate the project configuration file named ``platformio.ini`` at the root of the project directory and open it.
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-6.png
|
||||
|
||||
Edit the content to match the code described below.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
#
|
||||
# Project Configuration File
|
||||
#
|
||||
# A detailed documentation with the EXAMPLES is located here:
|
||||
# http://docs.platformio.org/en/latest/projectconf.html
|
||||
#
|
||||
|
||||
# A sign `#` at the beginning of the line indicates a comment
|
||||
# Comment lines are ignored.
|
||||
|
||||
[env:arduino_uno]
|
||||
platform = atmelavr
|
||||
framework = arduino
|
||||
board = uno
|
||||
|
||||
|
||||
Conclusion
|
||||
----------
|
||||
|
||||
Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build > Build All``:
|
||||
|
||||
.. image:: ../_static/ide-platformio-qtcreator-7.png
|
||||
@@ -7,8 +7,8 @@ The `Sublime Text <http://www.sublimetext.com/>`_ is a cross-platform text and s
|
||||
|
||||
This software can be used with:
|
||||
|
||||
* all availalbe :ref:`platforms`
|
||||
* all availalbe :ref:`frameworks`
|
||||
* all available :ref:`platforms`
|
||||
* all available :ref:`frameworks`
|
||||
|
||||
Refer to the `Sublime Text Documentation <http://docs.sublimetext.info/en/latest>`_
|
||||
page for more detailed information.
|
||||
@@ -18,11 +18,27 @@ page for more detailed information.
|
||||
Integration
|
||||
-----------
|
||||
|
||||
Project Generator
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
Since PlatformIO 2.0 you can generate Eclipse compatible project using
|
||||
:option:`platformio init --ide` command:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
platformio init --ide sublimetext
|
||||
|
||||
Then import this project via ``Project > Open Project...`` and specify root
|
||||
directory where is located :ref:`projectconf`.
|
||||
|
||||
Manual Integration
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Initial configuration
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
First of all, we need to create "New Build System" with name "PlatformIO"
|
||||
from ``Menu: Tools → Build System → New Build System`` and fill it like
|
||||
from ``Menu: Tools > Build System > New Build System`` and fill it like
|
||||
described below:
|
||||
|
||||
.. code-block:: bash
|
||||
@@ -48,16 +64,16 @@ Secondly, we need to select "PlatformIO" Build System from a list:
|
||||
.. image:: ../_static/ide-sublime-text-platformio-newproject-2.png
|
||||
|
||||
After that, we can use the necessary commands from
|
||||
``Menu: Tools → Command Palette`` or with ``Ctrl+Shift+P`` (Windows/Linux)
|
||||
``Menu: Tools > Command Palette`` or with ``Ctrl+Shift+P`` (Windows/Linux)
|
||||
``Cmd+Shift+P`` (Mac) shortcut.
|
||||
|
||||
.. image:: ../_static/ide-sublime-text-platformio-newproject-3.png
|
||||
|
||||
Command Hotkeys
|
||||
~~~~~~~~~~~~~~~
|
||||
'''''''''''''''
|
||||
|
||||
Sublime Text allows to bind own hotkey per command. Let's setup them
|
||||
for PlatformIO commands using shortcut ``Menu: Preferences → Key-Bindings - User``:
|
||||
for PlatformIO commands using shortcut ``Menu: Preferences > Key-Bindings - User``:
|
||||
|
||||
.. image:: ../_static/ide-sublime-text-platformio-newproject-4.png
|
||||
|
||||
@@ -76,12 +92,12 @@ In this case, the final code will look like:
|
||||
]
|
||||
|
||||
First program in Sublime Text
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Simple "Blink" project will consist from two files:
|
||||
|
||||
1. Main "C" source file named ``main.c`` must be located in the ``src`` directory.
|
||||
Let's create new file named ``main.c`` using ``Menu: File → New File`` or shortcut ``Ctrl+N`` (Windows/Linux) ``Cmd+N`` (Mac) with the next contents:
|
||||
Let's create new file named ``main.c`` using ``Menu: File > New File`` or shortcut ``Ctrl+N`` (Windows/Linux) ``Cmd+N`` (Mac) with the next contents:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
@@ -124,6 +140,6 @@ Copy the source code which is described below to it.
|
||||
Conclusion
|
||||
----------
|
||||
|
||||
Taking everything into account, we can open project directory in Sublime Text using ``Menu: File → Open Folder`` and build it with shortcut ``Ctrl+B`` (Windows/Linux) or ``Cmd+B`` (Mac), clean project with shortcut ``F11`` and upload firmware to target with shortcut ``F12``.
|
||||
Taking everything into account, we can open project directory in Sublime Text using ``Menu: File > Open Folder`` and build it with shortcut ``Ctrl+B`` (Windows/Linux) or ``Cmd+B`` (Mac), clean project with shortcut ``F11`` and upload firmware to target with shortcut ``F12``.
|
||||
|
||||
.. image:: ../_static/ide-sublime-text-platformio-newproject-5.png
|
||||
|
||||
@@ -9,8 +9,8 @@ standalone application in a graphical user interface.
|
||||
|
||||
This software can be used with:
|
||||
|
||||
* all availalbe :ref:`platforms`
|
||||
* all availalbe :ref:`frameworks`
|
||||
* all available :ref:`platforms`
|
||||
* all available :ref:`frameworks`
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
@@ -7,8 +7,8 @@ The `Microsoft Visual Studio (Free) <http://visualstudio.com/free>`_ is an integ
|
||||
|
||||
This software can be used with:
|
||||
|
||||
* all availalbe :ref:`platforms`
|
||||
* all availalbe :ref:`frameworks`
|
||||
* all available :ref:`platforms`
|
||||
* all available :ref:`frameworks`
|
||||
|
||||
Refer to the `Visual Studio Documentation <https://msdn.microsoft.com/library/vstudio>`_
|
||||
page for more detailed information.
|
||||
@@ -18,10 +18,26 @@ page for more detailed information.
|
||||
Integration
|
||||
-----------
|
||||
|
||||
Setup New Project
|
||||
Project Generator
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
First of all, let's create new project from Visual Studio Start Page: ``Start → New Project`` or using ``Menu: File → New → Project``, then select project with ``Makefile`` type (``Visual C++ → General → Makefile Project``), fill ``Project name``, ``Solution name``, ``Location`` fields and press OK button.
|
||||
Since PlatformIO 2.0 you can generate Eclipse compatible project using
|
||||
:option:`platformio init --ide` command:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
platformio init --ide visualstudio
|
||||
|
||||
Then import this project via ``File > Import ...`` and specify root directory
|
||||
where is located :ref:`projectconf`.
|
||||
|
||||
Manual Integration
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Setup New Project
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
First of all, let's create new project from Visual Studio Start Page: ``Start > New Project`` or using ``Menu: File > New > Project``, then select project with ``Makefile`` type (``Visual C++ > General > Makefile Project``), fill ``Project name``, ``Solution name``, ``Location`` fields and press OK button.
|
||||
|
||||
.. image:: ../_static/ide-vs-platformio-newproject.png
|
||||
|
||||
@@ -37,7 +53,7 @@ Release Configuration is the same as Debug, so on the next step we check "Same a
|
||||
|
||||
.. image:: ../_static/ide-vs-platformio-newproject-3.png
|
||||
|
||||
Thirdly, we need to add directories with header files using project properties (right click on the project name or ``Alt-Enter`` shortcut) and add two directories to ``Configuration Properties → NMake → Include Search Path``:
|
||||
Thirdly, we need to add directories with header files using project properties (right click on the project name or ``Alt-Enter`` shortcut) and add two directories to ``Configuration Properties > NMake > Include Search Path``:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
@@ -47,12 +63,12 @@ Thirdly, we need to add directories with header files using project properties (
|
||||
.. image:: ../_static/ide-vs-platformio-newproject-5.png
|
||||
|
||||
First program in Visual Studio
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Simple "Blink" project will consist from two files:
|
||||
|
||||
1. Main "C" source file named ``main.c`` must be located in the ``src`` directory.
|
||||
Let's create new file named ``main.c`` using ``Menu: File → New File`` or shortcut ``Ctrl+N``:
|
||||
Let's create new file named ``main.c`` using ``Menu: File > New File`` or shortcut ``Ctrl+N``:
|
||||
|
||||
.. image:: ../_static/ide-vs-platformio-newproject-6.png
|
||||
|
||||
@@ -103,6 +119,6 @@ Copy the source code which is described below to it.
|
||||
Conclusion
|
||||
----------
|
||||
|
||||
Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build → Build Solution``:
|
||||
Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build > Build Solution``:
|
||||
|
||||
.. image:: ../_static/ide-vs-platformio-newproject-8.png
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
PlatformIO: A cross-platform code builder and the missing library manager
|
||||
=========================================================================
|
||||
|
||||
*Atmel AVR & SAM, Freescale Kinetis, Nordic nRF51, NXP LPC, ST STM32,
|
||||
*Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC, ST STM32,
|
||||
TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.*
|
||||
|
||||
.. image:: _static/platformio-logo.png
|
||||
@@ -29,6 +29,7 @@ Embedded Development. *Easier Than Ever.*
|
||||
* Built-in :ref:`Serial Port Monitor <cmd_serialports_monitor>`
|
||||
* Configurable build :ref:`-flags/-options <projectconf_build_flags>`
|
||||
* Integration with :ref:`development environments (IDE) <ide>`
|
||||
* Ready for Cloud Compiling and :ref:`ci`
|
||||
* Pre-built tool chains, :ref:`frameworks` for the popular Hardware Platforms
|
||||
|
||||
Smart Code Builder. *Fast and Reliable.*
|
||||
@@ -63,6 +64,7 @@ Contents
|
||||
frameworks/index
|
||||
librarymanager/index
|
||||
userguide/index
|
||||
ci/index
|
||||
ide
|
||||
articles
|
||||
FAQ <faq>
|
||||
|
||||
@@ -134,3 +134,4 @@ The registration requirements:
|
||||
|
||||
Now, you can :ref:`register <cmd_lib_register>` your library and allow others
|
||||
to :ref:`install <cmd_lib_install>` it.
|
||||
|
||||
|
||||
@@ -294,9 +294,124 @@ Installation
|
||||
1. Create ``platforms`` directory in :ref:`projectconf_pio_home_dir` if it
|
||||
doesn't exists.
|
||||
2. Copy ``test.py`` and ``test-builder.py`` files to ``platforms`` directory.
|
||||
3. Search available platforms via :ref:`cmd_search` command. You should see
|
||||
3. Search available platforms via :ref:`cmd_platforms_search` command. You should see
|
||||
``test`` platform.
|
||||
4. Install ``test`` platform via :ref:`cmd_install` command.
|
||||
4. Install ``test`` platform via :ref:`cmd_platforms_install` command.
|
||||
|
||||
Now, you can use ``test`` for the :ref:`projectconf_env_platform` option in
|
||||
:ref:`projectconf`.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
Let's use the real example which was requested by our user in `issue 175 <https://github.com/platformio/platformio/issues/175>`_. Need to add support for uploading firmware using GDB to
|
||||
:ref:`platform_ststm32`.
|
||||
|
||||
First of all, need to create new folder ``platforms`` in :ref:`projectconf_pio_home_dir`
|
||||
and copy there two files:
|
||||
|
||||
1. Platform manifest file ``ststm32gdb.py`` with the next content:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import os
|
||||
|
||||
from platformio.platforms.ststm32 import Ststm32Platform
|
||||
|
||||
|
||||
class Ststm32gdbPlatform(Ststm32Platform):
|
||||
|
||||
"""
|
||||
ST STM32 using GDB as uploader
|
||||
|
||||
http://www.st.com/web/en/catalog/mmc/FM141/SC1169?sc=stm32
|
||||
"""
|
||||
|
||||
def get_build_script(self):
|
||||
|
||||
return os.path.join(
|
||||
os.path.dirname(os.path.realpath(__file__)),
|
||||
"ststm32gdb-builder.py"
|
||||
)
|
||||
|
||||
2. Build script file ``ststm32gdb-builder.py`` with the next content:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
"""
|
||||
Builder for ST STM32 Series ARM microcontrollers with GDB upload.
|
||||
"""
|
||||
|
||||
from os.path import join
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
DefaultEnvironment, SConscript)
|
||||
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
||||
|
||||
env.Replace(
|
||||
UPLOADER=join(
|
||||
"$PIOPACKAGES_DIR", "toolchain-gccarmnoneeabi",
|
||||
"bin", "arm-none-eabi-gdb"
|
||||
),
|
||||
UPLOADERFLAGS=[
|
||||
join("$BUILD_DIR", "firmware.elf"),
|
||||
"-batch",
|
||||
"-x", join("$PROJECT_DIR", "upload.gdb")
|
||||
],
|
||||
|
||||
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
|
||||
)
|
||||
|
||||
env.Append(
|
||||
CPPDEFINES=[
|
||||
"${BOARD_OPTIONS['build']['variant'].upper()}"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-nostartfiles",
|
||||
"-nostdlib"
|
||||
]
|
||||
)
|
||||
|
||||
#
|
||||
# Target: Build executable and linkable firmware
|
||||
#
|
||||
|
||||
target_elf = env.BuildFirmware()
|
||||
|
||||
#
|
||||
# Target: Build the .bin file
|
||||
#
|
||||
|
||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
target_firm = join("$BUILD_DIR", "firmware.bin")
|
||||
else:
|
||||
target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
|
||||
#
|
||||
# Target: Print binary size
|
||||
#
|
||||
|
||||
target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD")
|
||||
AlwaysBuild(target_size)
|
||||
|
||||
#
|
||||
# Target: Upload by default .bin file
|
||||
#
|
||||
|
||||
upload = env.Alias(
|
||||
["upload", "uploadlazy"], target_firm, "$UPLOADCMD")
|
||||
AlwaysBuild(upload)
|
||||
|
||||
#
|
||||
# Target: Define targets
|
||||
#
|
||||
|
||||
Default([target_firm, target_size])
|
||||
|
||||
Now, we should see ``ststm32gdb`` platform using :ref:`cmd_platforms_search` command output
|
||||
and can install it via :ref:`platformio platforms install ststm32gdb <cmd_platforms_install>` command.
|
||||
|
||||
@@ -73,6 +73,40 @@ Boards
|
||||
* For more detailed ``board`` information please scroll tables below by
|
||||
horizontal.
|
||||
|
||||
Armstrap
|
||||
~~~~~~~~
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Type ``board``
|
||||
- Name
|
||||
- Microcontroller
|
||||
- Frequency
|
||||
- Flash
|
||||
- RAM
|
||||
|
||||
* - ``armstrap_eagle1024``
|
||||
- `Armstrap Eagle 1024 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
|
||||
- STM32F417VGT6
|
||||
- 168 MHz
|
||||
- 1024 Kb
|
||||
- 192 Kb
|
||||
|
||||
* - ``armstrap_eagle2048``
|
||||
- `Armstrap Eagle 2048 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
|
||||
- STM32F427VIT6
|
||||
- 168 MHz
|
||||
- 2048 Kb
|
||||
- 256 Kb
|
||||
|
||||
* - ``armstrap_eagle512``
|
||||
- `Armstrap Eagle 512 <http://docs.armstrap.org/en/latest/hardware-overview.html>`_
|
||||
- STM32F407VET6
|
||||
- 168 MHz
|
||||
- 512 Kb
|
||||
- 192 Kb
|
||||
|
||||
ST
|
||||
~~
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ processes:
|
||||
* - Format
|
||||
- Scope
|
||||
- Description
|
||||
* - ``Wp,option``
|
||||
* - ``-Wp,option``
|
||||
- CPPFLAGS
|
||||
- Bypass the compiler driver and pass *option* directly through to the
|
||||
preprocessor
|
||||
@@ -309,6 +309,35 @@ but will be applied only for the project source code from
|
||||
This option can be overridden by global environment variable
|
||||
:ref:`envvar_PLATFORMIO_SRCBUILD_FLAGS`.
|
||||
|
||||
``install_libs``
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
Specify dependent libraries which should be installed before environment
|
||||
process. The only library IDs are allowed. Multiple libraries can be passed
|
||||
using comma ``,`` sign.
|
||||
|
||||
You can obtain library IDs using :ref:`cmd_lib_search` command.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[env:depends_on_some_libs]
|
||||
install_libs = 1,13,19
|
||||
|
||||
``use_libs``
|
||||
^^^^^^^^^^^^
|
||||
|
||||
Specify libraries which should be used by ``Library Dependency Finder`` with
|
||||
the highest priority.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[env:libs_with_highest_priority]
|
||||
use_libs = OneWire_ID1
|
||||
|
||||
``ignore_libs``
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ Quickstart
|
||||
|
||||
1. :ref:`Install PlatformIO <installation>`.
|
||||
|
||||
2. Find board ``type`` on this :ref:`Embedded Boards <platforms>` page or
|
||||
via :ref:`cmd_boards` command.
|
||||
2. Find board ``type`` using `Embedded Boards Explorer <http://platformio.org/#!/boards>`_
|
||||
or via :ref:`cmd_boards` command.
|
||||
|
||||
3. Initialize new PlatformIO based project via :ref:`cmd_init` command with the
|
||||
pre-configured environments for your boards:
|
||||
|
||||
110
docs/userguide/cmd_ci.rst
Normal file
@@ -0,0 +1,110 @@
|
||||
.. _cmd_ci:
|
||||
|
||||
platformio ci
|
||||
=============
|
||||
|
||||
.. contents::
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
platformio ci [OPTIONS] [SRC]
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
:ref:`cmd_ci` command is conceived of as "hot key" for building project with
|
||||
arbitrary source code structure. In a nutshell, using ``SRC`` and
|
||||
:option:`platformio ci --lib` contents PlatformIO initialises via
|
||||
:ref:`cmd_init` new project in :option:`platformio ci --build-dir`
|
||||
with the build environments (using :option:`platformio ci --board` or
|
||||
:option:`platformio ci --project-conf`) and processes them via :ref:`cmd_run`
|
||||
command.
|
||||
|
||||
For more details as for integration with the popular Continuous Integration
|
||||
Systems please follow to :ref:`ci` page.
|
||||
|
||||
.. note::
|
||||
:ref:`cmd_ci` command accepts **multiple** ``SRC`` arguments,
|
||||
:option:`platformio ci --lib` and :option:`platformio ci --exclude` options
|
||||
which can be a path to directory, file or
|
||||
`Glob Pattern <http://en.wikipedia.org/wiki/Glob_(programming)>`_.
|
||||
|
||||
.. note::
|
||||
You can omit ``SRC`` argument and set path (multiple paths are allowed
|
||||
denoting with ``:``) to
|
||||
``PLATFORMIO_CI_SRC`` `Environment variable <http://en.wikipedia.org/wiki/Environment_variable>`_
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
.. program:: platformio ci
|
||||
|
||||
.. option::
|
||||
-l, --lib
|
||||
|
||||
Source code which will be copied to ``%build_dir%/lib`` directly.
|
||||
|
||||
If :option:`platformio ci --lib` is a path to file (not to directory), then
|
||||
PlatformIO will create temporary directory within ``%build_dir%/lib`` and copy
|
||||
the rest files into it.
|
||||
|
||||
|
||||
.. option::
|
||||
--exclude
|
||||
|
||||
Exclude directories and/-or files from :option:`platformio ci --build-dir`. The
|
||||
path must be relative to PlatformIO project within
|
||||
:option:`platformio ci --build-dir`.
|
||||
|
||||
For example, exclude from project ``src`` directory:
|
||||
|
||||
* ``examples`` folder
|
||||
* ``*.h`` files from ``foo`` folder
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
platformio ci --exclude=src/examples --exclude=src/foo/*.h [SRC]
|
||||
|
||||
.. option::
|
||||
-b, --board
|
||||
|
||||
Build project with automatically pre-generated environments based on board
|
||||
settings.
|
||||
|
||||
For more details please look into :option:`platformio init --board`.
|
||||
|
||||
.. option::
|
||||
--build-dir
|
||||
|
||||
Path to directory where PlatformIO will initialise new project. By default it's
|
||||
temporary directory within your operation system.
|
||||
|
||||
.. note::
|
||||
|
||||
This directory will be removed at the end of build process. If you want to
|
||||
keep it, please use :option:`platformio ci --keep-build-dir`.
|
||||
|
||||
.. option::
|
||||
--keep-build-dir
|
||||
|
||||
Don't remove :option:`platformio ci --build-dir` after build process.
|
||||
|
||||
.. option::
|
||||
--project-conf
|
||||
|
||||
Buid project using pre-configured :ref:`projectconf`.
|
||||
|
||||
.. option::
|
||||
-v, --verbose
|
||||
|
||||
Shows details about the results of processing environments. More details
|
||||
:option:`platformio run --verbose`
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
For the examples please follow to :ref:`ci` page.
|
||||
@@ -29,13 +29,15 @@ This command will create:
|
||||
Options
|
||||
-------
|
||||
|
||||
.. program:: platformio init
|
||||
|
||||
.. option::
|
||||
--project-dir, -d
|
||||
-d, --project-dir
|
||||
|
||||
A path to the directory where *PlatformIO* will initialise new project.
|
||||
|
||||
.. option::
|
||||
--board, -b
|
||||
-b, --board
|
||||
|
||||
If you specify board ``type`` (you can pass multiple ``--board`` options), then
|
||||
*PlatformIO* will automatically generate environment for :ref:`projectconf` and
|
||||
@@ -47,13 +49,32 @@ pre-fill these data:
|
||||
|
||||
The full list with pre-configured boards is available here :ref:`platforms`.
|
||||
|
||||
.. option::
|
||||
--ide
|
||||
|
||||
Initialise PlatformIO project for the specified IDE which can be imported later
|
||||
via "Import Project" functionality.
|
||||
|
||||
A list with supported IDE is available within ``platformio init --help`` command.
|
||||
Also, please look into :ref:`ide` page.
|
||||
|
||||
.. option::
|
||||
--disable-auto-uploading
|
||||
|
||||
If you initialise project with the specified ``--board``, then *PlatformIO*
|
||||
If you initialise project with the specified
|
||||
:option:`platformio init --board`, then *PlatformIO*
|
||||
will create environment with enabled firmware auto-uploading. This option
|
||||
allows you to disable firmware auto-uploading by default.
|
||||
|
||||
.. option::
|
||||
--env-prefix
|
||||
|
||||
An environment prefix which will be used with pair in board type.
|
||||
|
||||
For example, the default environment name for ``teensy_31`` board will
|
||||
be ``[env:teensy_31]``.
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ Process environments which are defined in :ref:`projectconf` file
|
||||
Options
|
||||
-------
|
||||
|
||||
.. program:: platformio run
|
||||
|
||||
.. option::
|
||||
-e, --environment
|
||||
|
||||
@@ -39,6 +41,27 @@ Process specified targets
|
||||
Upload port of embedded board. To print all available ports use
|
||||
:ref:`cmd_serialports` command
|
||||
|
||||
.. option::
|
||||
--build-dir
|
||||
|
||||
Specify the path to project directory. By default, ``--build-dir`` is equal to
|
||||
current working directory (``CWD``).
|
||||
|
||||
.. option::
|
||||
-v, --verbose
|
||||
|
||||
Shows details about the results of processing environments. Each instance of
|
||||
``--verbose`` on the command line increases the verbosity level by one, so if
|
||||
you need more details on the output, specify it twice.
|
||||
|
||||
There 3 levels of verbosity:
|
||||
|
||||
1. ``-v`` - output errors only
|
||||
2. ``-vv`` - output errors and warnings
|
||||
3. ``-vvv`` - output errors, warnings and additional information
|
||||
|
||||
By default, verbosity level is set to 3 (maximum information).
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ List available `Serial Ports <http://en.wikipedia.org/wiki/Serial_port>`_
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
.. program:: platformio serialports list
|
||||
|
||||
.. option::
|
||||
--json-output
|
||||
|
||||
@@ -99,6 +101,8 @@ To control *monitor* please use these "hot keys":
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
.. program:: platformio serialports monitor
|
||||
|
||||
.. option::
|
||||
-p, --port
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ Usage
|
||||
Description
|
||||
-----------
|
||||
|
||||
Check or update installed :ref:`Platforms <platforms>`
|
||||
Check or update installed :ref:`Platforms <platforms>` and
|
||||
:ref:`Libraries <librarymanager>`
|
||||
|
||||
|
||||
Examples
|
||||
|
||||
@@ -3,7 +3,35 @@
|
||||
User Guide
|
||||
==========
|
||||
|
||||
To print all available commands and options use:
|
||||
.. contents::
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
platformio [OPTIONS] COMMAND
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
.. program:: platformio
|
||||
|
||||
.. option::
|
||||
--force, - f
|
||||
|
||||
Force to accept any confirmation prompts. This option allows to avoid an issue
|
||||
with :ref:`faq_troubleshooting_pioblocksprompt`
|
||||
|
||||
.. option::
|
||||
--version
|
||||
|
||||
Show the version of PlatformIO
|
||||
|
||||
.. option::
|
||||
--help
|
||||
|
||||
Show help for the available options and commands
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@@ -11,19 +39,19 @@ To print all available commands and options use:
|
||||
$ platformio COMMAND --help
|
||||
|
||||
|
||||
Commands
|
||||
--------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
cmd_boards
|
||||
cmd_ci
|
||||
cmd_init
|
||||
cmd_install
|
||||
platformio lib <lib/index>
|
||||
cmd_list
|
||||
platformio platforms <platforms/index>
|
||||
cmd_run
|
||||
cmd_search
|
||||
cmd_serialports
|
||||
cmd_settings
|
||||
cmd_show
|
||||
cmd_uninstall
|
||||
cmd_update
|
||||
cmd_upgrade
|
||||
|
||||
@@ -22,6 +22,8 @@ Install new library by specified
|
||||
Options
|
||||
-------
|
||||
|
||||
.. program:: platformio lib install
|
||||
|
||||
.. option::
|
||||
-v, --version
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ List installed libraries
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
.. program:: platformio lib list
|
||||
|
||||
.. option::
|
||||
--json-output
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@ For more detail information please go to
|
||||
Options
|
||||
-------
|
||||
|
||||
.. program:: platformio lib search
|
||||
|
||||
.. option::
|
||||
-a, --author
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Usage
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
platformio lib update
|
||||
platformio lib update [LIBRARY_ID]
|
||||
|
||||
|
||||
Description
|
||||
@@ -22,6 +22,8 @@ Check or update installed libraries
|
||||
Examples
|
||||
--------
|
||||
|
||||
1. Update all installed libraries
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio lib update
|
||||
@@ -36,8 +38,23 @@ Examples
|
||||
# Updating [ 13 ] Adafruit-GFX library:
|
||||
# Versions: Current=a9e5bc4707, Latest=a9e5bc4707 [Up-to-date]
|
||||
# Updating [ 1 ] OneWire library:
|
||||
# Versions: Current=2.2, Latest=2.2 [Up-to-date]
|
||||
# Versions: Current=2.2, Latest=2.2 [Up-to-date]
|
||||
# Updating [ 4 ] IRremote library:
|
||||
# Versions: Current=f2dafe5030, Latest=f2dafe5030 [Up-to-date]
|
||||
# Updating [ 14 ] Adafruit-9DOF-Unified library:
|
||||
# Versions: Current=b2f07242ac, Latest=b2f07242ac [Up-to-date]
|
||||
|
||||
2. Update specified libraries
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio lib update 1 59
|
||||
# Updating [ 1 ] OneWire library:
|
||||
# Versions: Current=2.2, Latest=2.2 [Up-to-date]
|
||||
# Updating [ 59 ] USB-Host-Shield-20 library:
|
||||
# Versions: Current=fcab83dcb3, Latest=c61f9ce1c2 [Out-of-date]
|
||||
# The library #59 'USB-Host-Shield-20' has been successfully uninstalled!
|
||||
# Installing library [ 59 ]:
|
||||
# Downloading [####################################] 100%
|
||||
# Unpacking [####################################] 100%
|
||||
# The library #59 'USB-Host-Shield-20' has been successfully installed!
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.. _cmd_install:
|
||||
.. _cmd_platforms_install:
|
||||
|
||||
platformio install
|
||||
==================
|
||||
platformio platforms install
|
||||
============================
|
||||
|
||||
.. contents::
|
||||
|
||||
@@ -10,7 +10,7 @@ Usage
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
platformio install [OPTIONS] [PLATFORMS]
|
||||
platformio platforms install [OPTIONS] [PLATFORMS]
|
||||
|
||||
|
||||
Description
|
||||
@@ -27,6 +27,8 @@ There are several predefined aliases for packages, such as:
|
||||
Options
|
||||
-------
|
||||
|
||||
.. program:: platformio platforms install
|
||||
|
||||
.. option::
|
||||
--with-package
|
||||
|
||||
@@ -50,7 +52,7 @@ Examples
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio install timsp430
|
||||
$ platformio platforms install timsp430
|
||||
Installing toolchain-timsp430 package:
|
||||
Downloading [####################################] 100%
|
||||
Unpacking [####################################] 100%
|
||||
@@ -68,7 +70,7 @@ Examples
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio install timsp430 --skip-default-package --with-package=uploader
|
||||
$ platformio platforms install timsp430 --skip-default-package --with-package=uploader
|
||||
Installing tool-mspdebug package:
|
||||
Downloading [####################################] 100%
|
||||
Unpacking [####################################] 100%
|
||||
@@ -1,7 +1,7 @@
|
||||
.. _cmd_list:
|
||||
.. _cmd_platforms_list:
|
||||
|
||||
platformio list
|
||||
===============
|
||||
platformio platforms list
|
||||
=========================
|
||||
|
||||
.. contents::
|
||||
|
||||
@@ -10,7 +10,7 @@ Usage
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
platformio list [OPTIONS]
|
||||
platformio platforms list [OPTIONS]
|
||||
|
||||
|
||||
Description
|
||||
@@ -21,6 +21,8 @@ List installed :ref:`Platforms <platforms>`
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
.. program:: platformio platforms list
|
||||
|
||||
.. option::
|
||||
--json-output
|
||||
|
||||
@@ -31,7 +33,7 @@ Examples
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio list
|
||||
$ platformio platforms list
|
||||
atmelavr with packages: toolchain-atmelavr, tool-avrdude, framework-arduinoavr, tool-micronucleus
|
||||
atmelsam with packages: framework-arduinosam, ldscripts, toolchain-gccarmnoneeabi, tool-bossac
|
||||
freescalekinetis with packages: framework-mbed, toolchain-gccarmnoneeabi
|
||||
@@ -1,7 +1,7 @@
|
||||
.. _cmd_search:
|
||||
.. _cmd_platforms_search:
|
||||
|
||||
platformio search
|
||||
=================
|
||||
platformio platforms search
|
||||
===========================
|
||||
|
||||
.. contents::
|
||||
|
||||
@@ -10,7 +10,7 @@ Usage
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
platformio search QUERY [OPTIONS]
|
||||
platformio platforms search QUERY [OPTIONS]
|
||||
|
||||
|
||||
Description
|
||||
@@ -21,6 +21,8 @@ Search for development :ref:`Platforms <platforms>`
|
||||
Options
|
||||
~~~~~~~
|
||||
|
||||
.. program:: platformio platforms search
|
||||
|
||||
.. option::
|
||||
--json-output
|
||||
|
||||
@@ -34,7 +36,7 @@ Examples
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio search
|
||||
$ platformio platforms search
|
||||
atmelavr (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa)
|
||||
--------
|
||||
Atmel AVR 8- and 32-bit MCUs deliver a unique combination of performance...
|
||||
@@ -75,7 +77,7 @@ Examples
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio search ti
|
||||
$ platformio platforms search ti
|
||||
timsp430 (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa)
|
||||
--------
|
||||
MSP430 microcontrollers (MCUs) from Texas Instruments (TI) are ...
|
||||
@@ -88,7 +90,7 @@ Examples
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio search mbed
|
||||
$ platformio platforms search mbed
|
||||
freescalekinetis (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa)
|
||||
----------------
|
||||
Freescale Kinetis Microcontrollers is family of multiple hardware- and ...
|
||||
@@ -1,7 +1,7 @@
|
||||
.. _cmd_show:
|
||||
.. _cmd_platforms_show:
|
||||
|
||||
platformio show
|
||||
===============
|
||||
platformio platforms show
|
||||
=========================
|
||||
|
||||
.. contents::
|
||||
|
||||
@@ -10,7 +10,7 @@ Usage
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
platformio show PLATFORM
|
||||
platformio platforms show PLATFORM
|
||||
|
||||
|
||||
Description
|
||||
@@ -24,7 +24,7 @@ Examples
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio show atmelavr
|
||||
$ platformio platforms show atmelavr
|
||||
atmelavr - An embedded platform for Atmel AVR microcontrollers (with Arduino Framework)
|
||||
----------
|
||||
Package: toolchain-atmelavr
|
||||
@@ -1,7 +1,7 @@
|
||||
.. _cmd_uninstall:
|
||||
.. _cmd_platforms_uninstall:
|
||||
|
||||
platformio uninstall
|
||||
====================
|
||||
platformio platforms uninstall
|
||||
==============================
|
||||
|
||||
.. contents::
|
||||
|
||||
@@ -10,7 +10,7 @@ Usage
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
platformio uninstall PLATFORM
|
||||
platformio platforms uninstall PLATFORM
|
||||
|
||||
|
||||
Description
|
||||
@@ -24,7 +24,7 @@ Examples
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio uninstall timsp430
|
||||
$ platformio platforms uninstall timsp430
|
||||
Uninstalling toolchain-timsp430 package: [OK]
|
||||
Uninstalling tool-mspdebug package: [OK]
|
||||
Uninstalling framework-energiamsp430 package: [OK]
|
||||
99
docs/userguide/platforms/cmd_update.rst
Normal file
@@ -0,0 +1,99 @@
|
||||
.. _cmd_platforms_update:
|
||||
|
||||
platformio platforms update
|
||||
===========================
|
||||
|
||||
.. contents::
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
platformio platforms update
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
Check or update installed :ref:`Platforms <platforms>`
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio platforms update
|
||||
|
||||
Platform atmelavr
|
||||
--------
|
||||
Updating toolchain-atmelavr package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating tool-avrdude package:
|
||||
Versions: Current=2, Latest=2 [Up-to-date]
|
||||
Updating framework-arduinoavr package:
|
||||
Versions: Current=12, Latest=12 [Up-to-date]
|
||||
Updating tool-micronucleus package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
|
||||
Platform atmelsam
|
||||
--------
|
||||
Updating framework-arduinosam package:
|
||||
Versions: Current=3, Latest=3 [Up-to-date]
|
||||
Updating ldscripts package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating toolchain-gccarmnoneeabi package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating tool-bossac package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
|
||||
Platform stm32
|
||||
--------
|
||||
Updating toolchain-gccarmnoneeabi package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating tool-stlink package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating framework-spl package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating framework-cmsis package:
|
||||
Versions: Current=2, Latest=2 [Up-to-date]
|
||||
Updating framework-opencm3 package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating ldscripts package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
|
||||
Platform teensy
|
||||
--------
|
||||
Updating toolchain-atmelavr package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating ldscripts package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating framework-arduinoteensy package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating toolchain-gccarmnoneeabi package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating tool-teensy package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
|
||||
Platform timsp430
|
||||
--------
|
||||
Updating toolchain-timsp430 package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating tool-mspdebug package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating framework-energiamsp430 package:
|
||||
Versions: Current=2, Latest=2 [Up-to-date]
|
||||
|
||||
Platform titiva
|
||||
--------
|
||||
Updating ldscripts package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating toolchain-gccarmnoneeabi package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating tool-lm4flash package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating framework-opencm3 package:
|
||||
Versions: Current=1, Latest=1 [Up-to-date]
|
||||
Updating framework-energiativa package:
|
||||
Versions: Current=4, Latest=4 [Up-to-date]
|
||||
22
docs/userguide/platforms/index.rst
Normal file
@@ -0,0 +1,22 @@
|
||||
.. _userguide_platforms:
|
||||
|
||||
Platforms Manager
|
||||
=================
|
||||
|
||||
To print all available commands and options use:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ platformio platforms --help
|
||||
$ platformio platforms COMMAND --help
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
cmd_install
|
||||
cmd_list
|
||||
cmd_search
|
||||
cmd_show
|
||||
cmd_uninstall
|
||||
cmd_update
|
||||
@@ -1,29 +1,43 @@
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
|
||||
const char* ssid = "*****";
|
||||
const char* password = "*****";
|
||||
|
||||
const char* ssid = "******";
|
||||
const char* password = "******";
|
||||
MDNSResponder mdns;
|
||||
|
||||
ESP8266WebServer server(80);
|
||||
|
||||
|
||||
const int led = 13;
|
||||
|
||||
void handle_root() {
|
||||
|
||||
void handleRoot() {
|
||||
digitalWrite(led, 1);
|
||||
server.send(200, "text/plain", "hello from esp8266!");
|
||||
delay(100);
|
||||
digitalWrite(led, 0);
|
||||
}
|
||||
|
||||
void handleNotFound(){
|
||||
digitalWrite(led, 1);
|
||||
String message = "File Not Found\n\n";
|
||||
message += "URI: ";
|
||||
message += server.uri();
|
||||
message += "\nMethod: ";
|
||||
message += (server.method() == HTTP_GET)?"GET":"POST";
|
||||
message += "\nArguments: ";
|
||||
message += server.args();
|
||||
message += "\n";
|
||||
for (uint8_t i=0; i<server.args(); i++){
|
||||
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
|
||||
}
|
||||
server.send(404, "text/plain", message);
|
||||
digitalWrite(led, 0);
|
||||
}
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
Serial.begin(115200);
|
||||
void setup(void){
|
||||
pinMode(led, OUTPUT);
|
||||
digitalWrite(led, 0);
|
||||
|
||||
// Connect to WiFi network
|
||||
Serial.begin(115200);
|
||||
WiFi.begin(ssid, password);
|
||||
Serial.println("");
|
||||
|
||||
@@ -37,18 +51,23 @@ void setup(void)
|
||||
Serial.println(ssid);
|
||||
Serial.print("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
|
||||
server.on("/", handle_root);
|
||||
|
||||
if (mdns.begin("esp8266", WiFi.localIP())) {
|
||||
Serial.println("MDNS responder started");
|
||||
}
|
||||
|
||||
server.on("/", handleRoot);
|
||||
|
||||
server.on("/inline", [](){
|
||||
server.send(200, "text/plain", "this works as well");
|
||||
});
|
||||
|
||||
server.onNotFound(handleNotFound);
|
||||
|
||||
server.begin();
|
||||
Serial.println("HTTP server started");
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
void loop(void){
|
||||
server.handleClient();
|
||||
}
|
||||
}
|
||||
23
examples/ide/qtcreator/platformio.ini
Normal file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# Project Configuration File
|
||||
#
|
||||
# A detailed documentation with the EXAMPLES is located here:
|
||||
# http://docs.platformio.org/en/latest/projectconf.html
|
||||
#
|
||||
|
||||
# A sign `#` at the beginning of the line indicates a comment
|
||||
# Comment lines are ignored.
|
||||
|
||||
# Simple and base environment
|
||||
# [env:mybaseenv]
|
||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
||||
# framework =
|
||||
# board =
|
||||
#
|
||||
# Automatic targets - enable auto-uploading
|
||||
# targets = upload
|
||||
|
||||
[env:arduino_uno]
|
||||
platform = atmelavr
|
||||
framework = arduino
|
||||
board = uno
|
||||
19
examples/ide/qtcreator/platformio.pro
Normal file
@@ -0,0 +1,19 @@
|
||||
win32 {
|
||||
HOMEDIR += $$(USERPROFILE)
|
||||
}
|
||||
else {
|
||||
HOMEDIR += $$(PWD)
|
||||
}
|
||||
|
||||
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/framework-arduinoavr/cores/arduino"
|
||||
INCLUDEPATH += "$$HOMEDIR/.platformio/packages/toolchain-atmelavr/avr/include"
|
||||
|
||||
win32:INCLUDEPATH ~= s,/,\\,g
|
||||
|
||||
# DEFINES += __AVR_ATmega328__
|
||||
|
||||
OTHER_FILES += \
|
||||
platformio.ini
|
||||
|
||||
SOURCES += \
|
||||
src/main.c
|
||||
25
examples/ide/qtcreator/src/main.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "Arduino.h"
|
||||
/*
|
||||
Blink
|
||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
int led = 1; // blink 'digital' pin 1 - AKA the built in red LED
|
||||
|
||||
// the setup routine runs once when you press reset:
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
pinMode(led, OUTPUT);
|
||||
|
||||
}
|
||||
|
||||
// the loop routine runs over and over again forever:
|
||||
void loop() {
|
||||
digitalWrite(led, HIGH);
|
||||
delay(1000);
|
||||
digitalWrite(led, LOW);
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
23
examples/ide/sublime-text/platformio.ini
Normal file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# Project Configuration File
|
||||
#
|
||||
# A detailed documentation with the EXAMPLES is located here:
|
||||
# http://docs.platformio.org/en/latest/projectconf.html
|
||||
#
|
||||
|
||||
# A sign `#` at the beginning of the line indicates a comment
|
||||
# Comment lines are ignored.
|
||||
|
||||
# Simple and base environment
|
||||
# [env:mybaseenv]
|
||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
||||
# framework =
|
||||
# board =
|
||||
#
|
||||
# Automatic targets - enable auto-uploading
|
||||
# targets = upload
|
||||
|
||||
[env:flora8]
|
||||
platform = atmelavr
|
||||
framework = arduino
|
||||
board = flora8
|
||||
43
examples/ide/sublime-text/platformio.sublime-project
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"build_systems":
|
||||
[
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"run"
|
||||
],
|
||||
"name": "PlatformIO",
|
||||
"variants":
|
||||
[
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"run",
|
||||
"-t",
|
||||
"clean"
|
||||
],
|
||||
"name": "Clean"
|
||||
},
|
||||
{
|
||||
"cmd":
|
||||
[
|
||||
"platformio",
|
||||
"run",
|
||||
"-t",
|
||||
"upload"
|
||||
],
|
||||
"name": "Upload"
|
||||
}
|
||||
],
|
||||
"working_dir": "${project_path:${folder}}"
|
||||
}
|
||||
],
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
24
examples/ide/sublime-text/src/Blink.pde
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
Blink
|
||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
int led = 1; // blink 'digital' pin 1 - AKA the built in red LED
|
||||
|
||||
// the setup routine runs once when you press reset:
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
pinMode(led, OUTPUT);
|
||||
|
||||
}
|
||||
|
||||
// the loop routine runs over and over again forever:
|
||||
void loop() {
|
||||
digitalWrite(led, HIGH);
|
||||
delay(1000);
|
||||
digitalWrite(led, LOW);
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
62
examples/ide/visual-studio/blink.vcxproj
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0FA9C3A8-452B-41EF-A418-9102B170F49F}</ProjectGuid>
|
||||
<Keyword>MakeFileProj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeBuildCommandLine>platformio run</NMakeBuildCommandLine>
|
||||
<NMakeCleanCommandLine>platformio run -t clean</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions>WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<NMakeIncludeSearchPath>$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<NMakeBuildCommandLine>platformio run</NMakeBuildCommandLine>
|
||||
<NMakeCleanCommandLine>platformio run -t clean</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions>WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<NMakeIncludeSearchPath>$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="readme.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="platformio.ini" />
|
||||
<None Include="src\blink.pde" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
29
examples/ide/visual-studio/blink.vcxproj.filters
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\src">
|
||||
<UniqueIdentifier>{cad450ef-1a84-42d4-a5b5-a1736b8833d3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="readme.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="platformio.ini" />
|
||||
<None Include="src\blink.pde">
|
||||
<Filter>Source Files\src</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
23
examples/ide/visual-studio/platformio.ini
Normal file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# Project Configuration File
|
||||
#
|
||||
# A detailed documentation with the EXAMPLES is located here:
|
||||
# http://docs.platformio.org/en/latest/projectconf.html
|
||||
#
|
||||
|
||||
# A sign `#` at the beginning of the line indicates a comment
|
||||
# Comment lines are ignored.
|
||||
|
||||
# Simple and base environment
|
||||
# [env:mybaseenv]
|
||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
||||
# framework =
|
||||
# board =
|
||||
#
|
||||
# Automatic targets - enable auto-uploading
|
||||
# targets = upload
|
||||
|
||||
[env:arduino_uno]
|
||||
platform = atmelavr
|
||||
framework = arduino
|
||||
board = uno
|
||||
24
examples/ide/visual-studio/src/blink.pde
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
Blink
|
||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
int led = 1; // blink 'digital' pin 1 - AKA the built in red LED
|
||||
|
||||
// the setup routine runs once when you press reset:
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
pinMode(led, OUTPUT);
|
||||
|
||||
}
|
||||
|
||||
// the loop routine runs over and over again forever:
|
||||
void loop() {
|
||||
digitalWrite(led, HIGH);
|
||||
delay(1000);
|
||||
digitalWrite(led, LOW);
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
@@ -41,3 +41,9 @@ board = frdm_kl25z
|
||||
platform = ststm32
|
||||
framework = mbed
|
||||
board = nucleo_f401re
|
||||
|
||||
# Teensy Platform
|
||||
[env:teensy31]
|
||||
platform = teensy
|
||||
framework = mbed
|
||||
board = teensy31
|
||||
|
||||
@@ -5,22 +5,22 @@
|
||||
; http://docs.platformio.org/en/latest/projectconf.html
|
||||
;
|
||||
|
||||
[env:autogen_uno]
|
||||
[env:uno]
|
||||
platform = atmelavr
|
||||
framework = arduino
|
||||
board = uno
|
||||
|
||||
[env:autogen_teensy31]
|
||||
[env:teensy31]
|
||||
platform = teensy
|
||||
framework = arduino
|
||||
board = teensy31
|
||||
|
||||
[env:autogen_lpmsp430g2553]
|
||||
[env:lpmsp430g2553]
|
||||
platform = timsp430
|
||||
framework = energia
|
||||
board = lpmsp430g2553
|
||||
|
||||
[env:autogen_lptm4c1230c3pm]
|
||||
[env:lptm4c1230c3pm]
|
||||
platform = titiva
|
||||
framework = energia
|
||||
board = lptm4c1230c3pm
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
VERSION = (1, 4, 0)
|
||||
VERSION = (2, 0, 0)
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
__description__ = ("A cross-platform code builder and the missing library "
|
||||
"manager (Atmel AVR & SAM, Freescale Kinetis, "
|
||||
"manager (Atmel AVR & SAM, Espressif, Freescale Kinetis, "
|
||||
"Nordic nRF51, NXP LPC, ST STM32, TI MSP430 & Tiva, "
|
||||
"Teensy, Arduino, mbed, libOpenCM3, etc.)")
|
||||
__url__ = "http://platformio.org"
|
||||
|
||||
@@ -31,20 +31,38 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
|
||||
mod = __import__("platformio.commands." + name,
|
||||
None, None, ["cli"])
|
||||
except ImportError:
|
||||
raise exception.UnknownCLICommand(name)
|
||||
try:
|
||||
return self._handle_obsolate_command(name)
|
||||
except AttributeError:
|
||||
raise exception.UnknownCLICommand(name)
|
||||
return mod.cli
|
||||
|
||||
@staticmethod
|
||||
def _handle_obsolate_command(name):
|
||||
if name in ("install", "list", "search", "show", "uninstall"):
|
||||
click.secho(
|
||||
"Warning! `platformio %s` command is obsoleted and will be "
|
||||
"removed in the next release! Please use "
|
||||
"`platformio platforms %s` instead." % (name, name),
|
||||
fg="red"
|
||||
)
|
||||
from platformio.commands import platforms
|
||||
return getattr(platforms, "platforms_" + name)
|
||||
raise AttributeError()
|
||||
|
||||
|
||||
@click.command(cls=PlatformioCLI)
|
||||
@click.version_option(__version__, prog_name="PlatformIO")
|
||||
@click.option("--force", "-f", is_flag=True,
|
||||
help="Force to accept any confirmation prompts")
|
||||
@click.pass_context
|
||||
def cli(ctx):
|
||||
maintenance.on_platformio_start(ctx)
|
||||
def cli(ctx, force):
|
||||
maintenance.on_platformio_start(ctx, force)
|
||||
|
||||
|
||||
@cli.resultcallback()
|
||||
@click.pass_context
|
||||
def process_result(ctx, result):
|
||||
def process_result(ctx, result, force): # pylint: disable=W0613
|
||||
maintenance.on_platformio_end(ctx, result)
|
||||
|
||||
|
||||
@@ -54,7 +72,7 @@ def main():
|
||||
# /en/latest/security.html#insecureplatformwarning
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
cli(None)
|
||||
cli(None, None)
|
||||
except Exception as e: # pylint: disable=W0703
|
||||
if not isinstance(e, exception.ReturnErrorCode):
|
||||
maintenance.on_platformio_exception(e)
|
||||
|
||||
@@ -24,11 +24,11 @@ DEFAULT_SETTINGS = {
|
||||
},
|
||||
"auto_update_platforms": {
|
||||
"description": "Automatically update platforms (Yes/No)",
|
||||
"value": True
|
||||
"value": False
|
||||
},
|
||||
"auto_update_libraries": {
|
||||
"description": "Automatically update libraries (Yes/No)",
|
||||
"value": True
|
||||
"value": False
|
||||
},
|
||||
"enable_telemetry": {
|
||||
"description": ("Shares commands, platforms and libraries usage"
|
||||
@@ -47,6 +47,11 @@ DEFAULT_SETTINGS = {
|
||||
}
|
||||
|
||||
|
||||
SESSION_VARS = {
|
||||
"force_option": False
|
||||
}
|
||||
|
||||
|
||||
class State(object):
|
||||
|
||||
def __init__(self, path=None):
|
||||
@@ -101,9 +106,12 @@ def set_state_item(name, value):
|
||||
|
||||
|
||||
def get_setting(name):
|
||||
# disable prompts for Continuous Integration systems
|
||||
if name == "enable_prompts" and getenv("CI", "").lower() == "true":
|
||||
return False
|
||||
if name == "enable_prompts":
|
||||
# disable prompts for Continuous Integration systems
|
||||
# and when global "--force" option is set
|
||||
if any([getenv("CI", "").lower() == "true",
|
||||
get_session_var("force_option")]):
|
||||
return False
|
||||
|
||||
_env_name = "PLATFORMIO_SETTING_%s" % name.upper()
|
||||
if _env_name in environ:
|
||||
@@ -127,3 +135,12 @@ def reset_settings():
|
||||
with State() as data:
|
||||
if "settings" in data:
|
||||
del data['settings']
|
||||
|
||||
|
||||
def get_session_var(name, default=None):
|
||||
return SESSION_VARS.get(name, default)
|
||||
|
||||
|
||||
def set_session_var(name, value):
|
||||
assert name in SESSION_VARS
|
||||
SESSION_VARS[name] = value
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
"esp01": {
|
||||
"build": {
|
||||
"core": "esp8266",
|
||||
"extra_flags": "-DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266",
|
||||
"extra_flags": "-DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DESP8266",
|
||||
"f_cpu": "80000000L",
|
||||
"ldscript": "esp8266.ld",
|
||||
"ldscript": "esp8266.flash.512k.ld",
|
||||
"mcu": "esp8266",
|
||||
"variant": "esp01"
|
||||
"variant": "generic"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "Espressif ESP8266 board",
|
||||
|
||||
@@ -330,5 +330,65 @@
|
||||
},
|
||||
"url": "https://developer.mbed.org/platforms/ST-Nucleo-L152RE/",
|
||||
"vendor": "ST"
|
||||
},
|
||||
"armstrap_eagle512": {
|
||||
"build": {
|
||||
"core": "stm32",
|
||||
"extra_flags": "-DSTM32F40_41xxx",
|
||||
"f_cpu": "168000000L",
|
||||
"ldscript": "armstrap_eagle_512.ld",
|
||||
"cpu": "cortex-m4",
|
||||
"mcu": "stm32f407vet6",
|
||||
"variant": "stm32f4"
|
||||
},
|
||||
"frameworks": ["cmsis", "spl"],
|
||||
"name": "Armstrap Eagle 512",
|
||||
"platform": "ststm32",
|
||||
"upload": {
|
||||
"maximum_ram_size": 196608,
|
||||
"maximum_size": 524288
|
||||
},
|
||||
"url": "http://docs.armstrap.org/en/latest/hardware-overview.html",
|
||||
"vendor": "Armstrap"
|
||||
},
|
||||
"armstrap_eagle1024": {
|
||||
"build": {
|
||||
"core": "stm32",
|
||||
"extra_flags": "-DSTM32F40_41xxx",
|
||||
"f_cpu": "168000000L",
|
||||
"ldscript": "armstrap_eagle_1024.ld",
|
||||
"cpu": "cortex-m4",
|
||||
"mcu": "stm32f417vgt6",
|
||||
"variant": "stm32f4"
|
||||
},
|
||||
"frameworks": ["cmsis", "spl"],
|
||||
"name": "Armstrap Eagle 1024",
|
||||
"platform": "ststm32",
|
||||
"upload": {
|
||||
"maximum_ram_size": 196608,
|
||||
"maximum_size": 1048576
|
||||
},
|
||||
"url": "http://docs.armstrap.org/en/latest/hardware-overview.html",
|
||||
"vendor": "Armstrap"
|
||||
},
|
||||
"armstrap_eagle2048": {
|
||||
"build": {
|
||||
"core": "stm32",
|
||||
"extra_flags": "-DSTM32F427_437xx",
|
||||
"f_cpu": "168000000L",
|
||||
"ldscript": "armstrap_eagle_2048.ld",
|
||||
"cpu": "cortex-m4",
|
||||
"mcu": "stm32f427vit6",
|
||||
"variant": "stm32f4"
|
||||
},
|
||||
"frameworks": ["cmsis", "spl"],
|
||||
"name": "Armstrap Eagle 2048",
|
||||
"platform": "ststm32",
|
||||
"upload": {
|
||||
"maximum_ram_size": 262144,
|
||||
"maximum_size": 2091752
|
||||
},
|
||||
"url": "http://docs.armstrap.org/en/latest/hardware-overview.html",
|
||||
"vendor": "Armstrap"
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@
|
||||
"mcu": "mk20dx256",
|
||||
"cpu": "cortex-m4"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"frameworks": ["arduino", "mbed"],
|
||||
"name": "Teensy 3.1",
|
||||
"platform": "teensy",
|
||||
"upload": {
|
||||
|
||||
@@ -37,6 +37,7 @@ commonvars.AddVariables(
|
||||
("BUILD_FLAGS",),
|
||||
("SRCBUILD_FLAGS",),
|
||||
("IGNORE_LIBS",),
|
||||
("USE_LIBS",),
|
||||
|
||||
# board options
|
||||
("BOARD",),
|
||||
|
||||
@@ -43,6 +43,8 @@ env.Replace(
|
||||
"-Os", # optimize for size
|
||||
"-mlongcalls",
|
||||
"-mtext-section-literals",
|
||||
"-falign-functions=4",
|
||||
"-U__STRICT_ANSI__",
|
||||
"-MMD" # output dependancy info
|
||||
],
|
||||
|
||||
@@ -70,12 +72,12 @@ env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-esptool", "esptool"),
|
||||
UPLOADERFLAGS=[
|
||||
"-vv",
|
||||
"-cd", "none",
|
||||
"-cd", "ck",
|
||||
"-cb", "$UPLOAD_SPEED",
|
||||
"-cp", "$UPLOAD_PORT",
|
||||
"-ca", "0x00000",
|
||||
"-cf", "${SOURCES[0]}",
|
||||
"-ca", "0x40000",
|
||||
"-ca", "0x10000",
|
||||
"-cf", "${SOURCES[1]}"
|
||||
],
|
||||
UPLOADCMD='$UPLOADER $UPLOADERFLAGS'
|
||||
@@ -88,6 +90,9 @@ env.Append(
|
||||
"$UPLOADER",
|
||||
"-eo", "$SOURCES",
|
||||
"-bo", "${TARGETS[0]}",
|
||||
"-bm", "qio",
|
||||
"-bf", "40",
|
||||
"-bz", "512K",
|
||||
"-bs", ".text",
|
||||
"-bs", ".data",
|
||||
"-bs", ".rodata",
|
||||
@@ -135,7 +140,7 @@ if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||
else:
|
||||
target_firm = env.ElfToBin(
|
||||
[join("$BUILD_DIR", "firmware_00000"),
|
||||
join("$BUILD_DIR", "firmware_40000")], target_elf)
|
||||
join("$BUILD_DIR", "firmware_10000")], target_elf)
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -46,8 +46,8 @@ elif env.get("PLATFORM") == "espressif":
|
||||
env.Prepend(
|
||||
CPPPATH=[join("$PLATFORMFW_DIR", "sdk", "include")],
|
||||
LIBPATH=[join("$PLATFORMFW_DIR", "sdk", "lib")],
|
||||
LIBS=["hal", "phy", "net80211", "lwip",
|
||||
"wpa", "main", "pp", "c", "gcc"]
|
||||
LIBS=["smartconfig", "pp", "main", "wpa", "lwip",
|
||||
"net80211", "phy", "hal", "gcc", "m"]
|
||||
)
|
||||
|
||||
env.Replace(PLATFORMFW_DIR=PLATFORMFW_DIR)
|
||||
@@ -106,20 +106,20 @@ env.Append(
|
||||
#
|
||||
|
||||
if env.subst("${PLATFORMFW_DIR}")[-3:] == "sam":
|
||||
env.VariantDir(
|
||||
env.VariantDirWrap(
|
||||
join("$BUILD_DIR", "FrameworkCMSISInc"),
|
||||
join("$PLATFORMFW_DIR", "system", "CMSIS", "CMSIS", "Include")
|
||||
)
|
||||
env.VariantDir(
|
||||
env.VariantDirWrap(
|
||||
join("$BUILD_DIR", "FrameworkDeviceInc"),
|
||||
join("$PLATFORMFW_DIR", "system", "CMSIS", "Device", "ATMEL")
|
||||
)
|
||||
env.VariantDir(
|
||||
env.VariantDirWrap(
|
||||
join("$BUILD_DIR", "FrameworkLibSam"),
|
||||
join("$PLATFORMFW_DIR", "system", "libsam")
|
||||
)
|
||||
|
||||
env.VariantDir(
|
||||
env.VariantDirWrap(
|
||||
join("$BUILD_DIR", "FrameworkArduinoInc"),
|
||||
join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}")
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ env.Replace(
|
||||
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-cmsis")
|
||||
)
|
||||
|
||||
env.VariantDir(
|
||||
env.VariantDirWrap(
|
||||
join("$BUILD_DIR", "FrameworkCMSIS"),
|
||||
join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}")
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ ENERGIA_VERSION = int(
|
||||
"version.txt")).read().replace(".", "").strip())
|
||||
|
||||
# include board variant
|
||||
env.VariantDir(
|
||||
env.VariantDirWrap(
|
||||
join("$BUILD_DIR", "FrameworkEnergiaVariant"),
|
||||
join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}")
|
||||
)
|
||||
|
||||
@@ -138,7 +138,7 @@ if BOARD_BUILDOPTS.get("core") == "lm4f":
|
||||
CPPDEFINES=["LM4F"]
|
||||
)
|
||||
|
||||
env.VariantDir(
|
||||
env.VariantDirWrap(
|
||||
join("$BUILD_DIR", "FrameworkLibOpenCM3Variant"),
|
||||
join("$PLATFORMFW_DIR", "include")
|
||||
)
|
||||
@@ -166,7 +166,7 @@ env.Replace(
|
||||
)
|
||||
|
||||
libs = []
|
||||
env.VariantDir(
|
||||
env.VariantDirWrap(
|
||||
join("$BUILD_DIR", "FrameworkLibOpenCM3"),
|
||||
"$PLATFORMFW_DIR"
|
||||
)
|
||||
|
||||
@@ -53,7 +53,8 @@ MBED_VARIANTS = {
|
||||
"frdm_k64f": "K64F",
|
||||
"frdm_kl05z": "KL05Z",
|
||||
"frdm_k20d50m": "K20D50M",
|
||||
"frdm_k22f": "K22F"
|
||||
"frdm_k22f": "K22F",
|
||||
"teensy31": "TEENSY3_1"
|
||||
}
|
||||
|
||||
MBED_LIBS_MAP = {
|
||||
@@ -133,7 +134,7 @@ def add_mbedlib(libname, libar):
|
||||
(libname.upper(), crc32(root)))
|
||||
if var_dir in env.get("CPPPATH"):
|
||||
continue
|
||||
env.VariantDir(var_dir, root)
|
||||
env.VariantDirWrap(var_dir, root)
|
||||
env.Append(CPPPATH=[var_dir])
|
||||
|
||||
|
||||
@@ -177,6 +178,20 @@ def get_build_flags(data):
|
||||
return flags
|
||||
|
||||
|
||||
def _mbed_whole_archive_hook(flags):
|
||||
if (not isinstance(flags, list) or
|
||||
env.get("BOARD_OPTIONS", {}).get("platform") != "ststm32"):
|
||||
return flags
|
||||
|
||||
for pos, flag in enumerate(flags[:]):
|
||||
if isinstance(flag, basestring):
|
||||
continue
|
||||
flags.insert(pos, "-Wl,-whole-archive")
|
||||
flags.insert(pos + 2, "-Wl,-no-whole-archive")
|
||||
|
||||
return flags
|
||||
|
||||
|
||||
board_type = env.subst("$BOARD")
|
||||
variant = MBED_VARIANTS[
|
||||
board_type] if board_type in MBED_VARIANTS else board_type.upper()
|
||||
@@ -187,6 +202,8 @@ build_flags = get_build_flags(eixdata)
|
||||
variant_dir = join("$PLATFORMFW_DIR", "variant", variant)
|
||||
|
||||
env.Replace(
|
||||
_mbed_whole_archive_hook=_mbed_whole_archive_hook,
|
||||
_LIBFLAGS="${_mbed_whole_archive_hook(%s)}" % env.get("_LIBFLAGS")[2:-1],
|
||||
CPPFLAGS=build_flags.get("CPPFLAGS", []),
|
||||
CFLAGS=build_flags.get("CFLAGS", []),
|
||||
CXXFLAGS=build_flags.get("CXXFLAGS", []),
|
||||
@@ -204,7 +221,7 @@ if board_type in ("frdm_k22f", "frdm_k64f"):
|
||||
|
||||
for lib_path in eixdata.get("CPPPATH"):
|
||||
_vdir = join("$BUILD_DIR", "FrameworkMbedInc%d" % crc32(lib_path))
|
||||
env.VariantDir(_vdir, join(variant_dir, lib_path))
|
||||
env.VariantDirWrap(_vdir, join(variant_dir, lib_path))
|
||||
env.Append(CPPPATH=[_vdir])
|
||||
|
||||
env.Append(
|
||||
|
||||
@@ -22,7 +22,7 @@ env.Replace(
|
||||
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-spl")
|
||||
)
|
||||
|
||||
env.VariantDir(
|
||||
env.VariantDirWrap(
|
||||
join("$BUILD_DIR", "FrameworkSPLInc"),
|
||||
join("$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}",
|
||||
"variants", "${BOARD_OPTIONS['build']['variant']}", "inc")
|
||||
@@ -55,6 +55,8 @@ extra_flags = env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags")
|
||||
ignore_files = []
|
||||
if "STM32F40_41xxx" in extra_flags:
|
||||
ignore_files += ["stm32f4xx_fmc.c"]
|
||||
if "STM32F427_437xx" in extra_flags:
|
||||
ignore_files += ["stm32f4xx_fsmc.c"]
|
||||
elif "STM32F303xC" in extra_flags:
|
||||
ignore_files += ["stm32f30x_hrtim.c"]
|
||||
elif "STM32L1XX_MD" in extra_flags:
|
||||
|
||||
@@ -6,25 +6,46 @@
|
||||
"""
|
||||
|
||||
import platform
|
||||
from os.path import join
|
||||
from os.path import isfile, join
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||
DefaultEnvironment, SConscript)
|
||||
DefaultEnvironment, Exit, SConscript)
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
||||
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"),
|
||||
UPLOADERFLAGS=[
|
||||
"write", # write in flash
|
||||
"$SOURCES", # firmware path to flash
|
||||
"0x08000000" # flash start adress
|
||||
],
|
||||
if env['UPLOAD_PROTOCOL'] == "gdb":
|
||||
if not isfile(join(env.subst("$PROJECT_DIR"), "upload.gdb")):
|
||||
Exit(
|
||||
"You are using GDB as firmware uploader. "
|
||||
"Please specify upload commands in upload.gdb "
|
||||
"file in project directory!"
|
||||
)
|
||||
env.Replace(
|
||||
UPLOADER=join(
|
||||
"$PIOPACKAGES_DIR", "toolchain-gccarmnoneeabi",
|
||||
"bin", "arm-none-eabi-gdb"
|
||||
),
|
||||
UPLOADERFLAGS=[
|
||||
join("$BUILD_DIR", "firmware.elf"),
|
||||
"-batch",
|
||||
"-x", join("$PROJECT_DIR", "upload.gdb")
|
||||
],
|
||||
|
||||
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
|
||||
)
|
||||
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
|
||||
)
|
||||
else:
|
||||
env.Replace(
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"),
|
||||
UPLOADERFLAGS=[
|
||||
"write", # write in flash
|
||||
"$SOURCES", # firmware path to flash
|
||||
"0x08000000" # flash start adress
|
||||
],
|
||||
|
||||
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
|
||||
)
|
||||
|
||||
|
||||
env.Append(
|
||||
|
||||
@@ -40,6 +40,7 @@ if isfile(env.subst(join(
|
||||
UPLOADERFLAGS=[
|
||||
"-mmcu=$BOARD_MCU",
|
||||
"-w", # wait for device to apear
|
||||
"-s", # soft reboot if device not online
|
||||
"-v" # verbose output
|
||||
],
|
||||
UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES'
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# See LICENSE for details.
|
||||
|
||||
from os.path import join
|
||||
from platform import system
|
||||
from shutil import copyfile
|
||||
from time import sleep
|
||||
|
||||
@@ -23,6 +24,12 @@ def FlushSerialBuffer(env, port):
|
||||
|
||||
|
||||
def TouchSerialPort(env, port, baudrate):
|
||||
if system() == "Linux":
|
||||
try:
|
||||
s = Serial(env.subst(port))
|
||||
s.close()
|
||||
except: # pylint: disable=W0702
|
||||
pass
|
||||
s = Serial(port=env.subst(port), baudrate=baudrate)
|
||||
s.setDTR(False)
|
||||
s.close()
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
# See LICENSE for details.
|
||||
|
||||
import atexit
|
||||
import json
|
||||
import re
|
||||
from os import getenv, listdir, remove, sep, walk
|
||||
from os.path import basename, dirname, isdir, isfile, join, normpath
|
||||
|
||||
from SCons.Script import Exit, SConscript, SConscriptChdir
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, DefaultEnvironment, Exit,
|
||||
SConscript, SConscriptChdir)
|
||||
from SCons.Util import case_sensitive_suffixes
|
||||
|
||||
from platformio.util import pioversion_to_intstr
|
||||
@@ -15,23 +17,18 @@ from platformio.util import pioversion_to_intstr
|
||||
def BuildFirmware(env):
|
||||
|
||||
# fix ASM handling under non-casitive OS
|
||||
if not case_sensitive_suffixes('.s', '.S'):
|
||||
if not case_sensitive_suffixes(".s", ".S"):
|
||||
env.Replace(
|
||||
AS="$CC",
|
||||
ASCOM="$ASPPCOM"
|
||||
)
|
||||
|
||||
if "extra_flags" in env.get("BOARD_OPTIONS", {}).get("build", {}):
|
||||
env.MergeFlags(env.subst("${BOARD_OPTIONS['build']['extra_flags']}"))
|
||||
|
||||
if "BUILD_FLAGS" in env:
|
||||
env.MergeFlags(env['BUILD_FLAGS'])
|
||||
|
||||
env.ProcessFlags()
|
||||
env.BuildFramework()
|
||||
|
||||
firmenv = env.Clone()
|
||||
vdirs = firmenv.VariantDirRecursive(
|
||||
join("$BUILD_DIR", "src"), "$PROJECTSRC_DIR")
|
||||
join("$BUILD_DIR", "src"), "$PROJECTSRC_DIR", duplicate=False)
|
||||
|
||||
# build dependent libs
|
||||
deplibs = firmenv.BuildDependentLibraries("$PROJECTSRC_DIR")
|
||||
@@ -60,6 +57,19 @@ def BuildFirmware(env):
|
||||
*pioversion_to_intstr())]
|
||||
)
|
||||
|
||||
if "envdump" in COMMAND_LINE_TARGETS:
|
||||
print env.Dump()
|
||||
Exit()
|
||||
|
||||
if "idedata" in COMMAND_LINE_TARGETS:
|
||||
_data = {"defines": [], "includes": []}
|
||||
for item in env.get("VARIANT_DIRS", []):
|
||||
_data['includes'].append(env.subst(item[1]))
|
||||
for item in env.get("CPPDEFINES", []):
|
||||
_data['defines'].append(env.subst(item))
|
||||
print json.dumps(_data)
|
||||
Exit()
|
||||
|
||||
return firmenv.Program(
|
||||
join("$BUILD_DIR", "firmware"),
|
||||
[firmenv.GlobCXXFiles(vdir) for vdir in vdirs],
|
||||
@@ -69,6 +79,22 @@ def BuildFirmware(env):
|
||||
)
|
||||
|
||||
|
||||
def ProcessFlags(env):
|
||||
if "extra_flags" in env.get("BOARD_OPTIONS", {}).get("build", {}):
|
||||
env.MergeFlags(env.subst("${BOARD_OPTIONS['build']['extra_flags']}"))
|
||||
|
||||
if "BUILD_FLAGS" in env:
|
||||
env.MergeFlags(env['BUILD_FLAGS'])
|
||||
|
||||
# Cancel any previous definition of name, either built in or
|
||||
# provided with a -D option // Issue #191
|
||||
undefines = [f for f in env.get("CCFLAGS", []) if f.startswith("-U")]
|
||||
if undefines:
|
||||
for undef in undefines:
|
||||
env['CCFLAGS'].remove(undef)
|
||||
env.Append(_CPPDEFFLAGS=" %s" % " ".join(undefines))
|
||||
|
||||
|
||||
def GlobCXXFiles(env, path):
|
||||
files = []
|
||||
for suff in ["*.c", "*.cpp", "*.S"]:
|
||||
@@ -78,18 +104,23 @@ def GlobCXXFiles(env, path):
|
||||
return files
|
||||
|
||||
|
||||
def VariantDirWrap(env, variant_dir, src_dir, duplicate=True):
|
||||
DefaultEnvironment().Append(VARIANT_DIRS=[(variant_dir, src_dir)])
|
||||
env.VariantDir(variant_dir, src_dir, duplicate)
|
||||
|
||||
|
||||
def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True,
|
||||
ignore_pattern=None):
|
||||
if not ignore_pattern:
|
||||
ignore_pattern = (".git", ".svn")
|
||||
variants = []
|
||||
src_dir = env.subst(src_dir)
|
||||
for root, _, _ in walk(src_dir):
|
||||
for root, _, _ in walk(src_dir, followlinks=True):
|
||||
_src_dir = root
|
||||
_var_dir = variant_dir + root.replace(src_dir, "")
|
||||
if any([s in _var_dir.lower() for s in ignore_pattern]):
|
||||
continue
|
||||
env.VariantDir(_var_dir, _src_dir, duplicate)
|
||||
env.VariantDirWrap(_var_dir, _src_dir, duplicate)
|
||||
variants.append(_var_dir)
|
||||
return variants
|
||||
|
||||
@@ -131,9 +162,11 @@ def BuildLibrary(env, variant_dir, library_dir, ignore_files=None):
|
||||
|
||||
def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
|
||||
|
||||
INCLUDES_RE = re.compile(r"^\s*#include\s+(\<|\")([^\>\"\']+)(?:\>|\")",
|
||||
re.M)
|
||||
INCLUDES_RE = re.compile(
|
||||
r"^\s*#include\s+(\<|\")([^\>\"\']+)(?:\>|\")", re.M)
|
||||
LIBSOURCE_DIRS = [env.subst(d) for d in env.get("LIBSOURCE_DIRS", [])]
|
||||
USE_LIBS = [l.strip() for l in env.get("USE_LIBS", "").split(",")
|
||||
if l.strip()]
|
||||
|
||||
# start internal prototypes
|
||||
|
||||
@@ -174,7 +207,10 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
|
||||
if not isdir(lsd_dir):
|
||||
continue
|
||||
|
||||
for ld in listdir(lsd_dir):
|
||||
for ld in USE_LIBS + listdir(lsd_dir):
|
||||
if not isdir(join(lsd_dir, ld)):
|
||||
continue
|
||||
|
||||
inc_path = normpath(join(lsd_dir, ld, self.name))
|
||||
try:
|
||||
lib_dir = inc_path[:inc_path.index(
|
||||
@@ -205,6 +241,7 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
|
||||
"libs": set(),
|
||||
"ordered": set()
|
||||
}
|
||||
|
||||
state = _process_src_dir(state, env.subst(src_dir))
|
||||
|
||||
result = []
|
||||
@@ -213,22 +250,17 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
|
||||
return result
|
||||
|
||||
def _process_src_dir(state, src_dir):
|
||||
for root, _, _ in walk(src_dir):
|
||||
for root, _, _ in walk(src_dir, followlinks=True):
|
||||
for node in (env.GlobCXXFiles(root) +
|
||||
env.Glob(join(root, "*.h"))):
|
||||
state = _parse_includes(state, node)
|
||||
return state
|
||||
|
||||
def _parse_includes(state, node):
|
||||
if node.path in state['paths']:
|
||||
return state
|
||||
else:
|
||||
state['paths'].add(node.path)
|
||||
|
||||
skip_includes = ("arduino.h", "energia.h")
|
||||
matches = INCLUDES_RE.findall(node.get_text_contents())
|
||||
for (inc_type, inc_name) in matches:
|
||||
base_dir = dirname(node.path)
|
||||
base_dir = dirname(node.get_abspath())
|
||||
if inc_name.lower() in skip_includes:
|
||||
continue
|
||||
if join(base_dir, inc_name) in state['paths']:
|
||||
@@ -365,7 +397,7 @@ def ConvertInoToCpp(env):
|
||||
if not data:
|
||||
return
|
||||
|
||||
tmpcpp_file = join(env.subst("$PROJECTSRC_DIR"), "piomain.cpp")
|
||||
tmpcpp_file = join(env.subst("$PROJECTSRC_DIR"), "tmp_ino_to.cpp")
|
||||
with open(tmpcpp_file, "w") as f:
|
||||
f.write(data)
|
||||
|
||||
@@ -378,7 +410,9 @@ def exists(_):
|
||||
|
||||
def generate(env):
|
||||
env.AddMethod(BuildFirmware)
|
||||
env.AddMethod(ProcessFlags)
|
||||
env.AddMethod(GlobCXXFiles)
|
||||
env.AddMethod(VariantDirWrap)
|
||||
env.AddMethod(VariantDirRecursive)
|
||||
env.AddMethod(BuildFramework)
|
||||
env.AddMethod(BuildLibrary)
|
||||
|
||||
@@ -18,6 +18,7 @@ def cli(query, json_output): # pylint: disable=R0912
|
||||
|
||||
BOARDLIST_TPL = ("{type:<30} {mcu:<14} {frequency:<8} "
|
||||
" {flash:<7} {ram:<6} {name}")
|
||||
terminal_width, _ = click.get_terminal_size()
|
||||
|
||||
grpboards = {}
|
||||
for type_, data in get_boards().items():
|
||||
@@ -31,12 +32,14 @@ def cli(query, json_output): # pylint: disable=R0912
|
||||
if query.lower() not in search_data.lower():
|
||||
continue
|
||||
|
||||
click.echo("\nPlatform: %s" % platform)
|
||||
click.echo("-" * 75)
|
||||
click.echo("")
|
||||
click.echo("Platform: ", nl=False)
|
||||
click.secho(platform, bold=True)
|
||||
click.echo("-" * terminal_width)
|
||||
click.echo(BOARDLIST_TPL.format(
|
||||
type=click.style("Type", fg="cyan"), mcu="MCU",
|
||||
frequency="Frequency", flash="Flash", ram="RAM", name="Name"))
|
||||
click.echo("-" * 75)
|
||||
click.echo("-" * terminal_width)
|
||||
|
||||
for type_, data in sorted(boards.items(), key=lambda b: b[1]['name']):
|
||||
if query:
|
||||
|
||||
146
platformio/commands/ci.py
Normal file
@@ -0,0 +1,146 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
import stat
|
||||
from glob import glob
|
||||
from os import chmod, environ, makedirs, remove
|
||||
from os.path import abspath, basename, isdir, isfile, join
|
||||
from shutil import copyfile, copytree, rmtree
|
||||
from tempfile import mkdtemp
|
||||
|
||||
import click
|
||||
|
||||
from platformio import app
|
||||
from platformio.commands.init import cli as cmd_init
|
||||
from platformio.commands.run import cli as cmd_run
|
||||
from platformio.exception import CIBuildEnvsEmpty
|
||||
from platformio.util import get_boards
|
||||
|
||||
|
||||
def validate_path(ctx, param, value): # pylint: disable=W0613
|
||||
invalid_path = None
|
||||
for p in value:
|
||||
if not glob(p):
|
||||
invalid_path = p
|
||||
break
|
||||
try:
|
||||
assert invalid_path is None
|
||||
return value
|
||||
except AssertionError:
|
||||
raise click.BadParameter("Found invalid path: %s" % invalid_path)
|
||||
|
||||
|
||||
def validate_boards(ctx, param, value): # pylint: disable=W0613
|
||||
unknown_boards = set(value) - set(get_boards().keys())
|
||||
try:
|
||||
assert not unknown_boards
|
||||
return value
|
||||
except AssertionError:
|
||||
raise click.BadParameter(
|
||||
"%s. Please search for the board types using "
|
||||
"`platformio boards` command" % ", ".join(unknown_boards))
|
||||
|
||||
|
||||
@click.command("ci", short_help="Continuous Integration")
|
||||
@click.argument("src", nargs=-1, callback=validate_path)
|
||||
@click.option("--lib", "-l", multiple=True, callback=validate_path)
|
||||
@click.option("--exclude", multiple=True)
|
||||
@click.option("--board", "-b", multiple=True, callback=validate_boards)
|
||||
@click.option("--build-dir", default=mkdtemp,
|
||||
type=click.Path(exists=True, file_okay=False, dir_okay=True,
|
||||
writable=True, resolve_path=True))
|
||||
@click.option("--keep-build-dir", is_flag=True)
|
||||
@click.option("--project-conf",
|
||||
type=click.Path(exists=True, file_okay=True, dir_okay=False,
|
||||
readable=True, resolve_path=True))
|
||||
@click.option("--verbose", "-v", count=True, default=3)
|
||||
@click.pass_context
|
||||
def cli(ctx, src, lib, exclude, board, # pylint: disable=R0913
|
||||
build_dir, keep_build_dir, project_conf, verbose):
|
||||
|
||||
if not src:
|
||||
src = environ.get("PLATFORMIO_CI_SRC", "").split(":")
|
||||
if not src:
|
||||
raise click.BadParameter("Missing argument 'src'")
|
||||
|
||||
try:
|
||||
app.set_session_var("force_option", True)
|
||||
_clean_dir(build_dir)
|
||||
|
||||
for dir_name, patterns in dict(lib=lib, src=src).iteritems():
|
||||
if not patterns:
|
||||
continue
|
||||
contents = []
|
||||
for p in patterns:
|
||||
contents += glob(p)
|
||||
_copy_contents(join(build_dir, dir_name), contents)
|
||||
|
||||
if project_conf and isfile(project_conf):
|
||||
copyfile(project_conf, join(build_dir, "platformio.ini"))
|
||||
elif not board:
|
||||
raise CIBuildEnvsEmpty()
|
||||
|
||||
if exclude:
|
||||
_exclude_contents(build_dir, exclude)
|
||||
|
||||
# initialise project
|
||||
ctx.invoke(cmd_init, project_dir=build_dir, board=board,
|
||||
disable_auto_uploading=True)
|
||||
|
||||
# process project
|
||||
ctx.invoke(cmd_run, project_dir=build_dir, verbose=verbose)
|
||||
finally:
|
||||
if not keep_build_dir:
|
||||
rmtree(
|
||||
build_dir, onerror=lambda action, name, exc:
|
||||
(chmod(name, stat.S_IWRITE), remove(name))
|
||||
)
|
||||
|
||||
|
||||
def _clean_dir(dirpath):
|
||||
rmtree(dirpath)
|
||||
makedirs(dirpath)
|
||||
|
||||
|
||||
def _copy_contents(dst_dir, contents):
|
||||
items = {
|
||||
"dirs": set(),
|
||||
"files": set()
|
||||
}
|
||||
|
||||
for path in contents:
|
||||
path = abspath(path)
|
||||
if isdir(path):
|
||||
items['dirs'].add(path)
|
||||
elif isfile(path):
|
||||
items['files'].add(path)
|
||||
|
||||
dst_dir_name = basename(dst_dir)
|
||||
|
||||
if dst_dir_name == "src" and len(items['dirs']) == 1:
|
||||
copytree(list(items['dirs']).pop(), dst_dir)
|
||||
else:
|
||||
makedirs(dst_dir)
|
||||
for d in items['dirs']:
|
||||
copytree(d, join(dst_dir, basename(d)))
|
||||
|
||||
if not items['files']:
|
||||
return
|
||||
|
||||
if dst_dir_name == "lib":
|
||||
dst_dir = join(dst_dir, mkdtemp(dir=dst_dir))
|
||||
|
||||
for f in items['files']:
|
||||
copyfile(f, join(dst_dir, basename(f)))
|
||||
|
||||
|
||||
def _exclude_contents(dst_dir, patterns):
|
||||
contents = []
|
||||
for p in patterns:
|
||||
contents += glob(join(dst_dir, p))
|
||||
for path in contents:
|
||||
path = abspath(path)
|
||||
if isdir(path):
|
||||
rmtree(path)
|
||||
elif isfile(path):
|
||||
remove(path)
|
||||
@@ -8,46 +8,53 @@ from shutil import copyfile
|
||||
import click
|
||||
|
||||
from platformio import app, exception
|
||||
from platformio.ide.projectgenerator import ProjectGenerator
|
||||
from platformio.util import get_boards, get_source_dir
|
||||
|
||||
|
||||
def validate_boards(ctx, param, value): # pylint: disable=W0613
|
||||
unknown_boards = set(value) - set(get_boards().keys())
|
||||
try:
|
||||
assert not unknown_boards
|
||||
return value
|
||||
except AssertionError:
|
||||
raise click.BadParameter(
|
||||
"%s. Please search for the board types using "
|
||||
"`platformio boards` command" % ", ".join(unknown_boards))
|
||||
|
||||
|
||||
@click.command("init", short_help="Initialize new PlatformIO based project")
|
||||
@click.option("--project-dir", "-d", default=getcwd,
|
||||
type=click.Path(exists=True, file_okay=False, dir_okay=True,
|
||||
writable=True, resolve_path=True))
|
||||
@click.option("--board", "-b", multiple=True, metavar="TYPE")
|
||||
@click.option("--board", "-b", multiple=True, metavar="TYPE",
|
||||
callback=validate_boards)
|
||||
@click.option("--ide",
|
||||
type=click.Choice(ProjectGenerator.get_supported_ides()))
|
||||
@click.option("--disable-auto-uploading", is_flag=True)
|
||||
def cli(project_dir, board, disable_auto_uploading):
|
||||
|
||||
project_file = join(project_dir, "platformio.ini")
|
||||
src_dir = join(project_dir, "src")
|
||||
lib_dir = join(project_dir, "lib")
|
||||
if all([isfile(project_file), isdir(src_dir), isdir(lib_dir)]):
|
||||
raise exception.ProjectInitialized()
|
||||
|
||||
builtin_boards = set(get_boards().keys())
|
||||
if board and not set(board).issubset(builtin_boards):
|
||||
raise exception.UnknownBoard(
|
||||
", ".join(set(board).difference(builtin_boards)))
|
||||
@click.option("--env-prefix", default="")
|
||||
def cli(project_dir, board, ide, disable_auto_uploading, env_prefix):
|
||||
|
||||
# ask about auto-uploading
|
||||
if board and app.get_setting("enable_prompts"):
|
||||
disable_auto_uploading = not click.confirm(
|
||||
"\nWould you like to enable firmware auto-uploading when project "
|
||||
"Would you like to enable firmware auto-uploading when project "
|
||||
"is successfully built using `platformio run` command? \n"
|
||||
"Don't forget that you can upload firmware manually using "
|
||||
"`platformio run --target upload` command."
|
||||
)
|
||||
click.echo("")
|
||||
|
||||
if project_dir == getcwd():
|
||||
click.secho("\nThe current working directory", fg="yellow", nl=False)
|
||||
click.secho(" %s " % project_dir, fg="cyan", nl=False)
|
||||
click.secho(
|
||||
"will be used for the new project.\n"
|
||||
"will be used for project.\n"
|
||||
"You can specify another project directory via\n"
|
||||
"`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.\n",
|
||||
"`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.",
|
||||
fg="yellow"
|
||||
)
|
||||
click.echo("")
|
||||
|
||||
click.echo("The next files/directories will be created in %s" %
|
||||
click.style(project_dir, fg="cyan"))
|
||||
@@ -58,51 +65,75 @@ def cli(project_dir, board, disable_auto_uploading):
|
||||
click.echo("%s - Put here project specific or 3-rd party libraries" %
|
||||
click.style("lib", fg="cyan"))
|
||||
|
||||
if (not app.get_setting("enable_prompts") or
|
||||
click.confirm("Do you want to continue?")):
|
||||
|
||||
for d in (src_dir, lib_dir):
|
||||
if not isdir(d):
|
||||
makedirs(d)
|
||||
if not isfile(project_file):
|
||||
copyfile(join(get_source_dir(), "projectconftpl.ini"),
|
||||
project_file)
|
||||
if board:
|
||||
fill_project_envs(project_file, board, disable_auto_uploading)
|
||||
click.secho(
|
||||
"Project has been successfully initialized!\nUseful commands:\n"
|
||||
"`platformio run` - process/build project from the current "
|
||||
"directory\n"
|
||||
"`platformio run --target upload` or `platformio run -t upload` "
|
||||
"- upload firmware to embedded board\n"
|
||||
"`platformio run --target clean` - clean project (remove compiled "
|
||||
"files)",
|
||||
fg="green"
|
||||
)
|
||||
else:
|
||||
if (app.get_setting("enable_prompts") and
|
||||
not click.confirm("Do you want to continue?")):
|
||||
raise exception.AbortedByUser()
|
||||
|
||||
project_file = join(project_dir, "platformio.ini")
|
||||
src_dir = join(project_dir, "src")
|
||||
lib_dir = join(project_dir, "lib")
|
||||
|
||||
def fill_project_envs(project_file, board_types, disable_auto_uploading):
|
||||
for d in (src_dir, lib_dir):
|
||||
if not isdir(d):
|
||||
makedirs(d)
|
||||
|
||||
if not isfile(project_file):
|
||||
copyfile(join(get_source_dir(), "projectconftpl.ini"),
|
||||
project_file)
|
||||
|
||||
if board:
|
||||
fill_project_envs(
|
||||
project_file, board, disable_auto_uploading, env_prefix)
|
||||
|
||||
if ide:
|
||||
pg = ProjectGenerator(project_dir, ide)
|
||||
pg.generate()
|
||||
|
||||
click.secho(
|
||||
"\nProject has been successfully initialized!\nUseful commands:\n"
|
||||
"`platformio run` - process/build project from the current "
|
||||
"directory\n"
|
||||
"`platformio run --target upload` or `platformio run -t upload` "
|
||||
"- upload firmware to embedded board\n"
|
||||
"`platformio run --target clean` - clean project (remove compiled "
|
||||
"files)",
|
||||
fg="green"
|
||||
)
|
||||
|
||||
|
||||
def fill_project_envs(project_file, board_types, disable_auto_uploading,
|
||||
env_prefix):
|
||||
builtin_boards = get_boards()
|
||||
content = []
|
||||
for type_ in board_types:
|
||||
if type_ not in builtin_boards:
|
||||
continue
|
||||
else:
|
||||
content.append("")
|
||||
used_envs = []
|
||||
|
||||
with open(project_file) as f:
|
||||
used_envs = [l.strip() for l in f.read().splitlines() if
|
||||
l.strip().startswith("[env:")]
|
||||
|
||||
for type_ in board_types:
|
||||
data = builtin_boards[type_]
|
||||
env_name = "[env:%s%s]" % (env_prefix, type_)
|
||||
|
||||
if env_name in used_envs:
|
||||
continue
|
||||
|
||||
content.append("")
|
||||
content.append(env_name)
|
||||
content.append("platform = %s" % data['platform'])
|
||||
|
||||
# find default framework for board
|
||||
frameworks = data.get("frameworks")
|
||||
content.append("[env:autogen_%s]" % type_)
|
||||
content.append("platform = %s" % data['platform'])
|
||||
if frameworks:
|
||||
content.append("framework = %s" % frameworks[0])
|
||||
content.append("board = %s" % type_)
|
||||
|
||||
content.append("board = %s" % type_)
|
||||
content.append("%stargets = upload" % ("# " if disable_auto_uploading
|
||||
else ""))
|
||||
|
||||
if not content:
|
||||
return
|
||||
|
||||
with open(project_file, "a") as f:
|
||||
content.append("")
|
||||
f.write("\n".join(content))
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
import click
|
||||
|
||||
from platformio.platforms.base import PlatformFactory
|
||||
|
||||
|
||||
@click.command("install", short_help="Install new platforms")
|
||||
@click.argument("platforms", nargs=-1)
|
||||
@click.option("--with-package", multiple=True, metavar="<package>")
|
||||
@click.option("--without-package", multiple=True, metavar="<package>")
|
||||
@click.option("--skip-default-package", is_flag=True)
|
||||
def cli(platforms, with_package, without_package, skip_default_package):
|
||||
|
||||
for platform in platforms:
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
if p.install(with_package, without_package, skip_default_package):
|
||||
click.secho("The platform '%s' has been successfully installed!" %
|
||||
platform, fg="green")
|
||||
@@ -7,7 +7,7 @@ import click
|
||||
|
||||
from platformio import app, exception
|
||||
from platformio.libmanager import LibraryManager
|
||||
from platformio.util import get_api_result, get_lib_dir
|
||||
from platformio.util import get_api_result
|
||||
|
||||
LIBLIST_TPL = ("[{id:^14}] {name:<25} {compatibility:<30} "
|
||||
"\"{authornames}\": {description}")
|
||||
@@ -21,7 +21,9 @@ def echo_liblist_header():
|
||||
authornames="Authors",
|
||||
description="Description"
|
||||
))
|
||||
click.echo("-" * 85)
|
||||
|
||||
terminal_width, _ = click.get_terminal_size()
|
||||
click.echo("-" * terminal_width)
|
||||
|
||||
|
||||
def echo_liblist_item(item):
|
||||
@@ -98,7 +100,7 @@ def lib_search(query, **filters):
|
||||
@click.option("-v", "--version")
|
||||
@click.pass_context
|
||||
def lib_install(ctx, libid, version):
|
||||
lm = LibraryManager(get_lib_dir())
|
||||
lm = LibraryManager()
|
||||
for id_ in libid:
|
||||
click.echo(
|
||||
"Installing library [ %s ]:" % click.style(str(id_), fg="green"))
|
||||
@@ -147,7 +149,7 @@ def lib_install_dependency(ctx, data):
|
||||
@cli.command("uninstall", short_help="Uninstall libraries")
|
||||
@click.argument("libid", type=click.INT, nargs=-1)
|
||||
def lib_uninstall(libid):
|
||||
lm = LibraryManager(get_lib_dir())
|
||||
lm = LibraryManager()
|
||||
for id_ in libid:
|
||||
info = lm.get_info(id_)
|
||||
if lm.uninstall(id_):
|
||||
@@ -158,7 +160,7 @@ def lib_uninstall(libid):
|
||||
@cli.command("list", short_help="List installed libraries")
|
||||
@click.option("--json-output", is_flag=True)
|
||||
def lib_list(json_output):
|
||||
lm = LibraryManager(get_lib_dir())
|
||||
lm = LibraryManager()
|
||||
items = lm.get_installed().values()
|
||||
|
||||
if json_output:
|
||||
@@ -177,7 +179,7 @@ def lib_list(json_output):
|
||||
@cli.command("show", short_help="Show details about installed library")
|
||||
@click.argument("libid", type=click.INT)
|
||||
def lib_show(libid):
|
||||
lm = LibraryManager(get_lib_dir())
|
||||
lm = LibraryManager()
|
||||
info = lm.get_info(libid)
|
||||
click.secho(info['name'], fg="cyan")
|
||||
click.echo("-" * len(info['name']))
|
||||
@@ -209,13 +211,18 @@ def lib_show(libid):
|
||||
|
||||
|
||||
@cli.command("update", short_help="Update installed libraries")
|
||||
@click.argument("libid", type=click.INT, nargs=-1, required=False,
|
||||
metavar="[LIBRARY_ID]")
|
||||
@click.pass_context
|
||||
def lib_update(ctx):
|
||||
lm = LibraryManager(get_lib_dir())
|
||||
def lib_update(ctx, libid):
|
||||
lm = LibraryManager()
|
||||
for id_, latest_version in (lm.get_latest_versions() or {}).items():
|
||||
if libid and int(id_) not in libid:
|
||||
continue
|
||||
|
||||
info = lm.get_info(int(id_))
|
||||
|
||||
click.echo("Updating [ %s ] %s library:" % (
|
||||
click.echo("Updating [ %s ] %s library:" % (
|
||||
click.style(id_, fg="yellow"),
|
||||
click.style(info['name'], fg="cyan")))
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
import json
|
||||
|
||||
import click
|
||||
|
||||
from platformio.platforms.base import PlatformFactory
|
||||
|
||||
|
||||
@click.command("list", short_help="List installed platforms")
|
||||
@click.option("--json-output", is_flag=True)
|
||||
def cli(json_output):
|
||||
|
||||
installed_platforms = PlatformFactory.get_platforms(
|
||||
installed=True).keys()
|
||||
installed_platforms.sort()
|
||||
|
||||
data = []
|
||||
for platform in installed_platforms:
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
data.append({
|
||||
"name": platform,
|
||||
"packages": p.get_installed_packages()
|
||||
})
|
||||
|
||||
if json_output:
|
||||
click.echo(json.dumps(data))
|
||||
else:
|
||||
for item in data:
|
||||
click.echo("{name:<20} with packages: {pkgs}".format(
|
||||
name=click.style(item['name'], fg="cyan"),
|
||||
pkgs=", ".join(item['packages'])
|
||||
))
|
||||
155
platformio/commands/platforms.py
Normal file
@@ -0,0 +1,155 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
import click
|
||||
|
||||
from platformio import app
|
||||
from platformio.exception import PlatformNotInstalledYet
|
||||
from platformio.pkgmanager import PackageManager
|
||||
from platformio.platforms.base import PlatformFactory
|
||||
|
||||
|
||||
@click.group(short_help="Platforms and Packages Manager")
|
||||
def cli():
|
||||
pass
|
||||
|
||||
|
||||
@cli.command("install", short_help="Install new platforms")
|
||||
@click.argument("platforms", nargs=-1, required=True)
|
||||
@click.option("--with-package", multiple=True, metavar="<package>")
|
||||
@click.option("--without-package", multiple=True, metavar="<package>")
|
||||
@click.option("--skip-default-package", is_flag=True)
|
||||
def platforms_install(platforms, with_package, without_package,
|
||||
skip_default_package):
|
||||
for platform in platforms:
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
if p.install(with_package, without_package, skip_default_package):
|
||||
click.secho("The platform '%s' has been successfully installed!" %
|
||||
platform, fg="green")
|
||||
|
||||
|
||||
@cli.command("list", short_help="List installed platforms")
|
||||
@click.option("--json-output", is_flag=True)
|
||||
def platforms_list(json_output):
|
||||
|
||||
installed_platforms = PlatformFactory.get_platforms(
|
||||
installed=True).keys()
|
||||
installed_platforms.sort()
|
||||
|
||||
data = []
|
||||
for platform in installed_platforms:
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
data.append({
|
||||
"name": platform,
|
||||
"packages": p.get_installed_packages()
|
||||
})
|
||||
|
||||
if json_output:
|
||||
click.echo(json.dumps(data))
|
||||
else:
|
||||
for item in data:
|
||||
click.echo("{name:<20} with packages: {pkgs}".format(
|
||||
name=click.style(item['name'], fg="cyan"),
|
||||
pkgs=", ".join(item['packages'])
|
||||
))
|
||||
|
||||
|
||||
@cli.command("search", short_help="Search for development platforms")
|
||||
@click.argument("query", required=False)
|
||||
@click.option("--json-output", is_flag=True)
|
||||
def platforms_search(query, json_output):
|
||||
|
||||
data = []
|
||||
platforms = PlatformFactory.get_platforms().keys()
|
||||
platforms.sort()
|
||||
for platform in platforms:
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
type_ = p.get_type()
|
||||
description = p.get_description()
|
||||
|
||||
if query == "all":
|
||||
query = ""
|
||||
|
||||
search_data = "%s %s %s" % (type_, description, p.get_packages())
|
||||
if query and query.lower() not in search_data.lower():
|
||||
continue
|
||||
|
||||
data.append({
|
||||
"type": type_,
|
||||
"description": description,
|
||||
"packages": p.get_packages()
|
||||
})
|
||||
|
||||
if json_output:
|
||||
click.echo(json.dumps(data))
|
||||
else:
|
||||
terminal_width, _ = click.get_terminal_size()
|
||||
for item in data:
|
||||
click.secho(item['type'], fg="cyan", nl=False)
|
||||
click.echo(" (available packages: %s)" % ", ".join(
|
||||
item.get("packages").keys()))
|
||||
click.echo("-" * terminal_width)
|
||||
click.echo(item['description'])
|
||||
click.echo()
|
||||
|
||||
|
||||
@cli.command("show", short_help="Show details about installed platform")
|
||||
@click.argument("platform")
|
||||
@click.pass_context
|
||||
def platforms_show(ctx, platform):
|
||||
|
||||
installed_platforms = PlatformFactory.get_platforms(
|
||||
installed=True).keys()
|
||||
|
||||
if platform not in installed_platforms:
|
||||
if (not app.get_setting("enable_prompts") or
|
||||
click.confirm("The platform '%s' has not been installed yet. "
|
||||
"Would you like to install it now?" % platform)):
|
||||
ctx.invoke(platforms_install, platforms=[platform])
|
||||
else:
|
||||
raise PlatformNotInstalledYet(platform)
|
||||
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
click.echo("{name:<20} - {description} [ {url} ]".format(
|
||||
name=click.style(p.get_type(), fg="cyan"),
|
||||
description=p.get_description(), url=p.get_vendor_url()))
|
||||
|
||||
installed_packages = PackageManager.get_installed()
|
||||
for name in p.get_installed_packages():
|
||||
data = installed_packages[name]
|
||||
pkgalias = p.get_pkg_alias(name)
|
||||
click.echo("----------")
|
||||
click.echo("Package: %s" % click.style(name, fg="yellow"))
|
||||
if pkgalias:
|
||||
click.echo("Alias: %s" % pkgalias)
|
||||
click.echo("Version: %d" % int(data['version']))
|
||||
click.echo("Installed: %s" % datetime.fromtimestamp(
|
||||
data['time']).strftime("%Y-%m-%d %H:%M:%S"))
|
||||
|
||||
|
||||
@cli.command("uninstall", short_help="Uninstall platforms")
|
||||
@click.argument("platforms", nargs=-1, required=True)
|
||||
def platforms_uninstall(platforms):
|
||||
|
||||
for platform in platforms:
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
if p.uninstall():
|
||||
click.secho("The platform '%s' has been successfully "
|
||||
"uninstalled!" % platform, fg="green")
|
||||
|
||||
|
||||
@cli.command("update", short_help="Update installed Platforms and Packages")
|
||||
def platforms_update():
|
||||
|
||||
installed_platforms = PlatformFactory.get_platforms(
|
||||
installed=True).keys()
|
||||
installed_platforms.sort()
|
||||
|
||||
for platform in installed_platforms:
|
||||
click.echo("\nPlatform %s" % click.style(platform, fg="cyan"))
|
||||
click.echo("--------")
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
p.update()
|
||||
@@ -2,6 +2,7 @@
|
||||
# See LICENSE for details.
|
||||
|
||||
from datetime import datetime
|
||||
from os import chdir, getcwd
|
||||
from os.path import getmtime, isdir, join
|
||||
from shutil import rmtree
|
||||
from time import time
|
||||
@@ -9,7 +10,10 @@ from time import time
|
||||
import click
|
||||
|
||||
from platformio import app, exception, telemetry, util
|
||||
from platformio.commands.install import cli as cmd_install
|
||||
from platformio.commands.lib import lib_install as cmd_lib_install
|
||||
from platformio.commands.platforms import \
|
||||
platforms_install as cmd_platforms_install
|
||||
from platformio.libmanager import LibraryManager
|
||||
from platformio.platforms.base import PlatformFactory
|
||||
|
||||
|
||||
@@ -17,110 +21,162 @@ from platformio.platforms.base import PlatformFactory
|
||||
@click.option("--environment", "-e", multiple=True, metavar="<environment>")
|
||||
@click.option("--target", "-t", multiple=True, metavar="<target>")
|
||||
@click.option("--upload-port", metavar="<upload port>")
|
||||
@click.option("--project-dir", default=getcwd,
|
||||
type=click.Path(exists=True, file_okay=False, dir_okay=True,
|
||||
writable=True, resolve_path=True))
|
||||
@click.option("--verbose", "-v", count=True, default=3)
|
||||
@click.pass_context
|
||||
def cli(ctx, environment, target, upload_port):
|
||||
def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
|
||||
project_dir, verbose):
|
||||
initial_cwd = getcwd()
|
||||
chdir(project_dir)
|
||||
try:
|
||||
config = util.get_project_config()
|
||||
|
||||
config = util.get_project_config()
|
||||
if not config.sections():
|
||||
raise exception.ProjectEnvsNotAvailable()
|
||||
|
||||
if not config.sections():
|
||||
raise exception.ProjectEnvsNotAvailable()
|
||||
unknown = set(environment) - set([s[4:] for s in config.sections()])
|
||||
if unknown:
|
||||
raise exception.UnknownEnvNames(", ".join(unknown))
|
||||
|
||||
unknown = set(environment) - set([s[4:] for s in config.sections()])
|
||||
if unknown:
|
||||
raise exception.UnknownEnvNames(", ".join(unknown))
|
||||
# remove ".pioenvs" if project config is modified
|
||||
_pioenvs_dir = util.get_pioenvs_dir()
|
||||
if (isdir(_pioenvs_dir) and
|
||||
getmtime(join(util.get_project_dir(), "platformio.ini")) >
|
||||
getmtime(_pioenvs_dir)):
|
||||
rmtree(_pioenvs_dir)
|
||||
|
||||
# remove ".pioenvs" if project config is modified
|
||||
_pioenvs_dir = util.get_pioenvs_dir()
|
||||
if (isdir(_pioenvs_dir) and
|
||||
getmtime(join(util.get_project_dir(), "platformio.ini")) >
|
||||
getmtime(_pioenvs_dir)):
|
||||
rmtree(_pioenvs_dir)
|
||||
results = []
|
||||
for section in config.sections():
|
||||
# skip main configuration section
|
||||
if section == "platformio":
|
||||
continue
|
||||
|
||||
found_error = False
|
||||
_first_done = False
|
||||
for section in config.sections():
|
||||
# skip main configuration section
|
||||
if section == "platformio":
|
||||
continue
|
||||
elif section[:4] != "env:":
|
||||
raise exception.InvalidEnvName(section)
|
||||
if not section.startswith("env:"):
|
||||
raise exception.InvalidEnvName(section)
|
||||
|
||||
envname = section[4:]
|
||||
if environment and envname not in environment:
|
||||
# echo("Skipped %s environment" % style(envname, fg="yellow"))
|
||||
continue
|
||||
envname = section[4:]
|
||||
if environment and envname not in environment:
|
||||
# echo("Skipped %s environment" % style(envname, fg="yellow"))
|
||||
continue
|
||||
|
||||
options = {}
|
||||
for k, v in config.items(section):
|
||||
options[k] = v
|
||||
if results:
|
||||
click.echo()
|
||||
|
||||
if _first_done:
|
||||
click.echo()
|
||||
options = {}
|
||||
for k, v in config.items(section):
|
||||
options[k] = v
|
||||
|
||||
if not process_environment(ctx, envname, options, target, upload_port):
|
||||
found_error = True
|
||||
_first_done = True
|
||||
ep = EnvironmentProcessor(
|
||||
ctx, envname, options, target, upload_port, verbose)
|
||||
results.append(ep.process())
|
||||
|
||||
if found_error:
|
||||
raise exception.ReturnErrorCode()
|
||||
if not all(results):
|
||||
raise exception.ReturnErrorCode()
|
||||
finally:
|
||||
chdir(initial_cwd)
|
||||
|
||||
|
||||
def process_environment(ctx, name, options, targets, upload_port):
|
||||
terminal_width, _ = click.get_terminal_size()
|
||||
start_time = time()
|
||||
class EnvironmentProcessor(object):
|
||||
|
||||
click.echo("[%s] Processing %s (%s)" % (
|
||||
datetime.now().strftime("%c"),
|
||||
click.style(name, fg="cyan", bold=True),
|
||||
", ".join(["%s: %s" % (k, v) for k, v in options.iteritems()])
|
||||
))
|
||||
click.secho("-" * terminal_width, bold=True)
|
||||
def __init__(self, cmd_ctx, name, options, # pylint: disable=R0913
|
||||
targets, upload_port, verbose):
|
||||
self.cmd_ctx = cmd_ctx
|
||||
self.name = name
|
||||
self.options = options
|
||||
self.targets = targets
|
||||
self.upload_port = upload_port
|
||||
self.verbose_level = int(verbose)
|
||||
|
||||
result = _run_environment(ctx, name, options, targets, upload_port)
|
||||
def process(self):
|
||||
terminal_width, _ = click.get_terminal_size()
|
||||
start_time = time()
|
||||
|
||||
is_error = result['returncode'] != 0
|
||||
summary_text = " Took %.2f seconds " % (time() - start_time)
|
||||
half_line = "=" * ((terminal_width - len(summary_text) - 10) / 2)
|
||||
click.echo("%s [%s]%s%s" % (
|
||||
half_line,
|
||||
(click.style(" ERROR ", fg="red", bold=True)
|
||||
if is_error else click.style("SUCCESS", fg="green", bold=True)),
|
||||
summary_text,
|
||||
half_line
|
||||
), err=is_error)
|
||||
click.echo("[%s] Processing %s (%s)" % (
|
||||
datetime.now().strftime("%c"),
|
||||
click.style(self.name, fg="cyan", bold=True),
|
||||
", ".join(["%s: %s" % (k, v) for k, v in self.options.iteritems()])
|
||||
))
|
||||
click.secho("-" * terminal_width, bold=True)
|
||||
|
||||
return not is_error
|
||||
result = self._run()
|
||||
|
||||
is_error = result['returncode'] != 0
|
||||
summary_text = " Took %.2f seconds " % (time() - start_time)
|
||||
half_line = "=" * ((terminal_width - len(summary_text) - 10) / 2)
|
||||
click.echo("%s [%s]%s%s" % (
|
||||
half_line,
|
||||
(click.style(" ERROR ", fg="red", bold=True)
|
||||
if is_error else click.style("SUCCESS", fg="green", bold=True)),
|
||||
summary_text,
|
||||
half_line
|
||||
), err=is_error)
|
||||
|
||||
return not is_error
|
||||
|
||||
def _get_build_variables(self):
|
||||
variables = ["PIOENV=" + self.name]
|
||||
if self.upload_port:
|
||||
variables.append("UPLOAD_PORT=%s" % self.upload_port)
|
||||
for k, v in self.options.items():
|
||||
k = k.upper()
|
||||
if k == "TARGETS" or (k == "UPLOAD_PORT" and self.upload_port):
|
||||
continue
|
||||
variables.append("%s=%s" % (k.upper(), v))
|
||||
return variables
|
||||
|
||||
def _get_build_targets(self):
|
||||
targets = []
|
||||
if self.targets:
|
||||
targets = [t for t in self.targets]
|
||||
elif "targets" in self.options:
|
||||
targets = self.options['targets'].split()
|
||||
return targets
|
||||
|
||||
def _run(self):
|
||||
if "platform" not in self.options:
|
||||
raise exception.UndefinedEnvPlatform(self.name)
|
||||
|
||||
platform = self.options['platform']
|
||||
build_vars = self._get_build_variables()
|
||||
build_targets = self._get_build_targets()
|
||||
|
||||
telemetry.on_run_environment(self.options, build_targets)
|
||||
|
||||
# install platform and libs dependencies
|
||||
_autoinstall_platform(self.cmd_ctx, platform)
|
||||
if "install_libs" in self.options:
|
||||
_autoinstall_libs(self.cmd_ctx, self.options['install_libs'])
|
||||
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
return p.run(build_vars, build_targets, self.verbose_level)
|
||||
|
||||
|
||||
def _run_environment(ctx, name, options, targets, upload_port):
|
||||
variables = ["PIOENV=" + name]
|
||||
if upload_port:
|
||||
variables.append("UPLOAD_PORT=%s" % upload_port)
|
||||
for k, v in options.items():
|
||||
k = k.upper()
|
||||
if k == "TARGETS" or (k == "UPLOAD_PORT" and upload_port):
|
||||
continue
|
||||
variables.append("%s=%s" % (k.upper(), v))
|
||||
|
||||
envtargets = []
|
||||
if targets:
|
||||
envtargets = [t for t in targets]
|
||||
elif "targets" in options:
|
||||
envtargets = options['targets'].split()
|
||||
|
||||
if "platform" not in options:
|
||||
raise exception.UndefinedEnvPlatform(name)
|
||||
platform = options['platform']
|
||||
|
||||
telemetry.on_run_environment(options, envtargets)
|
||||
|
||||
def _autoinstall_platform(ctx, platform):
|
||||
installed_platforms = PlatformFactory.get_platforms(
|
||||
installed=True).keys()
|
||||
if (platform not in installed_platforms and (
|
||||
not app.get_setting("enable_prompts") or
|
||||
click.confirm("The platform '%s' has not been installed yet. "
|
||||
"Would you like to install it now?" % platform))):
|
||||
ctx.invoke(cmd_install, platforms=[platform])
|
||||
ctx.invoke(cmd_platforms_install, platforms=[platform])
|
||||
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
return p.run(variables, envtargets)
|
||||
|
||||
def _autoinstall_libs(ctx, libids_list):
|
||||
require_libs = [int(l.strip()) for l in libids_list.split(",")]
|
||||
installed_libs = [
|
||||
l['id'] for l in LibraryManager().get_installed().values()
|
||||
]
|
||||
|
||||
not_intalled_libs = set(require_libs) - set(installed_libs)
|
||||
if not require_libs or not not_intalled_libs:
|
||||
return
|
||||
|
||||
if (not app.get_setting("enable_prompts") or
|
||||
click.confirm(
|
||||
"The libraries with IDs '%s' have not been installed yet. "
|
||||
"Would you like to install them now?" %
|
||||
", ".join([str(i) for i in not_intalled_libs])
|
||||
)):
|
||||
ctx.invoke(cmd_lib_install, libid=not_intalled_libs)
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
import json
|
||||
|
||||
import click
|
||||
|
||||
from platformio.platforms.base import PlatformFactory
|
||||
|
||||
|
||||
@click.command("search", short_help="Search for development platforms")
|
||||
@click.argument("query", required=False)
|
||||
@click.option("--json-output", is_flag=True)
|
||||
def cli(query, json_output):
|
||||
|
||||
data = []
|
||||
platforms = PlatformFactory.get_platforms().keys()
|
||||
platforms.sort()
|
||||
for platform in platforms:
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
type_ = p.get_type()
|
||||
description = p.get_description()
|
||||
|
||||
if query == "all":
|
||||
query = ""
|
||||
|
||||
search_data = "%s %s %s" % (type_, description, p.get_packages())
|
||||
if query and query.lower() not in search_data.lower():
|
||||
continue
|
||||
|
||||
data.append({
|
||||
"type": type_,
|
||||
"description": description,
|
||||
"packages": p.get_packages()
|
||||
})
|
||||
|
||||
if json_output:
|
||||
click.echo(json.dumps(data))
|
||||
else:
|
||||
for item in data:
|
||||
click.secho(item['type'], fg="cyan", nl=False)
|
||||
click.echo(" (available packages: %s)" % ", ".join(
|
||||
p.get_packages().keys()))
|
||||
click.secho("-" * len(item['type']), fg="cyan")
|
||||
click.echo(item['description'])
|
||||
click.echo()
|
||||
@@ -25,7 +25,7 @@ def serialports_list(json_output):
|
||||
|
||||
for item in get_serialports():
|
||||
click.secho(item['port'], fg="cyan")
|
||||
click.echo("----------")
|
||||
click.echo("-" * len(item['port']))
|
||||
click.echo("Hardware ID: %s" % item['hwid'])
|
||||
click.echo("Description: %s" % item['description'])
|
||||
click.echo("")
|
||||
|
||||
@@ -16,6 +16,7 @@ def cli():
|
||||
def settings_get(name):
|
||||
|
||||
list_tpl = "{name:<40} {value:<35} {description}"
|
||||
terminal_width, _ = click.get_terminal_size()
|
||||
|
||||
click.echo(list_tpl.format(
|
||||
name=click.style("Name", fg="cyan"),
|
||||
@@ -23,7 +24,7 @@ def settings_get(name):
|
||||
click.style(" [Default]", fg="yellow")),
|
||||
description="Description"
|
||||
))
|
||||
click.echo("-" * 90)
|
||||
click.echo("-" * terminal_width)
|
||||
|
||||
for _name, _data in sorted(app.DEFAULT_SETTINGS.items()):
|
||||
if name and name != _name:
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import click
|
||||
|
||||
from platformio import app
|
||||
from platformio.commands.install import cli as cmd_install
|
||||
from platformio.exception import PlatformNotInstalledYet
|
||||
from platformio.pkgmanager import PackageManager
|
||||
from platformio.platforms.base import PlatformFactory
|
||||
|
||||
|
||||
@click.command("show", short_help="Show details about installed platform")
|
||||
@click.argument("platform")
|
||||
@click.pass_context
|
||||
def cli(ctx, platform):
|
||||
|
||||
installed_platforms = PlatformFactory.get_platforms(
|
||||
installed=True).keys()
|
||||
|
||||
if platform not in installed_platforms:
|
||||
if (not app.get_setting("enable_prompts") or
|
||||
click.confirm("The platform '%s' has not been installed yet. "
|
||||
"Would you like to install it now?" % platform)):
|
||||
ctx.invoke(cmd_install, platforms=[platform])
|
||||
else:
|
||||
raise PlatformNotInstalledYet(platform)
|
||||
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
click.echo("{name:<20} - {description} [ {url} ]".format(
|
||||
name=click.style(p.get_type(), fg="cyan"),
|
||||
description=p.get_description(), url=p.get_vendor_url()))
|
||||
|
||||
installed_packages = PackageManager.get_installed()
|
||||
for name in p.get_installed_packages():
|
||||
data = installed_packages[name]
|
||||
pkgalias = p.get_pkg_alias(name)
|
||||
click.echo("----------")
|
||||
click.echo("Package: %s" % click.style(name, fg="yellow"))
|
||||
if pkgalias:
|
||||
click.echo("Alias: %s" % pkgalias)
|
||||
click.echo("Version: %d" % int(data['version']))
|
||||
click.echo("Installed: %s" % datetime.fromtimestamp(
|
||||
data['time']).strftime("%Y-%m-%d %H:%M:%S"))
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
import click
|
||||
|
||||
from platformio.platforms.base import PlatformFactory
|
||||
|
||||
|
||||
@click.command("uninstall", short_help="Uninstall platforms")
|
||||
@click.argument("platforms", nargs=-1)
|
||||
def cli(platforms):
|
||||
|
||||
for platform in platforms:
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
if p.uninstall():
|
||||
click.secho("The platform '%s' has been successfully "
|
||||
"uninstalled!" % platform, fg="green")
|
||||
@@ -3,18 +3,14 @@
|
||||
|
||||
import click
|
||||
|
||||
from platformio.platforms.base import PlatformFactory
|
||||
from platformio.commands.lib import lib_update as cmd_lib_update
|
||||
from platformio.commands.platforms import \
|
||||
platforms_update as cmd_platforms_update
|
||||
|
||||
|
||||
@click.command("update", short_help="Update installed platforms")
|
||||
def cli():
|
||||
|
||||
installed_platforms = PlatformFactory.get_platforms(
|
||||
installed=True).keys()
|
||||
installed_platforms.sort()
|
||||
|
||||
for platform in installed_platforms:
|
||||
click.echo("\nPlatform %s" % click.style(platform, fg="cyan"))
|
||||
click.echo("--------")
|
||||
p = PlatformFactory.newPlatform(platform)
|
||||
p.update()
|
||||
@click.command("update",
|
||||
short_help="Update installed Platforms, Packages and Libraries")
|
||||
@click.pass_context
|
||||
def cli(ctx):
|
||||
ctx.invoke(cmd_platforms_update)
|
||||
ctx.invoke(cmd_lib_update)
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
import click
|
||||
import requests
|
||||
|
||||
from platformio import __version__
|
||||
from platformio import __version__, util
|
||||
from platformio.exception import GetLatestVersionError
|
||||
from platformio.util import exec_command
|
||||
|
||||
|
||||
@click.command("upgrade",
|
||||
@@ -22,9 +21,9 @@ def cli():
|
||||
click.secho("Please wait while upgrading PlatformIO ...",
|
||||
fg="yellow")
|
||||
|
||||
pip_result = exec_command(["pip", "install", "--upgrade",
|
||||
"platformio"])
|
||||
pio_result = exec_command(["platformio", "--version"])
|
||||
pip_result = util.exec_command(["pip", "install", "--upgrade",
|
||||
"platformio"])
|
||||
pio_result = util.exec_command(["platformio", "--version"])
|
||||
|
||||
if last in pio_result['out'].strip():
|
||||
click.secho("PlatformIO has been successfully upgraded to %s" %
|
||||
@@ -37,7 +36,9 @@ def cli():
|
||||
def get_latest_version():
|
||||
try:
|
||||
pkgdata = requests.get(
|
||||
"https://pypi.python.org/pypi/platformio/json").json()
|
||||
"https://pypi.python.org/pypi/platformio/json",
|
||||
headers=util.get_request_defheaders()
|
||||
).json()
|
||||
return pkgdata['info']['version']
|
||||
except:
|
||||
raise GetLatestVersionError()
|
||||
|
||||
@@ -3,15 +3,16 @@
|
||||
|
||||
from email.utils import parsedate_tz
|
||||
from math import ceil
|
||||
from os import environ
|
||||
from os.path import getsize, join
|
||||
from time import mktime
|
||||
|
||||
from click import progressbar
|
||||
from requests import get
|
||||
import click
|
||||
import requests
|
||||
|
||||
from platformio import util
|
||||
from platformio.exception import (FDSHASumMismatch, FDSizeMismatch,
|
||||
FDUnrecognizedStatusCode)
|
||||
from platformio.util import change_filemtime, exec_command
|
||||
|
||||
|
||||
class FileDownloader(object):
|
||||
@@ -27,7 +28,8 @@ class FileDownloader(object):
|
||||
self.set_destination(join(dest_dir, self._fname))
|
||||
self._progressbar = None
|
||||
|
||||
self._request = get(url, stream=True)
|
||||
self._request = requests.get(url, stream=True,
|
||||
headers=util.get_request_defheaders())
|
||||
if self._request.status_code != 200:
|
||||
raise FDUnrecognizedStatusCode(self._request.status_code, url)
|
||||
|
||||
@@ -48,9 +50,14 @@ class FileDownloader(object):
|
||||
f = open(self._destination, "wb")
|
||||
chunks = int(ceil(self.get_size() / float(self.CHUNK_SIZE)))
|
||||
|
||||
with progressbar(length=chunks, label="Downloading") as pb:
|
||||
for _ in pb:
|
||||
if environ.get("CI") == "true":
|
||||
click.echo("Downloading...")
|
||||
for _ in range(0, chunks):
|
||||
f.write(next(itercontent))
|
||||
else:
|
||||
with click.progressbar(length=chunks, label="Downloading") as pb:
|
||||
for _ in pb:
|
||||
f.write(next(itercontent))
|
||||
f.close()
|
||||
self._request.close()
|
||||
|
||||
@@ -66,11 +73,12 @@ class FileDownloader(object):
|
||||
|
||||
dlsha1 = None
|
||||
try:
|
||||
result = exec_command(["sha1sum", self._destination])
|
||||
result = util.exec_command(["sha1sum", self._destination])
|
||||
dlsha1 = result['out']
|
||||
except OSError:
|
||||
try:
|
||||
result = exec_command(["shasum", "-a", "1", self._destination])
|
||||
result = util.exec_command(
|
||||
["shasum", "-a", "1", self._destination])
|
||||
dlsha1 = result['out']
|
||||
except OSError:
|
||||
pass
|
||||
@@ -83,7 +91,7 @@ class FileDownloader(object):
|
||||
def _preserve_filemtime(self, lmdate):
|
||||
timedata = parsedate_tz(lmdate)
|
||||
lmtime = mktime(timedata[:9])
|
||||
change_filemtime(self._destination, lmtime)
|
||||
util.change_filemtime(self._destination, lmtime)
|
||||
|
||||
def __del__(self):
|
||||
self._request.close()
|
||||
|
||||