From 1426e7879397804c2ec506ffaac17cde978c4723 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 3 Oct 2015 15:38:33 +0100 Subject: [PATCH 1/9] Show valid environment names when user typed unknown values --- platformio/__init__.py | 2 +- platformio/commands/run.py | 7 +++++-- platformio/exception.py | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 33f6ab52..e181eb57 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (2, 3, 3) +VERSION = (2, 3, "4.dev0") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/commands/run.py b/platformio/commands/run.py index daf6ae41..8fdf485b 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -36,9 +36,12 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914 if not config.sections(): raise exception.ProjectEnvsNotAvailable() - unknown = set(environment) - set([s[4:] for s in config.sections()]) + known = set([s[4:] for s in config.sections() + if s.startswith("env:")]) + unknown = set(environment) - known if unknown: - raise exception.UnknownEnvNames(", ".join(unknown)) + raise exception.UnknownEnvNames( + ", ".join(unknown), ", ".join(known)) # clean obsolete .pioenvs dir if not disable_auto_clean: diff --git a/platformio/exception.py b/platformio/exception.py index 84b6aca0..940d41d2 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -104,17 +104,17 @@ class UnsupportedArchiveType(PlatformioException): class ProjectEnvsNotAvailable(PlatformioException): - MESSAGE = "Please setup environments in `platformio.ini` file." + MESSAGE = "Please setup environments in `platformio.ini` file" class InvalidEnvName(PlatformioException): - MESSAGE = "Invalid environment '%s'. The name must start " "with 'env:'." + MESSAGE = "Invalid environment '%s'. The name must start with 'env:'" class UnknownEnvNames(PlatformioException): - MESSAGE = "Unknown environment names '%s'." + MESSAGE = "Unknown environment names '%s'. Valid names are '%s'" class GetSerialPortsError(PlatformioException): From 52b98dd159cbb13b31a6567152828cff220bd596 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 4 Oct 2015 15:20:49 +0100 Subject: [PATCH 2/9] Add "Commands completion in Terminal" --- docs/faq.rst | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index 8aa0bd0c..ef95f275 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -24,8 +24,9 @@ between team members, regardless of operating system they prefer to work with. Beyond that, PlatformIO can be run not only on commonly used desktops/laptops but also on the servers without X Window System. While PlatformIO itself is a console application, it can be used in combination with one's favorite -:ref:`ide` or text editor such as :ref:`ide_arduino`, :ref:`ide_eclipse`, -:ref:`ide_visualstudio`, :ref:`ide_vim`, :ref:`ide_sublimetext`, etc. +:ref:`ide` or text editor such as :ref:`ide_arduino`, :ref:`ide_atom`, +:ref:`ide_clion`, :ref:`ide_eclipse`, :ref:`ide_qtcreator`, +:ref:`ide_sublimetext`, :ref:`ide_vim`, :ref:`ide_visualstudio`, etc. Alright, so PlatformIO can run on different operating systems. But more importantly, from development perspective at least, is a list of supported @@ -55,6 +56,19 @@ the project developed using PlatformIO is as follows: * Users develop code and PlatformIO makes sure that it is compiled, prepared and uploaded to all the boards of interest. +Commands completion in Terminal +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Bash completion +''''''''''''''' + +Bash completion support will complete subcommands and parameters. To enable +Bash completion for `platformio` subcommands you need to put into your `.bashrc`: + +.. code-block:: bash + + eval "$(_PLATFORMIO_COMPLETE=source platformio)" + .. _faq_troubleshooting: Troubleshooting From 1c9dc2ba3d32125015869fff84e2c998cf8cff99 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 6 Oct 2015 17:06:47 +0100 Subject: [PATCH 3/9] Handle WindowsError when can't remove .pioenvs directory --- platformio/commands/run.py | 8 +++--- platformio/exception.py | 52 ++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 8fdf485b..11a16325 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -45,7 +45,10 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914 # clean obsolete .pioenvs dir if not disable_auto_clean: - _clean_pioenvs_dir() + try: + _clean_pioenvs_dir(util.get_pioenvs_dir()) + except Exception: + raise exception.CleanPioenvsDirError(util.get_pioenvs_dir()) results = [] for section in config.sections(): @@ -224,8 +227,7 @@ def _autoinstall_libs(ctx, libids_list): ctx.invoke(cmd_lib_install, libid=not_intalled_libs) -def _clean_pioenvs_dir(): - pioenvs_dir = util.get_pioenvs_dir() +def _clean_pioenvs_dir(pioenvs_dir): structhash_file = join(pioenvs_dir, "structure.hash") proj_hash = calculate_project_hash() diff --git a/platformio/exception.py b/platformio/exception.py index 940d41d2..8195912e 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -33,14 +33,14 @@ class UnknownPlatform(PlatformioException): class PlatformNotInstalledYet(PlatformioException): - MESSAGE = ("The platform '%s' has not been installed yet. " - "Use `platformio platforms install` command") + MESSAGE = "The platform '%s' has not been installed yet. "\ + "Use `platformio platforms install` command" class UnknownCLICommand(PlatformioException): - MESSAGE = ("Unknown command '%s'. Please use `platformio --help`" - " to see all available commands") + MESSAGE = "Unknown command '%s'. Please use `platformio --help`"\ + " to see all available commands" class UnknownBoard(PlatformioException): @@ -75,14 +75,14 @@ class FDUnrecognizedStatusCode(PlatformioException): class FDSizeMismatch(PlatformioException): - MESSAGE = ("The size (%d bytes) of downloaded file '%s' " - "is not equal to remote size (%d bytes)") + MESSAGE = "The size (%d bytes) of downloaded file '%s' "\ + "is not equal to remote size (%d bytes)" class FDSHASumMismatch(PlatformioException): - MESSAGE = ("The 'sha1' sum '%s' of downloaded file '%s' " - "is not equal to remote '%s'") + MESSAGE = "The 'sha1' sum '%s' of downloaded file '%s' "\ + "is not equal to remote '%s'" class NotPlatformProject(PlatformioException): @@ -117,6 +117,12 @@ class UnknownEnvNames(PlatformioException): MESSAGE = "Unknown environment names '%s'. Valid names are '%s'" +class CleanPioenvsDirError(PlatformioException): + + MESSAGE = "Can not remove temporary directory `%s`. "\ + "Please remove it manually" + + class GetSerialPortsError(PlatformioException): MESSAGE = "No implementation for your platform ('%s') available" @@ -124,7 +130,7 @@ class GetSerialPortsError(PlatformioException): class GetLatestVersionError(PlatformioException): - MESSAGE = "Can't retrieve the latest PlatformIO version" + MESSAGE = "Can not retrieve the latest PlatformIO version" class APIRequestError(PlatformioException): @@ -173,36 +179,28 @@ class UpgraderFailed(PlatformioException): class CIBuildEnvsEmpty(PlatformioException): - MESSAGE = ( - "Can't find PlatformIO build environments.\nPlease specify `--board` " - "or path to `platformio.ini` with predefined environments using " - "`--project-conf` option" - ) + MESSAGE = "Can't find PlatformIO build environments.\n"\ + "Please specify `--board` or path to `platformio.ini` with "\ + "predefined environments using `--project-conf` option" class SConsNotInstalled(PlatformioException): - MESSAGE = ( - "The PlatformIO and `scons` aren't installed properly. " - "More details in FAQ/Troubleshooting section: " + MESSAGE = "The PlatformIO and `scons` aren't installed properly. "\ + "More details in FAQ/Troubleshooting section: "\ "http://docs.platformio.org/en/latest/faq.html" - ) class PlatformioUpgradeError(PlatformioException): - MESSAGE = ( - "%s \n\n" - "1. Please report this issue here: " - "https://github.com/platformio/platformio/issues \n" - "2. Try different installation/upgrading steps: " + MESSAGE = "%s \n\n"\ + "1. Please report this issue here: "\ + "https://github.com/platformio/platformio/issues \n"\ + "2. Try different installation/upgrading steps: "\ "http://docs.platformio.org/en/latest/installation.html" - ) class CygwinEnvDetected(PlatformioException): - MESSAGE = ( - "PlatformIO does not work within Cygwin environment. " + MESSAGE = "PlatformIO does not work within Cygwin environment. "\ "Use native Terminal instead." - ) From c395dd5ebd0c3ab5843fd642677610f5b991d01c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Oct 2015 11:57:46 +0100 Subject: [PATCH 4/9] Update requests to 2.8.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c2c1efc3..d942675f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,5 @@ click==5.1 colorama==0.3.3 lockfile==0.10.2 pyserial==2.7 -requests==2.7.0 +requests==2.8.0 scons==2.3.6 From 3a0614641b8aa8d4c5dbcbfc6c5c181d59b9306b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 8 Oct 2015 16:50:47 +0100 Subject: [PATCH 5/9] Add links for Hackaday --- README.rst | 5 +++-- docs/faq.rst | 4 ++-- docs/index.rst | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index bc7998be..9708443d 100644 --- a/README.rst +++ b/README.rst @@ -31,8 +31,9 @@ PlatformIO `Home & Demo `_ | `Project Examples `_ | -`Code `_ | -`Documentation `_ || +`Source Code `_ | +`Documentation `_ + `Blog `_ | `Reddit `_ | `Facebook `_ | diff --git a/docs/faq.rst b/docs/faq.rst index ef95f275..8a7fc30d 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -30,8 +30,8 @@ console application, it can be used in combination with one's favorite Alright, so PlatformIO can run on different operating systems. But more importantly, from development perspective at least, is a list of supported -boards and MCUs. To keep things short: PlatformIO supports over 100 -:ref:`Embedded Boards ` and all major +boards and MCUs. To keep things short: PlatformIO supports over 150+ +`Embedded Boards `_ and all major :ref:`Development Platforms `. PlatformIO allows users to: diff --git a/docs/index.rst b/docs/index.rst index febb2777..33e9d7ce 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -18,9 +18,10 @@ libOpenCM3, etc.* * `Source Code `_ | `Issues `_ * `Blog `_ | - `Reddit `_ | + `Twitter `_ | + `Hackaday `_ | `Facebook `_ | - `Twitter `_ + `Reddit `_ You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO* has pre-built different development platforms and pre-configured settings for From 6e274cbf20c67b72d7b97da8cc5658bac1eb47c2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 8 Oct 2015 16:59:12 +0100 Subject: [PATCH 6/9] Correct social links --- README.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 9708443d..e27d5901 100644 --- a/README.rst +++ b/README.rst @@ -32,12 +32,12 @@ PlatformIO `Home & Demo `_ | `Project Examples `_ | `Source Code `_ | -`Documentation `_ - +`Documentation `_ || `Blog `_ | -`Reddit `_ | +`Twitter `_ | +`Hackaday `_ | `Facebook `_ | -`Twitter `_ +`Reddit `_ .. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-logo.png :target: http://platformio.org From 3b8d7304ffc841df65b1d9b6e77aedd17a7e24da Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 9 Oct 2015 14:12:30 +0100 Subject: [PATCH 7/9] Propose upgrading via `pip` --- platformio/maintenance.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 5efec017..97675dab 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -184,10 +184,12 @@ def check_platformio_upgrade(): click.echo("") click.echo("*" * terminal_width) click.secho("There is a new version %s of PlatformIO available.\n" - "Please upgrade it via " % latest_version, + "Please upgrade it via `" % latest_version, fg="yellow", nl=False) click.secho("platformio upgrade", fg="cyan", nl=False) - click.secho(" command.\nChanges: ", fg="yellow", nl=False) + click.secho("` or `", fg="yellow", nl=False) + click.secho("pip install -U platformio", fg="cyan", nl=False) + click.secho("` command.\nChanges: ", fg="yellow", nl=False) click.secho("http://docs.platformio.org/en/latest/history.html", fg="cyan") click.echo("*" * terminal_width) From 7467c281cc43c8e07a0c12d3e2a941ad8f557462 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 10 Oct 2015 11:33:38 +0100 Subject: [PATCH 8/9] Add support for @ubIQio Ardhat board --- HISTORY.rst | 6 ++++++ platformio/__init__.py | 2 +- platformio/boards/misc.json | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 3c4a5f7d..75e475ba 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,12 @@ Release History PlatformIO 2.0 -------------- +2.3.4 (2015-10-??) +~~~~~~~~~~~~~~~~~~ + +* Added support for ubIQio Ardhat board + (`pull #302 `_) + 2.3.3 (2015-10-02) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index e181eb57..51ef87aa 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (2, 3, "4.dev0") +VERSION = (2, 3, "4.dev1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/boards/misc.json b/platformio/boards/misc.json index fbcbf031..ed4fde29 100644 --- a/platformio/boards/misc.json +++ b/platformio/boards/misc.json @@ -1,4 +1,26 @@ { + "ardhat": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_ARDHAT", + "f_cpu": "16000000L", + "mcu": "atmega328p", + "variant": "standard" + }, + "frameworks": ["arduino"], + "name": "ubIQio Ardhat", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 32256, + "protocol": "arduino", + "require_upload_port" : true, + "speed": 115200 + }, + "url": "http://ardhat.com", + "vendor": "ubIQio" + }, + "raspduino": { "build": { "core": "arduino", From 20edf7de41b3fc9a9c0dda24ee18198cd0c3a2ea Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 10 Oct 2015 11:35:01 +0100 Subject: [PATCH 9/9] Add support for @ubIQio Ardhat board // Resolve #302 --- docs/frameworks/arduino.rst | 22 +++++++++++++++++++++- docs/platforms/atmelavr.rst | 20 ++++++++++++++++++++ docs/platforms/espressif.rst | 2 +- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/docs/frameworks/arduino.rst b/docs/frameworks/arduino.rst index 2902cd6d..0e76b4f1 100644 --- a/docs/frameworks/arduino.rst +++ b/docs/frameworks/arduino.rst @@ -476,7 +476,7 @@ Espressif * - ``esp01`` - `Espressif ESP8266 board `_ - ESP8266 - - 80 MHz + - 40 MHz - 512 Kb - 32 Kb @@ -976,3 +976,23 @@ Wicked Device - 16 MHz - 128 Kb - 16 Kb + +ubIQio +~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``ardhat`` + - `ubIQio Ardhat `_ + - ATMEGA328P + - 16 MHz + - 32 Kb + - 2 Kb diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index cfd264d0..c86340e0 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -872,3 +872,23 @@ Wicked Device - 16 MHz - 128 Kb - 16 Kb + +ubIQio +~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``ardhat`` + - `ubIQio Ardhat `_ + - ATMEGA328P + - 16 MHz + - 32 Kb + - 2 Kb diff --git a/docs/platforms/espressif.rst b/docs/platforms/espressif.rst index 1a134dcb..5fde9300 100644 --- a/docs/platforms/espressif.rst +++ b/docs/platforms/espressif.rst @@ -77,6 +77,6 @@ Espressif * - ``esp01`` - `Espressif ESP8266 board `_ - ESP8266 - - 80 MHz + - 40 MHz - 512 Kb - 32 Kb