Compare commits

..

43 Commits

Author SHA1 Message Date
Ivan Kravets
49d5994628 Merge branch 'release/v2.2.2' 2015-07-30 18:56:13 +03:00
Ivan Kravets
e488d53950 Version bump to 2.2.2 (issues #247, #253, #254, #255, #257, #260) 2015-07-30 18:54:06 +03:00
Ivan Kravets
e6be7ab3b5 Minor improvements for exitStatus and returncode 2015-07-30 18:17:57 +03:00
Ivan Kravets
59505cb8f3 Show internal errors from "Miniterm" using "platformio serialports monitor" command // Resolve #257 2015-07-30 18:07:26 +03:00
Ivan Kravets
5761cea47e Fixed "platformio serialports monitor --help" information with HEX char for hotkeys // Resolve #253 2015-07-30 17:50:07 +03:00
Ivan Kravets
d27f9a9d09 Improve CI handling 2015-07-30 17:33:45 +03:00
Ivan Kravets
e43635bf9b Fix comments stripping 2015-07-30 14:37:46 +03:00
Ivan Kravets
3813614d31 Support for off-line/unpublished/private libraries // Resolved #260 2015-07-29 21:14:41 +03:00
Ivan Kravets
9a6189d7cd Disable Shippable Build Status 2015-07-29 20:24:18 +03:00
Ivan Kravets
132f2d20fd Skip SHA1 verification for non SF packages 2015-07-29 19:59:39 +03:00
Ivan Kravets
c96ae1f773 Fix linker cyclic for static libs 2015-07-29 17:48:10 +03:00
Ivan Kravets
45905d0992 Merge branch 'develop' of https://github.com/ivankravets/platformio into develop 2015-07-29 17:33:20 +03:00
Ivan Kravets
076696cde1 Use Linker cyclic option when deplibs exist 2015-07-29 17:33:06 +03:00
Ivan Kravets
25781c7631 Add os import to Python template 2015-07-29 14:47:47 +03:00
Ivan Kravets
99649614c5 Add link to article "Arduino Development in Atom Editor" 2015-07-23 19:53:13 +03:00
Ivan Kravets
7a6e8279e4 Integration with Atom IDE 2015-07-23 19:25:10 +03:00
Ivan Kravets
b79a79d423 Handle "OSError: [Errno 13] Permission denied" for PlatformIO installer script 2015-07-21 17:51:33 +03:00
Ivan Kravets
5a91d0bf1b Disable project auto-clean while building/uploading firmware // Resolve #255 2015-07-21 14:53:38 +03:00
Ivan Kravets
b9d14918f3 A few improvements for installation doc 2015-07-21 14:48:34 +03:00
Ivan Kravets
5d6b2e0eb6 Add Teensy HID USB mouse example 2015-07-17 21:31:28 +03:00
Ivan Kravets
3d7c3a0c7a Fix typo in history 2015-07-17 15:05:05 +03:00
Ivan Kravets
2f7f7dcd6a Update release date 2015-07-17 14:58:34 +03:00
Ivan Kravets
5b8c6c4d56 Merge branch 'release/v2.2.1' 2015-07-17 14:54:55 +03:00
Ivan Kravets
6af7fd8007 Merge branch 'release/v2.2.1' into develop 2015-07-17 14:54:55 +03:00
Ivan Kravets
bfb801acef Version bump to 2.2.1 (issues #132, #248, #249, #250, #251) 2015-07-17 14:54:39 +03:00
Ivan Kravets
9379c3cb39 Updated "sdk-esp8266" package for espressif platform 2015-07-17 14:51:17 +03:00
Ivan Kravets
d66e8fe7af Check if all default packages are installed 2015-07-17 14:50:06 +03:00
Valeriy Koval
b85303c12a Improve espressif platform and native example for new SDK 2015-07-17 14:32:50 +03:00
Ivan Kravets
60e3d7450f Fix platform auto-installation 2015-07-17 14:28:14 +03:00
Ivan Kravets
4cd294ef57 Fix indention 2015-07-17 13:52:43 +03:00
Ivan Kravets
890acbc80e Switch to PlatformIO's SCons version 2015-07-17 13:48:17 +03:00
Ivan Kravets
de1cce41b0 Improve platform auto-installing (especially for @SmartAthill) 2015-07-16 22:19:09 +03:00
Ivan Kravets
e20f6abef4 Fix mention about project conf 2015-07-16 13:29:22 +03:00
Ivan Kravets
fa11f5d613 More details about limited features of CLion IDE 2015-07-16 13:27:58 +03:00
Ivan Kravets
1e0adcfdc4 Bump to 2.2.1a0 2015-07-15 19:45:56 +03:00
Valeriy Koval
d5c852d329 Project generator for CLion IDE // Resolve #132 2015-07-15 19:34:10 +03:00
Ivan Kravets
c4e42c88fe Fix Espressif "uploadlazy" target for @SmartAnthill Project 2015-07-13 14:02:14 +03:00
Ivan Kravets
4b93ec0b0b Improve "uploadlazy" target for @SmartAnthill Project 2015-07-13 12:43:45 +03:00
Ivan Kravets
21b01c8949 Note about Windows drivers for embedded boards 2015-07-07 23:33:25 +03:00
Ivan Kravets
76415b930f Fixed incorrect arguments handling for "platformio serialports monitor" command // Resolve #248 2015-07-07 23:08:54 +03:00
Ivan Kravets
88ad2a1626 Minor fix 2015-07-06 22:36:05 +03:00
Ivan Kravets
94c459258c Add explanation about dir change 2015-07-06 18:44:00 +03:00
Ivan Kravets
e1b7810465 Merge branch 'release/v2.2.0' into develop 2015-07-01 18:03:44 +03:00
50 changed files with 777 additions and 72 deletions

View File

@@ -1,6 +1,33 @@
Release History
===============
2.2.2 (2015-07-30)
------------------
* Integration with `Atom IDE <http://docs.platformio.org/en/latest/ide/atom.html>`__
* Support for off-line/unpublished/private libraries
(`issue #260 <https://github.com/platformio/platformio/issues/260>`_)
* Disable project auto-clean while building/uploading firmware using
`platformio run --disable-auto-clean <http://docs.platformio.org/en/latest/userguide/cmd_run.html#cmdoption--disable-auto-clean>`_ option
(`issue #255 <https://github.com/platformio/platformio/issues/255>`_)
* Show internal errors from "Miniterm" using `platformio serialports monitor <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`__ command
(`issue #257 <https://github.com/platformio/platformio/issues/257>`_)
* Fixed `platformio serialports monitor --help <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`__ information with HEX char for hotkeys
(`issue #253 <https://github.com/platformio/platformio/issues/253>`_)
* Handle "OSError: [Errno 13] Permission denied" for PlatformIO installer script
(`issue #254 <https://github.com/platformio/platformio/issues/254>`_)
2.2.1 (2015-07-17)
------------------
* Project generator for `CLion IDE <http://docs.platformio.org/en/latest/ide/clion.html>`__
(`issue #132 <https://github.com/platformio/platformio/issues/132>`_)
* Updated ``tool-bossac`` package to 1.5 version for `atmelsam <http://docs.platformio.org/en/latest/platforms/atmelsam.html>`__ platform
(`issue #251 <https://github.com/platformio/platformio/issues/251>`_)
* Updated ``sdk-esp8266`` package for `espressif <http://docs.platformio.org/en/latest/platforms/espressif.html>`__ platform
* Fixed incorrect arguments handling for `platformio serialports monitor <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`_ command
(`issue #248 <https://github.com/platformio/platformio/issues/248>`_)
2.2.0 (2015-07-01)
------------------

View File

@@ -7,9 +7,6 @@ PlatformIO
.. 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://api.shippable.com/projects/555b0ceeedd7f2c052f3c2d0/badge?branchName=develop
:target: https://app.shippable.com/projects/555b0ceeedd7f2c052f3c2d0
:alt: Shippable Build Status
.. image:: https://circleci.com/gh/platformio/platformio/tree/develop.svg?style=svg
:target: https://circleci.com/gh/platformio/platformio/tree/develop
:alt: Circle.CI Build Status

BIN
docs/_static/ide-platformio-atom-1.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

BIN
docs/_static/ide-platformio-atom-2.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@@ -9,6 +9,7 @@ Articles about us
Here are recent articles about PlatformIO:
* Jul 20, 2015 - **Eli Fatsi** - `Arduino Development in Atom Editor <http://viget.com/extend/arduino-development-in-atom-editor>`_
* Jun 02, 2015 - **Alejandro Guirao Rodriguez** - `Discovering PlatformIO: The RaspberryPi / Arduino combo kit is a winner option when prototyping an IoT-style project <http://lekum.org/posts/discovering-platformio.html>`_
* 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/>`_

View File

@@ -134,7 +134,7 @@ same for the all projects, don't need to modify them):
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"
& $pip_path install --egg "http://dl.platformio.org/scons.zip"
Write-Host "Scons installed"
}

View File

@@ -7,6 +7,8 @@ IDE Integration
:maxdepth: 2
ide/arduino
ide/atom
ide/clion
ide/eclipse
ide/energia
ide/qtcreator

39
docs/ide/atom.rst Normal file
View File

@@ -0,0 +1,39 @@
.. _ide_atom:
Atom
====
`Atom <https://atom.io>`_ is a text editor that's modern, approachable,
yet hackable to the core—a tool you can customize to do anything but also use
productively without ever touching a config file.
This software can be used with:
* all available :ref:`platforms`
* all available :ref:`frameworks`
Refer to the `Atom Documentation <https://atom.io/docs>`_
page for more detailed information.
.. contents::
Integration
-----------
Using `Atom Packages <https://atom.io/docs/v1.0.2/using-atom-atom-packages>`_
please install `platomformio <https://atom.io/packages/platomformio>`_ package.
Screenshot
----------
Building
^^^^^^^^
.. image:: ../_static/ide-platformio-atom-1.gif
:target: https://atom.io/packages/platomformio
Uploading
^^^^^^^^^
.. image:: ../_static/ide-platformio-atom-2.gif
:target: https://atom.io/packages/platomformio

51
docs/ide/clion.rst Normal file
View File

@@ -0,0 +1,51 @@
.. _ide_clion:
CLion
=====
The `CLion <https://www.jetbrains.com/clion/>`_ is a cross-platform C/C++ IDE
for Linux, OS X, and Windows integrated with the CMake build system. The
initial version will support the GCC and Clang compilers and GDB debugger.
Clion includes such features as a smart editor, code quality assurance,
automated refactorings, project manager, integrated version control systems.
This software can be used with:
* all available :ref:`platforms`
* all available :ref:`frameworks`
Refer to the `CDT Documentation <https://www.jetbrains.com/clion/documentation/>`_
page for more detailed information.
.. contents::
Integration
-----------
Project Generator
^^^^^^^^^^^^^^^^^
Since PlatformIO 2.0 you can generate CLion compatible project using
:option:`platformio init --ide` command. Please choose board type using
:ref:`cmd_boards` command and run:
.. code-block:: shell
platformio init --ide clion --board %TYPE%
Then import this project from start menu or via ``File > Import Project>`` and
specify root directory where is located :ref:`projectconf`.
.. warning::
CLion is still in the development stage, so some of the features (like,
auto-complete) probably will not work with PlatformIO. See
`CLion issue #CPP-3977 <https://youtrack.jetbrains.com/issue/CPP-3977>`_.
Active discussion located in
`PlatformIO issue #132 <https://github.com/platformio/platformio/issues/132>`_.
Screenshot
----------
.. image:: ../_static/ide-platformio-clion.png
:target: http://docs.platformio.org/en/latest/_static/ide-platformio-clion.png

View File

@@ -34,6 +34,12 @@ application:
:ref:`MUST DISABLE <faq_troubleshooting_pioblocksprompt>` all prompts.
It will allow you to avoid blocking.
.. note::
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Troubleshooting
---------------
@@ -49,11 +55,11 @@ Super-Quick (Mac / Linux)
~~~~~~~~~~~~~~~~~~~~~~~~~
To install or upgrade *PlatformIO* paste that at a *Terminal* prompt
(**you might need** to run ``sudo`` first):
(**you MIGHT need** to run ``sudo`` first, just for installation):
.. code-block:: bash
python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
[sudo] python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
Installer Script (Mac / Linux / Windows)
@@ -61,10 +67,15 @@ Installer Script (Mac / Linux / Windows)
To install or upgrade *PlatformIO*, download
`get-platformio.py <https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py>`_
script. Then run the following (you might need to run ``sudo`` first):
script. Then run the following (**you MIGHT need** to run ``sudo`` first,
just for installation):
.. code-block:: bash
# change directory to folder where is located downloaded "get-platformio.py"
cd /path/to/dir/where/is/located/get-platformio.py/script
# run it
python get-platformio.py
@@ -72,6 +83,10 @@ On *Windows OS* it may look like:
.. code-block:: bash
# change directory to folder where is located downloaded "get-platformio.py"
cd C:\path\to\dir\where\is\located\get-platformio.py\script
# run it
C:\Python27\python.exe get-platformio.py
Full Guide

View File

@@ -33,6 +33,9 @@ Packages
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Frameworks

View File

@@ -33,6 +33,9 @@ Packages
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Frameworks

View File

@@ -145,6 +145,8 @@ Example of the **test** platform (``test.py``):
.. code-block:: python
import os
from platformio.platforms.base import BasePlatform
class TestPlatform(BasePlatform):

View File

@@ -36,6 +36,9 @@ Packages
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Frameworks

View File

@@ -27,6 +27,9 @@ Packages
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Frameworks

View File

@@ -27,6 +27,9 @@ Packages
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Frameworks

View File

@@ -27,6 +27,9 @@ Packages
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Frameworks

View File

@@ -27,6 +27,9 @@ Packages
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Frameworks

View File

@@ -42,6 +42,9 @@ Packages
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Frameworks

View File

@@ -36,6 +36,9 @@ Packages
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Frameworks

View File

@@ -33,6 +33,9 @@ Packages
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Frameworks

View File

@@ -36,6 +36,9 @@ Packages
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Frameworks

View File

@@ -57,6 +57,11 @@ A default value is ``%home_dir%/lib``.
This option can be overridden by global environment variable
:ref:`envvar_PLATFORMIO_LIB_DIR`.
.. note::
You can put here your own/private libraries. The source code of each
library should be placed in separate directory. For example,
``%lib_dir%/private_lib/[here are source files]``.
.. _projectconf_pio_src_dir:
``src_dir``

View File

@@ -62,6 +62,12 @@ There 3 levels of verbosity:
By default, verbosity level is set to 3 (maximum information).
.. option::
--disable-auto-clean
Disable auto-clean of :ref:`projectconf_pio_envs_dir` when :ref:`projectconf`
or :ref:`projectconf_pio_src_dir` (project structure) have been modified.
Examples
--------

View File

@@ -15,19 +15,54 @@
#include "smartconfig.h"
void ICACHE_FLASH_ATTR
smartconfig_done(void *data)
smartconfig_done(sc_status status, void *pdata)
{
struct station_config *sta_conf = data;
switch(status) {
case SC_STATUS_WAIT:
os_printf("SC_STATUS_WAIT\n");
break;
case SC_STATUS_FIND_CHANNEL:
os_printf("SC_STATUS_FIND_CHANNEL\n");
break;
case SC_STATUS_GETTING_SSID_PSWD:
os_printf("SC_STATUS_GETTING_SSID_PSWD\n");
sc_type *type = pdata;
if (*type == SC_TYPE_ESPTOUCH) {
os_printf("SC_TYPE:SC_TYPE_ESPTOUCH\n");
} else {
os_printf("SC_TYPE:SC_TYPE_AIRKISS\n");
}
break;
case SC_STATUS_LINK:
os_printf("SC_STATUS_LINK\n");
struct station_config *sta_conf = pdata;
wifi_station_set_config(sta_conf);
wifi_station_disconnect();
wifi_station_connect();
break;
case SC_STATUS_LINK_OVER:
os_printf("SC_STATUS_LINK_OVER\n");
if (pdata != NULL) {
uint8 phone_ip[4] = {0};
wifi_station_set_config(sta_conf);
wifi_station_disconnect();
wifi_station_connect();
os_memcpy(phone_ip, (uint8*)pdata, 4);
os_printf("Phone ip: %d.%d.%d.%d\n",phone_ip[0],phone_ip[1],phone_ip[2],phone_ip[3]);
}
smartconfig_stop();
break;
}
}
void user_rf_pre_init(void)
{
}
void user_init(void)
{
os_printf("SDK version:%s\n", system_get_sdk_version());
wifi_set_opmode(STATION_MODE);
smartconfig_start(SC_TYPE_AIRKISS, smartconfig_done);
smartconfig_start(smartconfig_done);
}

View File

@@ -0,0 +1,21 @@
How to build PlatformIO based project
=====================================
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
3. Extract ZIP archive
4. Run these commands:
.. code-block:: bash
# Change directory to example
> cd platformio-develop/examples/teensy/teensy-hid-usb-mouse
# Process example project
> platformio run
# Upload firmware
> platformio run --target upload
# Clean build files
> platformio run --target clean

View File

@@ -0,0 +1,24 @@
#
# 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:teensy31]
platform = teensy
framework = arduino
board = teensy31
build_flags = -DTEENSY31 -UUSB_SERIAL -DUSB_SERIAL_HID

View File

@@ -0,0 +1,24 @@
/* Simple USB Mouse Example
Teensy becomes a USB mouse and moves the cursor in a triangle
You must select Mouse from the "Tools > USB Type" menu
This example code is in the public domain.
*/
void setup() { } // no setup needed
void loop() {
int i;
for (i=0; i<40; i++) {
Mouse.move(2, -1);
delay(25);
}
for (i=0; i<40; i++) {
Mouse.move(2, 2);
delay(25);
}
for (i=0; i<40; i++) {
Mouse.move(-4, -1);
delay(25);
}
}

View File

@@ -1,7 +1,7 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
VERSION = (2, 2, 0)
VERSION = (2, 2, 2)
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@@ -82,7 +82,8 @@ def main():
else:
error_str += format_exc()
click.secho(error_str, fg="red", err=True)
sys_exit(1)
return 1
return 0
if __name__ == "__main__":

View File

@@ -7,7 +7,7 @@ from os.path import isfile, join
from platformio import __version__
from platformio.exception import InvalidSettingName, InvalidSettingValue
from platformio.util import get_home_dir
from platformio.util import get_home_dir, is_ci
DEFAULT_SETTINGS = {
"check_platformio_interval": {
@@ -109,8 +109,7 @@ def get_setting(name):
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")]):
if any([is_ci(), get_session_var("force_option")]):
return False
_env_name = "PLATFORMIO_SETTING_%s" % name.upper()

View File

@@ -122,7 +122,7 @@ if "FRAMEWORK" not in env:
LDSCRIPT_PATH=join(
"$PIOPACKAGES_DIR", "sdk-esp8266", "ld", "eagle.app.v6.ld"),
LIBS=["c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "main",
"json", "upgrade", "smartconfig", "at", "ssl"]
"json", "upgrade", "smartconfig", "pwm", "at", "ssl"]
)
#
@@ -136,7 +136,11 @@ target_elf = env.BuildFirmware()
#
if "uploadlazy" in COMMAND_LINE_TARGETS:
target_firm = join("$BUILD_DIR", "firmware.bin")
target_firm = [
join("$BUILD_DIR", "firmware_00000.bin"),
join("$BUILD_DIR", "firmware_%s.bin" %
("40000" if "FRAMEWORK" not in env else "10000"))
]
else:
target_firm = env.ElfToBin(
[join("$BUILD_DIR", "firmware_00000"),

View File

@@ -22,7 +22,7 @@ class InoToCPPConverter(object):
DETECTMAIN_RE = re.compile(r"void\s+(setup|loop)\s*\(", re.M | re.I)
STRIPCOMMENTS_RE = re.compile(r"(/\*.*?\*/|(^|\s+)//[^\r\n]*$)",
STRIPCOMMENTS_RE = re.compile(r"(/\*.*?\*/|^\s*//[^\r\n]*$)",
re.M | re.S)
def __init__(self, nodes):

View File

@@ -6,7 +6,8 @@ from glob import glob
from os import getenv, listdir, sep, walk
from os.path import basename, dirname, isdir, isfile, join, normpath
from SCons.Script import DefaultEnvironment, Exit, SConscript
from SCons.Script import (COMMAND_LINE_TARGETS, DefaultEnvironment, Exit,
SConscript)
from SCons.Util import case_sensitive_suffixes
from platformio.util import pioversion_to_intstr
@@ -42,12 +43,13 @@ def BuildFirmware(env):
)
# enable "cyclic reference" for linker
env.Prepend(
_LIBFLAGS="-Wl,--start-group "
)
env.Append(
_LIBFLAGS=" -Wl,--end-group"
)
if env.get("LIBS", deplibs):
env.Prepend(
_LIBFLAGS="-Wl,--start-group "
)
env.Append(
_LIBFLAGS=" -Wl,--end-group"
)
# Handle SRC_BUILD_FLAGS
if getenv("PLATFORMIO_SRC_BUILD_FLAGS", None):
@@ -155,7 +157,7 @@ def LookupSources(env, variant_dir, src_dir, duplicate=True, src_filter=None):
def BuildFramework(env):
if "FRAMEWORK" not in env:
if "FRAMEWORK" not in env or "uploadlazy" in COMMAND_LINE_TARGETS:
return
if env['FRAMEWORK'].lower() in ("arduino", "energia"):

View File

@@ -26,9 +26,10 @@ from platformio.platforms.base import PlatformFactory
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.option("--disable-auto-clean", is_flag=True)
@click.pass_context
def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
project_dir, verbose):
project_dir, verbose, disable_auto_clean):
with util.cd(project_dir):
config = util.get_project_config()
@@ -40,7 +41,8 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
raise exception.UnknownEnvNames(", ".join(unknown))
# clean obsolete .pioenvs dir
_clean_pioenvs_dir()
if not disable_auto_clean:
_clean_pioenvs_dir()
results = []
for section in config.sections():
@@ -163,7 +165,7 @@ class EnvironmentProcessor(object):
telemetry.on_run_environment(self.options, build_targets)
# install platform and libs dependencies
_autoinstall_platform(self.cmd_ctx, platform)
_autoinstall_platform(self.cmd_ctx, platform, build_targets)
if "lib_install" in self.options:
_autoinstall_libs(self.cmd_ctx, self.options['lib_install'])
@@ -171,14 +173,34 @@ class EnvironmentProcessor(object):
return p.run(build_vars, build_targets, self.verbose_level)
def _autoinstall_platform(ctx, platform):
def _autoinstall_platform(ctx, platform, targets):
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
if (platform not in installed_platforms and (
not app.get_setting("enable_prompts") or
cmd_options = {}
p = PlatformFactory.newPlatform(platform)
if "uploadlazy" in targets:
upload_tools = p.pkg_aliases_to_names(["uploader"])
# platform without uploaders
if not upload_tools and platform in installed_platforms:
return
# uploaders are already installed
if set(upload_tools) <= set(p.get_installed_packages()):
return
cmd_options['skip_default_package'] = True
if upload_tools:
cmd_options['with_package'] = ["uploader"]
elif (platform in installed_platforms and
set(p.get_default_packages()) <= set(p.get_installed_packages())):
return
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_platforms_install, platforms=[platform])
"Would you like to install it now?" % platform)):
ctx.invoke(cmd_platforms_install, platforms=[platform], **cmd_options)
def _autoinstall_libs(ctx, libids_list):

View File

@@ -7,6 +7,7 @@ import sys
import click
from serial.tools import miniterm
from platformio.exception import PlatformioException
from platformio.util import get_serialports
@@ -59,16 +60,16 @@ def serialports_list(json_output):
# 1: escape non-printable characters, do newlines as unusual
# 2: escape non-printable characters, newlines too
# 3: hex dump everything""")
@click.option("--exit-char", type=int, default=0x1d,
@click.option("--exit-char", type=int, default=29,
help="ASCII code of special character that is used to exit the "
"application, default=0x1d")
@click.option("--menu-char", type=int, default=0x14,
"application, default=19 (DEC)")
@click.option("--menu-char", type=int, default=20,
help="ASCII code of special character that is used to control "
"miniterm (menu), default=0x14")
"miniterm (menu), default=20 (DEC)")
@click.option("--quiet", is_flag=True,
help="Diagnostics: suppress non-error messages, default=Off")
def serialports_monitor(**kwargs):
sys.argv = sys.argv[3:]
sys.argv = sys.argv[2:]
if not kwargs['port']:
for item in get_serialports():
@@ -78,5 +79,5 @@ def serialports_monitor(**kwargs):
try:
miniterm.main()
except: # pylint: disable=W0702
pass
except Exception as e: # pylint: disable=W0702
raise PlatformioException(str(e))

View File

@@ -2,8 +2,7 @@
# See LICENSE for details.
import json
from glob import glob
from os import listdir, walk
from os import listdir, makedirs, walk
from os.path import abspath, basename, expanduser, isdir, join, relpath
import bottle
@@ -76,14 +75,26 @@ class ProjectGenerator(object):
return result
def get_tpls(self):
tpls = []
tpls_dir = join(util.get_source_dir(), "ide", "tpls", self.ide)
return glob(join(tpls_dir, ".*.tpl")) + glob(join(tpls_dir, "*.tpl"))
for root, _, files in walk(tpls_dir):
for f in files:
if f.endswith(".tpl"):
tpls.append((
root.replace(tpls_dir, ""), join(root, f)))
return tpls
def generate(self):
for tpl_path in self.get_tpls():
file_name = basename(tpl_path)[:-4]
with open(join(self.project_dir, file_name), "w") as f:
f.write(self._render_tpl(tpl_path).encode("utf8"))
for _relpath, _path in self.get_tpls():
tpl_dir = self.project_dir
if _relpath:
tpl_dir = join(self.project_dir, _relpath)[1:]
if not isdir(tpl_dir):
makedirs(tpl_dir)
file_name = basename(_path)[:-4]
with open(join(tpl_dir, file_name), "w") as f:
f.write(self._render_tpl(_path).encode("utf8"))
def _render_tpl(self, tpl_path):
content = ""

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/clion.iml" filepath="$PROJECT_DIR$/.idea/clion.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/platformio.iml" filepath="$PROJECT_DIR$/.idea/platformio.iml" />
</modules>
</component>
</project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -0,0 +1,266 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true">
<generated>
<config projectName="{{project_name}}" targetName="PLATFORMIO_CLEAN" />
<config projectName="{{project_name}}" targetName="PLATFORMIO_RUN" />
<config projectName="{{project_name}}" targetName="PLATFORMIO" />
<config projectName="{{project_name}}" targetName="{{project_name}}" />
<config projectName="{{project_name}}" targetName="DEBUG" />
<config projectName="{{project_name}}" targetName="PLATFORMIO_BUILD" />
<config projectName="{{project_name}}" targetName="PLATFORMIO_UPLOAD" />
</generated>
</component>
<component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true">
<ADDITIONAL_GENERATION_ENVIRONMENT>
<envs />
</ADDITIONAL_GENERATION_ENVIRONMENT>
</component>
<component name="ChangeListManager">
<list default="true" id="ec922180-b3d3-40f1-af0b-2568113a9075" name="Default" comment="" />
<ignored path="platformio.iws" />
<ignored path=".idea/workspace.xml" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="{{project_name}}" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.15758981">
<caret line="8" column="49" selection-start-line="8" selection-start-column="49" selection-end-line="8" selection-end-column="49" />
<folding />
</state>
</provider>
</entry>
</file>
% for file in srcfiles:
<file leaf-file-name="{{file}}" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR/${{file}}">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="24" column="4" selection-start-line="24" selection-start-column="4" selection-end-line="24" selection-end-column="4" />
<folding />
</state>
</provider>
</entry>
</file>
% end
</leaf>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
</component>
<component name="NamedScopeManager">
<order />
</component>
<component name="ProjectFrameBounds">
<option name="x" value="252" />
<option name="y" value="21" />
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
</expanded-state>
<selected-state>
<State>
<id>C/C++</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="{{project_name}}" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="{{project_name}}" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="{{project_name}}" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="{{project_name}}" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="{{project_name}}" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="recentsLimit" value="5" />
<property name="settings.editor.selected.configurable" value="CPPToolchains" />
<property name="settings.editor.splitter.proportion" value="0.2" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/CMakeLists.txt" />
<property name="restartRequiresConfirmation" value="true" />
<property name="FullScreen" value="false" />
</component>
<component name="RunManager" selected="Application.PLATFORMIO_BUILD">
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="{{project_name}}" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
<node-options />
<gulpfile />
<tasks />
<arguments />
<pass-parent-envs>true</pass-parent-envs>
<envs />
<method />
</configuration>
<configuration default="false" name="Build All" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" CONFIG_NAME="Debug" EXPLICIT_BUILD_TARGET_NAME="all">
<envs />
<method />
</configuration>
<configuration default="false" name="PLATFORMIO_BUILD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_BUILD" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<configuration default="false" name="PLATFORMIO_CLEAN" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_CLEAN" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<configuration default="false" name="PLATFORMIO_UPLOAD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_UPLOAD" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="Application.Build All" />
<item index="1" class="java.lang.String" itemvalue="Application.PLATFORMIO_BUILD" />
<item index="2" class="java.lang.String" itemvalue="Application.PLATFORMIO_CLEAN" />
<item index="3" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPLOAD" />
</list>
</component>
<component name="ShelveChangesManager" show_recycled="false" />
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="ec922180-b3d3-40f1-af0b-2568113a9075" name="Default" comment="" />
<created>1435919971910</created>
<option name="number" value="Default" />
<updated>1435919971910</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="252" y="21" width="1400" height="1000" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.4631503" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32996634" sideWeight="0.53684974" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<option name="time" value="4" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="masterDetails">
<states>
<state key="ScopeChooserConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.2)
project({{project_name}})
% for include in includes:
% if include.startswith(user_home_dir):
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
% else:
include_directories("{{include}}")
% end
% end
% for define in defines:
add_definitions(-D{{define}})
% end
add_custom_target(
PLATFORMIO_BUILD ALL
COMMAND platformio -f run
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(
PLATFORMIO_UPLOAD ALL
COMMAND platformio -f run --target upload
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(
PLATFORMIO_CLEAN ALL
COMMAND platformio -f run --target clean
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@@ -25,10 +25,12 @@ class AtmelavrPlatform(BasePlatform):
},
"tool-avrdude": {
"alias": "uploader",
"default": True
},
"tool-micronucleus": {
"alias": "uploader",
"default": True
},
@@ -51,11 +53,11 @@ class AtmelavrPlatform(BasePlatform):
for v in variables:
if "BOARD=" not in v:
continue
tuploader = "tool-avrdude"
disable_tool = "tool-micronucleus"
_, board = v.split("=")
bdata = get_boards(board)
if "digispark" in bdata['build']['core']:
tuploader = "tool-micronucleus"
self.PACKAGES[tuploader]['alias'] = "uploader"
disable_tool = "tool-avrdude"
del self.PACKAGES[disable_tool]['alias']
break
return BasePlatform.run(self, variables, targets, verbose)

View File

@@ -242,6 +242,10 @@ class BasePlatform(object):
names.append(name)
return names
def get_default_packages(self):
return [k for k, v in self.get_packages().items()
if v.get("default", False)]
def get_installed_packages(self):
pm = PackageManager()
return [n for n in self.get_packages().keys() if pm.is_installed(n)]

View File

@@ -7,6 +7,7 @@ import re
import sys
import threading
import uuid
from os import getenv
from time import time
import click
@@ -197,6 +198,32 @@ def _finalize():
def on_command(ctx): # pylint: disable=W0613
mp = MeasurementProtocol()
mp.send("screenview")
if util.is_ci():
measure_ci()
def measure_ci():
event = {
"category": "CI",
"action": "NoName",
"label": None
}
envmap = {
"APPVEYOR": {"label": getenv("APPVEYOR_REPO_NAME")},
"CIRCLECI": {"label": "%s/%s" % (getenv("CIRCLE_PROJECT_USERNAME"),
getenv("CIRCLE_PROJECT_REPONAME"))},
"TRAVIS": {"label": getenv("TRAVIS_REPO_SLUG")},
"SHIPPABLE": {"label": getenv("REPO_NAME")},
"DRONE": {"label": getenv("DRONE_REPO_SLUG")}
}
for key, value in envmap.iteritems():
if getenv(key, "").lower() != "true":
continue
event.update({"action": key, "label": value['label']})
on_event(**event)
def on_run_environment(options, targets):

View File

@@ -91,6 +91,9 @@ def generate_packages(packages):
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
""")
return "\n".join(lines)

View File

@@ -9,7 +9,7 @@ from tempfile import NamedTemporaryFile
CURINTERPRETER_PATH = os.path.normpath(sys.executable)
IS_WINDOWS = system() == "Windows"
IS_WINDOWS = system().lower() == "windows"
def fix_winpython_pathenv():
@@ -61,12 +61,12 @@ def exec_command(*args, **kwargs):
out, err = p.communicate()
if p.returncode != 0:
raise Exception(err)
raise Exception("\n".join([out, err]))
return out
def exec_python_cmd(args):
return exec_command([CURINTERPRETER_PATH] + args, shell=IS_WINDOWS).strip()
return exec_command([CURINTERPRETER_PATH] + args).strip()
def install_pip():
@@ -89,8 +89,7 @@ def install_pip():
def install_pypi_packages(packages):
for pipargs in packages:
print (exec_python_cmd([
"-m",
"pip.__main__" if sys.version_info < (2, 7, 0) else "pip",
"-m", "pip.__main__" if sys.version_info < (2, 7, 0) else "pip",
"install", "-U"] + pipargs))
@@ -100,9 +99,7 @@ def main():
("Installing Python Package Manager", install_pip, []),
("Installing PlatformIO and dependencies", install_pypi_packages, [
[["setuptools"], ["platformio"], [
"--egg",
"http://sourceforge.net/projects/platformio-storage/files/"
"scons.zip/download"
"--egg", "http://dl.platformio.org/scons.zip"
]]
])
]
@@ -112,14 +109,27 @@ def main():
is_error = False
for s in steps:
if is_error:
break
print ("\n==> %s ..." % s[0])
try:
s[1](*s[2])
print ("[SUCCESS]")
except Exception, e:
is_error = True
print (e)
print (str(e))
print ("[FAILURE]")
if "Permission denied" in str(e) and not IS_WINDOWS:
print ("""
-----------------
Permission denied
-----------------
You need the `sudo` permission to install Python packages. Try
$ sudo python -c "$(curl -fsSL
https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
""")
if is_error:
print ("The installation process has been FAILED!\n"
@@ -131,16 +141,25 @@ def main():
"successfully FINISHED! <==\n")
try:
print (exec_command("platformio", shell=IS_WINDOWS))
print (exec_command("platformio"))
except:
try:
print (exec_python_cmd([
"-m",
"platformio.__main__" if sys.version_info < (2, 7, 0) else
"platformio"]))
finally:
print ("\n Please RESTART your Terminal Application and run "
"`platformio --help` command.")
except:
pass
finally:
print ("""
----------------------------------------
Please RESTART your Terminal Application
----------------------------------------
Then run `platformio --help` command.
""")
if __name__ == "__main__":

View File

@@ -52,19 +52,25 @@ def validate_package(url, sfpkglist):
def test_package(package_data, sfpkglist):
assert package_data['url'].endswith("%d.tar.gz" % package_data['version'])
sf_package = "sourceforge.net" in package_data['url']
# check content type and that file exists
try:
r = requests.head(package_data['url'], allow_redirects=True)
if 500 <= r.status_code <= 599:
raise requests.exceptions.ConnectionError()
except requests.exceptions.ConnectionError:
return pytest.skip("SF is off-line")
except requests.exceptions.ConnectionError as e:
if sf_package:
return pytest.skip("SF is off-line")
raise Exception(e)
validate_response(r)
assert r.headers['Content-Type'] in ("application/x-gzip",
"application/octet-stream")
if not sf_package:
return
# check sha1 sum
if sfpkglist is None:
return pytest.skip("SF is off-line")

View File

@@ -11,7 +11,7 @@ deps =
isort
flake8
commands =
pip install --egg http://sourceforge.net/projects/platformio-storage/files/scons.zip/download
pip install --egg http://dl.platformio.org/scons.zip
[testenv:docs]
basepython = python2.7
@@ -48,5 +48,5 @@ passenv = *
deps = pytest
commands =
{envpython} --version
pip install --egg http://sourceforge.net/projects/platformio-storage/files/scons.zip/download
pip install --egg http://dl.platformio.org/scons.zip
py.test -v --basetemp="{envtmpdir}" tests