diff --git a/.travis.yml b/.travis.yml index 323dbf4c..144e8731 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,3 @@ -cache: - directories: - - $HOME/.platformio - language: python python: - "2.7" diff --git a/HISTORY.rst b/HISTORY.rst index f11395b0..65235d65 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,25 @@ Release History =============== +2.1.0 (2015-06-03) +------------------ + +* Added Silicon Labs EFM32 `siliconlabsefm32 `_ + development platform + (`issue #226 `_) +* Integrate PlatformIO with `Circle CI `_ and + `Shippable CI `_ +* Described in documentation how to `create/register own board `_ for PlatformIO +* Disabled "nano.specs" for ARM-based platforms + (`issue #219 `_) +* Fixed "ConnectionError" when PlatformIO SF Storage is off-line +* Fixed resolving of C/C++ std libs by Eclipse IDE + (`issue #220 `_) +* Fixed firmware uploading using USB programmer (USBasp) for + `atmelavr `_ + platform + (`issue #221 `_) + 2.0.2 (2015-05-27) ------------------ diff --git a/README.rst b/README.rst index 41f28fc6..b3129c0b 100644 --- a/README.rst +++ b/README.rst @@ -7,16 +7,22 @@ PlatformIO .. image:: https://ci.appveyor.com/api/projects/status/dku0h2rutfj0ctls/branch/develop?svg=true :target: https://ci.appveyor.com/project/ivankravets/platformio :alt: AppVeyor.CI Build Status +.. image:: https://api.shippable.com/projects/555b0ceeedd7f2c052f3c2d0/badge?branchName=develop + :target: https://app.shippable.com/projects/555b0ceeedd7f2c052f3c2d0 + :alt: Shippable Build Status +.. image:: https://circleci.com/gh/platformio/platformio/tree/develop.svg?style=svg + :target: https://circleci.com/gh/platformio/platformio/tree/develop + :alt: Circle.CI Build Status .. image:: https://gemnasium.com/platformio/platformio.png :target: https://gemnasium.com/platformio/platformio :alt: Dependency Status -.. image:: https://pypip.in/version/platformio/badge.png?style=flat +.. image:: https://img.shields.io/pypi/v/platformio.svg :target: https://pypi.python.org/pypi/platformio/ :alt: Latest Version -.. image:: https://pypip.in/download/platformio/badge.png?style=flat +.. image:: https://img.shields.io/pypi/dm/platformio.svg :target: https://pypi.python.org/pypi/platformio/ :alt: Downloads -.. image:: https://pypip.in/license/platformio/badge.png?style=flat +.. image:: https://img.shields.io/pypi/l/platformio.svg :target: https://pypi.python.org/pypi/platformio/ :alt: License .. image:: https://badges.gitter.im/Join%20Chat.svg @@ -31,7 +37,8 @@ PlatformIO `Twitter `_ *Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC, -ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.* +Silicon Labs EFM32, ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed, +libOpenCM3, etc.* .. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-logo.png :target: http://platformio.org @@ -136,6 +143,7 @@ It has support for the most popular embedded platforms: * `Nordic nRF51 `_ * `NXP LPC `_ * `ST STM32 `_ +* `Silicon Labs EFM32 `_ * `Teensy `_ * `TI MSP430 `_ * `TI TIVA C `_ diff --git a/circle.yml b/circle.yml new file mode 100644 index 00000000..b0553fc8 --- /dev/null +++ b/circle.yml @@ -0,0 +1,20 @@ +machine: + python: + version: 2.7 + environment: + TOX_ENV: docs + TOX_ENV: lint + TOX_ENV: py26 + TOX_ENV: py27 + +checkout: + post: + - git submodule update --init + +dependencies: + pre: + - pip install tox + +test: + override: + - tox -e $TOX_ENV diff --git a/docs/_static/ide-platformio-qtcreator-3.png b/docs/_static/ide-platformio-qtcreator-3.png index 9eba936b..8c908e38 100644 Binary files a/docs/_static/ide-platformio-qtcreator-3.png and b/docs/_static/ide-platformio-qtcreator-3.png differ diff --git a/docs/_static/ide-vs-platformio-newproject-2-1.png b/docs/_static/ide-vs-platformio-newproject-2-1.png index f00196f1..de85d851 100644 Binary files a/docs/_static/ide-vs-platformio-newproject-2-1.png and b/docs/_static/ide-vs-platformio-newproject-2-1.png differ diff --git a/docs/_static/ide-vs-platformio-newproject-2.png b/docs/_static/ide-vs-platformio-newproject-2.png index 3ccf136c..cb0bc810 100644 Binary files a/docs/_static/ide-vs-platformio-newproject-2.png and b/docs/_static/ide-vs-platformio-newproject-2.png differ diff --git a/docs/articles.rst b/docs/articles.rst index 5f708816..62099544 100644 --- a/docs/articles.rst +++ b/docs/articles.rst @@ -9,6 +9,7 @@ Articles about us Here are recent articles about PlatformIO: +* Jun 02, 2015 - **Alejandro Guirao Rodriguez** - `Discovering PlatformIO: The RaspberryPi / Arduino combo kit is a winner option when prototyping an IoT-style project `_ * May 11, 2015 - **IT Hare** - `From Web Developer to Embedded One: Interview with Ivan Kravets, The Guy Behind PlatformIO. Part II `_ * May 4, 2015 - **IT Hare** - `From Web Developer to Embedded One: Interview with Ivan Kravets, The Guy Behind PlatformIO. Part I `_ * April 17, 2015 - **Michael Ball** - `PlatformIO - A Cross-Platform Code Builder and Missing Library Manager `_ diff --git a/docs/ci/circleci.rst b/docs/ci/circleci.rst index 61da49de..daf7e674 100644 --- a/docs/ci/circleci.rst +++ b/docs/ci/circleci.rst @@ -30,9 +30,9 @@ Put ``circle.yml`` to the root directory of the GitHub repository. machine: environment: - - PLATFORMIO_CI_SRC=path/to/source/file.c - - PLATFORMIO_CI_SRC=path/to/source/file.ino - - PLATFORMIO_CI_SRC=path/to/source/directory + PLATFORMIO_CI_SRC: path/to/source/file.c + PLATFORMIO_CI_SRC: path/to/source/file.ino + PLATFORMIO_CI_SRC: path/to/source/directory dependencies: pre: diff --git a/docs/frameworks/mbed.rst b/docs/frameworks/mbed.rst index 1c909d13..9c60a9fb 100644 --- a/docs/frameworks/mbed.rst +++ b/docs/frameworks/mbed.rst @@ -25,6 +25,9 @@ Platforms * - :ref:`platform_nxplpc` - The NXP LPC is a family of 32-bit microcontroller integrated circuits by NXP Semiconductors. The LPC chips are grouped into related series that are based around the same 32-bit ARM processor core, such as the Cortex-M4F, Cortex-M3, Cortex-M0+, or Cortex-M0. Internally, each microcontroller consists of the processor core, static RAM memory, flash memory, debugging interface, and various peripherals. + * - :ref:`platform_siliconlabsefm32` + - Silicon Labs EFM32 Gecko 32-bit microcontroller (MCU) family includes devices that offer flash memory configurations up to 256 kB, 32 kB of RAM and CPU speeds up to 48 MHz. Based on the powerful ARM Cortex-M core, the Gecko family features innovative low energy techniques, short wake-up time from energy saving modes and a wide selection of peripherals, making it ideal for battery operated applications and other systems requiring high performance and low-energy consumption. + * - :ref:`platform_ststm32` - The STM32 family of 32-bit Flash MCUs based on the ARM Cortex-M processor is designed to offer new degrees of freedom to MCU users. It offers a 32-bit product range that combines very high performance, real-time capabilities, digital signal processing, and low-power, low-voltage operation, while maintaining full integration and ease of development. @@ -480,6 +483,54 @@ SeeedStudio - 512 Kb - 32 Kb +Silicon Labs +~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``efm32gg_stk3700`` + - `Silicon Labs EFM32GG-STK3700 (Giant Gecko) `_ + - EFM32GG990F1024 + - 48 MHz + - 1024 Kb + - 128 Kb + + * - ``efm32hg_stk3400`` + - `Silicon Labs SLSTK3400A USB-enabled (Happy Gecko) `_ + - EFM32HG322F64 + - 24 MHz + - 64 Kb + - 8 Kb + + * - ``efm32lg_stk3600`` + - `Silicon Labs EFM32LG-STK3600 (Leopard Gecko) `_ + - EFM32LG990F256 + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``efm32wg_stk3800`` + - `Silicon Labs EFM32WG-STK3800 (Wonder Gecko) `_ + - EFM32WG990F256 + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``efm32zg_stk3200`` + - `Silicon Labs EFM32ZG-STK3200 (Zero Gecko) `_ + - EFM2ZG222F32 + - 24 MHz + - 32 Kb + - 4 Kb + Solder Splash Labs ~~~~~~~~~~~~~~~~~~ diff --git a/docs/index.rst b/docs/index.rst index 8bb9fe21..2ff78019 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,8 +1,9 @@ PlatformIO: A cross-platform code builder and the missing library manager ========================================================================= -*Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC, ST STM32, -TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.* +*Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC, +Silicon Labs EFM32, ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed, +libOpenCM3, etc.* .. image:: _static/platformio-logo.png :target: http://platformio.org diff --git a/docs/platforms/creating_board.rst b/docs/platforms/creating_board.rst new file mode 100644 index 00000000..76c5ed2e --- /dev/null +++ b/docs/platforms/creating_board.rst @@ -0,0 +1,62 @@ +.. _board_creating: + +Creating Board +============== + +*PlatformIO* has pre-built settings for the most popular embedded boards. This +list is available: + +* `Embedded Boards Explorer `_ (Web) +* :ref:`cmd_boards` (CLI command) + +Nevertheless, PlatformIO allows to create own board or override existing +board's settings. All data is declared using +`JSON-style `_ via +`associative array `_ +(name/value pairs). + +.. contents:: + +JSON Structure +-------------- + +The key fields: + +* ``build`` data will be used by :ref:`Platforms ` and + :ref:`frameworks` builders +* ``frameworks`` is the list with supported :ref:`frameworks` +* ``platform`` main type of :ref:`Platforms ` +* ``upload`` upload settings which depend on the ``platform`` + +.. code-block:: json + + { + "myboard": { + "build": {}, + "frameworks": ["%LIST_WITH_SUPPORTED_FRAMEWORKS%"], + "name": "My test board", + "platform": "%PLATFORM_TYPE_HERE%", + "upload": {}, + "url": "http://example.com", + "vendor": "My Company Ltd." + } + } + +Installation +------------ + +1. Create ``boards`` directory in :ref:`projectconf_pio_home_dir` if it + doesn't exist. +2. Create ``my_own_boards.json`` file and put to ``boards`` directory. +3. Search available boards via :ref:`cmd_boards` command. You should see + ``myboard`` board. + +Now, you can use ``myboard`` for the :ref:`projectconf_env_board` option in +:ref:`projectconf`. + + +Examples +-------- + +For the examples, please look into built-in ``*.json`` files with boards +settings: https://github.com/platformio/platformio/tree/develop/platformio/boards. diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index 656c6497..3497fe88 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -292,7 +292,7 @@ Installation ------------ 1. Create ``platforms`` directory in :ref:`projectconf_pio_home_dir` if it - doesn't exists. + doesn't exist. 2. Copy ``test.py`` and ``test-builder.py`` files to ``platforms`` directory. 3. Search available platforms via :ref:`cmd_platforms_search` command. You should see ``test`` platform. diff --git a/docs/platforms/index.rst b/docs/platforms/index.rst index 00ec1e6e..1ed7a115 100644 --- a/docs/platforms/index.rst +++ b/docs/platforms/index.rst @@ -20,8 +20,10 @@ MCU, upload protocol or etc. Please use ``board`` option. freescalekinetis nordicnrf51 nxplpc + siliconlabsefm32 ststm32 teensy timsp430 titiva creating_platform + creating_board diff --git a/docs/platforms/siliconlabsefm32.rst b/docs/platforms/siliconlabsefm32.rst new file mode 100644 index 00000000..448d95db --- /dev/null +++ b/docs/platforms/siliconlabsefm32.rst @@ -0,0 +1,98 @@ +.. _platform_siliconlabsefm32: + +Platform ``siliconlabsefm32`` +============================= +Silicon Labs EFM32 Gecko 32-bit microcontroller (MCU) family includes devices that offer flash memory configurations up to 256 kB, 32 kB of RAM and CPU speeds up to 48 MHz. Based on the powerful ARM Cortex-M core, the Gecko family features innovative low energy techniques, short wake-up time from energy saving modes and a wide selection of peripherals, making it ideal for battery operated applications and other systems requiring high performance and low-energy consumption. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``framework-mbed`` + - `mbed Framework `_ + + * - ``toolchain-gccarmnoneeabi`` + - `gcc-arm-embedded `_, `GDB `_ + +.. warning:: + **Linux Users:** Don't forget to install "udev" rules file + `99-platformio-udev.rules `_ (an instruction is located in the file). + + + +Frameworks +---------- +.. list-table:: + :header-rows: 1 + + * - Name + - Description + + * - :ref:`framework_mbed` + - The mbed framework The mbed SDK has been designed to provide enough hardware abstraction to be intuitive and concise, yet powerful enough to build complex projects. It is built on the low-level ARM CMSIS APIs, allowing you to code down to the metal if needed. In addition to RTOS, USB and Networking libraries, a cookbook of hundreds of reusable peripheral and module libraries have been built on top of the SDK by the mbed Developer Community. + +Boards +------ + +.. note:: + * You can list pre-configured boards by :ref:`cmd_boards` command or + `PlatformIO Boards Explorer `_ + * For more detailed ``board`` information please scroll tables below by + horizontal. + +Silicon Labs +~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``efm32gg_stk3700`` + - `Silicon Labs EFM32GG-STK3700 (Giant Gecko) `_ + - EFM32GG990F1024 + - 48 MHz + - 1024 Kb + - 128 Kb + + * - ``efm32hg_stk3400`` + - `Silicon Labs SLSTK3400A USB-enabled (Happy Gecko) `_ + - EFM32HG322F64 + - 24 MHz + - 64 Kb + - 8 Kb + + * - ``efm32lg_stk3600`` + - `Silicon Labs EFM32LG-STK3600 (Leopard Gecko) `_ + - EFM32LG990F256 + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``efm32wg_stk3800`` + - `Silicon Labs EFM32WG-STK3800 (Wonder Gecko) `_ + - EFM32WG990F256 + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``efm32zg_stk3200`` + - `Silicon Labs EFM32ZG-STK3200 (Zero Gecko) `_ + - EFM2ZG222F32 + - 24 MHz + - 32 Kb + - 4 Kb diff --git a/examples/mbed/mbed-blink/platformio.ini b/examples/mbed/mbed-blink/platformio.ini index b6a88e91..306e976c 100644 --- a/examples/mbed/mbed-blink/platformio.ini +++ b/examples/mbed/mbed-blink/platformio.ini @@ -47,3 +47,9 @@ board = nucleo_f401re platform = teensy framework = mbed board = teensy31 + +# Silicon Labs EFM32 Platform +[env:siliconlabsefm32] +platform = siliconlabsefm32 +framework = mbed +board = efm32hg_stk3400 diff --git a/platformio/__init__.py b/platformio/__init__.py index a3dc3602..f28df34d 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,14 +1,14 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (2, 0, 2) +VERSION = (2, 1, 0) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" __description__ = ("A cross-platform code builder and the missing library " "manager (Atmel AVR & SAM, Espressif, Freescale Kinetis, " - "Nordic nRF51, NXP LPC, ST STM32, TI MSP430 & Tiva, " - "Teensy, Arduino, mbed, libOpenCM3, etc.)") + "Nordic nRF51, NXP LPC, Silicon Labs EFM32, ST STM32, " + "TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc)") __url__ = "http://platformio.org" __author__ = "Ivan Kravets" diff --git a/platformio/boards/siliconlabsefm32.json b/platformio/boards/siliconlabsefm32.json new file mode 100644 index 00000000..dfa58584 --- /dev/null +++ b/platformio/boards/siliconlabsefm32.json @@ -0,0 +1,86 @@ +{ + "efm32wg_stk3800": { + "build": { + "f_cpu": "48000000L", + "cpu": "cortex-m4", + "mcu": "efm32wg990f256" + }, + "frameworks": ["mbed"], + "name": "Silicon Labs EFM32WG-STK3800 (Wonder Gecko)", + "platform": "siliconlabsefm32", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 262144 + }, + "url": "https://developer.mbed.org/platforms/EFM32-Wonder-Gecko/", + "vendor": "Silicon Labs" + }, + + "efm32gg_stk3700": { + "build": { + "f_cpu": "48000000L", + "cpu": "cortex-m3", + "mcu": "efm32gg990f1024" + }, + "frameworks": ["mbed"], + "name": "Silicon Labs EFM32GG-STK3700 (Giant Gecko)", + "platform": "siliconlabsefm32", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 1048576 + }, + "url": "https://developer.mbed.org/platforms/EFM32-Giant-Gecko/", + "vendor": "Silicon Labs" + }, + + "efm32lg_stk3600": { + "build": { + "f_cpu": "48000000L", + "cpu": "cortex-m3", + "mcu": "efm32lg990f256" + }, + "frameworks": ["mbed"], + "name": "Silicon Labs EFM32LG-STK3600 (Leopard Gecko)", + "platform": "siliconlabsefm32", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 262144 + }, + "url": "https://developer.mbed.org/platforms/EFM32-Leopard-Gecko/", + "vendor": "Silicon Labs" + }, + + "efm32zg_stk3200": { + "build": { + "f_cpu": "24000000L", + "cpu": "cortex-m0plus", + "mcu": "efm2zg222f32" + }, + "frameworks": ["mbed"], + "name": "Silicon Labs EFM32ZG-STK3200 (Zero Gecko)", + "platform": "siliconlabsefm32", + "upload": { + "maximum_ram_size": 4096, + "maximum_size": 32768 + }, + "url": "https://developer.mbed.org/platforms/EFM32-Zero-Gecko/", + "vendor": "Silicon Labs" + }, + + "efm32hg_stk3400": { + "build": { + "f_cpu": "24000000L", + "cpu": "cortex-m3", + "mcu": "efm32hg322f64" + }, + "frameworks": ["mbed"], + "name": "Silicon Labs SLSTK3400A USB-enabled (Happy Gecko)", + "platform": "siliconlabsefm32", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 65536 + }, + "url": "https://developer.mbed.org/platforms/EFM32-Happy-Gecko/", + "vendor": "Silicon Labs" + } +} diff --git a/platformio/builder/scripts/atmelavr.py b/platformio/builder/scripts/atmelavr.py index f221e5c4..f86f130f 100644 --- a/platformio/builder/scripts/atmelavr.py +++ b/platformio/builder/scripts/atmelavr.py @@ -20,14 +20,18 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621 with open(path, "w") as f: f.write(str(value)) + if "micronucleus" in env['UPLOADER']: + print "Please unplug/plug device ..." + upload_options = env.get("BOARD_OPTIONS", {}).get("upload", {}) + if "usb" in env.subst("$UPLOAD_PROTOCOL"): + upload_options['require_upload_port'] = False + env.Replace(UPLOAD_SPEED=None) + if env.subst("$UPLOAD_SPEED"): env.Append(UPLOADERFLAGS=["-b", "$UPLOAD_SPEED"]) - if "micronucleus" in env['UPLOADER']: - print "Please unplug/plug device ..." - if not upload_options.get("require_upload_port", False): return @@ -74,7 +78,6 @@ else: UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"), UPLOADERFLAGS=[ "-v", - "-D", # disable auto erase for flash memory "-p", "$BOARD_MCU", "-C", '"%s"' % join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude.conf"), diff --git a/platformio/builder/scripts/basearm.py b/platformio/builder/scripts/basearm.py index bae7db23..33114dca 100644 --- a/platformio/builder/scripts/basearm.py +++ b/platformio/builder/scripts/basearm.py @@ -47,8 +47,7 @@ env.Replace( "-Os", "-Wl,--gc-sections,--relax", "-mthumb", - "-mcpu=${BOARD_OPTIONS['build']['cpu']}", - "--specs=nano.specs" + "-mcpu=${BOARD_OPTIONS['build']['cpu']}" ], LIBS=["c", "gcc", "m"], diff --git a/platformio/builder/scripts/siliconlabsefm32.py b/platformio/builder/scripts/siliconlabsefm32.py new file mode 100644 index 00000000..29692f6f --- /dev/null +++ b/platformio/builder/scripts/siliconlabsefm32.py @@ -0,0 +1,50 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Silicon Labs EFM32 series ARM microcontrollers. +""" + +from os.path import join + +from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, + DefaultEnvironment, SConscript) + +env = DefaultEnvironment() + +SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) + +# +# Target: Build executable and linkable firmware +# + +target_elf = env.BuildFirmware() + +# +# Target: Build the .bin file +# + +if "uploadlazy" in COMMAND_LINE_TARGETS: + target_firm = join("$BUILD_DIR", "firmware.bin") +else: + target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf) + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Upload by default .bin file +# + +upload = env.Alias(["upload", "uploadlazy"], target_firm, env.UploadToDisk) +AlwaysBuild(upload) + +# +# Target: Define targets +# + +Default([target_firm, target_size]) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index b0673c06..2cd8b44e 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -426,10 +426,14 @@ def DumpIDEData(env): data['includes'].append(env.subst(item[1])) # includes from toolchain - for item in glob(env.subst( - join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN", - "*", "include"))): - data['includes'].append(item) + toolchain_dir = env.subst( + join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN")) + toolchain_incglobs = [ + join(toolchain_dir, "*", "include"), + join(toolchain_dir, "lib", "gcc", "*", "*", "include") + ] + for g in toolchain_incglobs: + data['includes'].extend(glob(g)) # global symbols for item in env.get("CPPDEFINES", []): diff --git a/platformio/downloader.py b/platformio/downloader.py index 04227029..304c5002 100644 --- a/platformio/downloader.py +++ b/platformio/downloader.py @@ -25,8 +25,11 @@ class FileDownloader(object): self._destination = self._fname if dest_dir: self.set_destination(join(dest_dir, self._fname)) - self._progressbar = None + self._progressbar = None + self._request = None + + # make connection self._request = requests.get(url, stream=True, headers=util.get_request_defheaders()) if self._request.status_code != 200: @@ -93,4 +96,5 @@ class FileDownloader(object): util.change_filemtime(self._destination, lmtime) def __del__(self): - self._request.close() + if self._request: + self._request.close() diff --git a/platformio/pkgmanager.py b/platformio/pkgmanager.py index b60332af..b149b04c 100644 --- a/platformio/pkgmanager.py +++ b/platformio/pkgmanager.py @@ -2,11 +2,12 @@ # See LICENSE for details. from os import makedirs, remove -from os.path import isdir, join +from os.path import basename, isdir, isfile, join from shutil import rmtree from time import time import click +import requests from platformio import exception, telemetry, util from platformio.app import get_state_item, set_state_item @@ -85,7 +86,17 @@ class PackageManager(object): if not isdir(pkg_dir): makedirs(pkg_dir) - dlpath = self.download(info['url'], pkg_dir, info['sha1']) + dlpath = None + try: + dlpath = self.download(info['url'], pkg_dir, info['sha1']) + except requests.exceptions.ConnectionError: + if info['url'].startswith("http://sourceforge.net"): + dlpath = self.download( + "http://dl.platformio.org/packages/%s" % + basename(info['url']), pkg_dir, info['sha1']) + + assert isfile(dlpath) + if self.unpack(dlpath, pkg_dir): self._register(name, info['version']) # remove archive diff --git a/platformio/platforms/siliconlabsefm32.py b/platformio/platforms/siliconlabsefm32.py new file mode 100644 index 00000000..a39f7fb7 --- /dev/null +++ b/platformio/platforms/siliconlabsefm32.py @@ -0,0 +1,36 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from platformio.platforms.base import BasePlatform + + +class Siliconlabsefm32Platform(BasePlatform): + + """ + Silicon Labs EFM32 Gecko 32-bit microcontroller (MCU) family includes + devices that offer flash memory configurations up to 256 kB, 32 kB of + RAM and CPU speeds up to 48 MHz. + + Based on the powerful ARM Cortex-M core, the Gecko family features + innovative low energy techniques, short wake-up time from energy saving + modes and a wide selection of peripherals, making it ideal for battery + operated applications and other systems requiring high performance and + low-energy consumption. + + http://www.silabs.com/products/mcu/32-bit/efm32-gecko/Pages/efm32-gecko.aspx + """ + + PACKAGES = { + + "toolchain-gccarmnoneeabi": { + "alias": "toolchain", + "default": True + }, + + "framework-mbed": { + "default": True + } + } + + def get_name(self): + return "Silicon Labs EFM32" diff --git a/requirements.txt b/requirements.txt index 9b707761..a38fcfee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ click==4.0 -bottle=0.12.8 +bottle==0.12.8 colorama==0.3.3 pyserial==2.7 requests==2.7.0 -scons==2.3.0 diff --git a/setup.py b/setup.py index 41b5a586..6ae6c1c2 100644 --- a/setup.py +++ b/setup.py @@ -51,6 +51,6 @@ setup( "Topic :: Software Development :: Compilers" ], keywords=("builder library manager atmel avr sam espressif esp freescale " - "kinetis nordic nrf51 nxp lpc st stm32 ti msp430 tiva teensy " - "arduino mbed libopencm3") + "kinetis nordic nrf51 nxp lpc silicon labs efm32 st stm32 ti " + "msp430 tiva teensy arduino mbed libopencm3") ) diff --git a/tests/test_pkgmanifest.py b/tests/test_pkgmanifest.py index 1493813a..f8f8efc4 100644 --- a/tests/test_pkgmanifest.py +++ b/tests/test_pkgmanifest.py @@ -54,14 +54,20 @@ def test_package(package_data, sfpkglist): assert package_data['url'].endswith("%d.tar.gz" % package_data['version']) # check content type and that file exists - r = requests.head(package_data['url'], allow_redirects=True) + try: + r = requests.head(package_data['url'], allow_redirects=True) + if 500 <= r.status_code <= 599: + raise requests.exceptions.ConnectionError() + except requests.exceptions.ConnectionError: + return pytest.skip("SF is off-line") + validate_response(r) assert r.headers['Content-Type'] in ("application/x-gzip", "application/octet-stream") # check sha1 sum if sfpkglist is None: - return pytest.skip("SF is offline") + return pytest.skip("SF is off-line") pkgname = basename(package_data['url']) assert pkgname in sfpkglist assert package_data['sha1'] == sfpkglist.get(pkgname, {}).get("sha1")