From 69cde35fb7d1df6acafc0c987858f77f0076d14f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 10 Dec 2014 23:13:41 +0200 Subject: [PATCH 01/30] Start 0.10.0-dev --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index aa63e746..c52bc7fa 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (0, 9, 2) +VERSION = (0, 10, "0-dev") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 9e4618ca7ea048b308946b13a0167b8d27b421e3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 13 Dec 2014 22:54:50 +0200 Subject: [PATCH 02/30] Finally fix issue #18 - Compilation fails on Windows --- platformio/builder/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index d2cac107..05810edb 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -50,8 +50,7 @@ commonvars.AddVariables( ) DefaultEnvironment( - # Temporary fix for the issue #18 - tools=["default", "gcc", "g++", "ar", "gnulink", "platformio"], + tools=["gcc", "g++", "ar", "gnulink", "platformio"], toolpath=[join("$PIOBUILDER_DIR", "tools")], variables=commonvars, From 43441a431e3b9e42dca535ace774b3bd667d75d7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 14 Dec 2014 00:39:33 +0200 Subject: [PATCH 03/30] Improve Telemetry service --- platformio/telemetry.py | 155 ++++++++++++++++++++++++++++------------ 1 file changed, 108 insertions(+), 47 deletions(-) diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 55d1d276..2ec9a180 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -1,8 +1,10 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. +import atexit import platform import re +import threading import uuid from sys import argv as sys_argv from time import time @@ -57,14 +59,6 @@ class MeasurementProtocol(TelemetryBase): self._prefill_appinfo() self._prefill_custom_data() - @classmethod - def session_instance(cls): - try: - return cls._session_instance - except AttributeError: - cls._session_instance = requests.Session() - return cls._session_instance - def __getitem__(self, name): if name in self.PARAMS_MAP: name = self.PARAMS_MAP[name] @@ -119,22 +113,88 @@ class MeasurementProtocol(TelemetryBase): if "qt" in self._params and isinstance(self['qt'], float): self['qt'] = int((time() - self['qt']) * 1000) + MPDataPusher.get_instance().push(self._params) + + +class MPDataPusher(threading.Thread): + + @classmethod + def get_instance(cls): try: - r = self.session_instance().post( - "https://ssl.google-analytics.com/collect", - data=self._params - ) - r.raise_for_status() - except: # pylint: disable=W0702 - backup_report(self._params) - return False - return True + return cls._thinstance + except AttributeError: + cls._event = threading.Event() + cls._thinstance = cls() + cls._thinstance.start() + return cls._thinstance + + @classmethod + def http_session(cls): + try: + return cls._http_session + except AttributeError: + cls._http_session = requests.Session() + return cls._http_session + + def __init__(self): + threading.Thread.__init__(self) + self._terminate = False + self._server_online = False + self._stack = [] + + def run(self): + while not self._terminate: + self._event.wait() + if self._terminate or not self._stack: + return + self._event.clear() + + data = self._stack.pop() + try: + r = self.http_session().post( + "https://ssl.google-analytics.com/collect", + data=data, + timeout=3 + ) + r.raise_for_status() + self._server_online = True + except: # pylint: disable=W0702 + self._server_online = False + self._stack.append(data) + + def push(self, data): + self._stack.append(data) + self._event.set() + + def is_server_online(self): + return self._server_online + + def get_stack_data(self): + return self._stack + + def join(self, timeout=3): + self._terminate = True + self._event.set() + self.http_session().close() + threading.Thread.join(self, timeout) + + +@atexit.register +def _finalize(): + MAX_RESEND_REPORTS = 10 + mpdp = MPDataPusher.get_instance() + backup_reports(mpdp.get_stack_data()) + + resent_nums = 0 + while mpdp.is_server_online() and resent_nums < MAX_RESEND_REPORTS: + if not resend_backuped_report(): + break + resent_nums += 1 def on_command(ctx): # pylint: disable=W0613 mp = MeasurementProtocol() - if mp.send("screenview"): - resend_backuped_reports() + mp.send("screenview") def on_run_environment(options, targets): @@ -153,53 +213,54 @@ def on_event(category, action, label=None, value=None, screen_name=None): mp['event_value'] = int(value) if screen_name: mp['screen_name'] = screen_name[:2048] - return mp.send("event") + mp.send("event") def on_exception(e): mp = MeasurementProtocol() mp['exd'] = "%s: %s" % (type(e).__name__, e) mp['exf'] = 1 - return mp.send("exception") + mp.send("exception") -def backup_report(params): +def backup_reports(data): + if not data: + return + KEEP_MAX_REPORTS = 1000 tm = app.get_state_item("telemetry", {}) if "backup" not in tm: tm['backup'] = [] - # skip static options - for key in params.keys(): - if key in ("v", "tid", "cid", "cd1", "cd2", "sr", "an"): - del params[key] + for params in data: + # skip static options + for key in params.keys(): + if key in ("v", "tid", "cid", "cd1", "cd2", "sr", "an"): + del params[key] - # store time in UNIX format - if "qt" not in params: - params['qt'] = time() - elif not isinstance(params['qt'], float): - params['qt'] = time() - (params['qt'] / 1000) + # store time in UNIX format + if "qt" not in params: + params['qt'] = time() + elif not isinstance(params['qt'], float): + params['qt'] = time() - (params['qt'] / 1000) + + tm['backup'].append(params) - tm['backup'].append(params) tm['backup'] = tm['backup'][KEEP_MAX_REPORTS*-1:] app.set_state_item("telemetry", tm) -def resend_backuped_reports(): - MAX_RESEND_REPORTS = 10 +def resend_backuped_report(): + tm = app.get_state_item("telemetry", {}) + if "backup" not in tm or not tm['backup']: + return False - resent_nums = 0 - while resent_nums < MAX_RESEND_REPORTS: - tm = app.get_state_item("telemetry", {}) - if "backup" not in tm or not tm['backup']: - break + report = tm['backup'].pop() + app.set_state_item("telemetry", tm) - report = tm['backup'].pop() - app.set_state_item("telemetry", tm) - resent_nums += 1 + mp = MeasurementProtocol() + for key, value in report.items(): + mp[key] = value + mp.send(report['t']) - mp = MeasurementProtocol() - for key, value in report.items(): - mp[key] = value - if not mp.send(report['t']): - break + return True From d68937afe083547398ed26918983b30907896f99 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 14 Dec 2014 19:46:40 +0200 Subject: [PATCH 04/30] Reduce terminate timeout --- platformio/telemetry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 2ec9a180..6bd014dc 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -172,7 +172,7 @@ class MPDataPusher(threading.Thread): def get_stack_data(self): return self._stack - def join(self, timeout=3): + def join(self, timeout=0.1): self._terminate = True self._event.set() self.http_session().close() From d9a7537d5da0ce5e96f9af5813ad9da7f86ba0e0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 14 Dec 2014 19:47:19 +0200 Subject: [PATCH 05/30] Add example to lib search with the "excluding" operator --- HISTORY.rst | 6 ++--- docs/userguide/lib/cmd_search.rst | 40 ++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index f5783f63..1e3ff5c5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,11 +15,11 @@ Release History ------------------ * Ask user to install platform (when it hasn't been installed yet) within - `platformio run `_ + `platformio run `__ and `platformio show `_ commands * Improved main `documentation `_ * Fixed "*OSError: [Errno 2] No such file or directory*" within - `platformio run `_ + `platformio run `__ command when PlatformIO isn't installed properly * Fixed example for `Eclipse IDE with Tiva board `_ (`issue #32 `_) @@ -108,7 +108,7 @@ Release History environment option * Allowed to override some of settings via system environment variables such as: ``$PIOSRCBUILD_FLAGS`` and ``$PIOENVS_DIR`` -* Added ``--upload-port`` option for `platformio run `_ command +* Added ``--upload-port`` option for `platformio run `__ command * Implemented (especially for `SmartAnthill `_) `platformio run -t uploadlazy `_ target (no dependencies to framework libs, ELF and etc.) diff --git a/docs/userguide/lib/cmd_search.rst b/docs/userguide/lib/cmd_search.rst index 3156c0ee..fe3ac834 100644 --- a/docs/userguide/lib/cmd_search.rst +++ b/docs/userguide/lib/cmd_search.rst @@ -120,7 +120,7 @@ Examples # [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc) # ... -3. Search for `Arduino-based "I2C" libraries `_ +3. Search for `Arduino-based "I2C" libraries `_ .. code-block:: bash @@ -135,7 +135,7 @@ Examples # [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303) # ... -4. Search for `libraries by "web" and "http" keywords `_. +4. Search for `libraries by "web" and "http" keywords `_. .. code-block:: bash @@ -148,7 +148,7 @@ Examples # [ 17 ] Adafruit-CC3000 arduino, atmelavr "Adafruit Industries": Library code for Adafruit's CC3000 Wi-Fi/WiFi breakouts # ... -5. Search for `libraries from "Adafruit Industries" author `_ +5. Search for `libraries by "Adafruit Industries" author `_ .. code-block:: bash @@ -163,7 +163,7 @@ Examples # [ 26 ] Adafruit-LSM303DLHC-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer) # ... -6. Search for `libraries that are compatible with Dallas temperature sensors `_ +6. Search for `libraries which are compatible with Dallas temperature sensors `_ like DS18B20, DS18S20 and etc. .. code-block:: bash @@ -176,16 +176,38 @@ Examples # [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc) # ... -7. Search for `Arduino-based *X10* or *XBee* libraries `_. +7. Search for `Energia-based *nRF24* or *HttpClient* libraries `_. The search query that is described below can be interpreted like - ``arduino x10 OR arduino xbee`` + ``energia nRF24 OR energia HttpClient`` .. code-block:: bash - $ platformio lib search "+(x10 xbee)" --framework="arduino" + $ platformio lib search "+(nRF24 HttpClient)" --framework="energia" # Found 2 libraries: # # [ ID ] Name Compatibility "Authors": Description # ------------------------------------------------------------------------------------- - # [ 36 ] X10 arduino, atmelavr "Doug Clinton": Sending X10 signals over AC power lines (PL513, TW523 and etc) - # [ 6 ] XBee arduino, atmelavr "Andrew Rapp": Arduino library for communicating with XBees in API mode + # [ 46 ] HttpClient energia, timsp430, titiva "Zack Lalanne": HttpClient is a library to make it easier to interact with web servers + # [ 43 ] nRF24 energia, timsp430 "Eric": The nRF24L01 is a low-cost 2.4GHz ISM transceiver module. It supports a number of channel frequencies in the 2.4GHz band and a range of data rates. + + +8. Search for the `all sensor libraries excluding temperature `_. + +.. code-block:: bash + + $ platformio lib search "sensor -temperature" + # Found N libraries: + # + # [ ID ] Name Compatibility "Authors": Description + # ------------------------------------------------------------------------------------- + # [ 31 ] Adafruit-Unified-Sensor arduino, atmelavr "Adafruit Industries": Adafruit Unified Sensor Driver + # [ 10 ] I2Cdevlib-AK8975 arduino, atmelavr "Jeff Rowberg": AK8975 is 3-axis electronic compass IC with high sensitive Hall sensor technology + # [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303) + # [ 23 ] Adafruit-L3GD20-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the L3GD20 Gyroscope + # [ 26 ] Adafruit-LSM303DLHC-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer) + # [ 33 ] Adafruit-TMP006 arduino, atmelavr "Adafruit Industries": A library for the Adafruit TMP006 Infrared Thermopile Sensor + # [ 34 ] Adafruit-TSL2561-Unified arduino, atmelavr "Adafruit Industries": Unified light sensor driver for Adafruit's TSL2561 breakouts + # [ 97 ] I2Cdevlib-BMA150 arduino, atmelavr "Jeff Rowberg": The BMA150 is a triaxial, low-g acceleration sensor IC with digital output for consumer market applications + # [ 106 ] I2Cdevlib-MPR121 arduino, atmelavr "Jeff Rowberg": The MPR121 is a 12-bit proximity capacitive touch sensor + # [ 111 ] I2Cdevlib-AK8975 energia, timsp430 "Jeff Rowberg": AK8975 is 3-axis electronic compass IC with high sensitive Hall sensor technology + # Show next libraries? [y/N]: From 11b26b373040f8c28b3e55609e4a2f2e95bcd6c2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 16 Dec 2014 23:45:00 +0200 Subject: [PATCH 06/30] Clarify when lib not found by search request --- platformio/commands/lib.py | 27 +++++++++++++++++++++------ platformio/exception.py | 5 +++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 67f61827..5c65bd46 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -3,9 +3,7 @@ import click -from platformio import app -from platformio.exception import (LibAlreadyInstalledError, - LibInstallDependencyError) +from platformio import app, exception from platformio.libmanager import LibraryManager from platformio.util import get_api_result, get_lib_dir @@ -57,6 +55,19 @@ def lib_search(query, **filters): query += ' %s:"%s"' % (key, value) result = get_api_result("/lib/search", dict(query=query)) + if result['total'] == 0: + click.secho( + "Nothing has been found by your request\n" + "Try a less-specific search or use truncation (or wildcard) " + "operator", fg="yellow", nl=False) + click.secho(" *", fg="green") + click.secho("For example: DS*, PCA*, DHT* and etc.\n", fg="yellow") + click.echo("For more examples and advanced search syntax, " + "please use documentation:") + click.secho("http://docs.platformio.ikravets.com" + "/en/latest/userguide/lib/cmd_search.html\n", fg="cyan") + return + click.secho("Found %d libraries:\n" % result['total'], fg="green" if result['total'] else "yellow") @@ -107,9 +118,9 @@ def lib_install(ctx, libid, version): try: lib_install_dependency(ctx, item) except AssertionError: - raise LibInstallDependencyError(str(item)) + raise exception.LibInstallDependencyError(str(item)) - except LibAlreadyInstalledError: + except exception.LibAlreadyInstalledError: click.secho("Already installed", fg="yellow") @@ -155,7 +166,7 @@ def lib_list(): echo_liblist_item(item) -@cli.command("show", short_help="Show details about installed libraries") +@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()) @@ -221,6 +232,10 @@ def lib_update(ctx): @cli.command("register", short_help="Register new library") @click.argument("config_url") def lib_register(config_url): + if (not config_url.startswith("http://") and not + config_url.startswith("https://")): + raise exception.InvalidLibConfURL(config_url) + result = get_api_result("/lib/register", data=dict(config_url=config_url)) if "message" in result and result['message']: click.secho(result['message'], fg="green" if "successed" in result and diff --git a/platformio/exception.py b/platformio/exception.py index 8188a9fb..bbfc2f01 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -127,6 +127,11 @@ class LibInstallDependencyError(PlatformioException): MESSAGE = "Error has been occurred for library dependency '%s'" +class InvalidLibConfURL(PlatformioException): + + MESSAGE = "Invalid library config URL '%s'" + + class BuildScriptNotFound(PlatformioException): MESSAGE = "Invalid path '%s' to build script" From 9dcc774bfd14c0f4a7130de6f13e92382b1c1d43 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 19 Dec 2014 19:53:25 +0200 Subject: [PATCH 07/30] Add example with uploading firmware via USB programmer (USBasp) // Resolve #35 --- HISTORY.rst | 9 ++++++++- docs/projectconf.rst | 32 ++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 1e3ff5c5..50769763 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,14 @@ Release History =============== +0.10.0 (?) +---------- + +* Added `example with uploading firmware `_ + via USB programmer (USBasp) to + `atmelavr `_ + MCUs (`issue #35 `_) + 0.9.2 (2014-12-10) ------------------ @@ -10,7 +18,6 @@ Release History (`issue #34 `_) * Fixed compilation bug on *Windows* with installed *MSVC* (`issue #18 `_) - 0.9.1 (2014-12-05) ------------------ diff --git a/docs/projectconf.rst b/docs/projectconf.rst index aa3bf1ba..0c017f4f 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -246,7 +246,7 @@ Examples ``board_*`` and ``upload_*`` options (use only ``board`` option) and Arduino Wiring-based Framework -.. code-block:: ini +.. code-block:: ini [env:atmelavr_arduino_uno_board] platform = atmelavr @@ -261,7 +261,7 @@ Examples auto pre-configured ``board_*`` and ``upload_*`` options (use only ``board`` option) and Arduino Wiring-based Framework -.. code-block:: ini +.. code-block:: ini [env:atmelavr_microduino_core_board] platform = atmelavr @@ -276,7 +276,7 @@ Examples auto pre-configured ``board_*`` and ``upload_*`` options (use only ``board`` option) and Arduino Wiring-based Framework -.. code-block:: ini +.. code-block:: ini [env:atmelavr_raspduino_board] platform = atmelavr @@ -292,7 +292,7 @@ Examples 4. :ref:`platform_atmelavr`: Embedded board that is based on ATmega168 MCU with "arduino" bootloader -.. code-block:: ini +.. code-block:: ini [env:atmelavr_atmega168_board] platform = atmelavr @@ -309,11 +309,23 @@ Examples targets = upload -5. :ref:`platform_timsp430`: TI MSP430G2553 LaunchPad with auto pre-configured +5. Upload firmware via USB programmer (USBasp) to :ref:`platform_atmelavr` + microcontrollers + +.. code-block:: ini + + [env:atmelavr_usbasp] + platform = atmelavr + framework = arduino + board = pro8MHzatmega328 + upload_protocol = usbasp -B5 + + +6. :ref:`platform_timsp430`: TI MSP430G2553 LaunchPad with auto pre-configured ``board_*`` and ``upload_*`` options (use only ``board`` option) and Energia Wiring-based Framework -.. code-block:: ini +.. code-block:: ini [env:timsp430_g2553_launchpad] platform = timsp430 @@ -321,9 +333,9 @@ Examples board = lpmsp430g2553 -6. :ref:`platform_timsp430`: Embedded board that is based on MSP430G2553 MCU +7. :ref:`platform_timsp430`: Embedded board that is based on MSP430G2553 MCU -.. code-block:: ini +.. code-block:: ini [env:timsp430_g2553_board] platform = timsp430 @@ -336,11 +348,11 @@ Examples targets = upload -5. :ref:`platform_titiva`: TI Tiva C ARM Series TM4C123G LaunchPad with auto +8. :ref:`platform_titiva`: TI Tiva C ARM Series TM4C123G LaunchPad with auto pre-configured ``board_*`` and ``upload_*`` options (use only ``board`` option) and Energia Wiring-based Framework -.. code-block:: ini +.. code-block:: ini [env:titiva_tm4c1230c3pm_launchpad] platform = titiva From 060e1764cb61515785a2e17a9a726d0200acb21d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 24 Dec 2014 21:36:11 +0200 Subject: [PATCH 08/30] Fix urllib3's SSL warning under Python <= 2.7.2 // Resolve #39 --- HISTORY.rst | 1 + platformio/util.py | 1 + 2 files changed, 2 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 50769763..cbef9933 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -8,6 +8,7 @@ Release History via USB programmer (USBasp) to `atmelavr `_ MCUs (`issue #35 `_) +* Fixed urllib3's SSL warning under Python <= 2.7.2 (`issue #39 `_) 0.9.2 (2014-12-10) ------------------ diff --git a/platformio/util.py b/platformio/util.py index 5509b1b2..67121ea0 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -120,6 +120,7 @@ def get_api_result(path, params=None, data=None): r = None try: + requests.packages.urllib3.disable_warnings() headers = {"User-Agent": "PlatformIO/%s %s" % ( __version__, requests.utils.default_user_agent())} # if packages - redirect to SF From 0241d65460a0d6c87a4bf6ed8051107488e77ff6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 24 Dec 2014 22:12:42 +0200 Subject: [PATCH 09/30] Avoid SSL connection to packages manifest file // Resolve #39 --- platformio/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/util.py b/platformio/util.py index 67121ea0..2ef61ca6 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -126,7 +126,7 @@ def get_api_result(path, params=None, data=None): # if packages - redirect to SF if path == "/packages": r = requests.get( - "https://sourceforge.net/projects/platformio-storage/files/" + "http://sourceforge.net/projects/platformio-storage/files/" "packages/manifest.json", params=params, headers=headers) elif data: r = requests.post(__apiurl__ + path, params=params, data=data, From 65895e658f4aa71ca10c19542e2800133f62116c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 26 Dec 2014 23:48:07 +0200 Subject: [PATCH 10/30] Fix bug with Arduino's USB boards // Resolve issue #40 --- HISTORY.rst | 1 + platformio/builder/scripts/frameworks/arduino.py | 5 +++-- platformio/builder/tools/platformio.py | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index cbef9933..f74898fe 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,6 +9,7 @@ Release History `atmelavr `_ MCUs (`issue #35 `_) * Fixed urllib3's SSL warning under Python <= 2.7.2 (`issue #39 `_) +* Fixed bug with Arduino's USB boards (`issue #40 `_) 0.9.2 (2014-12-10) ------------------ diff --git a/platformio/builder/scripts/frameworks/arduino.py b/platformio/builder/scripts/frameworks/arduino.py index d6f8dbf1..129f539d 100644 --- a/platformio/builder/scripts/frameworks/arduino.py +++ b/platformio/builder/scripts/frameworks/arduino.py @@ -26,7 +26,8 @@ if "build.usb_product" in BOARD_OPTIONS: ARDUINO_USBDEFINES = [ "USB_VID=%s" % BOARD_OPTIONS['build.vid'], "USB_PID=%s" % BOARD_OPTIONS['build.pid'], - "USB_PRODUCT=%s" % BOARD_OPTIONS['build.usb_product'].replace('"', "") + 'USB_PRODUCT=\\"%s\\"' % BOARD_OPTIONS['build.usb_product'].replace( + '"', "") ] # include board variant @@ -37,7 +38,7 @@ env.VariantDir( env.Append( CPPDEFINES=[ - "ARDUINO_ARCH_AVR", # @TODO Should be dynamic + "ARDUINO_ARCH_%s" % env.subst("$PLATFORM").upper()[-3:], "ARDUINO=%d" % ARDUINO_VERSION, "ARDUINO_%s" % BOARD_OPTIONS['build.board'] ] + ARDUINO_USBDEFINES, diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 3304598b..c751e56a 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -16,7 +16,7 @@ def ProcessGeneral(env): if "FRAMEWORK" in env: if env['FRAMEWORK'] in ("arduino", "energia"): - env.ConvertInotoCpp() + env.ConvertInoToCpp() SConscriptChdir(0) corelibs = SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "frameworks", "${FRAMEWORK}.py")), @@ -29,7 +29,7 @@ def BuildFirmware(env, corelibs): vdirs = src.VariantDirRecursive( join("$BUILD_DIR", "src"), join("$PROJECT_DIR", "src")) - # build source's dependent libs + # build dependent libs deplibs = [] for vdir in vdirs: deplibs += src.BuildDependentLibraries(vdir) @@ -158,7 +158,7 @@ def ParseBoardOptions(env, path, name): return data -def ConvertInotoCpp(env): +def ConvertInoToCpp(env): def delete_tmpcpp(files): for f in files: @@ -220,5 +220,5 @@ def generate(env): env.AddMethod(ParseIncludesRecurive) env.AddMethod(VariantDirRecursive) env.AddMethod(ParseBoardOptions) - env.AddMethod(ConvertInotoCpp) + env.AddMethod(ConvertInoToCpp) return env From 01bbfcced01755aaa8325ef82c63fe57d07bc91e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 26 Dec 2014 23:49:21 +0200 Subject: [PATCH 11/30] Update "requests" to 2.5.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f2fc32dd..cb607b15 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ click==3.3 colorama==0.3.2 pyserial==2.7 -requests==2.5.0 +requests==2.5.1 scons==2.3.0 From 2aa4d0af33b7c5b767cf0865cc27cccbb320c9a2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 Dec 2014 23:59:20 +0200 Subject: [PATCH 12/30] Implement 'boards' command // Resolve #11 --- HISTORY.rst | 2 + docs/userguide/cmd_boards.rst | 87 +++ docs/userguide/index.rst | 1 + platformio/boards/arduino.json | 684 ++++++++++++++++++ platformio/boards/microduino.json | 160 ++++ platformio/boards/misc.json | 19 + platformio/boards/timsp430.json | 107 +++ platformio/boards/titiva.json | 47 ++ platformio/builder/main.py | 32 +- platformio/builder/scripts/atmelavr.py | 15 +- .../builder/scripts/frameworks/arduino.py | 33 +- .../builder/scripts/frameworks/energia.py | 28 +- platformio/builder/tools/platformio.py | 47 +- platformio/commands/boards.py | 60 ++ platformio/util.py | 32 +- setup.py | 2 +- 16 files changed, 1251 insertions(+), 105 deletions(-) create mode 100644 docs/userguide/cmd_boards.rst create mode 100644 platformio/boards/arduino.json create mode 100644 platformio/boards/microduino.json create mode 100644 platformio/boards/misc.json create mode 100644 platformio/boards/timsp430.json create mode 100644 platformio/boards/titiva.json create mode 100644 platformio/commands/boards.py diff --git a/HISTORY.rst b/HISTORY.rst index f74898fe..c20f2f59 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,8 @@ Release History 0.10.0 (?) ---------- +* Implemented `platformio boards `_ + command (`issue #11 `_) * Added `example with uploading firmware `_ via USB programmer (USBasp) to `atmelavr `_ diff --git a/docs/userguide/cmd_boards.rst b/docs/userguide/cmd_boards.rst new file mode 100644 index 00000000..49fc3f0a --- /dev/null +++ b/docs/userguide/cmd_boards.rst @@ -0,0 +1,87 @@ +.. _cmd_boards: + +platformio boards +================= + +.. contents:: + +Usage +----- + +.. code-block:: bash + + # Print all available pre-configured embedded boards + platformio boards + + # Filter boards by "Query" + platformio boards QUERY + + +Description +----------- + +List pre-configured Embedded Boards + + +Examples +-------- + +1. Show Arduino-based boards + +.. code-block:: bash + + $ platformio boards arduino + + Platform: atmelavr + --------------------------------------------------------------------------- + Type MCU Frequency Flash RAM Name + --------------------------------------------------------------------------- + bt atmega168 16Mhz 14Kb 1Kb Arduino BT + btatmega168 atmega168 16Mhz 14Kb 1Kb Arduino BT ATmega168 + btatmega328 atmega168 16Mhz 14Kb 1Kb Arduino BT ATmega328 + diecimila atmega168 16Mhz 14Kb 1Kb Arduino Duemilanove or Diecimila + diecimilaatmega168 atmega168 16Mhz 14Kb 1Kb Arduino Duemilanove or Diecimila ATmega168 + diecimilaatmega328 atmega168 16Mhz 14Kb 1Kb Arduino Duemilanove or Diecimila ATmega328 + esplora atmega32u4 16Mhz 28Kb 2Kb Arduino Esplora + ethernet atmega328p 16Mhz 31Kb 2Kb Arduino Ethernet + ... + +2. Show boards which are based on ``ATmega168`` MCU + +.. code-block:: bash + + $ platformio boards atmega168 + + Platform: atmelavr + --------------------------------------------------------------------------- + Type MCU Frequency Flash RAM Name + --------------------------------------------------------------------------- + bt atmega168 16Mhz 14Kb 1Kb Arduino BT + btatmega168 atmega168 16Mhz 14Kb 1Kb Arduino BT ATmega168 + ... + pro atmega168 8Mhz 14Kb 1Kb Arduino Pro or Pro Mini + ... + lilypad atmega168 8Mhz 14Kb 1Kb LilyPad Arduino + lilypadatmega168 atmega168 8Mhz 14Kb 1Kb LilyPad Arduino ATmega168 + lilypadatmega328 atmega168 8Mhz 14Kb 1Kb LilyPad Arduino ATmega328 + 168pa16m atmega168p 16Mhz 15Kb 1Kb Microduino Core (Atmega168PA@16M,5V) + 168pa8m atmega168p 8Mhz 15Kb 1Kb Microduino Core (Atmega168PA@8M,3.3V) + +3. Show boards by :ref:`platform_timsp430` + +.. code-block:: bash + + $ platformio boards timsp430 + + Platform: timsp430 + --------------------------------------------------------------------------- + Type MCU Frequency Flash RAM Name + --------------------------------------------------------------------------- + lpmsp430fr5739 msp430fr5739 16Mhz 15Kb 1Kb FraunchPad w/ msp430fr5739 + lpmsp430f5529 msp430f5529 16Mhz 128Kb 1Kb LaunchPad w/ msp430f5529 (16MHz) + lpmsp430f5529_25 msp430f5529 25Mhz 128Kb 1Kb LaunchPad w/ msp430f5529 (25MHz) + lpmsp430fr5969 msp430fr5969 8Mhz 64Kb 1Kb LaunchPad w/ msp430fr5969 + lpmsp430g2231 msp430g2231 1Mhz 2Kb 128B LaunchPad w/ msp430g2231 (1MHz) + lpmsp430g2452 msp430g2452 16Mhz 8Kb 256B LaunchPad w/ msp430g2452 (16MHz) + lpmsp430g2553 msp430g2553 16Mhz 16Kb 512B LaunchPad w/ msp430g2553 (16MHz) + diff --git a/docs/userguide/index.rst b/docs/userguide/index.rst index 59eab5a8..a2db09ce 100644 --- a/docs/userguide/index.rst +++ b/docs/userguide/index.rst @@ -14,6 +14,7 @@ To print all available commands and options use: .. toctree:: :maxdepth: 2 + cmd_boards cmd_init cmd_install platformio lib diff --git a/platformio/boards/arduino.json b/platformio/boards/arduino.json new file mode 100644 index 00000000..9715f6d8 --- /dev/null +++ b/platformio/boards/arduino.json @@ -0,0 +1,684 @@ +{ + "LilyPadUSB": { + "build": { + "board": "AVR_LILYPAD_USB", + "core": "arduino", + "extra_flags": "{build.usb_flags}", + "f_cpu": "8000000L", + "mcu": "atmega32u4", + "pid": "0x9208", + "usb_product": "LilyPad USB", + "variant": "leonardo", + "vid": "0x1B4F" + }, + "name": "LilyPad Arduino USB", + "platform": "atmelavr", + "upload": { + "disable_flushing": "true", + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "speed": 57600, + "use_1200bps_touch": "true", + "wait_for_upload_port": "true" + } + }, + "atmegang": { + "build": { + "board": "AVR_NG", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega8", + "variant": "standard" + }, + "name": "Arduino NG or older", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 7168, + "protocol": "arduino", + "speed": 19200 + } + }, + "atmegangatmega168": { + "build": { + "board": "AVR_NG", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega8", + "variant": "standard" + }, + "name": "Arduino NG or older ATmega168", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 7168, + "protocol": "arduino", + "speed": 19200 + } + }, + "atmegangatmega8": { + "build": { + "board": "AVR_NG", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega8", + "variant": "standard" + }, + "name": "Arduino NG or older ATmega8", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 7168, + "protocol": "arduino", + "speed": 19200 + } + }, + "bt": { + "build": { + "board": "AVR_BT", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino BT", + "platform": "atmelavr", + "upload": { + "disable_flushing": "true", + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "btatmega168": { + "build": { + "board": "AVR_BT", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino BT ATmega168", + "platform": "atmelavr", + "upload": { + "disable_flushing": "true", + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "btatmega328": { + "build": { + "board": "AVR_BT", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino BT ATmega328", + "platform": "atmelavr", + "upload": { + "disable_flushing": "true", + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "diecimila": { + "build": { + "board": "AVR_DUEMILANOVE", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "standard" + }, + "name": "Arduino Duemilanove or Diecimila", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "diecimilaatmega168": { + "build": { + "board": "AVR_DUEMILANOVE", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "standard" + }, + "name": "Arduino Duemilanove or Diecimila ATmega168", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "diecimilaatmega328": { + "build": { + "board": "AVR_DUEMILANOVE", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "standard" + }, + "name": "Arduino Duemilanove or Diecimila ATmega328", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "esplora": { + "build": { + "board": "AVR_ESPLORA", + "core": "arduino", + "extra_flags": "{build.usb_flags}", + "f_cpu": "16000000L", + "mcu": "atmega32u4", + "pid": "0x803c", + "usb_product": "Arduino Esplora", + "variant": "leonardo", + "vid": "0x2341" + }, + "name": "Arduino Esplora", + "platform": "atmelavr", + "upload": { + "disable_flushing": "true", + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "speed": 57600, + "use_1200bps_touch": "true", + "wait_for_upload_port": "true" + } + }, + "ethernet": { + "build": { + "board": "AVR_ETHERNET", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega328p", + "variant": "ethernet" + }, + "name": "Arduino Ethernet", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 32256, + "protocol": "arduino", + "speed": 115200 + } + }, + "fio": { + "build": { + "board": "AVR_FIO", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega328p", + "variant": "eightanaloginputs" + }, + "name": "Arduino Fio", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 30720, + "protocol": "arduino", + "speed": 57600 + } + }, + "leonardo": { + "build": { + "board": "AVR_LEONARDO", + "core": "arduino", + "extra_flags": "{build.usb_flags}", + "f_cpu": "16000000L", + "mcu": "atmega32u4", + "pid": "0x8036", + "usb_product": "Arduino Leonardo", + "variant": "leonardo", + "vid": "0x2341" + }, + "name": "Arduino Leonardo", + "platform": "atmelavr", + "upload": { + "disable_flushing": "true", + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "speed": 57600, + "use_1200bps_touch": "true", + "wait_for_upload_port": "true" + } + }, + "lilypad": { + "build": { + "board": "AVR_LILYPAD", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega168", + "variant": "standard" + }, + "name": "LilyPad Arduino", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "lilypadatmega168": { + "build": { + "board": "AVR_LILYPAD", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega168", + "variant": "standard" + }, + "name": "LilyPad Arduino ATmega168", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "lilypadatmega328": { + "build": { + "board": "AVR_LILYPAD", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega168", + "variant": "standard" + }, + "name": "LilyPad Arduino ATmega328", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "mega": { + "build": { + "board": "AVR_MEGA", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega1280", + "variant": "mega" + }, + "name": "Arduino Mega or Mega 2560", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 126976, + "protocol": "arduino", + "speed": 57600 + } + }, + "megaADK": { + "build": { + "board": "AVR_ADK", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega2560", + "variant": "mega" + }, + "name": "Arduino Mega ADK", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 253952, + "protocol": "wiring", + "speed": 115200 + } + }, + "megaatmega1280": { + "build": { + "board": "AVR_MEGA", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega1280", + "variant": "mega" + }, + "name": "Arduino Mega or Mega 2560 ATmega1280", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 126976, + "protocol": "arduino", + "speed": 57600 + } + }, + "megaatmega2560": { + "build": { + "board": "AVR_MEGA", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega1280", + "variant": "mega" + }, + "name": "Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 126976, + "protocol": "arduino", + "speed": 57600 + } + }, + "micro": { + "build": { + "board": "AVR_MICRO", + "core": "arduino", + "extra_flags": "{build.usb_flags}", + "f_cpu": "16000000L", + "mcu": "atmega32u4", + "pid": "0x8037", + "usb_product": "Arduino Micro", + "variant": "micro", + "vid": "0x2341" + }, + "name": "Arduino Micro", + "platform": "atmelavr", + "upload": { + "disable_flushing": "true", + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "speed": 57600, + "use_1200bps_touch": "true", + "wait_for_upload_port": "true" + } + }, + "mini": { + "build": { + "board": "AVR_MINI", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino Mini", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "miniatmega168": { + "build": { + "board": "AVR_MINI", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino Mini ATmega168", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "miniatmega328": { + "build": { + "board": "AVR_MINI", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino Mini ATmega328", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "nano": { + "build": { + "board": "AVR_NANO", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino Nano", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "nanoatmega168": { + "build": { + "board": "AVR_NANO", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino Nano ATmega168", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "nanoatmega328": { + "build": { + "board": "AVR_NANO", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino Nano ATmega328", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "pro": { + "build": { + "board": "AVR_PRO", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino Pro or Pro Mini", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "pro16MHzatmega168": { + "build": { + "board": "AVR_PRO", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino Pro or Pro Mini ATmega168 (5V, 16 MHz)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "pro16MHzatmega328": { + "build": { + "board": "AVR_PRO", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino Pro or Pro Mini ATmega328 (5V, 16 MHz)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "pro8MHzatmega168": { + "build": { + "board": "AVR_PRO", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino Pro or Pro Mini ATmega168 (3.3V, 8 MHz)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "pro8MHzatmega328": { + "build": { + "board": "AVR_PRO", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega168", + "variant": "eightanaloginputs" + }, + "name": "Arduino Pro or Pro Mini ATmega328 (3.3V, 8 MHz)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 14336, + "protocol": "arduino", + "speed": 19200 + } + }, + "robotControl": { + "build": { + "board": "AVR_ROBOT_CONTROL", + "core": "arduino", + "extra_flags": "{build.usb_flags}", + "f_cpu": "16000000L", + "mcu": "atmega32u4", + "pid": "0x8038", + "usb_product": "Robot Control", + "variant": "robot_control", + "vid": "0x2341" + }, + "name": "Arduino Robot Control", + "platform": "atmelavr", + "upload": { + "disable_flushing": "true", + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "speed": 57600, + "use_1200bps_touch": "true", + "wait_for_upload_port": "true" + } + }, + "robotMotor": { + "build": { + "board": "AVR_ROBOT_MOTOR", + "core": "arduino", + "extra_flags": "{build.usb_flags}", + "f_cpu": "16000000L", + "mcu": "atmega32u4", + "pid": "0x8039", + "usb_product": "Robot Motor", + "variant": "robot_motor", + "vid": "0x2341" + }, + "name": "Arduino Robot Motor", + "platform": "atmelavr", + "upload": { + "disable_flushing": "true", + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "speed": 57600, + "use_1200bps_touch": "true", + "wait_for_upload_port": "true" + } + }, + "uno": { + "build": { + "board": "AVR_UNO", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega328p", + "variant": "standard" + }, + "name": "Arduino Uno", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 32256, + "protocol": "arduino", + "speed": 115200 + } + }, + "yun": { + "build": { + "board": "AVR_YUN", + "core": "arduino", + "extra_flags": "{build.usb_flags}", + "f_cpu": "16000000L", + "mcu": "atmega32u4", + "pid": "0x8041", + "usb_product": "Arduino Yun", + "variant": "yun", + "vid": "0x2341" + }, + "name": "Arduino Yun", + "platform": "atmelavr", + "upload": { + "disable_flushing": "true", + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "speed": 57600, + "use_1200bps_touch": "true", + "via_ssh": "true", + "wait_for_upload_port": "true" + } + } +} \ No newline at end of file diff --git a/platformio/boards/microduino.json b/platformio/boards/microduino.json new file mode 100644 index 00000000..01740513 --- /dev/null +++ b/platformio/boards/microduino.json @@ -0,0 +1,160 @@ +{ + "1284p16m": { + "build": { + "board": "AVR_MICRODUINO_CORE_PLUS", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega1284p", + "variant": "plus" + }, + "name": "Microduino Core+ (ATmega1284P@16M,5V)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 130048, + "protocol": "arduino", + "speed": 115200 + } + }, + "1284p8m": { + "build": { + "board": "AVR_MICRODUINO_CORE_PLUS", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega1284p", + "variant": "plus" + }, + "name": "Microduino Core+ (ATmega1284P@8M,3.3V)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 130048, + "protocol": "arduino", + "speed": 57600 + } + }, + "168pa16m": { + "build": { + "board": "AVR_MICRODUINO_CORE", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega168p", + "variant": "standard" + }, + "name": "Microduino Core (Atmega168PA@16M,5V)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 15872, + "protocol": "arduino", + "speed": 115200 + } + }, + "168pa8m": { + "build": { + "board": "AVR_MICRODUINO_CORE", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega168p", + "variant": "standard" + }, + "name": "Microduino Core (Atmega168PA@8M,3.3V)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 15872, + "protocol": "arduino", + "speed": 57600 + } + }, + "328p16m": { + "build": { + "board": "AVR_MICRODUINO_CORE", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega328p", + "variant": "standard" + }, + "name": "Microduino Core (Atmega328P@16M,5V)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 32256, + "protocol": "arduino", + "speed": 115200 + } + }, + "328p8m": { + "build": { + "board": "AVR_MICRODUINO_CORE", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega328p", + "variant": "standard" + }, + "name": "Microduino Core (Atmega328P@8M,3.3V)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 32256, + "protocol": "arduino", + "speed": 57600 + } + }, + "32u416m": { + "build": { + "board": "AVR_MICRODUINO_CORE_USB", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega32u4", + "pid": "0x8036", + "variant": "32u4", + "vid": "0x2341" + }, + "name": "Microduino Core USB (ATmega32U4@16M,5V)", + "platform": "atmelavr", + "upload": { + "disable_flushing": "true", + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "speed": 57600, + "use_1200bps_touch": "true", + "wait_for_upload_port": "true" + } + }, + "644pa16m": { + "build": { + "board": "AVR_MICRODUINO_CORE_PLUS", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega644p", + "variant": "plus" + }, + "name": "Microduino Core+ (Atmega644PA@16M,5V)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 4096, + "maximum_size": 64512, + "protocol": "arduino", + "speed": 115200 + } + }, + "644pa8m": { + "build": { + "board": "AVR_MICRODUINO_CORE_PLUS", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega644p", + "variant": "plus" + }, + "name": "Microduino Core+ (Atmega644PA@8M,3.3V)", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 4096, + "maximum_size": 64512, + "protocol": "arduino", + "speed": 57600 + } + } +} \ No newline at end of file diff --git a/platformio/boards/misc.json b/platformio/boards/misc.json new file mode 100644 index 00000000..c9d378fa --- /dev/null +++ b/platformio/boards/misc.json @@ -0,0 +1,19 @@ +{ + "raspduino": { + "build": { + "board": "AVR_RASPDUINO", + "core": "arduino", + "f_cpu": "16000000L", + "mcu": "atmega328p", + "variant": "standard" + }, + "name": "Raspduino", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 30720, + "protocol": "arduino", + "speed": 57600 + } + } +} \ No newline at end of file diff --git a/platformio/boards/timsp430.json b/platformio/boards/timsp430.json new file mode 100644 index 00000000..87051331 --- /dev/null +++ b/platformio/boards/timsp430.json @@ -0,0 +1,107 @@ +{ + "lpmsp430f5529": { + "build": { + "core": "msp430", + "f_cpu": "16000000L", + "mcu": "msp430f5529", + "variant": "launchpad_f5529" + }, + "name": "LaunchPad w/ msp430f5529 (16MHz)", + "platform": "timsp430", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 131072, + "protocol": "tilib" + } + }, + "lpmsp430f5529_25": { + "build": { + "core": "msp430", + "f_cpu": "25000000L", + "mcu": "msp430f5529", + "variant": "launchpad_f5529" + }, + "name": "LaunchPad w/ msp430f5529 (25MHz)", + "platform": "timsp430", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 131072, + "protocol": "tilib" + } + }, + "lpmsp430fr5739": { + "build": { + "core": "msp430", + "f_cpu": "16000000L", + "mcu": "msp430fr5739", + "variant": "fraunchpad" + }, + "name": "FraunchPad w/ msp430fr5739", + "platform": "timsp430", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 15872, + "protocol": "rf2500" + } + }, + "lpmsp430fr5969": { + "build": { + "core": "msp430", + "f_cpu": "8000000L", + "mcu": "msp430fr5969", + "variant": "launchpad_fr5969" + }, + "name": "LaunchPad w/ msp430fr5969", + "platform": "timsp430", + "upload": { + "maximum_ram_size": 1024, + "maximum_size": 65536, + "protocol": "tilib" + } + }, + "lpmsp430g2231": { + "build": { + "core": "msp430", + "f_cpu": "1000000L", + "mcu": "msp430g2231", + "variant": "launchpad" + }, + "name": "LaunchPad w/ msp430g2231 (1MHz)", + "platform": "timsp430", + "upload": { + "maximum_ram_size": 128, + "maximum_size": 2048, + "protocol": "rf2500" + } + }, + "lpmsp430g2452": { + "build": { + "core": "msp430", + "f_cpu": "16000000L", + "mcu": "msp430g2452", + "variant": "launchpad" + }, + "name": "LaunchPad w/ msp430g2452 (16MHz)", + "platform": "timsp430", + "upload": { + "maximum_ram_size": 256, + "maximum_size": 8192, + "protocol": "rf2500" + } + }, + "lpmsp430g2553": { + "build": { + "core": "msp430", + "f_cpu": "16000000L", + "mcu": "msp430g2553", + "variant": "launchpad" + }, + "name": "LaunchPad w/ msp430g2553 (16MHz)", + "platform": "timsp430", + "upload": { + "maximum_ram_size": 512, + "maximum_size": 16384, + "protocol": "rf2500" + } + } +} \ No newline at end of file diff --git a/platformio/boards/titiva.json b/platformio/boards/titiva.json new file mode 100644 index 00000000..acccb418 --- /dev/null +++ b/platformio/boards/titiva.json @@ -0,0 +1,47 @@ +{ + "lplm4f120h5qr": { + "build": { + "core": "lm4f", + "f_cpu": "80000000L", + "ldscript": "lm4fcpp_blizzard.ld", + "mcu": "cortex-m4", + "variant": "stellarpad" + }, + "name": "LaunchPad (Stellaris) w/ lm4f120 (80MHz)", + "platform": "titiva", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 262144 + } + }, + "lptm4c1230c3pm": { + "build": { + "core": "lm4f", + "f_cpu": "80000000L", + "ldscript": "lm4fcpp_blizzard.ld", + "mcu": "cortex-m4", + "variant": "stellarpad" + }, + "name": "LaunchPad (Tiva C) w/ tm4c123 (80MHz)", + "platform": "titiva", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 262144 + } + }, + "lptm4c1294ncpdt": { + "build": { + "core": "lm4f", + "f_cpu": "120000000L", + "ldscript": "lm4fcpp_snowflake.ld", + "mcu": "cortex-m4", + "variant": "launchpad_129" + }, + "name": "LaunchPad (Tiva C) w/ tm4c129 (120MHz)", + "platform": "titiva", + "upload": { + "maximum_ram_size": 262144, + "maximum_size": 1048576 + } + } +} \ No newline at end of file diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 05810edb..a69a31d0 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -2,22 +2,20 @@ # See LICENSE for details. try: - from platformio.util import get_home_dir + from platformio import util except ImportError: import sys for _path in sys.path: if "platformio" in _path: sys.path.insert(0, _path[:_path.rfind("platformio")-1]) break - from platformio.util import get_home_dir + from platformio import util from os.path import join from SCons.Script import (DefaultEnvironment, SConscript, SConscriptChdir, Variables) -from platformio.util import (get_lib_dir, get_pioenvs_dir, get_project_dir, - get_source_dir) # AllowSubstExceptions() @@ -54,23 +52,39 @@ DefaultEnvironment( toolpath=[join("$PIOBUILDER_DIR", "tools")], variables=commonvars, - PIOHOME_DIR=get_home_dir(), - PROJECT_DIR=get_project_dir(), - PIOENVS_DIR=get_pioenvs_dir(), + PIOHOME_DIR=util.get_home_dir(), + PROJECT_DIR=util.get_project_dir(), + PIOENVS_DIR=util.get_pioenvs_dir(), - PIOBUILDER_DIR=join(get_source_dir(), "builder"), + PIOBUILDER_DIR=join(util.get_source_dir(), "builder"), PIOPACKAGES_DIR=join("$PIOHOME_DIR", "packages"), PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_FRAMEWORK"), BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"), LIBSOURCE_DIRS=[ join("$PROJECT_DIR", "lib"), - get_lib_dir(), + util.get_lib_dir(), join("$PLATFORMFW_DIR", "libraries"), ] ) env = DefaultEnvironment() + +if "BOARD" in env: + try: + env.Replace(BOARD_OPTIONS=util.get_boards(env.subst("$BOARD"))) + except KeyError: + env.Exit("Error: Unknown board '%s'" % env.subst("$BOARD")) + + if "BOARD_MCU" not in env: + env.Replace(BOARD_MCU="${BOARD_OPTIONS['build']['mcu']}") + if "BOARD_F_CPU" not in env: + env.Replace(BOARD_F_CPU="${BOARD_OPTIONS['build']['f_cpu']}") + if "UPLOAD_PROTOCOL" not in env: + env.Replace(UPLOAD_PROTOCOL="${BOARD_OPTIONS['upload']['protocol']}") + if "UPLOAD_SPEED" not in env: + env.Replace(UPLOAD_SPEED="${BOARD_OPTIONS['upload']['speed']}") + env.PrependENVPath( "PATH", env.subst(join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN", "bin")) diff --git a/platformio/builder/scripts/atmelavr.py b/platformio/builder/scripts/atmelavr.py index cfdd2de9..9fdc0460 100644 --- a/platformio/builder/scripts/atmelavr.py +++ b/platformio/builder/scripts/atmelavr.py @@ -11,7 +11,7 @@ from time import sleep from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default, DefaultEnvironment, Exit) -from platformio.util import get_serialports, reset_serialport +from platformio.util import get_serialports env = DefaultEnvironment() @@ -41,7 +41,10 @@ env.Replace( "-mmcu=$BOARD_MCU" ], - CXXFLAGS=["-fno-exceptions"], + CXXFLAGS=[ + "-fno-exceptions", + "-fno-threadsafe-statics" + ], CPPDEFINES=[ "F_CPU=$BOARD_F_CPU" @@ -101,7 +104,7 @@ env.Append( ) -def reset_device(): +def before_upload(): def rpi_sysgpio(path, value): with open(path, "w") as f: @@ -115,7 +118,7 @@ def reset_device(): rpi_sysgpio("/sys/class/gpio/gpio18/value", 0) rpi_sysgpio("/sys/class/gpio/unexport", 18) else: - return reset_serialport(env.subst("$UPLOAD_PORT")) + return env.FlushSerialBuffer("$UPLOAD_PORT") CORELIBS = env.ProcessGeneral() @@ -147,7 +150,7 @@ else: # upload = env.Alias(["upload", "uploadlazy"], target_hex, [ - lambda target, source, env: reset_device(), "$UPLOADHEXCMD"]) + lambda target, source, env: before_upload(), "$UPLOADHEXCMD"]) AlwaysBuild(upload) # @@ -155,7 +158,7 @@ AlwaysBuild(upload) # uploadeep = env.Alias("uploadeep", target_eep, [ - lambda target, source, env: reset_device(), "$UPLOADEEPCMD"]) + lambda target, source, env: before_upload(), "$UPLOADEEPCMD"]) AlwaysBuild(uploadeep) # diff --git a/platformio/builder/scripts/frameworks/arduino.py b/platformio/builder/scripts/frameworks/arduino.py index 129f539d..ca7409eb 100644 --- a/platformio/builder/scripts/frameworks/arduino.py +++ b/platformio/builder/scripts/frameworks/arduino.py @@ -12,35 +12,31 @@ from SCons.Script import Import, Return env = None Import("env") -BOARD_OPTIONS = env.ParseBoardOptions( - join("$PLATFORMFW_DIR", "boards.txt"), - "${BOARD}" -) ARDUINO_VERSION = int( open(join(env.subst("$PLATFORMFW_DIR"), "version.txt")).read().replace(".", "").strip()) # usb flags ARDUINO_USBDEFINES = [] -if "build.usb_product" in BOARD_OPTIONS: +if "usb_product" in env.subst("${BOARD_OPTIONS['build']}"): ARDUINO_USBDEFINES = [ - "USB_VID=%s" % BOARD_OPTIONS['build.vid'], - "USB_PID=%s" % BOARD_OPTIONS['build.pid'], - 'USB_PRODUCT=\\"%s\\"' % BOARD_OPTIONS['build.usb_product'].replace( - '"', "") + "USB_VID=${BOARD_OPTIONS['build']['vid']}", + "USB_PID=${BOARD_OPTIONS['build']['pid']}", + 'USB_PRODUCT=\\"%s\\"' % (env.subst( + "${BOARD_OPTIONS['build']['usb_product']}").replace('"', "")) ] # include board variant env.VariantDir( join("$BUILD_DIR", "FrameworkArduinoVariant"), - join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant']) + join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}") ) env.Append( CPPDEFINES=[ "ARDUINO_ARCH_%s" % env.subst("$PLATFORM").upper()[-3:], "ARDUINO=%d" % ARDUINO_VERSION, - "ARDUINO_%s" % BOARD_OPTIONS['build.board'] + "ARDUINO_${BOARD_OPTIONS['build']['board']}" ] + ARDUINO_USBDEFINES, CPPPATH=[ join("$BUILD_DIR", "FrameworkArduino"), @@ -48,25 +44,16 @@ env.Append( ] ) -if "BOARD_MCU" not in env: - env.Replace(BOARD_MCU=BOARD_OPTIONS['build.mcu']) -if "BOARD_F_CPU" not in env: - env.Replace(BOARD_F_CPU=BOARD_OPTIONS['build.f_cpu']) -if "UPLOAD_PROTOCOL" not in env: - env.Replace(UPLOAD_PROTOCOL=BOARD_OPTIONS['upload.protocol']) -if "UPLOAD_SPEED" not in env: - env.Replace(UPLOAD_SPEED=BOARD_OPTIONS['upload.speed']) - - -libs = [] # # Target: Build Core Library # +libs = [] + libs.append(env.BuildLibrary( join("$BUILD_DIR", "FrameworkArduino"), - join("$PLATFORMFW_DIR", "cores", BOARD_OPTIONS['build.core']) + join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}") )) Return("libs") diff --git a/platformio/builder/scripts/frameworks/energia.py b/platformio/builder/scripts/frameworks/energia.py index e2bb8a53..45db6e7d 100644 --- a/platformio/builder/scripts/frameworks/energia.py +++ b/platformio/builder/scripts/frameworks/energia.py @@ -12,10 +12,6 @@ from SCons.Script import Import, Return env = None Import("env") -BOARD_OPTIONS = env.ParseBoardOptions( - join("$PLATFORMFW_DIR", "boards.txt"), - "${BOARD}" -) ENERGIA_VERSION = int( open(join(env.subst("$PLATFORMFW_DIR"), "version.txt")).read().replace(".", "").strip()) @@ -23,7 +19,7 @@ ENERGIA_VERSION = int( # include board variant env.VariantDir( join("$BUILD_DIR", "FrameworkEnergiaVariant"), - join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant']) + join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}") ) env.Append( @@ -37,31 +33,25 @@ env.Append( ] ) -if "BOARD_MCU" not in env: - env.Replace(BOARD_MCU=BOARD_OPTIONS['build.mcu']) -if "BOARD_F_CPU" not in env: - env.Replace(BOARD_F_CPU=BOARD_OPTIONS['build.f_cpu']) -if "UPLOAD_PROTOCOL" not in env and "upload.protocol" in BOARD_OPTIONS: - env.Replace(UPLOAD_PROTOCOL=BOARD_OPTIONS['upload.protocol']) - # specific linker script for TIVA devices -if "ldscript" in BOARD_OPTIONS: +if "ldscript" in env.subst("${BOARD_OPTIONS['build']}"): env.Append( - LINKFLAGS=["-T", join("$PLATFORMFW_DIR", "cores", - BOARD_OPTIONS['build.core'], - BOARD_OPTIONS['ldscript'])] + LINKFLAGS=["-T", join( + "$PLATFORMFW_DIR", "cores", + "${BOARD_OPTIONS['build']['core']}", + "${BOARD_OPTIONS['build']['ldscript']}")] ) -libs = [] - # # Target: Build Core Library # +libs = [] + libs.append(env.BuildLibrary( join("$BUILD_DIR", "FrameworkEnergia"), - join("$PLATFORMFW_DIR", "cores", BOARD_OPTIONS['build.core']) + join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}") )) Return("libs") diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index c751e56a..822600fb 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -5,8 +5,10 @@ import atexit import re from os import getenv, listdir, remove, walk from os.path import basename, isdir, isfile, join +from time import sleep from SCons.Script import SConscript, SConscriptChdir +from serial import Serial def ProcessGeneral(env): @@ -126,38 +128,6 @@ def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True): return variants -def ParseBoardOptions(env, path, name): - path = env.subst(path) - name = env.subst(name) - if not isfile(path): - env.Exit("Invalid path to boards.txt -> %s" % path) - - data = {} - with open(path) as f: - for line in f: - if not line.strip() or line[0] == "#": - continue - - _group = line[:line.index(".")] - _cpu = name[len(_group):] - line = line[len(_group)+1:].strip() - if _group != name[:len(_group)]: - continue - elif "menu.cpu." in line: - if _cpu not in line: - continue - else: - line = line[len(_cpu)+10:] - - if "=" in line: - opt, value = line.split("=", 1) - data[opt] = value - if not data: - env.Exit("Unknown Board '%s'" % name) - else: - return data - - def ConvertInoToCpp(env): def delete_tmpcpp(files): @@ -206,6 +176,17 @@ def ConvertInoToCpp(env): atexit.register(delete_tmpcpp, tmpcpp) +def FlushSerialBuffer(env, port): + s = Serial(env.subst(port)) + s.flushInput() + s.setDTR(False) + s.setRTS(False) + sleep(0.1) + s.setDTR(True) + s.setRTS(True) + s.close() + + def exists(_): return True @@ -219,6 +200,6 @@ def generate(env): env.AddMethod(GetDependentLibraries) env.AddMethod(ParseIncludesRecurive) env.AddMethod(VariantDirRecursive) - env.AddMethod(ParseBoardOptions) env.AddMethod(ConvertInoToCpp) + env.AddMethod(FlushSerialBuffer) return env diff --git a/platformio/commands/boards.py b/platformio/commands/boards.py new file mode 100644 index 00000000..77cbbb21 --- /dev/null +++ b/platformio/commands/boards.py @@ -0,0 +1,60 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +import json + +import click + +from platformio.util import get_boards + + +@click.command("list", short_help="Pre-configured Embedded Boards") +@click.argument("query", required=False) +def cli(query): + + BOARDLIST_TPL = ("{type:<30} {mcu:<13} {frequency:<8} " + " {flash:<7} {ram:<6} {name}") + + grpboards = {} + for type_, data in get_boards().items(): + if data['platform'] not in grpboards: + grpboards[data['platform']] = {} + grpboards[data['platform']][type_] = data + + for (platform, boards) in grpboards.items(): + if query: + search_data = json.dumps(boards).lower() + if query.lower() not in search_data.lower(): + continue + + click.echo("\nPlatform: %s" % platform) + click.echo("-" * 75) + click.echo(BOARDLIST_TPL.format( + type=click.style("Type", fg="cyan"), mcu="MCU", + frequency="Frequency", flash="Flash", ram="RAM", name="Name")) + click.echo("-" * 75) + + for type_, data in sorted(boards.items(), key=lambda b: b[1]['name']): + if query: + search_data = "%s %s" % (type_, json.dumps(data).lower()) + if query.lower() not in search_data.lower(): + continue + + flash_size = "" + if "maximum_size" in data.get("upload", None): + flash_size = int(data['upload']['maximum_size']) + flash_size = "%dKb" % (flash_size / 1024) + + ram_size = "" + if "maximum_ram_size" in data.get("upload", None): + ram_size = int(data['upload']['maximum_ram_size']) + if ram_size >= 1024: + ram_size = "%dKb" % (ram_size / 1024) + else: + ram_size = "%dB" % ram_size + + click.echo(BOARDLIST_TPL.format( + type=click.style(type_, fg="cyan"), mcu=data['build']['mcu'], + frequency="%dMhz" % (int(data['build']['f_cpu'][:-1]) + / 1000000), + flash=flash_size, ram=ram_size, name=data['name'])) diff --git a/platformio/util.py b/platformio/util.py index 2ef61ca6..a5c015f3 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -1,15 +1,14 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. +import json from os import name as os_name -from os import getcwd, getenv, makedirs, utime +from os import getcwd, getenv, listdir, makedirs, utime from os.path import dirname, expanduser, isdir, isfile, join, realpath from platform import system, uname from subprocess import PIPE, Popen -from time import sleep import requests -from serial import Serial from platformio import __apiurl__, __version__ from platformio.exception import (APIRequestError, GetSerialPortsError, @@ -94,17 +93,6 @@ def exec_command(args): return dict(out=out.strip(), err=err.strip()) -def reset_serialport(port): - s = Serial(port) - s.flushInput() - s.setDTR(False) - s.setRTS(False) - sleep(0.1) - s.setDTR(True) - s.setRTS(True) - s.close() - - def get_serialports(): if os_name == "nt": from serial.tools.list_ports_windows import comports @@ -149,3 +137,19 @@ def get_api_result(path, params=None, data=None): if r: r.close() return result + + +def get_boards(type_=None): + boards = {} + bdirs = [join(get_source_dir(), "boards")] + if isdir(join(get_home_dir(), "boards")): + bdirs.append(join(get_home_dir(), "boards")) + + for bdir in bdirs: + for json_file in listdir(bdir): + if not json_file.endswith(".json"): + continue + with open(join(bdir, json_file)) as f: + boards.update(json.load(f)) + + return boards[type_] if type_ is not None else boards diff --git a/setup.py b/setup.py index 00be7482..7db2c825 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ setup( # "SCons" ] + (["colorama"] if system() == "Windows" else []), packages=find_packages(), - package_data={"platformio": ["*.ini"]}, + package_data={"platformio": ["projectconftpl.ini", "boards/*.json"]}, entry_points={ "console_scripts": [ "platformio = platformio.__main__:main" From 15acca7b57d5a4df54d71d295ead44cf7e3ba294 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Dec 2014 00:06:54 +0200 Subject: [PATCH 13/30] Mention about "boards" command in the platform page --- docs/platforms/atmelavr.rst | 5 +++-- docs/platforms/timsp430.rst | 5 +++-- docs/platforms/titiva.rst | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index 49ad22a9..29603813 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -59,8 +59,9 @@ Boards ------ .. note:: - For more detailed ``board`` information please scroll tables below by - horizontal. + * You can list pre-configured boards by :ref:`cmd_boards` command + * For more detailed ``board`` information please scroll tables below by + horizontal. Arduino ~~~~~~~ diff --git a/docs/platforms/timsp430.rst b/docs/platforms/timsp430.rst index 22809b5d..5d7e625e 100644 --- a/docs/platforms/timsp430.rst +++ b/docs/platforms/timsp430.rst @@ -56,8 +56,9 @@ Boards ------ .. note:: - For more detailed ``board`` information please scroll table below by - horizontal. + * You can list pre-configured boards by :ref:`cmd_boards` command + * For more detailed ``board`` information please scroll tables below by + horizontal. .. list-table:: :header-rows: 1 diff --git a/docs/platforms/titiva.rst b/docs/platforms/titiva.rst index 0b1f7b80..1c00ce02 100644 --- a/docs/platforms/titiva.rst +++ b/docs/platforms/titiva.rst @@ -56,8 +56,9 @@ Boards ------ .. note:: - For more detailed ``board`` information please scroll table below by - horizontal. + * You can list pre-configured boards by :ref:`cmd_boards` command + * For more detailed ``board`` information please scroll tables below by + horizontal. .. list-table:: :header-rows: 1 From fe60369b6a9166ffefa5f269b0d43cb74d065a6f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Dec 2014 20:03:43 +0200 Subject: [PATCH 14/30] Fix pre-configured settings for Arduino boards and ATmega 328 MCU --- docs/userguide/cmd_boards.rst | 19 ++- platformio/boards/arduino.json | 255 +++++++----------------------- platformio/boards/microduino.json | 6 +- 3 files changed, 71 insertions(+), 209 deletions(-) diff --git a/docs/userguide/cmd_boards.rst b/docs/userguide/cmd_boards.rst index 49fc3f0a..d8188832 100644 --- a/docs/userguide/cmd_boards.rst +++ b/docs/userguide/cmd_boards.rst @@ -36,16 +36,15 @@ Examples --------------------------------------------------------------------------- Type MCU Frequency Flash RAM Name --------------------------------------------------------------------------- - bt atmega168 16Mhz 14Kb 1Kb Arduino BT btatmega168 atmega168 16Mhz 14Kb 1Kb Arduino BT ATmega168 - btatmega328 atmega168 16Mhz 14Kb 1Kb Arduino BT ATmega328 - diecimila atmega168 16Mhz 14Kb 1Kb Arduino Duemilanove or Diecimila + btatmega328 atmega328p 16Mhz 28Kb 2Kb Arduino BT ATmega328 diecimilaatmega168 atmega168 16Mhz 14Kb 1Kb Arduino Duemilanove or Diecimila ATmega168 - diecimilaatmega328 atmega168 16Mhz 14Kb 1Kb Arduino Duemilanove or Diecimila ATmega328 + diecimilaatmega328 atmega328p 16Mhz 30Kb 2Kb Arduino Duemilanove or Diecimila ATmega328 esplora atmega32u4 16Mhz 28Kb 2Kb Arduino Esplora ethernet atmega328p 16Mhz 31Kb 2Kb Arduino Ethernet ... + 2. Show boards which are based on ``ATmega168`` MCU .. code-block:: bash @@ -56,14 +55,14 @@ Examples --------------------------------------------------------------------------- Type MCU Frequency Flash RAM Name --------------------------------------------------------------------------- - bt atmega168 16Mhz 14Kb 1Kb Arduino BT btatmega168 atmega168 16Mhz 14Kb 1Kb Arduino BT ATmega168 - ... - pro atmega168 8Mhz 14Kb 1Kb Arduino Pro or Pro Mini - ... - lilypad atmega168 8Mhz 14Kb 1Kb LilyPad Arduino + diecimilaatmega168 atmega168 16Mhz 14Kb 1Kb Arduino Duemilanove or Diecimila ATmega168 + miniatmega168 atmega168 16Mhz 14Kb 1Kb Arduino Mini ATmega168 + atmegangatmega168 atmega168 16Mhz 14Kb 1Kb Arduino NG or older ATmega168 + nanoatmega168 atmega168 16Mhz 14Kb 1Kb Arduino Nano ATmega168 + pro8MHzatmega168 atmega168 8Mhz 14Kb 1Kb Arduino Pro or Pro Mini ATmega168 (3.3V, 8 MHz) + pro16MHzatmega168 atmega168 16Mhz 14Kb 1Kb Arduino Pro or Pro Mini ATmega168 (5V, 16 MHz) lilypadatmega168 atmega168 8Mhz 14Kb 1Kb LilyPad Arduino ATmega168 - lilypadatmega328 atmega168 8Mhz 14Kb 1Kb LilyPad Arduino ATmega328 168pa16m atmega168p 16Mhz 15Kb 1Kb Microduino Core (Atmega168PA@16M,5V) 168pa8m atmega168p 8Mhz 15Kb 1Kb Microduino Core (Atmega168PA@8M,3.3V) diff --git a/platformio/boards/arduino.json b/platformio/boards/arduino.json index 9715f6d8..4c281814 100644 --- a/platformio/boards/arduino.json +++ b/platformio/boards/arduino.json @@ -14,30 +14,13 @@ "name": "LilyPad Arduino USB", "platform": "atmelavr", "upload": { - "disable_flushing": "true", + "disable_flushing": true, "maximum_ram_size": 2560, "maximum_size": 28672, "protocol": "avr109", "speed": 57600, - "use_1200bps_touch": "true", - "wait_for_upload_port": "true" - } - }, - "atmegang": { - "build": { - "board": "AVR_NG", - "core": "arduino", - "f_cpu": "16000000L", - "mcu": "atmega8", - "variant": "standard" - }, - "name": "Arduino NG or older", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 7168, - "protocol": "arduino", - "speed": 19200 + "use_1200bps_touch": true, + "wait_for_upload_port": true } }, "atmegangatmega168": { @@ -45,14 +28,14 @@ "board": "AVR_NG", "core": "arduino", "f_cpu": "16000000L", - "mcu": "atmega8", + "mcu": "atmega168", "variant": "standard" }, "name": "Arduino NG or older ATmega168", "platform": "atmelavr", "upload": { "maximum_ram_size": 1024, - "maximum_size": 7168, + "maximum_size": 14336, "protocol": "arduino", "speed": 19200 } @@ -74,24 +57,6 @@ "speed": 19200 } }, - "bt": { - "build": { - "board": "AVR_BT", - "core": "arduino", - "f_cpu": "16000000L", - "mcu": "atmega168", - "variant": "eightanaloginputs" - }, - "name": "Arduino BT", - "platform": "atmelavr", - "upload": { - "disable_flushing": "true", - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "speed": 19200 - } - }, "btatmega168": { "build": { "board": "AVR_BT", @@ -103,7 +68,7 @@ "name": "Arduino BT ATmega168", "platform": "atmelavr", "upload": { - "disable_flushing": "true", + "disable_flushing": true, "maximum_ram_size": 1024, "maximum_size": 14336, "protocol": "arduino", @@ -115,32 +80,15 @@ "board": "AVR_BT", "core": "arduino", "f_cpu": "16000000L", - "mcu": "atmega168", + "mcu": "atmega328p", "variant": "eightanaloginputs" }, "name": "Arduino BT ATmega328", "platform": "atmelavr", "upload": { - "disable_flushing": "true", - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "speed": 19200 - } - }, - "diecimila": { - "build": { - "board": "AVR_DUEMILANOVE", - "core": "arduino", - "f_cpu": "16000000L", - "mcu": "atmega168", - "variant": "standard" - }, - "name": "Arduino Duemilanove or Diecimila", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, + "disable_flushing": true, + "maximum_ram_size": 2048, + "maximum_size": 28672, "protocol": "arduino", "speed": 19200 } @@ -167,16 +115,16 @@ "board": "AVR_DUEMILANOVE", "core": "arduino", "f_cpu": "16000000L", - "mcu": "atmega168", + "mcu": "atmega328p", "variant": "standard" }, "name": "Arduino Duemilanove or Diecimila ATmega328", "platform": "atmelavr", "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, + "maximum_ram_size": 2048, + "maximum_size": 30720, "protocol": "arduino", - "speed": 19200 + "speed": 57600 } }, "esplora": { @@ -194,13 +142,13 @@ "name": "Arduino Esplora", "platform": "atmelavr", "upload": { - "disable_flushing": "true", + "disable_flushing": true, "maximum_ram_size": 2560, "maximum_size": 28672, "protocol": "avr109", "speed": 57600, - "use_1200bps_touch": "true", - "wait_for_upload_port": "true" + "use_1200bps_touch": true, + "wait_for_upload_port": true } }, "ethernet": { @@ -252,30 +200,13 @@ "name": "Arduino Leonardo", "platform": "atmelavr", "upload": { - "disable_flushing": "true", + "disable_flushing": true, "maximum_ram_size": 2560, "maximum_size": 28672, "protocol": "avr109", "speed": 57600, - "use_1200bps_touch": "true", - "wait_for_upload_port": "true" - } - }, - "lilypad": { - "build": { - "board": "AVR_LILYPAD", - "core": "arduino", - "f_cpu": "8000000L", - "mcu": "atmega168", - "variant": "standard" - }, - "name": "LilyPad Arduino", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "speed": 19200 + "use_1200bps_touch": true, + "wait_for_upload_port": true } }, "lilypadatmega168": { @@ -300,31 +231,14 @@ "board": "AVR_LILYPAD", "core": "arduino", "f_cpu": "8000000L", - "mcu": "atmega168", + "mcu": "atmega328p", "variant": "standard" }, "name": "LilyPad Arduino ATmega328", "platform": "atmelavr", "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "speed": 19200 - } - }, - "mega": { - "build": { - "board": "AVR_MEGA", - "core": "arduino", - "f_cpu": "16000000L", - "mcu": "atmega1280", - "variant": "mega" - }, - "name": "Arduino Mega or Mega 2560", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 126976, + "maximum_ram_size": 2048, + "maximum_size": 30720, "protocol": "arduino", "speed": 57600 } @@ -365,19 +279,19 @@ }, "megaatmega2560": { "build": { - "board": "AVR_MEGA", + "board": "AVR_MEGA2560", "core": "arduino", "f_cpu": "16000000L", - "mcu": "atmega1280", + "mcu": "atmega2560", "variant": "mega" }, "name": "Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)", "platform": "atmelavr", "upload": { "maximum_ram_size": 8192, - "maximum_size": 126976, - "protocol": "arduino", - "speed": 57600 + "maximum_size": 253952, + "protocol": "wiring", + "speed": 115200 } }, "micro": { @@ -395,30 +309,13 @@ "name": "Arduino Micro", "platform": "atmelavr", "upload": { - "disable_flushing": "true", + "disable_flushing": true, "maximum_ram_size": 2560, "maximum_size": 28672, "protocol": "avr109", "speed": 57600, - "use_1200bps_touch": "true", - "wait_for_upload_port": "true" - } - }, - "mini": { - "build": { - "board": "AVR_MINI", - "core": "arduino", - "f_cpu": "16000000L", - "mcu": "atmega168", - "variant": "eightanaloginputs" - }, - "name": "Arduino Mini", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "speed": 19200 + "use_1200bps_touch": true, + "wait_for_upload_port": true } }, "miniatmega168": { @@ -443,33 +340,16 @@ "board": "AVR_MINI", "core": "arduino", "f_cpu": "16000000L", - "mcu": "atmega168", + "mcu": "atmega328p", "variant": "eightanaloginputs" }, "name": "Arduino Mini ATmega328", "platform": "atmelavr", "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, + "maximum_ram_size": 2048, + "maximum_size": 28672, "protocol": "arduino", - "speed": 19200 - } - }, - "nano": { - "build": { - "board": "AVR_NANO", - "core": "arduino", - "f_cpu": "16000000L", - "mcu": "atmega168", - "variant": "eightanaloginputs" - }, - "name": "Arduino Nano", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "speed": 19200 + "speed": 115200 } }, "nanoatmega168": { @@ -494,40 +374,23 @@ "board": "AVR_NANO", "core": "arduino", "f_cpu": "16000000L", - "mcu": "atmega168", + "mcu": "atmega328p", "variant": "eightanaloginputs" }, "name": "Arduino Nano ATmega328", "platform": "atmelavr", "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, + "maximum_ram_size": 2048, + "maximum_size": 30720, "protocol": "arduino", - "speed": 19200 - } - }, - "pro": { - "build": { - "board": "AVR_PRO", - "core": "arduino", - "f_cpu": "8000000L", - "mcu": "atmega168", - "variant": "eightanaloginputs" - }, - "name": "Arduino Pro or Pro Mini", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "speed": 19200 + "speed": 57600 } }, "pro16MHzatmega168": { "build": { "board": "AVR_PRO", "core": "arduino", - "f_cpu": "8000000L", + "f_cpu": "16000000L", "mcu": "atmega168", "variant": "eightanaloginputs" }, @@ -544,17 +407,17 @@ "build": { "board": "AVR_PRO", "core": "arduino", - "f_cpu": "8000000L", - "mcu": "atmega168", + "f_cpu": "16000000L", + "mcu": "atmega328p", "variant": "eightanaloginputs" }, "name": "Arduino Pro or Pro Mini ATmega328 (5V, 16 MHz)", "platform": "atmelavr", "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, + "maximum_ram_size": 2048, + "maximum_size": 30720, "protocol": "arduino", - "speed": 19200 + "speed": 57600 } }, "pro8MHzatmega168": { @@ -579,16 +442,16 @@ "board": "AVR_PRO", "core": "arduino", "f_cpu": "8000000L", - "mcu": "atmega168", + "mcu": "atmega328p", "variant": "eightanaloginputs" }, "name": "Arduino Pro or Pro Mini ATmega328 (3.3V, 8 MHz)", "platform": "atmelavr", "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, + "maximum_ram_size": 2048, + "maximum_size": 30720, "protocol": "arduino", - "speed": 19200 + "speed": 57600 } }, "robotControl": { @@ -606,13 +469,13 @@ "name": "Arduino Robot Control", "platform": "atmelavr", "upload": { - "disable_flushing": "true", + "disable_flushing": true, "maximum_ram_size": 2560, "maximum_size": 28672, "protocol": "avr109", "speed": 57600, - "use_1200bps_touch": "true", - "wait_for_upload_port": "true" + "use_1200bps_touch": true, + "wait_for_upload_port": true } }, "robotMotor": { @@ -630,13 +493,13 @@ "name": "Arduino Robot Motor", "platform": "atmelavr", "upload": { - "disable_flushing": "true", + "disable_flushing": true, "maximum_ram_size": 2560, "maximum_size": 28672, "protocol": "avr109", "speed": 57600, - "use_1200bps_touch": "true", - "wait_for_upload_port": "true" + "use_1200bps_touch": true, + "wait_for_upload_port": true } }, "uno": { @@ -671,14 +534,14 @@ "name": "Arduino Yun", "platform": "atmelavr", "upload": { - "disable_flushing": "true", + "disable_flushing": true, "maximum_ram_size": 2560, "maximum_size": 28672, "protocol": "avr109", "speed": 57600, - "use_1200bps_touch": "true", - "via_ssh": "true", - "wait_for_upload_port": "true" + "use_1200bps_touch": true, + "via_ssh": true, + "wait_for_upload_port": true } } } \ No newline at end of file diff --git a/platformio/boards/microduino.json b/platformio/boards/microduino.json index 01740513..4799e105 100644 --- a/platformio/boards/microduino.json +++ b/platformio/boards/microduino.json @@ -114,13 +114,13 @@ "name": "Microduino Core USB (ATmega32U4@16M,5V)", "platform": "atmelavr", "upload": { - "disable_flushing": "true", + "disable_flushing": true, "maximum_ram_size": 2560, "maximum_size": 28672, "protocol": "avr109", "speed": 57600, - "use_1200bps_touch": "true", - "wait_for_upload_port": "true" + "use_1200bps_touch": true, + "wait_for_upload_port": true } }, "644pa16m": { From 7af9f50426730dedc65afcf8881f27cf91b534b3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Dec 2014 20:41:21 +0200 Subject: [PATCH 15/30] Fix firmware uploading to Arduino Leonardo-based boards // Resolve #40 --- platformio/builder/scripts/atmelavr.py | 17 +++++++++--- platformio/builder/tools/platformio.py | 37 +++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/platformio/builder/scripts/atmelavr.py b/platformio/builder/scripts/atmelavr.py index 9fdc0460..2b2584a4 100644 --- a/platformio/builder/scripts/atmelavr.py +++ b/platformio/builder/scripts/atmelavr.py @@ -58,7 +58,6 @@ env.Replace( UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"), UPLOADERFLAGS=[ - "-V", # do not verify "-q", # suppress progress output "-D", # disable auto erase for flash memory "-p", "$BOARD_MCU", @@ -118,7 +117,19 @@ def before_upload(): rpi_sysgpio("/sys/class/gpio/gpio18/value", 0) rpi_sysgpio("/sys/class/gpio/unexport", 18) else: - return env.FlushSerialBuffer("$UPLOAD_PORT") + upload_options = env.get("BOARD_OPTIONS", {}).get("upload", {}) + + if not upload_options.get("disable_flushing", False): + env.FlushSerialBuffer("$UPLOAD_PORT") + + before_ports = [i['port'] for i in get_serialports()] + + if (upload_options.get("use_1200bps_touch", False) and + "UPLOAD_PORT" in env): + env.TouchSerialPort("$UPLOAD_PORT", 1200) + + if upload_options.get("wait_for_upload_port", False): + env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports)) CORELIBS = env.ProcessGeneral() @@ -174,7 +185,7 @@ if is_uptarget: for item in get_serialports(): if "VID:PID" in item['hwid']: print "Auto-detected UPLOAD_PORT: %s" % item['port'] - env['UPLOAD_PORT'] = item['port'] + env.Replace(UPLOAD_PORT=item['port']) break if "UPLOAD_PORT" not in env: diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 822600fb..1da60525 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -2,14 +2,17 @@ # See LICENSE for details. import atexit +import platform import re from os import getenv, listdir, remove, walk from os.path import basename, isdir, isfile, join from time import sleep -from SCons.Script import SConscript, SConscriptChdir +from SCons.Script import Exit, SConscript, SConscriptChdir from serial import Serial +from platformio.util import get_serialports + def ProcessGeneral(env): corelibs = [] @@ -187,6 +190,36 @@ def FlushSerialBuffer(env, port): s.close() +def TouchSerialPort(env, port, baudrate): + s = Serial(port=env.subst(port), baudrate=baudrate) + s.close() + if platform.system() != "Darwin": + sleep(0.3) + + +def WaitForNewSerialPort(env, before): + new_port = None + elapsed = 0 + while elapsed < 10: + now = [i['port'] for i in get_serialports()] + diff = list(set(now) - set(before)) + if diff: + new_port = diff[0] + break + + before = now + sleep(0.25) + elapsed += 0.25 + + if not new_port: + Exit("Error: Couldn't find a board on the selected port. " + "Check that you have the correct port selected. " + "If it is correct, try pressing the board's reset " + "button after initiating the upload.") + + return new_port + + def exists(_): return True @@ -202,4 +235,6 @@ def generate(env): env.AddMethod(VariantDirRecursive) env.AddMethod(ConvertInoToCpp) env.AddMethod(FlushSerialBuffer) + env.AddMethod(TouchSerialPort) + env.AddMethod(WaitForNewSerialPort) return env From 200944ebb3fc34b128212c3a53e26908be04560a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Dec 2014 20:43:29 +0200 Subject: [PATCH 16/30] Fix lint warning with unused argument --- platformio/builder/tools/platformio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 1da60525..f6a2e4f1 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -197,7 +197,7 @@ def TouchSerialPort(env, port, baudrate): sleep(0.3) -def WaitForNewSerialPort(env, before): +def WaitForNewSerialPort(_, before): new_port = None elapsed = 0 while elapsed < 10: From 4a5903849e900951ddccab6eaec36ae6b83bf5f4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Dec 2014 20:57:05 +0200 Subject: [PATCH 17/30] Automatic detection of port on "serialports monitor" // Resolve #37 --- HISTORY.rst | 2 ++ platformio/commands/serialports.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index c20f2f59..b0d95210 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -10,6 +10,8 @@ Release History via USB programmer (USBasp) to `atmelavr `_ MCUs (`issue #35 `_) +* Automatic detection of port on `platformio serialports monitor `_ + (`issue #37 `_) * Fixed urllib3's SSL warning under Python <= 2.7.2 (`issue #39 `_) * Fixed bug with Arduino's USB boards (`issue #40 `_) diff --git a/platformio/commands/serialports.py b/platformio/commands/serialports.py index 4a73775c..d75eba85 100644 --- a/platformio/commands/serialports.py +++ b/platformio/commands/serialports.py @@ -61,8 +61,15 @@ def serialports_list(): "miniterm (menu), default=0x14") @click.option("--quiet", is_flag=True, help="Diagnostics: suppress non-error messages, default=Off") -def serialports_monitor(**_): +def serialports_monitor(**kwargs): sys.argv = sys.argv[3:] + + if not kwargs['port']: + for item in get_serialports(): + if "VID:PID" in item['hwid']: + sys.argv += ["--port", item['port']] + break + try: miniterm.main() except: # pylint: disable=W0702 From 9cfa4e40d0b385fe9d0e69f1444d38fb0c7f1b94 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Dec 2014 22:57:36 +0200 Subject: [PATCH 18/30] Cleanup extra_flags --- platformio/boards/arduino.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/platformio/boards/arduino.json b/platformio/boards/arduino.json index 4c281814..3e86b106 100644 --- a/platformio/boards/arduino.json +++ b/platformio/boards/arduino.json @@ -3,7 +3,6 @@ "build": { "board": "AVR_LILYPAD_USB", "core": "arduino", - "extra_flags": "{build.usb_flags}", "f_cpu": "8000000L", "mcu": "atmega32u4", "pid": "0x9208", @@ -131,7 +130,6 @@ "build": { "board": "AVR_ESPLORA", "core": "arduino", - "extra_flags": "{build.usb_flags}", "f_cpu": "16000000L", "mcu": "atmega32u4", "pid": "0x803c", @@ -189,7 +187,6 @@ "build": { "board": "AVR_LEONARDO", "core": "arduino", - "extra_flags": "{build.usb_flags}", "f_cpu": "16000000L", "mcu": "atmega32u4", "pid": "0x8036", @@ -298,7 +295,6 @@ "build": { "board": "AVR_MICRO", "core": "arduino", - "extra_flags": "{build.usb_flags}", "f_cpu": "16000000L", "mcu": "atmega32u4", "pid": "0x8037", @@ -458,7 +454,6 @@ "build": { "board": "AVR_ROBOT_CONTROL", "core": "arduino", - "extra_flags": "{build.usb_flags}", "f_cpu": "16000000L", "mcu": "atmega32u4", "pid": "0x8038", @@ -482,7 +477,6 @@ "build": { "board": "AVR_ROBOT_MOTOR", "core": "arduino", - "extra_flags": "{build.usb_flags}", "f_cpu": "16000000L", "mcu": "atmega32u4", "pid": "0x8039", @@ -523,7 +517,6 @@ "build": { "board": "AVR_YUN", "core": "arduino", - "extra_flags": "{build.usb_flags}", "f_cpu": "16000000L", "mcu": "atmega32u4", "pid": "0x8041", From c3686b40982f396af809e6e9fa9003cf5867d35e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Dec 2014 22:58:27 +0200 Subject: [PATCH 19/30] Improve compatibility with Arduino bundled libs --- platformio/builder/tools/platformio.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index f6a2e4f1..9272fa90 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -89,10 +89,16 @@ def GetDependentLibraries(env, src_dir): result = [] for i in includes: - item = (i[1][1], i[1][2]) - if item in result: - continue - result.append(item) + items = [(i[1][1], i[1][2])] + + if isdir(join(items[0][1], "utility")): + items.append(("%sUtility" % items[0][0], + join(items[0][1], "utility"))) + + for item in items: + if item in result: + continue + result.append(item) return result From f78f5b454b4909781b5307158e596b5c45c9dbb5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Dec 2014 23:09:07 +0200 Subject: [PATCH 20/30] Parse libs in header files --- platformio/builder/tools/platformio.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 9272fa90..d76eea5f 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -83,7 +83,8 @@ def BuildDependentLibraries(env, src_dir): def GetDependentLibraries(env, src_dir): includes = {} regexp = re.compile(r"^\s*#include\s+(?:\<|\")([^\>\"\']+)(?:\>|\")", re.M) - for node in env.GlobCXXFiles(src_dir): + nodes = env.GlobCXXFiles(src_dir) + env.Glob(join(src_dir, "*.h")) + for node in nodes: env.ParseIncludesRecurive(regexp, node, includes) includes = sorted(includes.items(), key=lambda s: s[0]) From 1b7065d8c1611bfacdab7d30dea133c32417c7d8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Dec 2014 23:38:18 +0200 Subject: [PATCH 21/30] Added support for *Engduino* boards // Resolve #38 --- HISTORY.rst | 11 +++-- platformio/boards/engduino.json | 71 +++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 platformio/boards/engduino.json diff --git a/HISTORY.rst b/HISTORY.rst index b0d95210..9bd66af6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,14 +6,17 @@ Release History * Implemented `platformio boards `_ command (`issue #11 `_) +* Added support of *Engduino* boards for + `atmelavr `__ + platform (`issue #38 `_) * Added `example with uploading firmware `_ - via USB programmer (USBasp) to + via USB programmer (USBasp) for `atmelavr `_ - MCUs (`issue #35 `_) + *MCUs* (`issue #35 `_) * Automatic detection of port on `platformio serialports monitor `_ (`issue #37 `_) -* Fixed urllib3's SSL warning under Python <= 2.7.2 (`issue #39 `_) -* Fixed bug with Arduino's USB boards (`issue #40 `_) +* Fixed urllib3's *SSL* warning under Python <= 2.7.2 (`issue #39 `_) +* Fixed bug with *Arduino USB* boards (`issue #40 `_) 0.9.2 (2014-12-10) ------------------ diff --git a/platformio/boards/engduino.json b/platformio/boards/engduino.json new file mode 100644 index 00000000..50c5209b --- /dev/null +++ b/platformio/boards/engduino.json @@ -0,0 +1,71 @@ +{ + "engduinov1": { + "build": { + "board": "AVR_ENGDUINOV1", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega32u4", + "pid": "0x9208", + "usb_product": "EngduinoV1", + "variant": "engduinov1", + "vid": "0x1B4F" + }, + "name": "EngduinoV1", + "platform": "atmelavr", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "speed": 57600, + "use_1200bps_touch": true, + "wait_for_upload_port": true + } + }, + "engduinov2": { + "build": { + "board": "AVR_ENGDUINOV2", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega32u4", + "pid": "0x9208", + "usb_product": "EngduinoV2", + "variant": "engduinov2", + "vid": "0x1B4F" + }, + "name": "EngduinoV2", + "platform": "atmelavr", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "speed": 57600, + "use_1200bps_touch": true, + "wait_for_upload_port": true + } + }, + "engduinov3": { + "build": { + "board": "AVR_ENGDUINOV3", + "core": "arduino", + "f_cpu": "8000000L", + "mcu": "atmega32u4", + "pid": "0x9208", + "usb_product": "EngduinoV3", + "variant": "engduinov3", + "vid": "0x1B4F" + }, + "name": "EngduinoV3", + "platform": "atmelavr", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "speed": 57600, + "use_1200bps_touch": true, + "wait_for_upload_port": true + } + } +} \ No newline at end of file From 740f609ca822ba1f000a3971358da7403145c9c0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Dec 2014 23:38:45 +0200 Subject: [PATCH 22/30] Added docs for Engduino boards --- docs/platforms/atmelavr.rst | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index 29603813..32cea252 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -219,6 +219,41 @@ More detailed information you can find here `Arduino boards `_. +Engduino +~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller ``board_mcu`` + - Frequency ``board_f_cpu`` + - Flash + - RAM + * - ``engduinov1`` + - `EngduinoV1 `_ + - ATmega32u4 ``atmega32u4`` + - 8 MHz ``8000000L`` + - 32 Kb + - 2.5 Kb + * - ``engduinov2`` + - `EngduinoV2 `_ + - ATmega32u4 ``atmega32u4`` + - 8 MHz ``8000000L`` + - 32 Kb + - 2.5 Kb + * - ``engduinov3`` + - `EngduinoV3 `_ + - ATmega32u4 ``atmega32u4`` + - 8 MHz ``8000000L`` + - 32 Kb + - 2.5 Kb + +More detailed information you can find here +`Engduino Site `_. + + Microduino ~~~~~~~~~~ @@ -320,5 +355,5 @@ Raspduino - 32 Kb - 2 Kb -More detailed information you can find in +More detailed information you can find here `Wiki `_. From c109857707cffbe280b962de5762ad071e58f23b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Dec 2014 23:49:46 +0200 Subject: [PATCH 23/30] Correct Engduino names --- docs/platforms/atmelavr.rst | 6 +++--- platformio/boards/engduino.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index 32cea252..9b8aa94d 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -232,19 +232,19 @@ Engduino - Flash - RAM * - ``engduinov1`` - - `EngduinoV1 `_ + - `Engduino 1 `_ - ATmega32u4 ``atmega32u4`` - 8 MHz ``8000000L`` - 32 Kb - 2.5 Kb * - ``engduinov2`` - - `EngduinoV2 `_ + - `Engduino 2 `_ - ATmega32u4 ``atmega32u4`` - 8 MHz ``8000000L`` - 32 Kb - 2.5 Kb * - ``engduinov3`` - - `EngduinoV3 `_ + - `Engduino 3 `_ - ATmega32u4 ``atmega32u4`` - 8 MHz ``8000000L`` - 32 Kb diff --git a/platformio/boards/engduino.json b/platformio/boards/engduino.json index 50c5209b..0d45a52c 100644 --- a/platformio/boards/engduino.json +++ b/platformio/boards/engduino.json @@ -10,7 +10,7 @@ "variant": "engduinov1", "vid": "0x1B4F" }, - "name": "EngduinoV1", + "name": "Engduino 1", "platform": "atmelavr", "upload": { "disable_flushing": true, @@ -33,7 +33,7 @@ "variant": "engduinov2", "vid": "0x1B4F" }, - "name": "EngduinoV2", + "name": "Engduino 2", "platform": "atmelavr", "upload": { "disable_flushing": true, @@ -56,7 +56,7 @@ "variant": "engduinov3", "vid": "0x1B4F" }, - "name": "EngduinoV3", + "name": "Engduino 3", "platform": "atmelavr", "upload": { "disable_flushing": true, From 82744afe585f7a2ef709fe302486f8d39e323e4f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 29 Dec 2014 15:10:31 +0200 Subject: [PATCH 24/30] Allow auto-installation of platforms when prompts are disabled // Resolve #43 --- HISTORY.rst | 3 ++- platformio/commands/run.py | 8 +++++--- platformio/commands/show.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 9bd66af6..463e45db 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,7 +15,8 @@ Release History *MCUs* (`issue #35 `_) * Automatic detection of port on `platformio serialports monitor `_ (`issue #37 `_) -* Fixed urllib3's *SSL* warning under Python <= 2.7.2 (`issue #39 `_) +* Allowed auto-installation of platforms when prompts are disabled (`issue #43 `_) +* Fixed urllib3's *SSL* warning under Python <= 2.7.2 (`issue #39 `_) * Fixed bug with *Arduino USB* boards (`issue #40 `_) 0.9.2 (2014-12-10) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index c45f61d6..2458b3bb 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -68,10 +68,12 @@ def process_environment(ctx, name, options, targets, upload_port): telemetry.on_run_environment(options, envtargets) - if (app.get_setting("enable_prompts") and - platform not in PlatformFactory.get_platforms(installed=True) and + 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)): + "Would you like to install it now?" % platform))): ctx.invoke(cmd_install, platforms=[platform]) p = PlatformFactory.newPlatform(platform) diff --git a/platformio/commands/show.py b/platformio/commands/show.py index de8769bb..989b9aaf 100644 --- a/platformio/commands/show.py +++ b/platformio/commands/show.py @@ -21,7 +21,7 @@ def cli(ctx, platform): installed=True).keys() if platform not in installed_platforms: - if (app.get_setting("enable_prompts") and + 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]) From af191834d154b68b555fad165943809e6373647f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 29 Dec 2014 20:22:01 +0200 Subject: [PATCH 25/30] Allow to initialise project with the specified embedded boards // Resolve #21 --- HISTORY.rst | 3 +++ docs/projectconf.rst | 6 +++++ docs/quickstart.rst | 47 ++++++++++------------------------- docs/userguide/cmd_init.rst | 37 ++++++++++++++++++++++++++- platformio/commands/init.py | 42 ++++++++++++++++++++++++++++--- platformio/exception.py | 5 ++++ platformio/projectconftpl.ini | 12 +++++++-- 7 files changed, 112 insertions(+), 40 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 463e45db..266b83aa 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,6 +9,9 @@ Release History * Added support of *Engduino* boards for `atmelavr `__ platform (`issue #38 `_) +* Added ``--board`` option to `platformio init `_ + command which allows to initialise project with the specified embedded boards + (`issue #21 `_) * Added `example with uploading firmware `_ via USB programmer (USBasp) for `atmelavr `_ diff --git a/docs/projectconf.rst b/docs/projectconf.rst index 0c017f4f..eb6ab93c 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -58,18 +58,24 @@ For example, ``[env:hello_world]``. Options ~~~~~~~ +.. _projectconf_env_platform: + ``platform`` ^^^^^^^^^^^^ :ref:`Platform ` type +.. _projectconf_env_framework: + ``framework`` ^^^^^^^^^^^^^ See ``framework`` type in *Frameworks* section of :ref:`platforms` +.. _projectconf_env_board: + ``board`` ^^^^^^^^^ diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 1fc63923..789ea3f8 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -7,33 +7,18 @@ Quickstart Please read `Get Started `_ article from the official WebSite. -First, :ref:`Install PlatformIO `. +1. :ref:`Install PlatformIO `. -Print all available development platforms for installing +2. Find board ``type`` from :ref:`platforms` (you can choose multiple board + types). + +3. Initialize new PlatformIO based project with the pre-configured + environments for your boards: .. code-block:: bash - $ platformio search - [ ... ] + $ platformio init --board=TYPE1 --board=TYPE2 - -Install new development platform - -.. code-block:: bash - - $ platformio install PLATFORM - Downloading [####################################] 100% - Unpacking [####################################] 100% - Installing ..... - [ ... ] - The platform 'PLATFORM' has been successfully installed! - - -Initialize new PlatformIO based project - -.. code-block:: bash - - $ platformio init The current working directory *** will be used for the new project. You can specify another project directory via `platformio init -d %PATH_TO_THE_PROJECT_DIR%` command. @@ -46,29 +31,23 @@ Initialize new PlatformIO based project Project has been successfully initialized! Now you can process it with `platformio run` command. +More detailed information about this command is here :ref:`cmd_init`. -Setup environments in ``platformio.ini``. For more examples go to -:ref:`Project Configuration File ` - -.. code-block:: ini - - # Simple and base environment - [env:mybaseenv] - platform = %INSTALLED_PLATFORM_NAME_HERE% - - -Process the project's environments +4. Process the project's environments. .. code-block:: bash $ platformio run - # if embedded project then upload firmware + # if you don't have specified `targets = upload` option for environment, + # then you can upload firmware manually with this command: $ platformio run --target upload # clean project $ platformio run --target clean +If you don't have installed required platforms, then *PlatformIO* will propose +you to install them automatically. Further examples can be found in the ``examples/`` directory in the source distribution or `on the web `_. diff --git a/docs/userguide/cmd_init.rst b/docs/userguide/cmd_init.rst index fb2ac331..295d2b89 100644 --- a/docs/userguide/cmd_init.rst +++ b/docs/userguide/cmd_init.rst @@ -32,8 +32,27 @@ Options .. option:: --project-dir, -d -Specified path to the directory where *PlatformIO* will initialize new project. +A path to the directory where *PlatformIO* will initialise new project. +.. option:: + --board, -b + +If you specify board ``type`` (you can pass multiple ``--board`` options), then +*PlatformIO* will automatically generate environment for :ref:`projectconf` and +pre-fill these data: + +* :ref:`projectconf_env_platform` +* :ref:`projectconf_env_framework` +* :ref:`projectconf_env_board` + +The full list with pre-configured boards is available here :ref:`platforms`. + +.. option:: + --disable-auto-uploading + +If you initialise project with the specified ``--board``, then *PlatformIO* +will create environment with enabled firmware auto-uploading. This option +allows you to disable firmware auto-uploading by default. Examples -------- @@ -43,6 +62,7 @@ Examples .. code-block:: bash $ platformio init + The current working directory *** will be used for the new project. You can specify another project directory via `platformio init -d %PATH_TO_THE_PROJECT_DIR%` command. @@ -61,6 +81,21 @@ Examples .. code-block:: bash $ platformio init -d %PATH_TO_DIR% + + The next files/directories will be created in *** + platformio.ini - Project Configuration File + src - a source directory. Put your source code here + lib - a directory for the project specific libraries + Do you want to continue? [y/N]: y + Project has been successfully initialized! + Now you can process it with `platformio run` command. + +3. Initialise project for Arduino Uno + +.. code-block:: bash + + $ platformio init --board uno + The next files/directories will be created in *** platformio.ini - Project Configuration File src - a source directory. Put your source code here diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 986d784c..10e0fb2f 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -8,15 +8,17 @@ from shutil import copyfile import click from platformio import app -from platformio.exception import ProjectInitialized -from platformio.util import get_source_dir +from platformio.exception import ProjectInitialized, UnknownBoard +from platformio.util import get_boards, get_source_dir @click.command("init", short_help="Initialize new PlatformIO based project") @click.option("--project-dir", "-d", default=getcwd(), type=click.Path(exists=True, file_okay=False, dir_okay=True, writable=True, resolve_path=True)) -def cli(project_dir): +@click.option("--board", "-b", multiple=True, metavar="TYPE") +@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") @@ -24,6 +26,10 @@ def cli(project_dir): if all([isfile(project_file), isdir(src_dir), isdir(lib_dir)]): raise ProjectInitialized() + builtin_boards = set(get_boards().keys()) + if board and not set(board).issubset(builtin_boards): + raise UnknownBoard(", ".join(set(board).difference(builtin_boards))) + if project_dir == getcwd(): click.secho("The current working directory", fg="yellow", nl=False) click.secho(" %s " % project_dir, fg="cyan", nl=False) @@ -51,6 +57,8 @@ def cli(project_dir): if not isfile(project_file): copyfile(join(get_source_dir(), "projectconftpl.ini"), project_file) + if board: + fill_project_envs(project_file, board, disable_auto_uploading) click.secho( "Project has been successfully initialized!\n" "Now you can process it with `platformio run` command.", @@ -58,3 +66,31 @@ def cli(project_dir): ) else: click.secho("Aborted by user", fg="red") + + +def fill_project_envs(project_file, board_types, disable_auto_uploading): + builtin_boards = get_boards() + content = [] + for type_ in board_types: + if type_ not in builtin_boards: + continue + else: + content.append("") + + data = builtin_boards[type_] + framework = data.get("build", {}).get("core", None) + if framework in ("msp430", "lm4f"): + framework = "energia" + + content.append("[env:autogen_%s]" % type_) + content.append("platform = %s" % data['platform']) + + if framework: + content.append("framework = %s" % framework) + content.append("board = %s" % type_) + + content.append("%stargets = upload" % "# " if disable_auto_uploading + else "") + + with open(project_file, "a") as f: + f.write("\n".join(content)) diff --git a/platformio/exception.py b/platformio/exception.py index bbfc2f01..727a4602 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -30,6 +30,11 @@ class UnknownCLICommand(PlatformioException): " to see all available commands") +class UnknownBoard(PlatformioException): + + MESSAGE = "Unknown board type '%s'" + + class UnknownPackage(PlatformioException): MESSAGE = "Detected unknown package '%s'" diff --git a/platformio/projectconftpl.ini b/platformio/projectconftpl.ini index 21525446..ce94d9de 100644 --- a/platformio/projectconftpl.ini +++ b/platformio/projectconftpl.ini @@ -5,6 +5,14 @@ # http://docs.platformio.ikravets.com/en/latest/projectconf.html # +# A sign `#` at the beginning of the line indicate a comment +# Comment lines are ignored. + # Simple and base environment -#[env:mybaseenv] -#platform = %INSTALLED_PLATFORM_NAME_HERE% +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload From e8628443f0f107395532281aa9eca9d0728e31e7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 29 Dec 2014 20:27:11 +0200 Subject: [PATCH 26/30] Correct spelling --- docs/projectconf.rst | 2 +- platformio/projectconftpl.ini | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/projectconf.rst b/docs/projectconf.rst index eb6ab93c..999ec4c0 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -8,7 +8,7 @@ The Project configuration file is named ``platformio.ini``. This is a ``platformio.ini`` has sections (each denoted by a ``[header]``) and key / value pairs within the sections. A sign ``#`` at the beginning of the -line indicate a comment. Comment lines are ignored. +line indicates a comment. Comment lines are ignored. The sections and their allowable values are described below. diff --git a/platformio/projectconftpl.ini b/platformio/projectconftpl.ini index ce94d9de..2194934a 100644 --- a/platformio/projectconftpl.ini +++ b/platformio/projectconftpl.ini @@ -1,11 +1,11 @@ # # Project Configuration File # -# A detailed documentation with EXAMPLES is located here: +# A detailed documentation with the EXAMPLES is located here: # http://docs.platformio.ikravets.com/en/latest/projectconf.html # -# A sign `#` at the beginning of the line indicate a comment +# A sign `#` at the beginning of the line indicates a comment # Comment lines are ignored. # Simple and base environment From 95582d16a6e272395716e5a0533c9f195d3bace2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 30 Dec 2014 14:02:20 +0200 Subject: [PATCH 27/30] Rename Twitter account to @PlatformIO_Org --- README.rst | 2 +- docs/index.rst | 2 +- platformio/maintenance.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index a92a43d6..11ea743f 100644 --- a/README.rst +++ b/README.rst @@ -21,7 +21,7 @@ PlatformIO `Documentation `_ | `Project Examples `_ | `Blog `_ | -`Twitter `_ +`Twitter `_ .. image:: https://raw.githubusercontent.com/ivankravets/platformio/develop/docs/_static/platformio-logo.png :target: http://platformio.ikravets.com diff --git a/docs/index.rst b/docs/index.rst index b72528a6..5ebd76ad 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,7 +9,7 @@ PlatformIO: A cross-platform code builder and the missing library manager `Source Code `_ | `Issues `_ | `Blog `_ | -`Twitter `_ +`Twitter `_ You have no need to install any *IDE* or compile any tool chains. *PlatformIO* has pre-built different development platforms including: compiler, debugger, diff --git a/platformio/maintenance.py b/platformio/maintenance.py index d7d620d5..37b133be 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -92,7 +92,7 @@ def after_upgrade(ctx): "- %s us on Twitter to stay up-to-date " "on the latest project news > %s" % (click.style("follow", fg="cyan"), - click.style("https://twitter.com/platformiotool", fg="cyan")) + click.style("https://twitter.com/PlatformIO_Org", fg="cyan")) ) click.echo("- %s us a star on GitHub > %s" % ( click.style("give", fg="cyan"), From c74d10b2e31356f156ace04e298bce553b087fa6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 30 Dec 2014 23:22:42 +0200 Subject: [PATCH 28/30] Migrate to PlatformIO open-source ORG domain --- HISTORY.rst | 64 ++++++++++++++-------------- README.rst | 58 ++++++++++++------------- docs/index.rst | 4 +- docs/librarymanager/index.rst | 2 +- docs/quickstart.rst | 2 +- docs/userguide/lib/cmd_install.rst | 8 ++-- docs/userguide/lib/cmd_search.rst | 16 +++---- docs/userguide/lib/cmd_show.rst | 2 +- docs/userguide/lib/cmd_uninstall.rst | 2 +- platformio/__init__.py | 4 +- platformio/commands/lib.py | 2 +- platformio/exception.py | 2 +- platformio/maintenance.py | 2 +- platformio/projectconftpl.ini | 4 +- 14 files changed, 86 insertions(+), 86 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 266b83aa..8977ce5e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,19 +4,19 @@ Release History 0.10.0 (?) ---------- -* Implemented `platformio boards `_ +* Implemented `platformio boards `_ command (`issue #11 `_) * Added support of *Engduino* boards for - `atmelavr `__ + `atmelavr `__ platform (`issue #38 `_) -* Added ``--board`` option to `platformio init `_ +* Added ``--board`` option to `platformio init `_ command which allows to initialise project with the specified embedded boards (`issue #21 `_) -* Added `example with uploading firmware `_ +* Added `example with uploading firmware `_ via USB programmer (USBasp) for - `atmelavr `_ + `atmelavr `_ *MCUs* (`issue #35 `_) -* Automatic detection of port on `platformio serialports monitor `_ +* Automatic detection of port on `platformio serialports monitor `_ (`issue #37 `_) * Allowed auto-installation of platforms when prompts are disabled (`issue #43 `_) * Fixed urllib3's *SSL* warning under Python <= 2.7.2 (`issue #39 `_) @@ -26,7 +26,7 @@ Release History ------------------ * Replaced "dark blue" by "cyan" colour for the texts (`issue #33 `_) -* Added new setting `enable_prompts `_ +* Added new setting `enable_prompts `_ and allowed to disable all *PlatformIO* prompts (useful for cloud compilers) (`issue #34 `_) * Fixed compilation bug on *Windows* with installed *MSVC* (`issue #18 `_) @@ -35,11 +35,11 @@ Release History ------------------ * Ask user to install platform (when it hasn't been installed yet) within - `platformio run `__ - and `platformio show `_ commands -* Improved main `documentation `_ + `platformio run `__ + and `platformio show `_ commands +* Improved main `documentation `_ * Fixed "*OSError: [Errno 2] No such file or directory*" within - `platformio run `__ + `platformio run `__ command when PlatformIO isn't installed properly * Fixed example for `Eclipse IDE with Tiva board `_ (`issue #32 `_) @@ -49,8 +49,8 @@ Release History 0.9.0 (2014-12-01) ------------------ -* Implemented `platformio settings `_ command -* Improved `platformio init `_ command. +* Implemented `platformio settings `_ command +* Improved `platformio init `_ command. Added new option ``--project-dir`` where you can specify another path to directory where new project will be initialized (`issue #31 `_) * Added *Migration Manager* which simplifies process with upgrading to a @@ -67,18 +67,18 @@ Release History 0.8.0 (2014-10-19) ------------------ -* Avoided trademark issues in `library.json `_ - with the new fields: `frameworks `_, - `platforms `_ - and `dependencies `_ +* Avoided trademark issues in `library.json `_ + with the new fields: `frameworks `_, + `platforms `_ + and `dependencies `_ (`issue #17 `_) * Switched logic from "Library Name" to "Library Registry ID" for all - `platformio lib `_ + `platformio lib `_ commands (install, uninstall, update and etc.) -* Renamed ``author`` field to `authors `_ - and allowed to setup multiple authors per library in `library.json `_ -* Added option to specify "maintainer" status in `authors `_ field -* New filters/options for `platformio lib search `_ +* Renamed ``author`` field to `authors `_ + and allowed to setup multiple authors per library in `library.json `_ +* Added option to specify "maintainer" status in `authors `_ field +* New filters/options for `platformio lib search `_ command: ``--framework`` and ``--platform`` 0.7.1 (2014-10-06) @@ -92,15 +92,15 @@ Release History 0.7.0 (2014-09-24) ------------------ -* Implemented new `[platformio] `_ - section for Configuration File with `home_dir `_ +* Implemented new `[platformio] `_ + section for Configuration File with `home_dir `_ option (`issue #14 `_) * Implemented *Library Manager* (`issue #6 `_) 0.6.0 (2014-08-09) ------------------ -* Implemented `platformio serialports monitor `_ (`issue #10 `_) +* Implemented `platformio serialports monitor `_ (`issue #10 `_) * Fixed an issue ``ImportError: No module named platformio.util`` (`issue #9 `_) * Fixed bug with auto-conversation from Arduino \*.ino to \*.cpp @@ -113,7 +113,7 @@ Release History frameworks (`issue #7 `_) * Added `Arduino example `_ with external library (*Adafruit CC3000*) -* Implemented `platformio upgrade `_ +* Implemented `platformio upgrade `_ command and "auto-check" for the latest version (`issue #8 `_) * Fixed an issue with "auto-reset" for *Raspduino* board @@ -122,21 +122,21 @@ Release History 0.4.0 (2014-07-31) ------------------ -* Implemented `platformio serialports `_ command +* Implemented `platformio serialports `_ command * Allowed to put special build flags only for ``src`` files via - `srcbuild_flags `_ + `srcbuild_flags `_ environment option * Allowed to override some of settings via system environment variables such as: ``$PIOSRCBUILD_FLAGS`` and ``$PIOENVS_DIR`` -* Added ``--upload-port`` option for `platformio run `__ command +* Added ``--upload-port`` option for `platformio run `__ command * Implemented (especially for `SmartAnthill `_) - `platformio run -t uploadlazy `_ + `platformio run -t uploadlazy `_ target (no dependencies to framework libs, ELF and etc.) -* Allowed to skip default packages via `platformio install --skip-default-package `_ +* Allowed to skip default packages via `platformio install --skip-default-package `_ option * Added tools for *Raspberry Pi* platform * Added support for *Microduino* and *Raspduino* boards in - `atmelavr `_ platform + `atmelavr `_ platform 0.3.1 (2014-06-21) diff --git a/README.rst b/README.rst index 11ea743f..99366baf 100644 --- a/README.rst +++ b/README.rst @@ -17,26 +17,26 @@ PlatformIO :target: https://pypi.python.org/pypi/platformio/ :alt: License -`Website + Library Search `_ | -`Documentation `_ | +`Website + Library Search `_ | +`Documentation `_ | `Project Examples `_ | `Blog `_ | `Twitter `_ .. image:: https://raw.githubusercontent.com/ivankravets/platformio/develop/docs/_static/platformio-logo.png - :target: http://platformio.ikravets.com + :target: http://platformio.org -`PlatformIO `_ is a cross-platform code builder +`PlatformIO `_ is a cross-platform code builder and the missing library manager. -* `Get Started `_ -* `Web 2.0 Library Search `_ -* `Development Platforms `_ -* `Embedded Boards `_ -* `Library Manager `_ -* `User Guide `_ -* `IDE Integration `_ -* `Release History `_ +* `Get Started `_ +* `Web 2.0 Library Search `_ +* `Development Platforms `_ +* `Embedded Boards `_ +* `Library Manager `_ +* `User Guide `_ +* `IDE Integration `_ +* `Release History `_ You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO* has pre-built different development platforms including: compiler, debugger, @@ -52,18 +52,18 @@ sized computers (like *Raspberry Pi*). Embedded Development. *Easier Than Ever.* ----------------------------------------- *PlatformIO* is well suited for embedded development and has pre-configured -settings for most popular `Embedded Boards `_. +settings for most popular `Embedded Boards `_. * Colourful `command-line output `_ -* Built-in `Serial Port Monitor `_ -* Configurable `build -flags/-options `_ +* Built-in `Serial Port Monitor `_ +* Configurable `build -flags/-options `_ * Automatic **firmware uploading** -* Integration with `development environments (IDE) `_ +* Integration with `development environments (IDE) `_ * Ready for **cloud compilers** -* Pre-built tool chains, frameworks for the popular `Hardware Platforms `_ +* Pre-built tool chains, frameworks for the popular `Hardware Platforms `_ .. image:: https://raw.githubusercontent.com/ivankravets/platformio-web/develop/app/images/platformio-embedded-development.png - :target: http://platformio.ikravets.com + :target: http://platformio.org :alt: PlatformIO Embedded Development Process The Missing Library Manager. *It's here!* @@ -71,16 +71,16 @@ The Missing Library Manager. *It's here!* *PlatformIO Library Manager* is the missing library manager for development platforms which allows you to organize and have up-to-date external libraries. -* Friendly `Command-Line Interface `_ -* Modern `Web 2.0 Library Search `_ +* Friendly `Command-Line Interface `_ +* Modern `Web 2.0 Library Search `_ * Open Source `Library Registry API `_ -* Library Crawler based on `library.json `_ +* Library Crawler based on `library.json `_ specification * Library **dependency management** * Automatic library updating .. image:: https://raw.githubusercontent.com/ivankravets/platformio-web/develop/app/images/platformio-library-manager.png - :target: http://platformio.ikravets.com + :target: http://platformio.org :alt: PlatformIO Library Manager Architecture Smart Code Builder. *Fast and Reliable.* @@ -93,30 +93,30 @@ cross-platform substitute for the classic *Make* utility. * Reliable detection of *build changes* * Improved support for *parallel builds* * Ability to share *built files in a cache* -* Lookup for external libraries which are installed via `Library Manager `_ +* Lookup for external libraries which are installed via `Library Manager `_ .. image:: https://raw.githubusercontent.com/ivankravets/platformio-web/develop/app/images/platformio-scons-builder.png - :target: http://platformio.ikravets.com + :target: http://platformio.org :alt: PlatformIO Code Builder Architecture Single source code. *Multiple platforms.* ----------------------------------------- *PlatformIO* allows developer to compile the same code with different development platforms using the *Only One Command* -`platformio run `_. +`platformio run `_. This happens due to -`Project Configuration File (platformio.ini) `_ +`Project Configuration File (platformio.ini) `_ where you can setup different environments with specific options (platform type, firmware uploading settings, pre-built framework, build flags and many more). It has support for many popular embedded platforms like these: -* ``atmelavr`` `Atmel AVR `_ +* ``atmelavr`` `Atmel AVR `_ (including *Arduino*-based boards, *Microduino, Raspduino, Teensy*) -* ``timsp430`` `TI MSP430 `_ +* ``timsp430`` `TI MSP430 `_ (including *MSP430* LaunchPads) -* ``titiva`` `TI TIVA C `_ +* ``titiva`` `TI TIVA C `_ (including *TIVA C* Series LaunchPads) diff --git a/docs/index.rst b/docs/index.rst index 5ebd76ad..ee2680b9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2,9 +2,9 @@ PlatformIO: A cross-platform code builder and the missing library manager ========================================================================= .. image:: _static/platformio-logo.png - :target: http://platformio.ikravets.com + :target: http://platformio.org -`Website + Library Search `_ | +`Website + Library Search `_ | `Project Examples `_ | `Source Code `_ | `Issues `_ | diff --git a/docs/librarymanager/index.rst b/docs/librarymanager/index.rst index 5dcc323a..3e9604ef 100644 --- a/docs/librarymanager/index.rst +++ b/docs/librarymanager/index.rst @@ -9,7 +9,7 @@ Library Manager *PlatformIO Library Manager* allows you to organize external embedded libraries. You can search for new libraries via :ref:`Command Line interface ` -or `Web 2.0 Library Search `_. +or `Web 2.0 Library Search `_. You don't need to bother for finding the latest version of library. Due to :ref:`cmd_lib_update` command you will have up-to-date external libraries. diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 789ea3f8..26d6a656 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -4,7 +4,7 @@ Quickstart ========== .. note:: - Please read `Get Started `_ + Please read `Get Started `_ article from the official WebSite. 1. :ref:`Install PlatformIO `. diff --git a/docs/userguide/lib/cmd_install.rst b/docs/userguide/lib/cmd_install.rst index b31a6b04..854401b7 100644 --- a/docs/userguide/lib/cmd_install.rst +++ b/docs/userguide/lib/cmd_install.rst @@ -17,7 +17,7 @@ Description ----------- Install new library by specified -`PlatformIO Library Registry ID `_. +`PlatformIO Library Registry ID `_. Options ------- @@ -35,7 +35,7 @@ Examples .. code-block:: bash - # IRremote: http://platformio.ikravets.com/#!/lib/show/4/IRremote + # IRremote: http://platformio.org/#!/lib/show/4/IRremote $ platformio lib install 4 # Installing library [ 4 ]: # Downloading [####################################] 100% @@ -47,7 +47,7 @@ Examples .. code-block:: bash - # XBee: http://platformio.ikravets.com/#!/lib/show/6/XBee + # XBee: http://platformio.org/#!/lib/show/6/XBee $ platformio lib install 6 --version=0.5 # Installing library [ 6 ]: # Downloading [####################################] 100% @@ -59,7 +59,7 @@ Examples .. code-block:: bash - # Adafruit-ST7735: http://platformio.ikravets.com/#!/lib/show/12/Adafruit-ST7735 + # Adafruit-ST7735: http://platformio.org/#!/lib/show/12/Adafruit-ST7735 $ platformio lib install 12 # Installing library [ 12 ]: # Downloading [####################################] 100% diff --git a/docs/userguide/lib/cmd_search.rst b/docs/userguide/lib/cmd_search.rst index fe3ac834..84899256 100644 --- a/docs/userguide/lib/cmd_search.rst +++ b/docs/userguide/lib/cmd_search.rst @@ -16,7 +16,7 @@ Usage Description ----------- -Search for library in `PlatformIO Library Registry `_ +Search for library in `PlatformIO Library Registry `_ by :ref:`library_config` fields in the boolean mode. The boolean search capability supports the following operators: @@ -108,7 +108,7 @@ Examples # Show next libraries? [y/N]: # ... -2. Search for `1-Wire libraries `_ +2. Search for `1-Wire libraries `_ .. code-block:: bash @@ -120,7 +120,7 @@ Examples # [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc) # ... -3. Search for `Arduino-based "I2C" libraries `_ +3. Search for `Arduino-based "I2C" libraries `_ .. code-block:: bash @@ -135,7 +135,7 @@ Examples # [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303) # ... -4. Search for `libraries by "web" and "http" keywords `_. +4. Search for `libraries by "web" and "http" keywords `_. .. code-block:: bash @@ -148,7 +148,7 @@ Examples # [ 17 ] Adafruit-CC3000 arduino, atmelavr "Adafruit Industries": Library code for Adafruit's CC3000 Wi-Fi/WiFi breakouts # ... -5. Search for `libraries by "Adafruit Industries" author `_ +5. Search for `libraries by "Adafruit Industries" author `_ .. code-block:: bash @@ -163,7 +163,7 @@ Examples # [ 26 ] Adafruit-LSM303DLHC-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer) # ... -6. Search for `libraries which are compatible with Dallas temperature sensors `_ +6. Search for `libraries which are compatible with Dallas temperature sensors `_ like DS18B20, DS18S20 and etc. .. code-block:: bash @@ -176,7 +176,7 @@ Examples # [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc) # ... -7. Search for `Energia-based *nRF24* or *HttpClient* libraries `_. +7. Search for `Energia-based *nRF24* or *HttpClient* libraries `_. The search query that is described below can be interpreted like ``energia nRF24 OR energia HttpClient`` @@ -191,7 +191,7 @@ Examples # [ 43 ] nRF24 energia, timsp430 "Eric": The nRF24L01 is a low-cost 2.4GHz ISM transceiver module. It supports a number of channel frequencies in the 2.4GHz band and a range of data rates. -8. Search for the `all sensor libraries excluding temperature `_. +8. Search for the `all sensor libraries excluding temperature `_. .. code-block:: bash diff --git a/docs/userguide/lib/cmd_show.rst b/docs/userguide/lib/cmd_show.rst index 669acac6..8c4730a4 100644 --- a/docs/userguide/lib/cmd_show.rst +++ b/docs/userguide/lib/cmd_show.rst @@ -24,7 +24,7 @@ Examples .. code-block:: bash - # OneWire: http://platformio.ikravets.com/#!/lib/show/1/OneWire + # OneWire: http://platformio.org/#!/lib/show/1/OneWire $ platformio lib show 1 # OneWire # ------- diff --git a/docs/userguide/lib/cmd_uninstall.rst b/docs/userguide/lib/cmd_uninstall.rst index b98025ed..c2a3d327 100644 --- a/docs/userguide/lib/cmd_uninstall.rst +++ b/docs/userguide/lib/cmd_uninstall.rst @@ -24,6 +24,6 @@ Examples .. code-block:: bash - # XBee: http://platformio.ikravets.com/#!/lib/show/6/XBee + # XBee: http://platformio.org/#!/lib/show/6/XBee $ platformio lib uninstall 6 # The library #6 'XBee' has been successfully uninstalled! diff --git a/platformio/__init__.py b/platformio/__init__.py index c52bc7fa..1805e219 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -7,7 +7,7 @@ __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" __description__ = ("A cross-platform code builder and " "the missing library manager") -__url__ = "http://platformio.ikravets.com" +__url__ = "http://platformio.org" __author__ = "Ivan Kravets" __email__ = "me@ikravets.com" @@ -15,4 +15,4 @@ __email__ = "me@ikravets.com" __license__ = "MIT License" __copyright__ = "Copyright (C) 2014 Ivan Kravets" -__apiurl__ = "http://api.platformio.ikravets.com" +__apiurl__ = "http://api.platformio.org" diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 5c65bd46..1c4bebde 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -64,7 +64,7 @@ def lib_search(query, **filters): click.secho("For example: DS*, PCA*, DHT* and etc.\n", fg="yellow") click.echo("For more examples and advanced search syntax, " "please use documentation:") - click.secho("http://docs.platformio.ikravets.com" + click.secho("http://docs.platformio.org" "/en/latest/userguide/lib/cmd_search.html\n", fg="cyan") return diff --git a/platformio/exception.py b/platformio/exception.py index 727a4602..c3ef53a0 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -162,5 +162,5 @@ class SConsNotInstalled(PlatformioException): MESSAGE = ( "The PlatformIO and `scons` aren't installed properly. " "Please use official installation manual: " - "http://docs.platformio.ikravets.com/en/latest/installation.html" + "http://docs.platformio.org/en/latest/installation.html" ) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 37b133be..dae2b648 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -140,7 +140,7 @@ def check_platformio_upgrade(): fg="yellow", nl=False) click.secho("platformio upgrade", fg="cyan", nl=False) click.secho(" command.\nChanges: ", fg="yellow", nl=False) - click.secho("http://docs.platformio.ikravets.com/en/latest/history.html\n", + click.secho("http://docs.platformio.org/en/latest/history.html\n", fg="cyan") diff --git a/platformio/projectconftpl.ini b/platformio/projectconftpl.ini index 2194934a..da48cf88 100644 --- a/platformio/projectconftpl.ini +++ b/platformio/projectconftpl.ini @@ -2,7 +2,7 @@ # Project Configuration File # # A detailed documentation with the EXAMPLES is located here: -# http://docs.platformio.ikravets.com/en/latest/projectconf.html +# http://docs.platformio.org/en/latest/projectconf.html # # A sign `#` at the beginning of the line indicates a comment @@ -11,7 +11,7 @@ # Simple and base environment # [env:mybaseenv] # platform = %INSTALLED_PLATFORM_NAME_HERE% -# framework = +# framework = # board = # # Automatic targets - enable auto-uploading From 1fb0644f519120cf307ba2ce5393d8b4261e42bc Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 1 Jan 2015 19:50:45 +0200 Subject: [PATCH 29/30] Happy New Year to copyrights :) --- LICENSE | 2 +- README.rst | 2 +- docs/conf.py | 2 +- platformio/__init__.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LICENSE b/LICENSE index 588d06b2..50d24ce8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Ivan Kravets +Copyright (c) 2014-2015 Ivan Kravets Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.rst b/README.rst index 99366baf..76fba3ca 100644 --- a/README.rst +++ b/README.rst @@ -123,6 +123,6 @@ It has support for many popular embedded platforms like these: Licence ------- -Copyright (C) 2014 Ivan Kravets +Copyright (C) 2014-2015 Ivan Kravets Licenced under the MIT Licence. diff --git a/docs/conf.py b/docs/conf.py index 5e890ad6..b499869d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -45,7 +45,7 @@ master_doc = 'index' # General information about the project. project = u'PlatformIO' -copyright = u'2014, Ivan Kravets' +copyright = u'2014-2015, Ivan Kravets' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/platformio/__init__.py b/platformio/__init__.py index 1805e219..6b960136 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -13,6 +13,6 @@ __author__ = "Ivan Kravets" __email__ = "me@ikravets.com" __license__ = "MIT License" -__copyright__ = "Copyright (C) 2014 Ivan Kravets" +__copyright__ = "Copyright (C) 2014-2015 Ivan Kravets" __apiurl__ = "http://api.platformio.org" From 68733a447a0c0b9d6490ded243fce0272a511119 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 1 Jan 2015 20:57:47 +0200 Subject: [PATCH 30/30] Bump to 0.10.0 (resolve issues: #11, #21, #35, #37, #38, #39, #40, #43 ) --- HISTORY.rst | 5 +++-- platformio/__init__.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 8977ce5e..b09e2216 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,8 +1,8 @@ Release History =============== -0.10.0 (?) ----------- +0.10.0 (2015-01-01) Happy New Year! +----------------------------------- * Implemented `platformio boards `_ command (`issue #11 `_) @@ -22,6 +22,7 @@ Release History * Fixed urllib3's *SSL* warning under Python <= 2.7.2 (`issue #39 `_) * Fixed bug with *Arduino USB* boards (`issue #40 `_) + 0.9.2 (2014-12-10) ------------------ diff --git a/platformio/__init__.py b/platformio/__init__.py index 6b960136..acddb2e5 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (0, 10, "0-dev") +VERSION = (0, 10, 0) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"