diff --git a/platformio/platforms/__init__.py b/.coveragerc similarity index 65% rename from platformio/platforms/__init__.py rename to .coveragerc index 0c05c3b0..32d9f345 100644 --- a/platformio/platforms/__init__.py +++ b/.coveragerc @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,3 +11,16 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +[run] +omit = + platformio/builder/* +source = platformio + +[report] +# Regexes for lines to exclude from consideration +exclude_lines = + pragma: no cover + def __repr__ + raise AssertionError + raise NotImplementedError diff --git a/.gitignore b/.gitignore index 89257136..0a54e681 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ docs/_build dist build .cache +coverage.xml +.coverage +htmlcov diff --git a/.isort.cfg b/.isort.cfg index 907a398d..9ac98225 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,3 +1,3 @@ [settings] line_length=79 -known_third_party=bottle,click,lockfile,pytest,requests,serial,SCons +known_third_party=bottle,click,lockfile,pytest,requests,semantic_version,serial,SCons diff --git a/.style.yapf b/.style.yapf new file mode 100644 index 00000000..7bc85964 --- /dev/null +++ b/.style.yapf @@ -0,0 +1,3 @@ +[style] +blank_line_before_nested_class_or_def = true +allow_multiline_lambdas = true diff --git a/.travis.yml b/.travis.yml index 0a418de9..658547ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,17 +5,22 @@ python: env: - TOX_ENV=docs - TOX_ENV=lint - - TOX_ENV=py26 - TOX_ENV=py27 install: - git submodule update --init --recursive - pip install -U pip setuptools tox - - sudo apt-get install -qq lib32z1 lib32ncurses5 lib32bz2-1.0 # temporarily + + # temporary hook to fix issue with gcc-pic32 + - sudo apt-get install -qq lib32z1 lib32ncurses5 lib32bz2-1.0 script: - tox -e $TOX_ENV +after_success: + - tox -e coverage + - bash <(curl -s https://codecov.io/bash) + notifications: slack: secure: ksQmXOP5NVsf8IgoDuxD68Q/YNwDpZuwq0V29h2dxYCr38oYdAkq/Os4LSCs0X6P0cQFf6nC1hM/d+cAvU+SmzcHGxEceHNEGCg3/TAj+68KIwooPU93Lfq1zwdfteZWxANjKlCQy4+wZliHLhL8fvCYgfJww/6qKmqSYleBNM= diff --git a/HISTORY.rst b/HISTORY.rst index 2cf5ea27..9ee0df5c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,79 @@ Release Notes ============= +PlatformIO 3.0 +-------------- + +3.0.0 (2016-??-??) +~~~~~~~~~~~~~~~~~~ + +* PlatformIO Plus + + + `Unit Testing `__ for Embedded + (`issue #408 `_) + +* Decentralized Development Platforms + + + Development platform manifest "platform.json" and + `open source development platforms `__ + + `Semantic Versioning `__ for platform commands, + development platforms and dependent packages + + Custom package repositories + + External embedded board configuration files, isolated build scripts + (`issue #479 `_) + + Embedded Board compatibility with more than one development platform + (`issue #456 `_) + +* Library Manager 3.0 + + + Project dependencies per build environment using `lib_deps `__ option + (`issue #413 `_) + + `Semantic Versioning `__ for library commands and + dependencies + (`issue #410 `_) + + Multiple library storages: Project's Local, PlatformIO's Global or Custom + (`issue #475 `_) + + Install library by name + (`issue #414 `_) + + Depend on a library using VCS URL (GitHub, Git, ARM mbed code registry, Hg, SVN) + (`issue #498 `_) + + Strict search for library dependencies + (`issue #588 `_) + + Allowed ``library.json`` to specify sources other than PlatformIO's Repository + (`issue #461 `_) + +* New Intelligent Library Build System + + + `Library Dependency Finder `__ + that interprets C/C++ Preprocessor conditional macros with deep search behavior + + Check library compatibility with project environment before building + (`issue #415 `_) + + Control Library Dependency Finder for compatibility using + `lib_compat_mode `__ + option + + Custom library storages/directories with + `lib_extra_dirs `__ option + (`issue #537 `_) + + Handle extra build flags, source filters and build script from + `library.json `__ + (`issue #289 `_) + + Allowed to disable library archiving (``*.ar``) + (`issue #719 `_) + + Show detailed build information about dependent libraries + (`issue #617 `_) + + Support for the 3rd party manifests (Arduino IDE "library.properties" + and ARM mbed "module.json") + +* Print human-readable information when processing environments without + ``-v, --verbose`` option + (`issue #721 `_) +* Added ``license`` field to `library.json `__ + (`issue #522 `_) +* Warn about unknown options in project configuration file ``platformio.ini`` + (`issue #740 `_) +* Stopped supporting Python 2.6 + + PlatformIO 2.0 -------------- diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..51b3d166 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ + +lint: + pylint --rcfile=./.pylintrc ./platformio + +isort: + isort -rc ./platformio + isort -rc ./tests + +yapf: + yapf --recursive --in-place platformio/ + +before-commit: isort yapf lint + +clean-docs: + rm -rf docs/_build + +clean: clean-docs + find . -name \*.pyc -delete + find . -name __pycache__ -delete + rm -rf .cache + rm -rf build + rm -rf htmlcov + rm -f .coverage \ No newline at end of file diff --git a/README.rst b/README.rst index 2b3817ac..b0d469df 100644 --- a/README.rst +++ b/README.rst @@ -7,6 +7,8 @@ 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://codecov.io/gh/platformio/platformio/branch/develop/graph/badge.svg + :target: https://codecov.io/gh/platformio/platformio .. image:: https://requires.io/github/platformio/platformio/requirements.svg?branch=develop :target: https://requires.io/github/platformio/platformio/requirements/?branch=develop :alt: Requirements Status @@ -190,7 +192,7 @@ See `contributing guidelines +Copyright 2014-present PlatformIO The PlatformIO is licensed under the permissive Apache 2.0 license, so you can use it in both commercial and personal projects with confidence. diff --git a/docs/_static/extra.css b/docs/_static/extra.css index 1d7f3b0b..6c61b363 100644 --- a/docs/_static/extra.css +++ b/docs/_static/extra.css @@ -1,5 +1,5 @@ /** - * Copyright 2014-2016 Ivan Kravets + * Copyright 2014-present PlatformIO * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/docs/articles.rst b/docs/articles.rst index 3ceb7fce..30ef007f 100644 --- a/docs/articles.rst +++ b/docs/articles.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -38,18 +38,18 @@ Here are recent articles about PlatformIO: * May 16, 2016 - **Pedro Minatel** - `Controle remoto WiFi com ESP8266 (WiFi remote control using ESP8266, Portuguese) `_ * May 11, 2016 - **Jo Vandeginste** - `Using PlatformIO to compile for Jeelabs' Jeenode Micro `_ * May 08, 2016 - **Radoslaw Bob** - `Touch controlled buzzer (Nodemcu ESP8266) `_ -* May 06, 2016 - **Jean Roux** - `The IoT building blocks I use for my home-automation projects `_ +* May 06, 2016 - **Jean Roux** - `The IoT building blocks I use for my home-automation projects `_ * May 05, 2016 - **Ivan Kravets, Ph.D. / Eclipse Virtual IoT Meetup** - `PlatformIO: a cross-platform IoT solution to build them all! `_ * May 01, 2016 - **Pedro Minatel** - `PlatformIO – Uma alternativa ao Arduino IDE (PlatformIO - An alternative to the Arduino IDE, Portuguese) `_ * Apr 23, 2016 - **Al Williams** - `Hackaday: Atomic Arduino (and Other) Development `_ * Apr 16, 2016 - **Sathittham Sangthong** - `[PlatformIO] มาลองเล่น PlatformIO แทน Arduino IDE กัน (Let's play together with PlatformIO IDE [alternative to Arduino IDE], Thai) `_ -* Apr 15, 2016 - **Daniel Eichhorn** - `ESP8266: Offline Debugging with the Platformio Environment `_ +* Apr 15, 2016 - **Daniel Eichhorn** - `ESP8266: Offline Debugging with the Platformio Environment `_ * Apr 11, 2016 - **Matjaz Trcek** - `Top 5 Arduino integrated development environments `_ * Apr 06, 2016 - **Aleks** - `PlatformIO ausprobiert (Tried PlatformIO, German) `_ * Apr 02, 2016 - **Diego Pinto** - `Você tem coragem de abandonar a IDE do Arduino? PlatformIO + Atom (Do you dare to leave the Arduino IDE? PlatformIO + Atom, Portuguese) `_ * Mar 30, 2016 - **Brandon Cannaday** - `Getting Started with PlatformIO and ESP8266 NodeMcu `_ * Mar 29, 2016 - **Pablo Peñalve** - `PlatformIO + Geany + Raspberry PI, Spanish `_ -* Mar 24, 2016 - **NAzT** - `PlatformIO และการปรับแต่ง เพื่อใช้สำหรับพัฒนา Arduino Library (PlatformIO and advanced development for Arduino Library, Thai) `_ +* Mar 24, 2016 - **NAzT** - `PlatformIO และการปรับแต่ง เพื่อใช้สำหรับพัฒนา Arduino Library (PlatformIO and advanced development for Arduino Library, Thai) `_ * Mar 16, 2016 - **Jakub Skořepa** - `Instalace PlatformIO (PlatformIO IDE Installation, Czech) `_ * Mar 12, 2016 - **Peter Marks** - `PlatformIO, the Arduino IDE for programmers `_ * Mar 12, 2016 - **Richard Arthurs** - `Getting Started With PlatformIO `_ diff --git a/docs/ci/appveyor.rst b/docs/ci/appveyor.rst index 2fc919dd..af246a86 100644 --- a/docs/ci/appveyor.rst +++ b/docs/ci/appveyor.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ci/circleci.rst b/docs/ci/circleci.rst index ba6d6932..c159a4ef 100644 --- a/docs/ci/circleci.rst +++ b/docs/ci/circleci.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -152,7 +152,7 @@ Examples - sudo pip install -U platformio # pre-install PlatformIO development platforms, they will be cached - - platformio platforms install atmelavr atmelsam teensy + - platformio platform install atmelavr atmelsam teensy # # Libraries from PlatformIO Library Registry: diff --git a/docs/ci/drone.rst b/docs/ci/drone.rst index 37d0ac0b..8156a449 100644 --- a/docs/ci/drone.rst +++ b/docs/ci/drone.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ci/index.rst b/docs/ci/index.rst index 93b1b2a6..931f5147 100644 --- a/docs/ci/index.rst +++ b/docs/ci/index.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ci/shippable.rst b/docs/ci/shippable.rst index c64e96e9..aafc2d07 100644 --- a/docs/ci/shippable.rst +++ b/docs/ci/shippable.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ci/travis.rst b/docs/ci/travis.rst index cb27dd33..53ff0f06 100644 --- a/docs/ci/travis.rst +++ b/docs/ci/travis.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/demo.rst b/docs/demo.rst index 28dcc084..b44a2c69 100644 --- a/docs/demo.rst +++ b/docs/demo.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -41,11 +41,11 @@ Platform Manager Used in demo ~~~~~~~~~~~~ -1. :ref:`userguide_platforms` -2. :ref:`cmd_platforms_list` command -3. :ref:`platformio platforms search avr ` command -4. :ref:`platformio platforms show teensy ` command -5. :ref:`cmd_platforms_update` command. +1. :ref:`userguide_platform` +2. :ref:`cmd_platform_list` command +3. :ref:`platformio platform search avr ` command +4. :ref:`platformio platform show teensy ` command +5. :ref:`cmd_platform_update` command. Library Manager --------------- diff --git a/docs/envvars.rst b/docs/envvars.rst index e9316c64..5931e391 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -57,6 +57,10 @@ Allows to override :ref:`projectconf` option :ref:`projectconf_pio_home_dir`. Allows to override :ref:`projectconf` option :ref:`projectconf_pio_lib_dir`. +.. envvar:: PLATFORMIO_LIBDEPS_DIR + +Allows to override :ref:`projectconf` option :ref:`projectconf_pio_libdeps_dir`. + .. envvar:: PLATFORMIO_SRC_DIR Allows to override :ref:`projectconf` option :ref:`projectconf_pio_src_dir`. @@ -69,6 +73,10 @@ Allows to override :ref:`projectconf` option :ref:`projectconf_pio_envs_dir`. Allows to override :ref:`projectconf` option :ref:`projectconf_pio_data_dir`. +.. envvar:: PLATFORMIO_TEST_DIR + +Allows to override :ref:`projectconf` option :ref:`projectconf_pio_test_dir`. + Building -------- @@ -103,6 +111,10 @@ Allows to set :ref:`projectconf` option :ref:`projectconf_src_filter`. Allows to set :ref:`projectconf` option :ref:`projectconf_extra_script`. +.. envvar:: PLATFORMIO_LIB_EXTRA_DIRS + +Allows to set :ref:`projectconf` option :ref:`projectconf_lib_extra_dirs`. + Uploading --------- @@ -149,3 +161,7 @@ Allows to override setting :ref:`setting_enable_prompts`. .. envvar:: PLATFORMIO_SETTING_ENABLE_TELEMETRY Allows to override setting :ref:`setting_enable_telemetry`. + +.. envvar:: PLATFORMIO_SETTING_FORCE_VERBOSE + +Allows to override setting :ref:`setting_force_verbose`. diff --git a/docs/faq.rst b/docs/faq.rst index 663c108f..dd30f4bd 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -155,12 +155,6 @@ Answered in `issue #144 `_ -* `#331: Unable to use MySensors library `_ - ARM toolchain: cc1plus: error while loading shared libraries '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' diff --git a/docs/frameworks/arduino.rst b/docs/frameworks/arduino.rst index b16c12d6..ff28614b 100644 --- a/docs/frameworks/arduino.rst +++ b/docs/frameworks/arduino.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/cmsis.rst b/docs/frameworks/cmsis.rst index 7520cd94..394c652e 100644 --- a/docs/frameworks/cmsis.rst +++ b/docs/frameworks/cmsis.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/cmsis_extra.rst b/docs/frameworks/cmsis_extra.rst index d57aff1a..fb8711ce 100644 --- a/docs/frameworks/cmsis_extra.rst +++ b/docs/frameworks/cmsis_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/energia.rst b/docs/frameworks/energia.rst index 4f9a2594..5235ee76 100644 --- a/docs/frameworks/energia.rst +++ b/docs/frameworks/energia.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/index.rst b/docs/frameworks/index.rst index 56a5f532..dc925667 100644 --- a/docs/frameworks/index.rst +++ b/docs/frameworks/index.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/libopencm3.rst b/docs/frameworks/libopencm3.rst index 9822bc97..ea45d299 100644 --- a/docs/frameworks/libopencm3.rst +++ b/docs/frameworks/libopencm3.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/libopencm3_extra.rst b/docs/frameworks/libopencm3_extra.rst index f0bc221a..54f9050b 100644 --- a/docs/frameworks/libopencm3_extra.rst +++ b/docs/frameworks/libopencm3_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/mbed.rst b/docs/frameworks/mbed.rst index df5d4c00..05009466 100644 --- a/docs/frameworks/mbed.rst +++ b/docs/frameworks/mbed.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/mbed_extra.rst b/docs/frameworks/mbed_extra.rst index b073db35..4da14956 100644 --- a/docs/frameworks/mbed_extra.rst +++ b/docs/frameworks/mbed_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/simba.rst b/docs/frameworks/simba.rst index 699e38be..93512001 100644 --- a/docs/frameworks/simba.rst +++ b/docs/frameworks/simba.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/simba_extra.rst b/docs/frameworks/simba_extra.rst index 40b700ee..aa4c7298 100755 --- a/docs/frameworks/simba_extra.rst +++ b/docs/frameworks/simba_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/spl.rst b/docs/frameworks/spl.rst index 54fbe5e5..d9203e8b 100644 --- a/docs/frameworks/spl.rst +++ b/docs/frameworks/spl.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/spl_extra.rst b/docs/frameworks/spl_extra.rst index 15b14696..f84cff83 100644 --- a/docs/frameworks/spl_extra.rst +++ b/docs/frameworks/spl_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/wiringpi.rst b/docs/frameworks/wiringpi.rst index c973dbd8..93febf97 100644 --- a/docs/frameworks/wiringpi.rst +++ b/docs/frameworks/wiringpi.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/frameworks/wiringpi_extra.rst b/docs/frameworks/wiringpi_extra.rst index e82a29bc..a0a33ec8 100644 --- a/docs/frameworks/wiringpi_extra.rst +++ b/docs/frameworks/wiringpi_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/history.rst b/docs/history.rst index 08e44848..9c0c0f45 100644 --- a/docs/history.rst +++ b/docs/history.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide.rst b/docs/ide.rst index 63c3469f..f41e3643 100644 --- a/docs/ide.rst +++ b/docs/ide.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide/_platformio_ide_extra.rst b/docs/ide/_platformio_ide_extra.rst index c762c1b1..cf446adf 100644 --- a/docs/ide/_platformio_ide_extra.rst +++ b/docs/ide/_platformio_ide_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide/atom.rst b/docs/ide/atom.rst index 09c6692c..fdfe142b 100644 --- a/docs/ide/atom.rst +++ b/docs/ide/atom.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide/clion.rst b/docs/ide/clion.rst index 387dad92..01600f2e 100644 --- a/docs/ide/clion.rst +++ b/docs/ide/clion.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide/codeblocks.rst b/docs/ide/codeblocks.rst index 04819998..dd1857dd 100644 --- a/docs/ide/codeblocks.rst +++ b/docs/ide/codeblocks.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide/eclipse.rst b/docs/ide/eclipse.rst index 6f889b6b..558117c8 100644 --- a/docs/ide/eclipse.rst +++ b/docs/ide/eclipse.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide/emacs.rst b/docs/ide/emacs.rst index ef402dfb..769a64ce 100644 --- a/docs/ide/emacs.rst +++ b/docs/ide/emacs.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide/netbeans.rst b/docs/ide/netbeans.rst index 432ddb26..d4a95e98 100644 --- a/docs/ide/netbeans.rst +++ b/docs/ide/netbeans.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide/qtcreator.rst b/docs/ide/qtcreator.rst index a84c8875..714d10c7 100644 --- a/docs/ide/qtcreator.rst +++ b/docs/ide/qtcreator.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide/sublimetext.rst b/docs/ide/sublimetext.rst index feaa5f3a..7e58b2fc 100644 --- a/docs/ide/sublimetext.rst +++ b/docs/ide/sublimetext.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide/vim.rst b/docs/ide/vim.rst index 02a09733..c6fc368f 100644 --- a/docs/ide/vim.rst +++ b/docs/ide/vim.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/ide/visualstudio.rst b/docs/ide/visualstudio.rst index e7008e92..46323421 100644 --- a/docs/ide/visualstudio.rst +++ b/docs/ide/visualstudio.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/index.rst b/docs/index.rst index ce0d088c..13be0abd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -111,6 +111,7 @@ Contents platforms/embedded_boards frameworks/index platforms/custom_platform_and_board + platforms/unit_testing .. toctree:: :caption: Library Manager @@ -118,6 +119,7 @@ Contents Quickstart User Guide + librarymanager/ldf librarymanager/config librarymanager/creating diff --git a/docs/installation.rst b/docs/installation.rst index a74cca4e..53dd81ca 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/librarymanager/config.rst b/docs/librarymanager/config.rst index c56d74ed..7f619bcb 100644 --- a/docs/librarymanager/config.rst +++ b/docs/librarymanager/config.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -22,6 +22,7 @@ to keep project in own structure and define: * examples list * compatible frameworks and platforms * library dependencies +* advanced build settings PlatformIO Library Crawler uses ``library.json`` manifest to extract source code from developer's location and keeps cleaned library in own @@ -221,6 +222,19 @@ Example: }, "version": "1.0.0" + +``license`` +----------- + +A license of the library. You can check +`the full list of SPDX license IDs `_. Ideally you +should pick one that is `OSI `_ +approved. + +.. code-block:: javascript + + "license": "Apache-2.0" + .. _libjson_downloadurl: ``downloadUrl`` @@ -367,6 +381,7 @@ A list of dependent libraries. They will be installed automatically with Allowed requirements for dependent library: * ``name`` | Type: ``String`` +* ``version`` | Type: ``String`` * ``authors`` | Type: ``String`` or ``Array`` * ``frameworks`` | Type: ``String`` or ``Array`` * ``platforms`` | Type: ``String`` or ``Array`` @@ -387,17 +402,30 @@ Example: }, { "name": "Library-Bar", - "frameworks": "FrameworkFoo, FrameworkBar" + "version": "~1.2.3" + }, + { + "name": "lib-from-repo", + "version": "https://github.com/user/package.git#1.2.3" } ] +A short definition of dependencies is allowed: + +.. code-block:: javascript + + "dependencies": { + "mylib": "1.2.3", + "lib-from-repo": "githubuser/package" + } + See more ``library.json`` :ref:`library_creating_examples`. .. _libjson_examples: ``examples`` ----------------- +------------ *Optional* | Type: ``String`` or ``Array`` | `Glob Pattern `_ @@ -413,3 +441,105 @@ A list of example patterns. This field is predefined with default value: "[Ee]xamples/*/*.ino", "[Ee]xamples/*/*.pde" ] + + +.. _libjson_build: + +``build`` +------------ + +*Optional* | Type: ``Object`` + +Specify advanced settings, options and flags for the build system. Possible +options: + +.. list-table:: + :header-rows: 1 + + * - Option + - Type + - Description + * - ``flags`` + - ``String`` or ``Array`` + - Extra flags to control preprocessing, compilation, assembly and + linking processes. More details :ref:`projectconf_build_flags` + * - ``unflags`` + - ``String`` or ``Array`` + - Remove base/initial flags which were set by development + platform. More details :ref:`projectconf_build_unflags` + * - ``srcFilter`` + - ``String`` or ``Array`` + - Specify which source files should be included/excluded + from build process. More details :ref:`projectconf_src_filter` + * - ``extraScript`` + - ``String`` + - Launch extra script before build process. + More details :ref:`projectconf_extra_script` + * - ``libArchive`` + - ``Boolean`` + - Archive object files to Static Library. This is default behavior of + PlatformIO Build System (``"libArchive": true``). + +**Examples** + +1. Custom macros/defines + +.. code-block:: javascript + + "build": { + "flags": "-D MYLIB_REV=0.1.2 -DRELEASE" + } + +2. Extra includes for C preprocessor + +.. code-block:: javascript + + "build": { + "flags": [ + "-I inc", + "-I inc/target_x13" + ] + } + +3. Force to use ``C99`` standard instead of ``C11`` + +.. code-block:: javascript + + "build": { + "unflags": "-std=gnu++11", + "flags": "-std=c99" + } + +4. Build source files (``c, cpp, h``) at the top level of the library + +.. code-block:: javascript + + "build": { + "srcFilter": [ + "+<*.c>", + "+<*.cpp>", + "+<*.h>" + ] + } + + +5. Extend PlatformIO Build System with own extra script + +.. code-block:: javascript + + "build": { + "extraScript": "generate_headers.py" + } + +``generate_headers.py`` + +.. code-block:: python + + Import('env') + # print env.Dump() + env.Append( + CPPDEFINES=["HELLO=WORLD", "TAG=1.2.3", "DEBUG"], + CPPPATH=["inc", "inc/devices"] + ) + + # some python code that generates header files "on-the-fly" diff --git a/docs/librarymanager/creating.rst b/docs/librarymanager/creating.rst index 2fe3dbbd..5d150f16 100644 --- a/docs/librarymanager/creating.rst +++ b/docs/librarymanager/creating.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/librarymanager/index.rst b/docs/librarymanager/index.rst index 8a935663..5e2327d4 100644 --- a/docs/librarymanager/index.rst +++ b/docs/librarymanager/index.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/librarymanager/ldf.rst b/docs/librarymanager/ldf.rst new file mode 100644 index 00000000..bd5889ff --- /dev/null +++ b/docs/librarymanager/ldf.rst @@ -0,0 +1,165 @@ +.. Copyright 2014-present PlatformIO + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +.. _ldf: + +Library Dependency Finder (LDF) +=============================== + +.. versionadded:: 3.0 + +Library Dependency Finder is a core part of PlatformIO Build System that +operates with the C/C++ source files and looks for ``#include ...`` +directives. + +In spite of the fact that Library Dependency Finder is written in pure Python, +it interprets (emulates) :ref:`ldf_c_cond_syntax` (``#ifdef``, ``if``, ``defined``, +``else``, and ``elif``) without calling ``gcc -E``. This approach allows +significantly reduce total compilation time. + +Library Dependency Finder has controls that can be set up in :ref:`projectconf`: + +.. hlist:: + :columns: 3 + + * :ref:`projectconf_lib_deps` + * :ref:`projectconf_lib_extra_dirs` + * :ref:`projectconf_lib_force` + * :ref:`projectconf_lib_ignore` + * :ref:`projectconf_lib_compat_mode` + * :ref:`projectconf_lib_ldf_mode` + +----------- + +.. contents:: + +Storage +------- + +There are different storages where Library Dependency Finder looks for +libraries. These storages (folders) have priority and LDF operates in the next +order: + +1. :ref:`projectconf_lib_extra_dirs` - extra storages per build environment +2. :ref:`projectconf_pio_lib_dir` - own/private library storage per project +3. :ref:`projectconf_pio_libdeps_dir` - project dependencies storage used by + :ref:`librarymanager` +4. ":ref:`projectconf_pio_home_dir`/lib" - global storage per all projects. + +.. _ldf_mode: + +Dependency Finder Mode +---------------------- + +Library Dependency Finder starts work from analyzing source files of the +project (:ref:`projectconf_pio_src_dir`) and can work in the next modes: + +* ``0`` - "manual mode", does not process source files of a project and + dependencies. Builds only the libraries that are specified in + manifests (:ref:`library_config`, ``module.json``) or in the :ref:`projectconf`. +* ``1`` - parses ALL C/C++ source code of the project and follows only by + nested includes/chain (``#include ...``) from the libraries. +* ``2`` - **default** - parses ALL C/C++ source code of the project and parses + ALL C/C++ source code of the each dependency (recursively). + +This mode can be changed using :ref:`projectconf_lib_ldf_mode` option in +:ref:`projectconf`. + +A difference between ``1`` and ``2`` modes. For example, there are 2 libraries: + +* Library "Foo" with files: + + - ``Foo/foo.h`` + - ``Foo/foo.cpp`` + +* Library "Bar" with files: + + - ``Bar/bar.h`` + - ``Bar/bar.cpp`` + +:Case 1: + + * ``lib_ldf_mode = 1`` + * ``Foo/foo.h`` depends on "Bar" library (contains ``#include ``) + * ``#include `` is located in one of the project source files + + Here are nested includes (``project file > foo.h > bar.h``) and ``LDF`` + will find both libraries "Foo" and "Bar". + +:Case 2: + + * ``lib_ldf_mode = 1`` + * ``Foo/foo.cpp`` depends on "Bar" library (contains ``#include ``) + * ``#include `` is located in one of the project source files + + In this case, ``LDF`` will not find "Bar" library because it doesn't know + about CPP file (``Foo/foo.cpp``). + +:Case 3: + + * ``lib_ldf_mode = 2`` + * ``Foo/foo.cpp`` depends on "Bar" library (contains ``#include ``) + * ``#include `` is located in one of the project source files + + Firstly, ``LDF`` finds "Foo" library, then it parses all sources from "Foo" + library and finds ``Foo/foo.cpp`` that depends on ``#include ``. + Secondly, it will parse all sources from "Bar" library and this operation + continues until all dependencies will not be parsed. + +.. _ldf_compat_mode: + +Compatibility Mode +------------------ + +Compatibility mode allows to control strictness of Library Dependency Finder. +If library contains one of manifest file (:ref:`library_config`, +``library.properties``, ``module.json``), then LDF check compatibility of this +library with real build environment. Available compatibility modes: + +* ``0`` - does not check for compatibility (is not recommended) +* ``1`` - **default** - checks for the compatibility with + :ref:`projectconf_env_framework` from build environment +* ``2`` - checks for the compatibility with :ref:`projectconf_env_framework` + and :ref:`projectconf_env_platform` from build environment. + +This mode can be changed using :ref:`projectconf_lib_compat_mode` option in +:ref:`projectconf`. + +.. _ldf_c_cond_syntax: + +C/C++ Preprocessor conditional syntax +------------------------------------- + +In spite of the fact that Library Dependency Finder is written in pure Python, +it interprets (emulates) `C/C++ Preprocessor conditional syntax `_ +(``#ifdef``, ``if``, ``defined``, ``else``, and ``elif``) without calling +``gcc -E``. For example, + +``platformio.ini`` + +.. code-block:: ini + + [env:myenv] + build_flags = -D MY_PROJECT_VERSION=13 + +``mylib.h`` + +.. code-block:: c + + #ifdef PROJECT_VERSION + // include common file for the project + #include "my_common.h" + #endif + + #if PROJECT_VERSION < 10 + // this include will be ignored because does not satisfy condition above + #include "my_old.h" + #endif diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index 52bcb584..0c5faa9a 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/atmelavr_extra.rst b/docs/platforms/atmelavr_extra.rst index 754de6e0..7d97a4d8 100644 --- a/docs/platforms/atmelavr_extra.rst +++ b/docs/platforms/atmelavr_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/atmelsam.rst b/docs/platforms/atmelsam.rst index 12cbc41a..8bc92bbc 100644 --- a/docs/platforms/atmelsam.rst +++ b/docs/platforms/atmelsam.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/creating_board.rst b/docs/platforms/creating_board.rst index 55be0dbd..02c8b0ea 100644 --- a/docs/platforms/creating_board.rst +++ b/docs/platforms/creating_board.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -35,29 +35,44 @@ 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` +* ``platform`` name 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." - } + "build": { + "extra_flags": "-DHELLO_PLATFORMIO", + "f_cpu": "16000000L", + "hwids": [ + [ + "0x1234", + "0x0013" + ], + [ + "0x4567", + "0x0013" + ] + ], + "mcu": "%MCU_TYPE_HERE%" + }, + "frameworks": ["%LIST_WITH_SUPPORTED_FRAMEWORKS%"], + "name": "My Test Board", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 32256 + }, + "url": "http://example.com", + "vendor": "MyCompany" } + 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. +2. Create ``myboard.json`` file and put to ``boards`` directory. 3. Search available boards via :ref:`cmd_boards` command. You should see ``myboard`` board. @@ -68,5 +83,6 @@ Now, you can use ``myboard`` for the :ref:`projectconf_env_board` option in Examples -------- -For the examples, please look into built-in ``*.json`` files with boards -settings: https://github.com/platformio/platformio/tree/develop/platformio/boards. +Please take a look at the source code of +`PlatformIO Development Platforms `_ +and navigate to ``boards`` folder of the repository. diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index 09e11695..90f14517 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -14,7 +14,7 @@ Custom Development Platform =========================== -*PlatformIO* was developed like a tool which would build the same source code +*PlatformIO* was developed like a tool that may build the same source code for the different development platforms via single command :ref:`cmd_run` without any dependent software or requirements. @@ -32,7 +32,7 @@ different/own build scripts, uploader and etc. **Step-by-Step Manual** -1. Chose :ref:`platform_creating_packages` for platform +1. Choose :ref:`platform_creating_packages` for platform 2. Create :ref:`platform_creating_manifest_file` 3. Create :ref:`platform_creating_build_script` 4. Finish with the :ref:`platform_creating_installation`. @@ -187,89 +187,82 @@ Packages .. _platform_creating_manifest_file: -Manifest File -------------- +Manifest File ``platform.json`` +------------------------------- -A platform manifest file is a `Python `_ script with the -next requirements: +.. code-block:: json -1. The file should have ``.py`` extension -2. The **name of the file** is the **platform name** (lowercase) -3. The source code of this file should contain a ``class`` which describes your - own platform. The name of the ``class`` should start with your - **platform name** (the first letter should be capitalized) + ``Platform`` - ending. This ``class`` should be derived from *PlatformIO* ``BasePlatform`` - class. - -.. warning:: - If you are new to *Python* language, please read: - - * `Style Guide for Python Code `_. - * A hash sign (#) that is not inside a string literal begins a comment. - All characters after the # and up to the physical line end are part - of the comment and the *Python* interpreter ignores them. - -Example of the **test** platform (``test.py``): - -.. code-block:: python - - import os - - from platformio.platforms.base import BasePlatform - - class TestPlatform(BasePlatform): - # This is a description of your platform. - # Platformio uses it for the `platformio search / list` commands - """ - My Test platform - test.py - """ - - PACKAGES = { - - "toolchain-foo": { - - # alias is used for quick access to package. - # For example, - # `> platformio install test --without-package=toolchain` - "alias": "toolchain", - - # Flag which allows PlatformIO to install this package by - # default via `> platformio install test` command - "default": True - }, - - "tool-bar": { - "alias": "uploader", - "default": True - }, - - "framework-baz": { - "default": True + { + "name": "myplatform", + "title": "My Platform", + "description": "My custom development platform", + "url": "http://example.com", + "homepage": "http://platformio.org/platforms/myplatform", + "license": { + "type": "Apache-2.0", + "url": "http://opensource.org/licenses/apache2.0.php" + }, + "engines": { + "platformio": "~3.0.0", + "scons": ">=2.3.0,<2.6.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/platformio/platform-myplatform.git" + }, + "version": "0.0.0", + "packageRepositories": [ + "https://dl.bintray.com/platformio/dl-packages/manifest.json", + "https://sourceforge.net/projects/platformio-storage/files/packages/manifest.json/download", + "http://dl.platformio.org/packages/manifest.json", + { + "framework-%FRAMEWORK_NAME_1%": [ + { + "url": "http://dl.example.com/packages/framework-%FRAMEWORK_NAME_1%-1.10607.0.tar.gz", + "sha1": "adce2cd30a830d71cb6572575bf08461b7b73c07", + "version": "1.10607.0", + "system": "*" } + ] } - - def get_build_script(self): - """ Returns a path to build script """ - - # You can return static path - #return "/path/to/test-builder.py" - - # or detect dynamically if `test-builder.py` is located in the same - # folder with `test.py` - return os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "test-builder.py" - ) + ], + "frameworks": { + "%FRAMEWORK_NAME_1%": { + "package": "framework-%FRAMEWORK_NAME_1%", + "script": "builder/frameworks/%FRAMEWORK_NAME_1%.py" + }, + "%FRAMEWORK_NAME_N%": { + "package": "framework-%FRAMEWORK_NAME_N%", + "script": "builder/frameworks/%FRAMEWORK_NAME_N%.py" + } + }, + "packages": { + "toolchain-gccarmnoneeabi": { + "type": "toolchain", + "version": ">=1.40803.0,<1.40805.0" + }, + "framework-%FRAMEWORK_NAME_1%": { + "type": "framework", + "optional": true, + "version": "~1.10607.0" + }, + "framework-%FRAMEWORK_NAME_N%": { + "type": "framework", + "optional": true, + "version": "~1.117.0" + } + } + } .. _platform_creating_build_script: -Build Script ------------- +Build Script ``main.py`` +------------------------ Platform's build script is based on a next-generation build tool named `SCons `_. PlatformIO has own built-in firmware builder -``env.BuildProgram`` with the nested libraries search. Please look into a -base template of ``test-builder.py``. +``env.BuildProgram`` with the deep libraries search. Please look into a +base template of ``main.py``. .. code-block:: python @@ -347,15 +340,6 @@ base template of ``test-builder.py``. Default(target_bin) -Please look into the examples with built-in scripts for the popular -platforms: - -* `baseavr.py `_ -* `basearm.py `_ -* `atmelavr.py `_ -* `timsp430.py `_ -* `ststm32.py `_ - .. _platform_creating_installation: Installation @@ -363,126 +347,17 @@ Installation 1. Create ``platforms`` directory in :ref:`projectconf_pio_home_dir` if it 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. -4. Install ``test`` platform via :ref:`cmd_platforms_install` command. +2. Create ``myplatform`` directory in ``platforms`` +3. Copy ``platform.json`` and ``builder/main.py`` files to ``myplatform`` directory. +4. Search available platforms via :ref:`cmd_platform_search` command. You + should see ``myplatform`` platform. +5. Install ``myplatform`` platform via :ref:`cmd_platform_install` command. -Now, you can use ``test`` for the :ref:`projectconf_env_platform` option in -:ref:`projectconf`. +Now, you can use ``myplatform`` for the :ref:`projectconf_env_platform` +option in :ref:`projectconf`. -Example -------- - -Let's use the real example which was requested by our user in `issue 175 `_. Need to add support for uploading firmware using GDB to -:ref:`platform_ststm32`. - -First of all, need to create new folder ``platforms`` in :ref:`projectconf_pio_home_dir` -and copy there two files: - -1. Platform manifest file ``ststm32gdb.py`` with the next content: - -.. code-block:: python - - import os - - from platformio.platforms.ststm32 import Ststm32Platform - - - class Ststm32gdbPlatform(Ststm32Platform): - - """ - ST STM32 using GDB as uploader - - http://www.st.com/web/en/catalog/mmc/FM141/SC1169?sc=stm32 - """ - - def get_build_script(self): - - return os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "ststm32gdb-builder.py" - ) - -2. Build script file ``ststm32gdb-builder.py`` with the next content: - -.. code-block:: python - - """ - Builder for ST STM32 Series ARM microcontrollers with GDB upload. - """ - - from os.path import join - - from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, - DefaultEnvironment, SConscript) - - - env = DefaultEnvironment() - - SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) - - env.Replace( - UPLOADER=join( - "$PIOPACKAGES_DIR", "toolchain-gccarmnoneeabi", - "bin", "arm-none-eabi-gdb" - ), - UPLOADERFLAGS=[ - join("$BUILD_DIR", "firmware.elf"), - "-batch", - "-x", join("$PROJECT_DIR", "upload.gdb") - ], - - UPLOADCMD="$UPLOADER $UPLOADERFLAGS" - ) - - env.Append( - CPPDEFINES=[ - "${BOARD_OPTIONS['build']['variant'].upper()}" - ], - - LINKFLAGS=[ - "-nostartfiles", - "-nostdlib" - ] - ) - - # - # Target: Build executable and linkable firmware - # - - target_elf = env.BuildProgram() - - # - # Target: Build the .bin file - # - - if "uploadlazy" in COMMAND_LINE_TARGETS: - target_firm = join("$BUILD_DIR", "firmware.bin") - else: - target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf) - - # - # Target: Print binary size - # - - target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD") - AlwaysBuild(target_size) - - # - # Target: Upload by default .bin file - # - - upload = env.Alias( - ["upload", "uploadlazy"], target_firm, "$UPLOADCMD") - AlwaysBuild(upload) - - # - # Target: Define targets - # - - Default([target_firm, target_size]) - -Now, we should see ``ststm32gdb`` platform using :ref:`cmd_platforms_search` command output -and can install it via :ref:`platformio platforms install ststm32gdb ` command. +Examples +-------- +Please take a look at the source code of +`PlatformIO Development Platforms `_. diff --git a/docs/platforms/custom_platform_and_board.rst b/docs/platforms/custom_platform_and_board.rst index 7db1381c..36614a24 100644 --- a/docs/platforms/custom_platform_and_board.rst +++ b/docs/platforms/custom_platform_and_board.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/embedded_boards.rst b/docs/platforms/embedded_boards.rst index 91df1475..9bf44d69 100644 --- a/docs/platforms/embedded_boards.rst +++ b/docs/platforms/embedded_boards.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/espressif.rst b/docs/platforms/espressif.rst index 56ffbc43..fca7b8ab 100644 --- a/docs/platforms/espressif.rst +++ b/docs/platforms/espressif.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/espressif_extra.rst b/docs/platforms/espressif_extra.rst index 65d7356a..b6315b4e 100644 --- a/docs/platforms/espressif_extra.rst +++ b/docs/platforms/espressif_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/freescalekinetis.rst b/docs/platforms/freescalekinetis.rst index 13e60daf..aba52b24 100644 --- a/docs/platforms/freescalekinetis.rst +++ b/docs/platforms/freescalekinetis.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/index.rst b/docs/platforms/index.rst index f7f68146..cdfa1003 100644 --- a/docs/platforms/index.rst +++ b/docs/platforms/index.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/intel_arc32.rst b/docs/platforms/intel_arc32.rst index c4863e5c..3127fd76 100644 --- a/docs/platforms/intel_arc32.rst +++ b/docs/platforms/intel_arc32.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/lattice_ice40.rst b/docs/platforms/lattice_ice40.rst index 4a836ed3..fd54c760 100644 --- a/docs/platforms/lattice_ice40.rst +++ b/docs/platforms/lattice_ice40.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/linux_arm.rst b/docs/platforms/linux_arm.rst index 56783765..0b69a2d3 100644 --- a/docs/platforms/linux_arm.rst +++ b/docs/platforms/linux_arm.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/linux_i686.rst b/docs/platforms/linux_i686.rst index 583ad151..fb1f3dd7 100644 --- a/docs/platforms/linux_i686.rst +++ b/docs/platforms/linux_i686.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/linux_x86_64.rst b/docs/platforms/linux_x86_64.rst index d770b2e8..445eb691 100644 --- a/docs/platforms/linux_x86_64.rst +++ b/docs/platforms/linux_x86_64.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/microchippic32.rst b/docs/platforms/microchippic32.rst index 51c92e8e..dc5db46a 100644 --- a/docs/platforms/microchippic32.rst +++ b/docs/platforms/microchippic32.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/native.rst b/docs/platforms/native.rst index 68fd805b..a4174222 100644 --- a/docs/platforms/native.rst +++ b/docs/platforms/native.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/nordicnrf51.rst b/docs/platforms/nordicnrf51.rst index fff500b3..75fd69d8 100644 --- a/docs/platforms/nordicnrf51.rst +++ b/docs/platforms/nordicnrf51.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/nordicnrf51_extra.rst b/docs/platforms/nordicnrf51_extra.rst index beab99ce..b77d8629 100644 --- a/docs/platforms/nordicnrf51_extra.rst +++ b/docs/platforms/nordicnrf51_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/nxplpc.rst b/docs/platforms/nxplpc.rst index 2c94410f..c733fa3e 100644 --- a/docs/platforms/nxplpc.rst +++ b/docs/platforms/nxplpc.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/siliconlabsefm32.rst b/docs/platforms/siliconlabsefm32.rst index c4829f08..c1ccc8a5 100644 --- a/docs/platforms/siliconlabsefm32.rst +++ b/docs/platforms/siliconlabsefm32.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/ststm32.rst b/docs/platforms/ststm32.rst index fb1acfa4..6edea8b9 100644 --- a/docs/platforms/ststm32.rst +++ b/docs/platforms/ststm32.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/ststm32_extra.rst b/docs/platforms/ststm32_extra.rst index 6a98012b..077a5517 100644 --- a/docs/platforms/ststm32_extra.rst +++ b/docs/platforms/ststm32_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/teensy.rst b/docs/platforms/teensy.rst index 0edcbcd2..80e92de9 100644 --- a/docs/platforms/teensy.rst +++ b/docs/platforms/teensy.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/teensy_extra.rst b/docs/platforms/teensy_extra.rst index 360ea86c..77438896 100644 --- a/docs/platforms/teensy_extra.rst +++ b/docs/platforms/teensy_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/timsp430.rst b/docs/platforms/timsp430.rst index 28b25393..b807d4b1 100644 --- a/docs/platforms/timsp430.rst +++ b/docs/platforms/timsp430.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/timsp430_extra.rst b/docs/platforms/timsp430_extra.rst index 40e21277..e30f5e3b 100644 --- a/docs/platforms/timsp430_extra.rst +++ b/docs/platforms/timsp430_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/titiva.rst b/docs/platforms/titiva.rst index bf4d6288..88b960b1 100644 --- a/docs/platforms/titiva.rst +++ b/docs/platforms/titiva.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/titiva_extra.rst b/docs/platforms/titiva_extra.rst index bdc91b0c..5830ab70 100644 --- a/docs/platforms/titiva_extra.rst +++ b/docs/platforms/titiva_extra.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/platforms/unit_testing.rst b/docs/platforms/unit_testing.rst new file mode 100644 index 00000000..5e6555a5 --- /dev/null +++ b/docs/platforms/unit_testing.rst @@ -0,0 +1,399 @@ +.. Copyright 2014-present PlatformIO + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +.. _unit_testing: + +Unit Testing +============ + +.. versionadded:: 3.0 (PlatformIO Plus) + +`Unit Testing (wiki) `_ +is a software testing method by which individual units of source code, sets +of one or more MCU program modules together with associated control data, +usage procedures, and operating procedures, are tested to determine whether +they are fit for use. Unit testing finds problems early in the development cycle. + +PlatformIO Test System is very interesting for embedded development. +It allows you to write tests locally and run them directly on the target +device (hardware unit testing). Also, you will be able to run the same tests +on the different target devices (:ref:`embedded_boards`). + +PlatformIO Test System consists of: + +* Project builder +* Test builder +* Firmware uploader +* Test processor + +There is special command :ref:`cmd_test` to run tests from PlatformIO Project. + +.. contents:: + +.. _unit_testing_design: + +Design +------ + +PlatformIO Test System design is based on a few isolated components: + +1. **Main program**. Contains the independent modules, procedures, + functions or methods that will be the target candidates (TC) for testing. +2. **Unit test**. This a small independent program that is intended to + re-use TC from the main program and apply tests for them. +3. **Test processor**. The set of approaches and tools that will be used + to apply test for the environments from :ref:`projectconf`. + +Workflow +-------- + +1. Create PlatformIO project using :ref:`cmd_init` command. +2. Place source code of main program to ``src`` directory. +3. Wrap ``main()`` or ``setup()/loop()`` methods of main program in ``UNIT_TEST`` + guard: + + .. code-block:: c + + /** + * Arduino Wiring-based Framework + */ + #ifndef UNIT_TEST + void setup () { + // some code... + } + + void loop () { + // some code... + } + #endif + + /** + * Generic C/C++ + */ + #ifndef UNIT_TEST + int main() { + // setup code... + + while (1) { + // loop code... + } + } + #endif + +4. Create ``test`` directory in the root of project. See :ref:`projectconf_pio_test_dir`. +5. Write test using :ref:`unit_testing_api`. The each test is a small + independent program with own ``main()`` or ``setup()/loop()`` methods. Also, + test should start from ``UNITY_BEGIN()`` and finish with ``UNITY_END()``. +6. Place test to ``test`` directory. If you have more than one test, split them + into sub-folders. For example, ``test/test_1/*.[c,cpp,h]``, + ``test_N/*.[c,cpp,h]``, etc. If no such directory in ``test`` folder, then + PlatformIO Test System will treat the source code of ``test`` folder + as SINGLE test. +7. Run tests using :ref:`cmd_test` command. + +.. _unit_testing_api: + +Test API +-------- + +The summary of `Unity Test API `_: + +* `Running Tests `_ + + - ``RUN_TEST(func, linenum)`` + +* `Ignoring Tests `_ + + - ``TEST_IGNORE()`` + - ``TEST_IGNORE_MESSAGE (message)`` + +* `Aborting Tests `_ + + - ``TEST_PROTECT()`` + - ``TEST_ABORT()`` + +* `Basic Validity Tests `_ + + - ``TEST_ASSERT_TRUE(condition)`` + - ``TEST_ASSERT_FALSE(condition)`` + - ``TEST_ASSERT(condition)`` + - ``TEST_ASSERT_UNLESS(condition)`` + - ``TEST_FAIL()`` + - ``TEST_FAIL_MESSAGE(message)`` + +* `Numerical Assertions: Integers `_ + + - ``TEST_ASSERT_EQUAL_INT(expected, actual)`` + - ``TEST_ASSERT_EQUAL_INT8(expected, actual)`` + - ``TEST_ASSERT_EQUAL_INT16(expected, actual)`` + - ``TEST_ASSERT_EQUAL_INT32(expected, actual)`` + - ``TEST_ASSERT_EQUAL_INT64(expected, actual)`` + + - ``TEST_ASSERT_EQUAL_UINT(expected, actual)`` + - ``TEST_ASSERT_EQUAL_UINT8(expected, actual)`` + - ``TEST_ASSERT_EQUAL_UINT16(expected, actual)`` + - ``TEST_ASSERT_EQUAL_UINT32(expected, actual)`` + - ``TEST_ASSERT_EQUAL_UINT64(expected, actual)`` + + - ``TEST_ASSERT_EQUAL_HEX(expected, actual)`` + - ``TEST_ASSERT_EQUAL_HEX8(expected, actual)`` + - ``TEST_ASSERT_EQUAL_HEX16(expected, actual)`` + - ``TEST_ASSERT_EQUAL_HEX32(expected, actual)`` + - ``TEST_ASSERT_EQUAL_HEX64(expected, actual)`` + - ``TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements)`` + + - ``TEST_ASSERT_EQUAL(expected, actual)`` + - ``TEST_ASSERT_INT_WITHIN(delta, expected, actual)`` + +* `Numerical Assertions: Bitwise `_ + + - ``TEST_ASSERT_BITS(mask, expected, actual)`` + - ``TEST_ASSERT_BITS_HIGH(mask, actual)`` + - ``TEST_ASSERT_BITS_LOW(mask, actual)`` + - ``TEST_ASSERT_BIT_HIGH(mask, actual)`` + - ``TEST_ASSERT_BIT_LOW(mask, actual)`` + +* `Numerical Assertions: Floats `_ + + - ``TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual)`` + - ``TEST_ASSERT_EQUAL_FLOAT(expected, actual)`` + - ``TEST_ASSERT_EQUAL_DOUBLE(expected, actual)`` + +* `String Assertions `_ + + - ``TEST_ASSERT_EQUAL_STRING(expected, actual)`` + - ``TEST_ASSERT_EQUAL_STRING_LEN(expected, actual, len)`` + - ``TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message)`` + - ``TEST_ASSERT_EQUAL_STRING_LEN_MESSAGE(expected, actual, len, message)`` + +* `Pointer Assertions `_ + + - ``TEST_ASSERT_NULL(pointer)`` + - ``TEST_ASSERT_NOT_NULL(pointer)`` + +* `Memory Assertions `_ + + - ``TEST_ASSERT_EQUAL_MEMORY(expected, actual, len)`` + +Example +------- + +1. Please follow to :ref:`quickstart` and create "Blink Project". According + to the Unit Testing :ref:`unit_testing_design` it is the **Main program**. +2. Create ``test`` directory in that project (on the same level as ``src``) + and place ``test_main.cpp`` file to it (the source code is located below). +3. Wrap ``setup()`` and ``loop()`` methods of main program in ``UNIT_TEST`` + guard. +4. Run tests using :ref:`cmd_test` command. + +Project structure +~~~~~~~~~~~~~~~~~ + +.. code-block:: bash + + project_dir + ├── lib + │   └── readme.txt + ├── platformio.ini + ├── src + │   └── main.cpp + └── test + └── test_main.cpp + +Source files +~~~~~~~~~~~~ + +* ``platformio.ini`` + + .. code-block:: ini + + ; Project Configuration File + ; Docs: http://docs.platformio.org/en/latest/projectconf.html + + [env:uno] + platform = atmelavr + framework = arduino + board = uno + + [env:nodemcu] + platform = espressif + framework = arduino + board = nodemcu + + [env:teensy31] + platform = teensy + framework = arduino + board = teensy31 + +* ``src/main.cpp`` + + .. code-block:: cpp + + /* + * Blink + * Turns on an LED on for one second, + * then off for one second, repeatedly. + */ + + #include "Arduino.h" + + #ifndef UNIT_TEST // IMPORTANT LINE! + + void setup() + { + // initialize LED digital pin as an output. + pinMode(LED_BUILTIN, OUTPUT); + } + + void loop() + { + // turn the LED on (HIGH is the voltage level) + digitalWrite(LED_BUILTIN, HIGH); + // wait for a second + delay(1000); + // turn the LED off by making the voltage LOW + digitalWrite(LED_BUILTIN, LOW); + // wait for a second + delay(1000); + } + + #endif // IMPORTANT LINE! + +* ``test/test_main.cpp`` + + .. code-block:: cpp + + #include + #include + + #ifdef UNIT_TEST + + // void setUp(void) { + // // set stuff up here + // } + + // void tearDown(void) { + // // clean stuff up here + // } + + void test_led_builtin_pin_number(void) { + TEST_ASSERT_EQUAL(LED_BUILTIN, 13); + } + + void test_led_state_high(void) { + digitalWrite(LED_BUILTIN, HIGH); + TEST_ASSERT_EQUAL(digitalRead(LED_BUILTIN), HIGH); + } + + void test_led_state_low(void) { + digitalWrite(LED_BUILTIN, LOW); + TEST_ASSERT_EQUAL(digitalRead(LED_BUILTIN), LOW); + } + + void setup() { + UNITY_BEGIN(); // IMPORTANT LINE! + RUN_TEST(test_led_builtin_pin_number); + + pinMode(LED_BUILTIN, OUTPUT); + } + + uint8_t i = 0; + uint8_t max_blinks = 5; + + void loop() { + if (i < max_blinks) + { + RUN_TEST(test_led_state_high); + delay(500); + RUN_TEST(test_led_state_low); + delay(500); + i++; + } + else if (i == max_blinks) { + UNITY_END(); // stop unit testing + } + } + + #endif + +Test results +~~~~~~~~~~~~ + +.. code-block:: bash + + > platformio test --environment uno + Collected 1 items + + ========================= [test::*] Building... (1/3) ============================== + + [Wed Jun 15 00:27:42 2016] Processing uno (platform: atmelavr, board: uno, framework: arduino) + -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + avr-g++ -o .pioenvs/uno/test/test_main.o -c -fno-exceptions -fno-threadsafe-statics -std=gnu++11 -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DPLATFORMIO=030000 -DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO -DARDUINO=10608 -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -I.pioenvs/uno/FrameworkArduino -I.pioenvs/uno/FrameworkArduinoVariant -Isrc -I.pioenvs/uno/UnityTestLib test/test_main.cpp + avr-g++ -o .pioenvs/uno/firmware.elf -Os -mmcu=atmega328p -Wl,--gc-sections,--relax .pioenvs/uno/src/main.o .pioenvs/uno/test/output_export.o .pioenvs/uno/test/test_main.o -L.pioenvs/uno -Wl,--start-group .pioenvs/uno/libUnityTestLib.a .pioenvs/uno/libFrameworkArduinoVariant.a .pioenvs/uno/libFrameworkArduino.a -lm -Wl,--end-group + avr-objcopy -O ihex -R .eeprom .pioenvs/uno/firmware.elf .pioenvs/uno/firmware.hex + avr-size --mcu=atmega328p -C -d .pioenvs/uno/firmware.elf + AVR Memory Usage + ---------------- + Device: atmega328p + + Program: 4702 bytes (14.3% Full) + (.text + .data + .bootloader) + + Data: 460 bytes (22.5% Full) + (.data + .bss + .noinit) + + + ========================= [test::*] Uploading... (2/3) ============================== + + [Wed Jun 15 00:27:43 2016] Processing uno (platform: atmelavr, board: uno, framework: arduino) + -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + avr-g++ -o .pioenvs/uno/firmware.elf -Os -mmcu=atmega328p -Wl,--gc-sections,--relax .pioenvs/uno/src/main.o .pioenvs/uno/test/output_export.o .pioenvs/uno/test/test_main.o -L.pioenvs/uno -Wl,--start-group .pioenvs/uno/libUnityTestLib.a .pioenvs/uno/libFrameworkArduinoVariant.a .pioenvs/uno/libFrameworkArduino.a -lm -Wl,--end-group + MethodWrapper([".pioenvs/uno/firmware.elf"], [".pioenvs/uno/src/main.o", ".pioenvs/uno/test/output_export.o", ".pioenvs/uno/test/test_main.o"]) + Check program size... + text data bss dec hex filename + 4464 238 222 4924 133c .pioenvs/uno/firmware.elf + BeforeUpload(["upload"], [".pioenvs/uno/firmware.hex"]) + Looking for upload port/disk... + avr-size --mcu=atmega328p -C -d .pioenvs/uno/firmware.elf + + Auto-detected: /dev/cu.usbmodemFD131 + avrdude -v -p atmega328p -C "/Users/ikravets/.platformio/packages/tool-avrdude/avrdude.conf" -c arduino -b 115200 -P "/dev/cu.usbmodemFD131" -D -U flash:w:.pioenvs/uno/firmware.hex:i + + [...] + + avrdude done. Thank you. + + ========================= [test::*] Testing... (3/3) ========================= + + If you do not see any output for the first 10 secs, please reset board (press reset button) + + test/test_main.cpp:30:test_led_builtin_pin_number PASSED + test/test_main.cpp:41:test_led_state_high PASSED + test/test_main.cpp:43:test_led_state_low PASSED + test/test_main.cpp:41:test_led_state_high PASSED + test/test_main.cpp:43:test_led_state_low PASSED + test/test_main.cpp:41:test_led_state_high PASSED + test/test_main.cpp:43:test_led_state_low PASSED + test/test_main.cpp:41:test_led_state_high PASSED + test/test_main.cpp:43:test_led_state_low PASSED + test/test_main.cpp:41:test_led_state_high PASSED + test/test_main.cpp:43:test_led_state_low PASSED + ----------------------- + 11 Tests 0 Failures 0 Ignored + + ========================= [TEST SUMMARY] ===================================== + test:*/env:uno PASSED + ========================= [PASSED] Took 13.35 seconds ======================== + +------- + +For the other examples and source code please follow to +`PlatformIO Unit Testing Examples `_ repository. diff --git a/docs/platforms/windows_x86.rst b/docs/platforms/windows_x86.rst index 6f904a0b..690c955b 100644 --- a/docs/platforms/windows_x86.rst +++ b/docs/platforms/windows_x86.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/projectconf.rst b/docs/projectconf.rst index f6835544..09c8f35f 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -44,8 +44,8 @@ Options ``home_dir`` ^^^^^^^^^^^^ -Is used to store platform toolchains, frameworks, external libraries, -service data and etc. +Is used to store platform toolchains, frameworks, global libraries for +:ref: `ldf`, service data and etc. A default value is User's home directory: @@ -60,18 +60,59 @@ This option can be overridden by global environment variable ``lib_dir`` ^^^^^^^^^^^ -This directory is used to store external libraries downloaded by -:ref:`librarymanager`. +You can put here your own/private libraries. The source code of each library +should be placed in separate directory, like +``lib/private_lib/[here are source files]``. This directory has the highest +priority for :ref:`ldf`. -A default value is ``%home_dir%/lib``. +A default value is ``lib`` that means that folder is located in the root of +project. This option can be overridden by global environment variable :envvar:`PLATFORMIO_LIB_DIR`. -.. note:: - You can put here your own/private libraries. The source code of each - library should be placed in separate directory. For example, - ``%lib_dir%/private_lib/[here are source files]``. +For example, see how can be organized ``Foo`` and ``Bar`` libraries: + +.. code:: + + |--lib + | |--Bar + | | |--docs + | | |--examples + | | |--src + | | |- Bar.c + | | |- Bar.h + | |--Foo + | | |- Foo.c + | | |- Foo.h + |- platformio.ini + |--src + |- main.c + + +Then in ``src/main.c`` you should use: + +.. code-block:: c + + #include + #include + + // rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +.. _projectconf_pio_libdeps_dir: + +``libdeps_dir`` +^^^^^^^^^^^^^^^ + +Internal storage where :ref:`librarymanager` will install project dependencies +(:ref:`projectconf_lib_deps`). A default value is ``.piolibdeps`` that means +that folder is located in the root of project. + +This option can be overridden by global environment variable +:envvar:`PLATFORMIO_LIBDEPS_DIR`. .. _projectconf_pio_src_dir: @@ -79,10 +120,8 @@ This option can be overridden by global environment variable ^^^^^^^^^^^ A path to project's source directory. PlatformIO uses it for :ref:`cmd_run` -command. - -A default value is ``src`` which means that folder is located in the root of -project. +command. A default value is ``src`` that means that folder is located in the +root of project. This option can be overridden by global environment variable :envvar:`PLATFORMIO_SRC_DIR`. @@ -110,14 +149,14 @@ fast! then PlatformIO will remove this folder automatically. It will be created on the next build operation. -A default value is ``.pioenvs`` which means that folder is located in the root of +A default value is ``.pioenvs`` that means that folder is located in the root of project. This option can be overridden by global environment variable :envvar:`PLATFORMIO_ENVS_DIR`. .. note:: - If you have any problems with building your Project environmets which + If you have any problems with building your Project environments which are defined in :ref:`projectconf`, then **TRY TO DELETE** this folder. In this situation you will remove all cached files without any risk. @@ -127,13 +166,24 @@ This option can be overridden by global environment variable ^^^^^^^^^^^^ Data directory to store contents and :ref:`platform_espressif_uploadfs`. - -A default value is ``data`` which means that folder is located in the root of +A default value is ``data`` that means that folder is located in the root of project. This option can be overridden by global environment variable :envvar:`PLATFORMIO_DATA_DIR`. +.. _projectconf_pio_test_dir: + +``test_dir`` +^^^^^^^^^^^^ + +Directory where :ref:`unit_testing` engine will look for the tests. +A default value is ``test`` that means that folder is located in the root of +project. + +This option can be overridden by global environment variable +:envvar:`PLATFORMIO_TEST_DIR`. + .. _projectconf_pio_env_default: ``env_default`` @@ -193,20 +243,48 @@ For example, ``[env:hello_world]``. General options ~~~~~~~~~~~~~~~ +.. contents:: + :local: + .. _projectconf_env_platform: ``platform`` ^^^^^^^^^^^^ -:ref:`platforms` type. +:ref:`platforms` name. +PlatformIO allows to use specific version of platform using +`Semantic Versioning `_ (X.Y.Z=MAJOR.MINOR.PATCH). +Version specifications can take any of the following forms: + +* ``0.1.2``: an exact version number. Use only this exact version +* ``^0.1.2``: any compatible version (exact version for ``0.x.x`` versions +* ``~0.1.2``: any version with the same major and minor versions, and an + equal or greater patch version +* ``>0.1.2``: any version greater than ``0.1.2``. ``>=``, ``<``, and ``<=`` + are also possible +* ``>0.1.0,!=0.2.0,<0.3.0``: any version greater than ``0.1.0``, not equal to + ``0.2.0`` and less than ``0.3.0`` + +Examples: + +.. code-block:: ini + + [env:the_latest_version] + platform = atmelavr + + [env:specific_major_version] + platform = atmelavr@^0.1.2 + + [env:specific_major_and_minor_version] + platform = atmelavr@~0.1.2 .. _projectconf_env_framework: ``framework`` ^^^^^^^^^^^^^ -:ref:`Framework ` type. +:ref:`frameworks` name. The multiple frameworks are allowed, split them with comma ``,`` separator. @@ -227,6 +305,9 @@ using `PlatformIO Embedded Boards Explorer `_. Board options ~~~~~~~~~~~~~ +.. contents:: + :local: + ``board_mcu`` ^^^^^^^^^^^^^ @@ -271,8 +352,11 @@ This option isn't available for the all development platforms. The only Flash chip interface mode. This option isn't available for the all development platforms. The only :ref:`platform_espressif` supports it. -Building options -~~~~~~~~~~~~~~~~ +Build options +~~~~~~~~~~~~~ + +.. contents:: + :local: .. _projectconf_build_flags: @@ -388,6 +472,8 @@ but will be applied only for the project source code from This option can be set by global environment variable :envvar:`PLATFORMIO_SRC_BUILD_FLAGS`. +.. _projectconf_build_unflags: + ``build_unflags`` ^^^^^^^^^^^^^^^^^ @@ -416,7 +502,7 @@ be applied in theirs order. By default, ``src_filter`` is predefined to ``+<*> -<.git/> - - - - -``, -which means "includes ALL files, then +that means "includes ALL files, then exclude ``.git`` and ``svn`` repository folders, ``example`` ... folder. This option can be set by global environment variable @@ -450,9 +536,7 @@ Example, specify own upload command for :ref:`platform_atmelavr`: .. code-block:: python - from SCons.Script import DefaultEnvironment - - env = DefaultEnvironment() + Import('env') env.Replace(UPLOADHEXCMD='"$UPLOADER" ${ARGUMENTS.get("custom_option")} --uploader --flags') @@ -491,8 +575,11 @@ The list with available targets is located in :option:`platformio run --target`. When no targets are defined, *PlatformIO* will build only sources by default. -Uploading options -~~~~~~~~~~~~~~~~~ +Upload options +~~~~~~~~~~~~~~ + +.. contents:: + :local: .. _projectconf_upload_port: @@ -549,65 +636,149 @@ development platforms. The only :ref:`platform_espressif` supports it. Library options ~~~~~~~~~~~~~~~ -``lib_install`` -^^^^^^^^^^^^^^^ +.. contents:: + :local: -Specify dependent libraries which should be installed before environment -process. The only library IDs are allowed. Multiple libraries can be passed -using comma ``,`` sign. +.. _projectconf_lib_deps: -You can obtain library IDs using :ref:`cmd_lib_search` command. +``lib_deps`` +^^^^^^^^^^^^ + +Specify project dependencies that should be installed automatically to +:ref:`projectconf_pio_libdeps_dir` before an environment process. +Multiple dependencies are allowed (multi-lines). + +**Valid forms** + +.. code-block:: ini + + [env:***] + lib_deps = + LIBRARY_1 + LIBRARY_2 + LIBRARY_N + +The each line with ``LIBRARY_1... LIBRARY_N`` will be passed automatically to +:ref:`cmd_lib_install` command. Please follow to :ref:`cmd_lib_install` for +detailed documentation about possible values. Example: .. code-block:: ini - [env:depends_on_some_libs] - lib_install = 1,13,19 + [env:depends_on_some_libs] + lib_deps = + 1 + PubSubClient + Json@~5.6,!=5.4 + https://github.com/gioblu/PJON.git@v2.0 + https://github.com/me-no-dev/ESPAsyncTCP.git -``lib_use`` -^^^^^^^^^^^ +.. _projectconf_lib_force: -Specify libraries which should be used by ``Library Dependency Finder (LDF)`` with -the highest priority. +``lib_force`` +^^^^^^^^^^^^^ + +.. seealso:: + Please make sure to read :ref:`ldf` guide first. + +Force Library Dependency Finder to depend on the specified library if it even +is not included in the project source code. Also, this library will be +processed in the first order. + +The correct value for this option is library name (not folder name). In the +most cases, library name is pre-defined in manifest file +(:ref:`library_config`, ``library.properties``, ``module.json``). The multiple +library names are allowed, split them with comma ``,`` separator. Example: .. code-block:: ini - [env:libs_with_highest_priority] - lib_use = OneWire_ID1,SPI + [env:myenv] + lib_force = OneWire, SPI + +.. _projectconf_lib_ignore: ``lib_ignore`` ^^^^^^^^^^^^^^ -Specify libraries which should be ignored by ``Library Dependency Finder (LDF)`` +.. seealso:: + Please make sure to read :ref:`ldf` guide first. + +Specify libraries which should be ignored by Library Dependency Finder. + +The correct value for this option is library name (not +folder name). In the most cases, library name is pre-defined in manifest file +(:ref:`library_config`, ``library.properties``, ``module.json``). The multiple +library names are allowed, split them with comma ``,`` separator. Example: .. code-block:: ini [env:ignore_some_libs] - lib_ignore = SPI,EngduinoV3_ID123 + lib_ignore = SPI, Ethernet -``lib_dfcyclic`` -^^^^^^^^^^^^^^^^ +.. _projectconf_lib_extra_dirs: -Control cyclic (recursive) behavior for ``Library Dependency Finder (LDF)``. -By default, this option is turned OFF (``lib_dfcyclic=False``) and means that -``LDF`` will find only libraries which are included in source files from the -project :ref:`projectconf_pio_src_dir`. +``lib_extra_dirs`` +^^^^^^^^^^^^^^^^^^ -If you want to enable cyclic (recursive, nested) search, please set this option -to ``True``. Founded library will be treated like a new source files and -``LDF`` will search dependencies for it. +.. versionadded:: 3.0 +.. seealso:: + Please make sure to read :ref:`ldf` guide first. + +A list with extra directories/storages where Library Dependency Finder will +look for dependencies. Multiple paths are allowed. Please separate them +using comma ``,`` symbol. + +This option can be set by global environment variable +:envvar:`PLATFORMIO_LIB_EXTRA_DIRS`. + +.. warning:: + This is a not direct path to library with source code. It should be the path + to storage that contains libraries grouped by folders. For example, + ``/extra/lib/storage/`` but not ``/extra/lib/storage/MyLibrary``. Example: .. code-block:: ini - [env:libs_with_enabled_ldf_cyclic] - lib_dfcyclic = True + [env:custom_lib_dirs] + lib_extra_dirs = /path/to/private/dir1,/path/to/private/dir2 + +.. _projectconf_lib_ldf_mode: + +``lib_ldf_mode`` +^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.0 +.. seealso:: + Please make sure to read :ref:`ldf` guide first. + +Library Dependency Finder starts work from analyzing source files of the +project (:ref:`projectconf_pio_src_dir`) and can work in the different modes +(see :ref:`ldf_mode`). + +By default, this value is set to ``lib_ldf_mode = 2`` and means that LDF +will parse ALL C/C++ source code of the project and will parse ALL C/C++ +source code of the each dependent library (recursively). + +.. _projectconf_lib_compat_mode: + +``lib_compat_mode`` +^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.0 +.. seealso:: + Please make sure to read :ref:`ldf` guide first. + +Library compatibility mode allows to control strictness of Library Dependency +Finder. More details :ref:`ldf_compat_mode`. + +By default, this value is set to ``lib_compat_mode = 1`` and means that LDF +will check only for framework compatibility. ----------- diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 57146752..f6d8600b 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -82,11 +82,10 @@ According to the table above the ID/TYPE for Teensy 3.1 is ``teensy31``. Also, the ID for Arduino UNO is ``uno`` and for NodeMCU 1.0 (ESP-12E Module) is ``nodemcuv2``. - Initialize Project ------------------ -PlatformIO ecosystem contains huge database with pre-configured settings for the +PlatformIO ecosystem contains big database with pre-configured settings for the most popular embedded boards. It helps you to forget about installing toolchains, writing build scripts or configuring uploading process. Just tell PlatformIO the Board ID and you will receive full working project with diff --git a/docs/userguide/cmd_boards.rst b/docs/userguide/cmd_boards.rst index 83b7f86f..a4b0eae9 100644 --- a/docs/userguide/cmd_boards.rst +++ b/docs/userguide/cmd_boards.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -33,6 +33,11 @@ Options .. program:: platformio boards +.. option:: + --installed + +List boards only from the installed platforms + .. option:: --json-output diff --git a/docs/userguide/cmd_ci.rst b/docs/userguide/cmd_ci.rst index d97d3b96..283744c6 100644 --- a/docs/userguide/cmd_ci.rst +++ b/docs/userguide/cmd_ci.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -112,8 +112,10 @@ Buid project using pre-configured :ref:`projectconf`. .. option:: -v, --verbose -Shows details about the results of processing environments. More details -:option:`platformio run --verbose` +Shows detailed information when processing environments. + +This option can be set globally using :ref:`setting_force_verbose` setting +or by environment variable :envvar:`PLATFORMIO_SETTING_FORCE_VERBOSE`. Examples -------- diff --git a/docs/userguide/cmd_init.rst b/docs/userguide/cmd_init.rst index 716ed155..6605d9a0 100644 --- a/docs/userguide/cmd_init.rst +++ b/docs/userguide/cmd_init.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/userguide/cmd_run.rst b/docs/userguide/cmd_run.rst index 6034cb04..c5b75ea3 100644 --- a/docs/userguide/cmd_run.rst +++ b/docs/userguide/cmd_run.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -64,7 +64,9 @@ Pre-built targets: --upload-port Upload port of embedded board. To print all available ports use -:ref:`cmd_serialports` command +:ref:`cmd_serialports` command. + +If upload port is not specified, PlatformIO will try to detect it automatically. .. option:: -d, --project-dir @@ -75,17 +77,10 @@ to current working directory (``CWD``). .. option:: -v, --verbose -Shows details about the results of processing environments. Each instance of -``--verbose`` on the command line increases the verbosity level by one, so if -you need more details on the output, specify it twice. +Shows detailed information when processing environments. -There 3 levels of verbosity: - -1. ``-v`` - output errors only -2. ``-vv`` - output errors and warnings -3. ``-vvv`` - output errors, warnings and additional information - -By default, verbosity level is set to 3 (maximum information). +This option can be set globally using :ref:`setting_force_verbose` setting +or by environment variable :envvar:`PLATFORMIO_SETTING_FORCE_VERBOSE`. .. option:: --disable-auto-clean @@ -101,17 +96,34 @@ Examples .. code-block:: bash $ platformio run - Processing arduino_pro5v environment: - scons: `.pioenvs/arduino_pro5v/firmware.elf' is up to date. - scons: `.pioenvs/arduino_pro5v/firmware.hex' is up to date. + [Sun Jul 17 00:09:16 2016] Processing uno (platform: atmelavr, board: uno, framework: arduino) + ----------------------------------------------------------------------------------------------- + Looking for dependencies... + Collecting 32 compatible libraries + Processing src/main.cpp + Processing .pioenvs/uno/libFrameworkArduinoVariant.a + Processing .platformio/packages/framework-arduinoavr/cores/arduino/CDC.cpp + Processing .platformio/packages/framework-arduinoavr/cores/arduino/HardwareSerial.cpp + Processing .platformio/packages/framework-arduinoavr/cores/arduino/HardwareSerial0.cpp + ... + Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_analog.c + Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_digital.c + Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_pulse.c + Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_shift.c + Processing .pioenvs/uno/libFrameworkArduino.a + Processing .pioenvs/uno/firmware.elf + Processing .pioenvs/uno/firmware.hex + Processing size + AVR Memory Usage + ---------------- + Device: atmega328p - Processing launchpad_msp430g2 environment: - scons: `.pioenvs/launchpad_msp430g2/firmware.elf' is up to date. - scons: `.pioenvs/launchpad_msp430g2/firmware.hex' is up to date. + Program: 1034 bytes (3.2% Full) + (.text + .data + .bootloader) + + Data: 9 bytes (0.4% Full) + (.data + .bss + .noinit) - Processing launchpad_lm4f120 environment: - scons: `.pioenvs/launchpad_lm4f120/firmware.elf' is up to date. - scons: `.pioenvs/launchpad_lm4f120/firmware.hex' is up to date 2. Process specific environment @@ -119,13 +131,27 @@ Examples .. code-block:: bash $ platformio run -e arduino_pro5v -e launchpad_lm4f120 - Processing arduino_pro5v environment: - scons: `.pioenvs/arduino_pro5v/firmware.elf' is up to date. - scons: `.pioenvs/arduino_pro5v/firmware.hex' is up to date. - - Processing launchpad_lm4f120 environment: - scons: `.pioenvs/launchpad_lm4f120/firmware.elf' is up to date. - scons: `.pioenvs/launchpad_lm4f120/firmware.hex' is up to date. + [Sun Jul 17 00:10:14 2016] Processing nodemcu (platform: espressif, board: nodemcu, framework: arduino) + -------------------------------------------------------------------------------------------------------- + Looking for dependencies... + Collecting 29 compatible libraries + Processing src/main.cpp + Processing .pioenvs/nodemcu/libFrameworkArduinoVariant.a + Processing .platformio/packages/framework-arduinoespressif/cores/esp8266/Esp.cpp + ... + Processing .platformio/packages/framework-arduinoespressif/cores/esp8266/pgmspace.cpp + Processing .platformio/packages/framework-arduinoespressif/cores/esp8266/setjmp.S + Processing .pioenvs/nodemcu/libFrameworkArduino.a + Processing .platformio/packages/framework-arduinoespressif/tools/sdk/lib/libmesh.a + ... + Processing .platformio/packages/framework-arduinoespressif/tools/sdk/lib/libaxtls.a + Processing .platformio/packages/framework-arduinoespressif/tools/sdk/lib/libstdc++.a + Processing .pioenvs/nodemcu/firmware.elf + Processing .platformio/packages/tool-esptool/esptool + Processing .pioenvs/nodemcu/firmware.bin + Processing size + text data bss dec hex filename + 221456 884 29496 251836 3d7bc .pioenvs/nodemcu/firmware.elf 3. Process specific target @@ -133,52 +159,49 @@ Examples .. code-block:: bash $ platformio run -t clean - Processing arduino_pro5v environment: - Removed .pioenvs/arduino_pro5v/src/main.o + [Sun Jul 17 00:19:36 2016] Processing uno (platform: atmelavr, board: uno, framework: arduino) + ---------------------------------------------------------------------------------------------------------------------------------------------------------------- + Looking for dependencies... + Collecting 32 compatible libraries + Removed .pioenvs/uno/FrameworkArduino/CDC.o + Removed .pioenvs/uno/FrameworkArduino/HardwareSerial.o ... - Removed .pioenvs/arduino_pro5v/firmware.hex - - Processing launchpad_msp430g2 environment: - Removed .pioenvs/launchpad_msp430g2/src/main.o - ... - Removed .pioenvs/launchpad_msp430g2/firmware.hex - - Processing launchpad_lm4f120 environment: - Removed .pioenvs/launchpad_lm4f120/src/main.o - ... - Removed .pioenvs/launchpad_lm4f120/firmware.hex + Removed .pioenvs/uno/libFrameworkArduinoVariant.a + Removed .pioenvs/uno/src/main.o + Removed .pioenvs/uno/libFrameworkArduino.a + Removed .pioenvs/uno/firmware.elf + Removed .pioenvs/uno/firmware.hex 4. Mix environments and targets .. code-block:: bash - $ platformio run -e launchpad_msp430g2 -t upload - Processing launchpad_msp430g2 environment: - /Users/ikravets/.platformio/timsp430/tools/mspdebug/mspdebug rf2500 --force-reset "prog .pioenvs/launchpad_msp430g2/firmware.hex" - MSPDebug version 0.20 - debugging tool for MSP430 MCUs - Copyright (C) 2009-2012 Daniel Beer - This is free software; see the source for copying conditions. There is NO - warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - Trying to open interface 1 on 009 - Initializing FET... - FET protocol version is 30394216 - Configured for Spy-Bi-Wire - Sending reset... - Set Vcc: 3000 mV - Device ID: 0x2553 - Code start address: 0xc000 - Code size : 16384 byte = 16 kb - RAM start address: 0x200 - RAM end address: 0x3ff - RAM size : 512 byte = 0 kb - Device: MSP430G2553/G2403 - Code memory starts at 0xc000 - Number of breakpoints: 2 - Chip ID data: 25 53 - Erasing... - Programming... - Writing 646 bytes at c000... - Writing 32 bytes at ffe0... - Done, 678 bytes total + $ platformio run -e teensy31 -t upload + [Sun Jul 17 00:27:14 2016] Processing teensy31 (platform: teensy, board: teensy31, framework: arduino) + ------------------------------------------------------------------------------------------------------- + Looking for dependencies... + Collecting 25 compatible libraries + Processing src/main.cpp + Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/AudioStream.cpp + Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/DMAChannel.cpp + Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/HardwareSerial1.cpp + ... + Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/yield.cpp + Processing .platformio/packages/tool-teensy/teensy_loader_cli + Processing .pioenvs/teensy31/libFrameworkArduino.a + Processing .pioenvs/teensy31/firmware.elf + Check program size... + text data bss dec hex filename + 11080 168 2288 13536 34e0 .pioenvs/teensy31/firmware.elf + Processing .pioenvs/teensy31/firmware.hex + Processing upload + Teensy Loader, Command Line, Version 2.0 + Read ".pioenvs/teensy31/firmware.hex": 11248 bytes, 4.3% usage + Soft reboot is not implemented for OSX + Waiting for Teensy device... + (hint: press the reset button) + Found HalfKay Bootloader + Read ".pioenvs/teensy31/firmware.hex": 11248 bytes, 4.3% usage + Programming........... + Booting diff --git a/docs/userguide/cmd_serialports.rst b/docs/userguide/cmd_serialports.rst index 963046b1..882a5f02 100644 --- a/docs/userguide/cmd_serialports.rst +++ b/docs/userguide/cmd_serialports.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/docs/userguide/cmd_settings.rst b/docs/userguide/cmd_settings.rst index ff5640d0..04be4260 100644 --- a/docs/userguide/cmd_settings.rst +++ b/docs/userguide/cmd_settings.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -87,6 +87,20 @@ Check for the new PlatformIO interval. Check for the platform updates interval. +.. _setting_force_verbose: + +``force_verbose`` +^^^^^^^^^^^^^^^^^ + +:Default: No +:Values: Yes/No + +Force verbose output when processing environments. This setting overrides + +* :option:`platformio run --verbose` +* :option:`platformio ci --verbose` +* :option:`platformio test --verbose` + .. _setting_enable_prompts: ``enable_prompts`` diff --git a/docs/userguide/cmd_test.rst b/docs/userguide/cmd_test.rst new file mode 100644 index 00000000..c42bda6c --- /dev/null +++ b/docs/userguide/cmd_test.rst @@ -0,0 +1,98 @@ +.. Copyright 2014-present PlatformIO + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +.. _cmd_test: + +platformio test +=============== + +.. versionadded:: 3.0 + +.. contents:: + +Usage +----- + +.. code-block:: bash + + platformio test [OPTIONS] + +Description +----------- + +Run tests from PlatformIO based project. More details about PlatformIO +:ref:`unit_testing`. + +This command allows you to apply the tests for the environments specified +in :ref:`projectconf`. + +Options +------- + +.. program:: platformio test + +.. option:: + -e, --environment + +Process specified environments. More details :option:`platformio run --environment` + +.. option:: + --skip + +Skip over tests where the name matches specified patterns. More than one +option/pattern is allowed. + +.. list-table:: + :header-rows: 1 + + * - Pattern + - Meaning + + * - ``*`` + - matches everything + + * - ``?`` + - matches any single character + + * - ``[seq]`` + - matches any character in seq + + * - ``[!seq]`` + - matches any character not in seq + +For example, ``platformio test --skip "mytest*" -i "test[13]"`` + +.. option:: + --upload-port + +Upload port of embedded board. To print all available ports use +:ref:`cmd_serialports` command. + +If upload port is not specified, PlatformIO will try to detect it automatically. + +.. option:: + -d, --project-dir + +Specify the path to project directory. By default, ``--project-dir`` is equal +to current working directory (``CWD``). + +.. option:: + -v, --verbose + +Shows detailed information when processing environments. + +This option can be set globally using :ref:`setting_force_verbose` setting +or by environment variable :envvar:`PLATFORMIO_SETTING_FORCE_VERBOSE`. + +Examples +-------- + +For the examples please follow to :ref:`unit_testing` page. diff --git a/docs/userguide/cmd_update.rst b/docs/userguide/cmd_update.rst index d429bb0d..137b8172 100644 --- a/docs/userguide/cmd_update.rst +++ b/docs/userguide/cmd_update.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -21,91 +21,215 @@ Usage .. code-block:: bash - platformio update + platformio update [OPTIONS] Description ----------- -Check or update installed :ref:`platforms` and -:ref:`Libraries ` +Check or update installed :ref:`platforms` and global +:ref:`Libraries `. This command is combination of 2 sub-commands: + +* :ref:`cmd_platform_update` +* :ref:`cmd_lib_update` + +Options +------- + +.. program:: platformio update + +.. option:: + -c, --only-check + +Do not update, only check for new version Examples -------- -.. code-block:: bash +.. code:: - $ platformio update + > platformio update + + Platform Manager + ================ + Platform timsp430 + -------- + Updating timsp430 @ 0.0.0: [Up-to-date] + Updating toolchain-timsp430 @ 1.40603.0: [Up-to-date] + Updating framework-energiamsp430 @ 1.17.0: [Up-to-date] + Updating framework-arduinomsp430 @ 1.10601.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + Platform freescalekinetis + -------- + Updating freescalekinetis @ 0.0.0: [Up-to-date] + Updating framework-mbed @ 1.121.1: [Up-to-date] + Updating toolchain-gccarmnoneeabi @ 1.40804.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + Platform ststm32 + -------- + Updating ststm32 @ 0.0.0: [Up-to-date] + Updating framework-libopencm3 @ 1.1.0: [Up-to-date] + Updating toolchain-gccarmnoneeabi @ 1.40804.0: [Up-to-date] + Updating tool-stlink @ 1.10200.0: [Up-to-date] + Updating framework-spl @ 1.10201.0: [Up-to-date] + Updating framework-cmsis @ 1.40300.0: [Up-to-date] + Updating framework-mbed @ 1.121.1: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + Platform lattice_ice40 + -------- + Updating lattice_ice40 @ 0.0.0: [Up-to-date] + Updating toolchain-icestorm @ 1.7.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] Platform atmelavr -------- - Updating toolchain-atmelavr package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-avrdude package: - Versions: Current=2, Latest=2 [Up-to-date] - Updating framework-arduinoavr package: - Versions: Current=12, Latest=12 [Up-to-date] - Updating tool-micronucleus package: - Versions: Current=1, Latest=1 [Up-to-date] + Updating atmelavr @ 0.0.0: [Up-to-date] + Updating framework-arduinoavr @ 1.10608.1: [Up-to-date] + Updating tool-avrdude @ 1.60001.1: [Up-to-date] + Updating toolchain-atmelavr @ 1.40801.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] - Platform atmelsam + Platform espressif -------- - Updating framework-arduinosam package: - Versions: Current=3, Latest=3 [Up-to-date] - Updating ldscripts package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating toolchain-gccarmnoneeabi package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-bossac package: - Versions: Current=1, Latest=1 [Up-to-date] + Updating espressif @ 0.0.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + Updating toolchain-xtensa @ 1.40802.0: [Up-to-date] + Updating tool-esptool @ 1.409.0: [Up-to-date] + Updating tool-mkspiffs @ 1.102.0: [Up-to-date] + Updating framework-arduinoespressif @ 1.20300.0: [Up-to-date] + Updating sdk-esp8266 @ 1.10502.0: [Up-to-date] - Platform stm32 + Platform linux_x86_64 -------- - Updating toolchain-gccarmnoneeabi package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-stlink package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-spl package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-cmsis package: - Versions: Current=2, Latest=2 [Up-to-date] - Updating framework-opencm3 package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating ldscripts package: - Versions: Current=1, Latest=1 [Up-to-date] + Updating linux_x86_64 @ 0.0.0: [Up-to-date] + Updating toolchain-gcclinux64 @ 1.40801.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + Platform windows_x86 + -------- + Updating windows_x86 @ 0.0.0: [Up-to-date] + Updating toolchain-gccmingw32 @ 1.40800.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] Platform teensy -------- - Updating toolchain-atmelavr package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating ldscripts package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-arduinoteensy package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating toolchain-gccarmnoneeabi package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-teensy package: - Versions: Current=1, Latest=1 [Up-to-date] + Updating teensy @ 0.0.0: [Up-to-date] + Updating framework-arduinoteensy @ 1.128.0: [Up-to-date] + Updating tool-teensy @ 1.1.0: [Up-to-date] + Updating framework-mbed @ 1.121.1: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + Updating toolchain-atmelavr @ 1.40801.0: [Up-to-date] + Updating toolchain-gccarmnoneeabi @ 1.40804.0: [Up-to-date] - Platform timsp430 + Platform nordicnrf51 -------- - Updating toolchain-timsp430 package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-mspdebug package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-energiamsp430 package: - Versions: Current=2, Latest=2 [Up-to-date] + Updating nordicnrf51 @ 0.0.0: [Up-to-date] + Updating toolchain-gccarmnoneeabi @ 1.40804.0: [Up-to-date] + Updating framework-arduinonordicnrf51 @ 1.20302.0: [Up-to-date] + Updating framework-mbed @ 1.121.1: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] Platform titiva -------- - Updating ldscripts package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating toolchain-gccarmnoneeabi package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-lm4flash package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-opencm3 package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-energiativa package: - Versions: Current=4, Latest=4 [Up-to-date] + Updating titiva @ 0.0.0: [Up-to-date] + Updating framework-libopencm3 @ 1.1.0: [Up-to-date] + Updating toolchain-gccarmnoneeabi @ 1.40804.0: [Up-to-date] + Updating framework-energiativa @ 1.17.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + Platform atmelsam + -------- + Updating atmelsam @ 0.0.0: [Up-to-date] + Updating toolchain-gccarmnoneeabi @ 1.40804.0: [Up-to-date] + Updating tool-openocd @ 1.900.0: [Up-to-date] + Updating framework-mbed @ 1.121.1: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + Updating tool-avrdude @ 1.60001.1: [Up-to-date] + Updating tool-bossac @ 1.10601.0: [Up-to-date] + + Platform siliconlabsefm32 + -------- + Updating siliconlabsefm32 @ 0.0.0: [Up-to-date] + Updating framework-mbed @ 1.121.1: [Up-to-date] + Updating toolchain-gccarmnoneeabi @ 1.40804.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + Platform microchippic32 + -------- + Updating microchippic32 @ 0.0.0: [Up-to-date] + Updating framework-arduinomicrochippic32 @ 1.10201.0: [Up-to-date] + Updating toolchain-microchippic32 @ 1.40803.0: [Up-to-date] + Updating tool-pic32prog @ 1.200200.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + Platform linux_i686 + -------- + Updating linux_i686 @ 0.0.0: [Up-to-date] + Updating toolchain-gcclinux32 @ 1.40801.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + Platform intel_arc32 + -------- + Updating intel_arc32 @ 0.0.0: [Up-to-date] + Updating framework-arduinointel @ 1.10006.0: [Up-to-date] + Updating tool-arduino101load @ 1.124.0: [Up-to-date] + Updating toolchain-intelarc32 @ 1.40805.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + Platform nxplpc + -------- + Updating nxplpc @ 0.0.0: [Up-to-date] + Updating framework-mbed @ 1.121.1: [Up-to-date] + Updating toolchain-gccarmnoneeabi @ 1.40804.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + Platform linux_arm + -------- + Updating linux_arm @ 0.0.0: [Up-to-date] + Updating toolchain-gccarmlinuxgnueabi @ 1.40802.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + Platform native + -------- + Updating native @ 0.0.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + + + Library Manager + =============== + Updating Adafruit-GFX @ 334e815bc1: [Up-to-date] + Updating Adafruit-ST7735 @ d53d4bf03a: [Up-to-date] + Updating Adafruit-DHT @ 09344416d2: [Up-to-date] + Updating Adafruit-Unified-Sensor @ f2af6f4efc: [Up-to-date] + Updating ESP8266_SSD1306 @ 3.2.3: [Up-to-date] + Updating EngduinoMagnetometer @ 3.1.0: [Up-to-date] + Updating IRremote @ 2.2.1: [Up-to-date] + Updating Json @ 5.6.4: [Up-to-date] + Updating MODSERIAL @ d8422efe47: [Up-to-date] + Updating PJON @ 1fb26fd: [Checking] + git version 2.7.4 (Apple Git-66) + Already up-to-date. + Updating Servo @ 36b69a7ced07: [Checking] + Mercurial Distributed SCM (version 3.8.4) + (see https://mercurial-scm.org for more information) + + Copyright (C) 2005-2016 Matt Mackall and others + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + pulling from https://developer.mbed.org/users/simon/code/Servo/ + searching for changes + no changes found + Updating TextLCD @ 308d188a2d3a: [Checking] + Mercurial Distributed SCM (version 3.8.4) + (see https://mercurial-scm.org for more information) + + Copyright (C) 2005-2016 Matt Mackall and others + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + pulling from https://developer.mbed.org/users/simon/code/TextLCD/ + searching for changes + no changes found diff --git a/docs/userguide/cmd_upgrade.rst b/docs/userguide/cmd_upgrade.rst index d0b1ebce..887a8b32 100644 --- a/docs/userguide/cmd_upgrade.rst +++ b/docs/userguide/cmd_upgrade.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -33,11 +33,12 @@ Check or upgrade PlatformIO to the latest version Examples -------- -.. code-block:: bash +.. code:: + + > platformio upgrade - $ platformio upgrade You are up-to-date! PlatformIO x.x.x is currently the newest version available. # If you have problem with permissions try: - $ sudo platformio upgrade + > sudo platformio upgrade diff --git a/docs/userguide/index.rst b/docs/userguide/index.rst index d447a775..05ada62a 100644 --- a/docs/userguide/index.rst +++ b/docs/userguide/index.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -62,9 +62,10 @@ Commands cmd_boards cmd_ci cmd_init - platformio platforms + platformio platform cmd_run cmd_serialports cmd_settings + cmd_test cmd_update cmd_upgrade diff --git a/docs/userguide/lib/cmd_install.rst b/docs/userguide/lib/cmd_install.rst index a28c24a6..6f007bbe 100644 --- a/docs/userguide/lib/cmd_install.rst +++ b/docs/userguide/lib/cmd_install.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -21,14 +21,68 @@ Usage .. code-block:: bash - platformio lib install [OPTIONS] [LIBRARY_ID] + platformio lib [STORAGE_OPTIONS] install [OPTIONS] [LIBRARY...] + # install project dependent library + # (run it from a project root where is located "platformio.ini") + platformio lib install [OPTIONS] [LIBRARY...] + + # install to global storage + platformio lib --global install [OPTIONS] [LIBRARY...] + platformio lib -g install [OPTIONS] [LIBRARY...] + + # install to custom storage + platformio lib --storage-dir /path/to/dir install [OPTIONS] [LIBRARY...] + platformio lib -d /path/to/dir install [OPTIONS] [LIBRARY...] + + # [LIBRARY...] forms + platformio lib [STORAGE_OPTIONS] install (with no args, project dependencies) + platformio lib [STORAGE_OPTIONS] install + platformio lib [STORAGE_OPTIONS] install id= + platformio lib [STORAGE_OPTIONS] install @ + platformio lib [STORAGE_OPTIONS] install @ + platformio lib [STORAGE_OPTIONS] install + platformio lib [STORAGE_OPTIONS] install @ + platformio lib [STORAGE_OPTIONS] install @ + platformio lib [STORAGE_OPTIONS] install + platformio lib [STORAGE_OPTIONS] install file:// + platformio lib [STORAGE_OPTIONS] install file:// + platformio lib [STORAGE_OPTIONS] install + platformio lib [STORAGE_OPTIONS] install = (name it should have locally) + platformio lib [STORAGE_OPTIONS] install ("tag" can be commit, branch or tag) Description ----------- -Install new library by specified -`PlatformIO Library Registry ID `_. +Install a library, and any libraries that it depends on using: + +1. Library ``id`` or ``name`` from `PlatformIO Library Registry `_ +2. Custom folder, repository or archive. + +The ``version`` supports `Semantic Versioning `_ ( +``..``) and can take any of the following forms: + +* ``0.1.2`` - an exact version number. Use only this exact version +* ``^0.1.2`` - any compatible version (exact version for ``0.x.x`` versions +* ``~0.1.2`` - any version with the same major and minor versions, and an + equal or greater patch version +* ``>0.1.2`` - any version greater than ``0.1.2``. ``>=``, ``<``, and ``<=`` + are also possible +* ``>0.1.0,!=0.2.0,<0.3.0`` - any version greater than ``0.1.0``, not equal to + ``0.2.0`` and less than ``0.3.0`` + +Also, PlatformIO supports installing from local directory or archive. Need +to use ``file://`` prefix before local path. Also, directory or +archive should contain ``.library.json`` manifest (see :ref:`library_config`). + +* ``file:///local/path/to/the/platform/dir`` +* ``file:///local/path/to/the/platform.zip`` +* ``file:///local/path/to/the/platform.tar.gz`` + +Storage Options +--------------- + +See base options for :ref:`userguide_lib`. Options ------- @@ -36,50 +90,151 @@ Options .. program:: platformio lib install .. option:: - -v, --version + -q, --quiet -Install specified version of library +Suppress progress reporting + +Version control +--------------- + +PlatformIO supports installing from Git, Mercurial and Subversion, and detects +the type of VCS using url prefixes: "git+", "hg+", or "svn+". + +.. note:: + PlatformIO requires a working VCS command on your path: ``git``, ``hg`` + or ``svn``. + +Git +^^^ + +The supported schemes are: ``git``, ``git+https`` and ``git+ssh``. Here are +the supported forms: + +* user/library (short version for GitHub repository) +* https://github.com/user/library.git +* git+git://git.server.org/my-library +* git+https://git.server.org/my-library +* git+ssh://git.server.org/my-library + +Passing branch names, a commit hash or a tag name is possible like so: + +* https://github.com/user/library.git#master +* git+git://git.server.org/my-library#master +* git+https://git.server.org/my-library#v1.0 +* git+ssh://git.server.org/my-library#7846d8ad52f983f2f2887bdc0f073fe9755a806d + +Mercurial +^^^^^^^^^ + +The supported schemes are: ``hg+http``, ``hg+https`` and ``hg+ssh``. Here are +the supported forms: + +* https://developer.mbed.org/users/user/code/library/ (install ARM mbed library) +* hg+hg://hg.server.org/my-library +* hg+https://hg.server.org/my-library +* hg+ssh://hg.server.org/my-library + +Passing branch names, a commit hash or a tag name is possible like so: + +* hg+hg://hg.server.org/my-library#master +* hg+https://hg.server.org/my-library#v1.0 +* hg+ssh://hg.server.org/my-library#4cfe2fa00668 + +Subversion +^^^^^^^^^^ + +The supported schemes are: ``svn``, ``svn+svn``, ``svn+http``, ``svn+https`` +and ``svn+ssh``. Here are the supported forms: + +* svn+svn://svn.server.org/my-library +* svn+https://svn.server.org/my-library +* svn+ssh://svn.server.org/my-library + +You can also give specific revisions to an SVN URL, like so: + +* svn+svn://svn.server.org/my-library#13 Examples -------- -1. Install the latest version of library +1. Install the latest version of library to a global storage using ID or NAME -.. code-block:: bash +.. code:: - # IRremote: http://platformio.org/lib/show/4/IRremote - $ platformio lib install 4 - # Installing library [ 4 ]: - # Downloading [####################################] 100% - # Unpacking [####################################] 100% - # The library #4 'IRremote' has been successfully installed! + > platformio lib -g install 4 + + Library Storage: /storage/dir/... + LibraryManager: Installing id=4 + Downloading [####################################] 100% + Unpacking [####################################] 100% + IRremote @ 2.2.1 has been successfully installed! + + # repeat command with name + > platformio lib -g install IRRemote + + Library Storage: /storage/dir/... + Looking for IRRemote library in registry + Found: http://platformio.org/lib/show/4/IRremote + LibraryManager: Installing id=4 + IRremote @ 2.2.1 is already installed -2. Install specified version of library +2. Install specified version of a library to a global storage -.. code-block:: bash +.. code:: - # XBee: http://platformio.org/lib/show/6/XBee - $ platformio lib install 6 --version=0.5 - # Installing library [ 6 ]: - # Downloading [####################################] 100% - # Unpacking [####################################] 100% - # The library #6 'XBee' has been successfully installed! + > platformio lib -g install Json@5.4.0 + + Library Storage: /storage/dir/... + Looking for Json library in registry + Found: http://platformio.org/lib/show/64/Json + LibraryManager: Installing id=64 @ 5.4.0 + Downloading [####################################] 100% + Unpacking [####################################] 100% + Json @ 5.4.0 has been successfully installed! -3. Install library with dependencies +3. Install library with dependencies to custom storage -.. code-block:: bash +.. code:: - # Adafruit-ST7735: http://platformio.org/lib/show/12/Adafruit-ST7735 - $ platformio lib install 12 - # Installing library [ 12 ]: - # Downloading [####################################] 100% - # Unpacking [####################################] 100% - # The library #12 'Adafruit-ST7735' has been successfully installed! - # Installing dependencies: - # Installing library [ 13 ]: - # Downloading [####################################] 100% - # Unpacking [####################################] 100% - # The library #13 'Adafruit-GFX' has been successfully installed! + > platformio lib --storage-dir /my/storage/dir install DallasTemperature + + Library Storage: /my/storage/dir + Looking for DallasTemperature library in registry + Found: http://platformio.org/lib/show/54/DallasTemperature + LibraryManager: Installing id=54 + Downloading [####################################] 100% + Unpacking [####################################] 100% + DallasTemperature @ 3.7.7 has been successfully installed! + Installing dependencies + Looking for OneWire library in registry + Found: http://platformio.org/lib/show/1/OneWire + LibraryManager: Installing id=1 + Downloading [####################################] 100% + Unpacking [####################################] 100% + OneWire @ 8fd2ebfec7 has been successfully installed! + +4. Install ARM mbed library to the global storage + +.. code:: + + > platformio lib -g install https://developer.mbed.org/users/simon/code/TextLCD/ + + Library Storage: /storage/dir/... + LibraryManager: Installing TextLCD + Mercurial Distributed SCM (version 3.8.4) + (see https://mercurial-scm.org for more information) + + Copyright (C) 2005-2016 Matt Mackall and others + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + requesting all changes + adding changesets + adding manifests + adding file changes + added 9 changesets with 18 changes to 6 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + TextLCD @ 308d188a2d3a has been successfully installed! diff --git a/docs/userguide/lib/cmd_list.rst b/docs/userguide/lib/cmd_list.rst index deb19b9c..db521e2b 100644 --- a/docs/userguide/lib/cmd_list.rst +++ b/docs/userguide/lib/cmd_list.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -21,14 +21,30 @@ Usage .. code-block:: bash + platformio lib [STORAGE_OPTIONS] list [OPTIONS] + + # list project dependent libraries + # (run it from a project root where is located "platformio.ini") platformio lib list [OPTIONS] + # list libraries from global storage + platformio lib --global list [OPTIONS] + platformio lib -g list [OPTIONS] + + # list libraries from custom storage + platformio lib --storage-dir /path/to/dir list [OPTIONS] + platformio lib -d /path/to/dir list [OPTIONS] Description ----------- List installed libraries +Storage Options +--------------- + +See base options for :ref:`userguide_lib`. + Options ~~~~~~~ @@ -42,18 +58,14 @@ Return the output in `JSON `_ format Examples -------- -.. code-block:: bash +.. code:: - $ platformio lib list - # - # [ ID ] Name Compatibility "Authors": Description - # ------------------------------------------------------------------------------------- - # [ 23 ] Adafruit-L3GD20-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the L3GD20 Gyroscope - # [ 12 ] Adafruit-ST7735 arduino, atmelavr "Adafruit Industries": A library for the Adafruit 1.8" SPI display - # [ 31 ] Adafruit-Unified-Sensor arduino, atmelavr "Adafruit Industries": Adafruit Unified Sensor Driver - # [ 26 ] Adafruit-LSM303DLHC-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for Adafruit's LSM303 Breakout (Accelerometer + Magnetometer) - # [ 6 ] XBee arduino, atmelavr "Andrew Rapp": Arduino library for communicating with XBees in API mode - # [ 13 ] Adafruit-GFX arduino, atmelavr "Adafruit Industries": A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.) - # [ 4 ] IRremote arduino, atmelavr "Ken Shirriff": Send and receive infrared signals with multiple protocols - # [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303) - # ... + > platformio lib list + + pio lib -g list + Library Storage: /storage/dir/... + [ ID ] Name Compatibility "Authors": Description + ----------------------------------------------------------------------------------------------------------- + [ 4 ] IRremote arduino, atmelavr "Rafi Khan, Ken Shirriff": Send and receive infrared signals with multiple protocols | @2.2.1 + [ 64 ] Json arduino, atmelavr, atmelsam, timsp430, titiva, teensy, freescalekinetis, ststm32, nordicnrf51, nxplpc, espressif, siliconlabsefm32, linux_arm, native, intel_arc32 "Benoit Blanchon": An elegant and efficient JSON library for embedded systems | @5.4.0 + [ VCS ] TextLCD - "Unknown": hg+https://developer.mbed.org/users/simon/code/TextLCD/ | @308d188a2d3a diff --git a/docs/userguide/lib/cmd_register.rst b/docs/userguide/lib/cmd_register.rst index 60f00c21..08911f64 100644 --- a/docs/userguide/lib/cmd_register.rst +++ b/docs/userguide/lib/cmd_register.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -32,6 +32,6 @@ Register new library and allow others to install it. Examples -------- -.. code-block:: bash +.. code:: - $ platformio lib register http://my.example.com/library.json + platformio lib register http://my.example.com/raw-library.json diff --git a/docs/userguide/lib/cmd_search.rst b/docs/userguide/lib/cmd_search.rst index 4325fe7f..4bc5d0ea 100644 --- a/docs/userguide/lib/cmd_search.rst +++ b/docs/userguide/lib/cmd_search.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -74,6 +74,11 @@ Options .. program:: platformio lib search +.. option:: + -n, --name + +Filter libraries by specified name (strict search) + .. option:: -a, --author @@ -112,126 +117,134 @@ Examples 1. List all libraries -.. code-block:: bash +.. code:: - $ platformio lib search - # Found N libraries: - # - # [ ID ] Name Compatibility "Authors": Description - # ------------------------------------------------------------------------------------- - # [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303) - # [ 13 ] Adafruit-GFX arduino, atmelavr "Adafruit Industries": A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.) - # [ 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) - # [ 12 ] Adafruit-ST7735 arduino, atmelavr "Adafruit Industries": A library for the Adafruit 1.8" SPI display - # [ 31 ] Adafruit-Unified-Sensor arduino, atmelavr "Adafruit Industries": Adafruit Unified Sensor Driver - # [ 4 ] IRremote arduino, atmelavr "Ken Shirriff": Send and receive infrared signals with multiple protocols - # [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc) - # [ 6 ] XBee arduino, atmelavr "Andrew Rapp": Arduino library for communicating with XBees in API mode - # [ 15 ] Adafruit-ADXL345-Unified arduino, atmelavr "Adafruit Industries": Unified driver for the ADXL345 Accelerometer - # Show next libraries? [y/N]: - # ... + > platformio lib search + + Found N libraries: + + [ ID ] Name Compatibility "Authors": Description + ------------------------------------------------------------------------------------- + [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303) + [ 13 ] Adafruit-GFX arduino, atmelavr "Adafruit Industries": A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.) + [ 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) + [ 12 ] Adafruit-ST7735 arduino, atmelavr "Adafruit Industries": A library for the Adafruit 1.8" SPI display + [ 31 ] Adafruit-Unified-Sensor arduino, atmelavr "Adafruit Industries": Adafruit Unified Sensor Driver + [ 4 ] IRremote arduino, atmelavr "Ken Shirriff": Send and receive infrared signals with multiple protocols + [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc) + [ 6 ] XBee arduino, atmelavr "Andrew Rapp": Arduino library for communicating with XBees in API mode + [ 15 ] Adafruit-ADXL345-Unified arduino, atmelavr "Adafruit Industries": Unified driver for the ADXL345 Accelerometer + Show next libraries? [y/N]: + ... 2. Search for `1-Wire libraries `_ -.. code-block:: bash +.. code:: - $ platformio lib search "1-wire" - # Found N libraries: - # - # [ ID ] Name Compatibility "Authors": Description - # ------------------------------------------------------------------------------------- - # [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc) - # ... + > platformio lib search "1-wire" + + Found N libraries: + + [ ID ] Name Compatibility "Authors": Description + ------------------------------------------------------------------------------------- + [ 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 `_ -.. code-block:: bash +.. code:: - $ platformio lib search "i2c" --framework="arduino" - # Found N libraries: - # - # [ ID ] Name Compatibility "Authors": Description - # ------------------------------------------------------------------------------------- - # [ 11 ] I2Cdevlib-Core arduino, atmelavr "Jeff Rowberg": The I2C Device Library (I2Cdevlib) is a collection of uniform and well-documented classes to provide simple and intuitive interfaces to I2C devices. - # [ 24 ] Adafruit-L3GD20 arduino, atmelavr "Adafruit Industries": Driver for Adafruit's L3GD20 I2C Gyroscope Breakout - # [ 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) - # ... + > platformio lib search "i2c" --framework="arduino" + + Found N libraries: + + [ ID ] Name Compatibility "Authors": Description + ------------------------------------------------------------------------------------- + [ 11 ] I2Cdevlib-Core arduino, atmelavr "Jeff Rowberg": The I2C Device Library (I2Cdevlib) is a collection of uniform and well-documented classes to provide simple and intuitive interfaces to I2C devices. + [ 24 ] Adafruit-L3GD20 arduino, atmelavr "Adafruit Industries": Driver for Adafruit's L3GD20 I2C Gyroscope Breakout + [ 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) + ... 4. Search for `libraries by "web" and "http" keywords `_. -.. code-block:: bash +.. code:: - $ platformio lib search --keyword="web" --keyword="http" - # Found N libraries: - # - # [ ID ] Name Compatibility "Authors": Description - # ------------------------------------------------------------------------------------- - # [ 5 ] Webduino arduino, atmelavr "Ben Combee": An extensible web server library (for use with the Arduino WizNet Ethernet Shield) - # [ 17 ] Adafruit-CC3000 arduino, atmelavr "Adafruit Industries": Library code for Adafruit's CC3000 Wi-Fi/WiFi breakouts - # ... + > platformio lib search --keyword="web" --keyword="http" + + Found N libraries: + + [ ID ] Name Compatibility "Authors": Description + ------------------------------------------------------------------------------------- + [ 5 ] Webduino arduino, atmelavr "Ben Combee": An extensible web server library (for use with the Arduino WizNet Ethernet Shield) + [ 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 `_ -.. code-block:: bash +.. code:: - $ platformio lib search --author="Adafruit Industries" - # Found N libraries: - # - # [ ID ] Name Compatibility "Authors": Description - # ------------------------------------------------------------------------------------- - # [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303) - # [ 13 ] Adafruit-GFX arduino, atmelavr "Adafruit Industries": A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.) - # [ 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) - # ... + > platformio lib search --author="Adafruit Industries" + + Found N libraries: + + [ ID ] Name Compatibility "Authors": Description + ------------------------------------------------------------------------------------- + [ 14 ] Adafruit-9DOF-Unified arduino, atmelavr "Adafruit Industries": Unified sensor driver for the Adafruit 9DOF Breakout (L3GD20 / LSM303) + [ 13 ] Adafruit-GFX arduino, atmelavr "Adafruit Industries": A core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.) + [ 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) + ... 6. Search for `libraries which are compatible with Dallas temperature sensors `_ like DS18B20, DS18S20 and etc. -.. code-block:: bash +.. code:: - $ platformio lib search "DS*" - # Found N libraries: - # - # [ ID ] Name Compatibility "Authors": Description - # ------------------------------------------------------------------------------------- - # [ 1 ] OneWire arduino, atmelavr "Paul Stoffregen": Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc) - # ... + > platformio lib search "DS*" + + Found N libraries: + + [ ID ] Name Compatibility "Authors": Description + ------------------------------------------------------------------------------------- + [ 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 `_. The search query that is described below can be interpreted like ``energia nRF24 OR energia HttpClient`` -.. code-block:: bash +.. code:: - $ platformio lib search "+(nRF24 HttpClient)" --framework="energia" - # Found 2 libraries: - # - # [ ID ] Name Compatibility "Authors": Description - # ------------------------------------------------------------------------------------- - # [ 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. + > platformio lib search "+(nRF24 HttpClient)" --framework="energia" + + Found 2 libraries: + + [ ID ] Name Compatibility "Authors": Description + ------------------------------------------------------------------------------------- + [ 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 +.. code:: - $ 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]: + > 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]: diff --git a/docs/userguide/lib/cmd_show.rst b/docs/userguide/lib/cmd_show.rst index 745685d1..b1f09e95 100644 --- a/docs/userguide/lib/cmd_show.rst +++ b/docs/userguide/lib/cmd_show.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -21,28 +21,65 @@ Usage .. code-block:: bash - platformio lib show ID + platformio lib [STORAGE_OPTIONS] show [LIBRARY] + # show info about project dependent library + # (run it from a project root where is located "platformio.ini") + platformio lib show [LIBRARY] + + # show info about library from global storage + platformio lib --global show [LIBRARY] + platformio lib -g show [LIBRARY] + + # show info about library from custom storage + platformio lib --storage-dir /path/to/dir show [LIBRARY] + platformio lib -d /path/to/dir show [LIBRARY] + + # [LIBRARY] forms + platformio lib [STORAGE_OPTIONS] show + platformio lib [STORAGE_OPTIONS] show + platformio lib [STORAGE_OPTIONS] show @ + platformio lib [STORAGE_OPTIONS] show @ + platformio lib [STORAGE_OPTIONS] show + platformio lib [STORAGE_OPTIONS] show @ + platformio lib [STORAGE_OPTIONS] show @ Description ----------- -Show details about the installed library +Show details about the installed library. +The ``version`` supports `Semantic Versioning `_ ( +``..``) and can take any of the following forms: + +* ``0.1.2`` - an exact version number. Use only this exact version +* ``^0.1.2`` - any compatible version (exact version for ``0.x.x`` versions +* ``~0.1.2`` - any version with the same major and minor versions, and an + equal or greater patch version +* ``>0.1.2`` - any version greater than ``0.1.2``. ``>=``, ``<``, and ``<=`` + are also possible +* ``>0.1.0,!=0.2.0,<0.3.0`` - any version greater than ``0.1.0``, not equal to + ``0.2.0`` and less than ``0.3.0`` + +Storage Options +--------------- + +See base options for :ref:`userguide_lib`. Examples -------- -.. code-block:: bash +.. code:: - # OneWire: http://platformio.org/lib/show/1/OneWire - $ platformio lib show 1 - # OneWire - # ------- - # Authors: Paul Stoffregen http://www.pjrc.com/teensy/td_libs_OneWire.html (maintainer), Jim Studt, Jason Dangel , Derek Yerger, Tom Pollard , Robin James - # Keywords: onewire, 1-wire, bus, sensor, temperature, ibutton - # Frameworks: arduino - # Platforms: atmelavr - # Version: 2.2 - # - # Control devices (from Dallas Semiconductor) that use the One Wire protocol (DS18S20, DS18B20, DS2408 and etc) + platformio lib -g show Json + + Library Storage: /storage/dir/... + Json + ==== + An elegant and efficient JSON library for embedded systems + + Authors: Benoit Blanchon http://blog.benoitblanchon.fr + Keywords: json, rest, http, web + Frameworks: arduino + Platforms: atmelavr, atmelsam, timsp430, titiva, teensy, freescalekinetis, ststm32, nordicnrf51, nxplpc, espressif, siliconlabsefm32, linux_arm, native, intel_arc32 + Version: 5.4.0 diff --git a/docs/userguide/lib/cmd_uninstall.rst b/docs/userguide/lib/cmd_uninstall.rst index df99372b..a465ad17 100644 --- a/docs/userguide/lib/cmd_uninstall.rst +++ b/docs/userguide/lib/cmd_uninstall.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -21,20 +21,56 @@ Usage .. code-block:: bash - platformio lib uninstall ID + platformio lib [STORAGE_OPTIONS] uninstall [LIBRARY...] + # uninstall project dependent library + # (run it from a project root where is located "platformio.ini") + platformio lib uninstall [LIBRARY...] + + # uninstall library from global storage + platformio lib --global uninstall [LIBRARY...] + platformio lib -g uninstall [LIBRARY...] + + # uninstall library from custom storage + platformio lib --storage-dir /path/to/dir uninstall [LIBRARY...] + platformio lib -d /path/to/dir uninstall [LIBRARY...] + + # [LIBRARY...] forms + platformio lib [STORAGE_OPTIONS] uninstall + platformio lib [STORAGE_OPTIONS] uninstall @ + platformio lib [STORAGE_OPTIONS] uninstall @ + platformio lib [STORAGE_OPTIONS] uninstall + platformio lib [STORAGE_OPTIONS] uninstall @ + platformio lib [STORAGE_OPTIONS] uninstall @ Description ----------- Uninstall specified library +The ``version`` supports `Semantic Versioning `_ ( +``..``) and can take any of the following forms: + +* ``0.1.2`` - an exact version number. Use only this exact version +* ``^0.1.2`` - any compatible version (exact version for ``0.x.x`` versions +* ``~0.1.2`` - any version with the same major and minor versions, and an + equal or greater patch version +* ``>0.1.2`` - any version greater than ``0.1.2``. ``>=``, ``<``, and ``<=`` + are also possible +* ``>0.1.0,!=0.2.0,<0.3.0`` - any version greater than ``0.1.0``, not equal to + ``0.2.0`` and less than ``0.3.0`` + +Storage Options +--------------- + +See base options for :ref:`userguide_lib`. Examples -------- -.. code-block:: bash +.. code:: - # XBee: http://platformio.org/lib/show/6/XBee - $ platformio lib uninstall 6 - # The library #6 'XBee' has been successfully uninstalled! + > platformio lib -g uninstall AsyncMqttClient + + Library Storage: /storage/dir/... + Uninstalling AsyncMqttClient @ 0.2.0: [OK] diff --git a/docs/userguide/lib/cmd_update.rst b/docs/userguide/lib/cmd_update.rst index 6b24f699..aea28cf0 100644 --- a/docs/userguide/lib/cmd_update.rst +++ b/docs/userguide/lib/cmd_update.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -21,51 +21,102 @@ Usage .. code-block:: bash - platformio lib update [LIBRARY_ID] + platformio lib [STORAGE_OPTIONS] update [OPTIONS] + + # update all project libraries + # (run it from a project root where is located "platformio.ini") + platformio lib update [OPTIONS] + + # update project dependent library + platformio lib [STORAGE_OPTIONS] update [OPTIONS] [LIBRARY...] + + # update library in global storage + platformio lib --global update [OPTIONS] [LIBRARY...] + platformio lib -g update [OPTIONS] [LIBRARY...] + + # update library in custom storage + platformio lib --storage-dir /path/to/dir update [OPTIONS] [LIBRARY...] + platformio lib -d /path/to/dir update [OPTIONS] [LIBRARY...] + + # [LIBRARY...] forms + platformio lib [STORAGE_OPTIONS] update + platformio lib [STORAGE_OPTIONS] update @ + platformio lib [STORAGE_OPTIONS] update @ + platformio lib [STORAGE_OPTIONS] update + platformio lib [STORAGE_OPTIONS] update @ + platformio lib [STORAGE_OPTIONS] update @ Description ----------- -Check or update installed libraries +Check or update installed libraries. +The ``version`` supports `Semantic Versioning `_ ( +``..``) and can take any of the following forms: + +* ``0.1.2`` - an exact version number. Use only this exact version +* ``^0.1.2`` - any compatible version (exact version for ``0.x.x`` versions +* ``~0.1.2`` - any version with the same major and minor versions, and an + equal or greater patch version +* ``>0.1.2`` - any version greater than ``0.1.2``. ``>=``, ``<``, and ``<=`` + are also possible +* ``>0.1.0,!=0.2.0,<0.3.0`` - any version greater than ``0.1.0``, not equal to + ``0.2.0`` and less than ``0.3.0`` + +Storage Options +--------------- + +See base options for :ref:`userguide_lib`. + +Options +------- + +.. program:: platformio lib update + +.. option:: + -c, --only-check + +Do not update, only check for new version Examples -------- -1. Update all installed libraries +1. Update all installed libraries in global storage -.. code-block:: bash +.. code:: - $ platformio lib update - # Updating [ 23 ] Adafruit-L3GD20-Unified library: - # Versions: Current=63de2eb9ea, Latest=63de2eb9ea [Up-to-date] - # Updating [ 12 ] Adafruit-ST7735 library: - # Versions: Current=e880eb1687, Latest=e880eb1687 [Up-to-date] - # Updating [ 31 ] Adafruit-Unified-Sensor library: - # Versions: Current=88ae805bce, Latest=88ae805bce [Up-to-date] - # Updating [ 26 ] Adafruit-LSM303DLHC-Unified library: - # Versions: Current=59767208a8, Latest=59767208a8 [Up-to-date] - # Updating [ 13 ] Adafruit-GFX library: - # Versions: Current=a9e5bc4707, Latest=a9e5bc4707 [Up-to-date] - # Updating [ 1 ] OneWire library: - # Versions: Current=2.2, Latest=2.2 [Up-to-date] - # Updating [ 4 ] IRremote library: - # Versions: Current=f2dafe5030, Latest=f2dafe5030 [Up-to-date] - # Updating [ 14 ] Adafruit-9DOF-Unified library: - # Versions: Current=b2f07242ac, Latest=b2f07242ac [Up-to-date] + > platformio lib -g update -2. Update specified libraries + Library Storage: /storage/dir/... + Updating ESP8266_SSD1306 @ 3.2.3: [Up-to-date] + Updating EngduinoMagnetometer @ 3.1.0: [Up-to-date] + Updating IRremote @ 2.2.1: [Up-to-date] + Updating Json @ 5.4.0: [Out-of-date] + LibraryManager: Installing id=64 @ 5.6.4 + Downloading [####################################] 100% + Unpacking [####################################] 100% + Json @ 5.6.4 has been successfully installed! + Updating PJON @ 1fb26fd: [Checking] + git version 2.7.4 (Apple Git-66) + Already up-to-date. + Updating TextLCD @ 308d188a2d3a: [Checking] + Mercurial Distributed SCM (version 3.8.4) + (see https://mercurial-scm.org for more information) -.. code-block:: bash + Copyright (C) 2005-2016 Matt Mackall and others + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + pulling from https://developer.mbed.org/users/simon/code/TextLCD/ + searching for changes + no changes found - $ platformio lib update 1 59 - # Updating [ 1 ] OneWire library: - # Versions: Current=2.2, Latest=2.2 [Up-to-date] - # Updating [ 59 ] USB-Host-Shield-20 library: - # Versions: Current=fcab83dcb3, Latest=c61f9ce1c2 [Out-of-date] - # The library #59 'USB-Host-Shield-20' has been successfully uninstalled! - # Installing library [ 59 ]: - # Downloading [####################################] 100% - # Unpacking [####################################] 100% - # The library #59 'USB-Host-Shield-20' has been successfully installed! +2. Update specified libraries in global storage + +.. code:: + + > platformio lib -g update Json 4 + + Library Storage: /storage/dir/... + Updating Json @ 5.6.4: [Up-to-date] + Updating IRremote @ 2.2.1: [Up-to-date] diff --git a/docs/userguide/lib/index.rst b/docs/userguide/lib/index.rst index 55626bfb..d0722ab7 100644 --- a/docs/userguide/lib/index.rst +++ b/docs/userguide/lib/index.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -14,15 +14,48 @@ Library Manager =============== -To print all available commands and options use: +Usage +----- .. code-block:: bash - $ platformio lib --help - $ platformio lib COMMAND --help + platformio lib [OPTIONS] COMMAND + + # To print all available commands and options use + platformio lib --help + platformio lib COMMAND --help + +Options +------- + +.. program:: platformio lib + +.. option:: + -g, --global + +.. versionadded:: 3.0 + + +Manage global PlatformIO's library storage ( +":ref:`projectconf_pio_home_dir`/lib") where :ref:`ldf` will look for +dependencies by default. + +.. option:: + -d, --storage-dir + +.. versionadded:: 3.0 + +Manage custom library storage. It can be used later for the +:ref:`projectconf_extra_script` option from :ref:`projectconf`. + +Demo +---- .. image:: ../../_static/platformio-demo-lib.gif +Commands +-------- + .. toctree:: :maxdepth: 2 diff --git a/docs/userguide/platforms/cmd_install.rst b/docs/userguide/platforms/cmd_install.rst index 03008881..4dd8145a 100644 --- a/docs/userguide/platforms/cmd_install.rst +++ b/docs/userguide/platforms/cmd_install.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -9,10 +9,10 @@ See the License for the specific language governing permissions and limitations under the License. -.. _cmd_platforms_install: +.. _cmd_platform_install: -platformio platforms install -============================ +platformio platform install +=========================== .. contents:: @@ -21,23 +21,49 @@ Usage .. code-block:: bash - platformio platforms install [OPTIONS] [PLATFORMS] + platformio platform install [OPTIONS] [PLATFORM...] + + # [PLATFORM...] forms + platformio platform install + platformio platform install @ + platformio platform install @ + platformio platform install + platformio platform install file:// + platformio platform install file:// + platformio platform install + platformio platform install (name it should have locally) + platformio platform install ("tag" can be commit, branch or tag) Description ----------- -Install pre-built development :ref:`platforms` with related packages. +Install :ref:`platforms` and dependent packages. -There are several predefined aliases for packages, such as: +The ``version`` supports `Semantic Versioning `_ ( +``..``) and can take any of the following forms: -* ``toolchain`` -* ``uploader`` +* ``0.1.2`` - an exact version number. Use only this exact version +* ``^0.1.2`` - any compatible version (exact version for ``0.x.x`` versions +* ``~0.1.2`` - any version with the same major and minor versions, and an + equal or greater patch version +* ``>0.1.2`` - any version greater than ``0.1.2``. ``>=``, ``<``, and ``<=`` + are also possible +* ``>0.1.0,!=0.2.0,<0.3.0`` - any version greater than ``0.1.0``, not equal to + ``0.2.0`` and less than ``0.3.0`` + +Also, PlatformIO supports installing from local directory or archive. Need to +use ``file://`` prefix before local path. Also, directory or archive should +contain ``platform.json`` manifest. + +* ``file:///local/path/to/the/platform/dir`` +* ``file:///local/path/to/the/platform.zip`` +* ``file:///local/path/to/the/platform.tar.gz`` Options ------- -.. program:: platformio platforms install +.. program:: platformio platform install .. option:: --with-package @@ -55,33 +81,141 @@ Do not install specified package (or alias) Skip default packages +Version control +--------------- + +PlatformIO supports installing from Git, Mercurial and Subversion, and detects +the type of VCS using url prefixes: "git+", "hg+", or "svn+". + +.. note:: + PlatformIO requires a working VCS command on your path: ``git``, ``hg`` + or ``svn``. + +Git +^^^ + +The supported schemes are: ``git``, ``git+https`` and ``git+ssh``. Here are +the supported forms: + +* platformio/platform-NAME (short version for GitHub repository) +* https://github.com/platformio/platform-NAME.git +* git+git://git.server.org/my-platform +* git+https://git.server.org/my-platform +* git+ssh://git.server.org/my-platform + +Passing branch names, a commit hash or a tag name is possible like so: + +* https://github.com/platformio/platform-name.git#master +* git+git://git.server.org/my-platform#master +* git+https://git.server.org/my-platform#v1.0 +* git+ssh://git.server.org/my-platform#7846d8ad52f983f2f2887bdc0f073fe9755a806d + +Mercurial +^^^^^^^^^ + +The supported schemes are: ``hg+http``, ``hg+https`` and ``hg+ssh``. Here are +the supported forms: + +* hg+hg://hg.server.org/my-platform +* hg+https://hg.server.org/my-platform +* hg+ssh://hg.server.org/my-platform + +Passing branch names, a commit hash or a tag name is possible like so: + +* hg+hg://hg.server.org/my-platform#master +* hg+https://hg.server.org/my-platform#v1.0 +* hg+ssh://hg.server.org/my-platform#4cfe2fa00668 + +Subversion +^^^^^^^^^^ + +The supported schemes are: ``svn``, ``svn+svn``, ``svn+http``, ``svn+https`` +and ``svn+ssh``. Here are the supported forms: + +* svn+svn://svn.server.org/my-platform +* svn+https://svn.server.org/my-platform +* svn+ssh://svn.server.org/my-platform + +You can also give specific revisions to an SVN URL, like so: + +* svn+svn://svn.server.org/my-platform#13 + Examples -------- -1. Install :ref:`platform_timsp430` with default packages +1. Install :ref:`platform_atmelavr` with default packages -.. code-block:: bash +.. code:: - $ platformio platforms install timsp430 - Installing toolchain-timsp430 package: + > platformio platform install atmelavr + + PlatformManager: Installing atmelavr + Downloading... + Unpacking [####################################] 100% + atmelavr @ 0.0.0 has been successfully installed! + PackageManager: Installing tool-scons @ >=2.3.0,<2.6.0 Downloading [####################################] 100% Unpacking [####################################] 100% - Installing tool-mspdebug package: + tool-scons @ 2.4.1 has been successfully installed! + PackageManager: Installing toolchain-atmelavr @ ~1.40801.0 Downloading [####################################] 100% Unpacking [####################################] 100% - Installing framework-energiamsp430 package: - Downloading [####################################] 100% - Unpacking [####################################] 100% - The platform 'timsp430' has been successfully installed! + toolchain-atmelavr @ 1.40801.0 has been successfully installed! + The platform 'atmelavr' has been successfully installed! + The rest of packages will be installed automatically depending on your build environment. - -2. Install :ref:`platform_timsp430` with ``uploader`` utility only and skip +2. Install :ref:`platform_atmelavr` with ``uploader`` utility only and skip default packages -.. code-block:: bash +.. code:: - $ platformio platforms install timsp430 --skip-default-package --with-package=uploader - Installing tool-mspdebug package: + > platformio platform install atmelavr --skip-default-package --with-package=uploader + + PlatformManager: Installing atmelavr Downloading [####################################] 100% Unpacking [####################################] 100% - The platform 'timsp430' has been successfully installed! + atmelavr @ 0.0.0 has been successfully installed! + PackageManager: Installing tool-micronucleus @ ~1.200.0 + Downloading [####################################] 100% + Unpacking [####################################] 100% + tool-micronucleus @ 1.200.0 has been successfully installed! + PackageManager: Installing tool-avrdude @ ~1.60001.0 + Downloading [####################################] 100% + Unpacking [####################################] 100% + tool-avrdude @ 1.60001.1 has been successfully installed! + The platform 'atmelavr' has been successfully installed! + The rest of packages will be installed automatically depending on your build environment. + +3. Install the latest development :ref:`platform_atmelavr` from Git repository + +.. code:: + + > platformio platform install https://github.com/platformio/platform-atmelavr.git + + PlatformManager: Installing platform-atmelavr + git version 2.7.4 (Apple Git-66) + Cloning into '/Volumes/MEDIA/tmp/pio3_test_projects/arduino-digihead-master/home_dir/platforms/installing-U3ucN0-package'... + remote: Counting objects: 176, done. + remote: Compressing objects: 100% (55/55), done. + remote: Total 176 (delta 114), reused 164 (delta 109), pack-reused 0 + Receiving objects: 100% (176/176), 38.86 KiB | 0 bytes/s, done. + Resolving deltas: 100% (114/114), done. + Checking connectivity... done. + Submodule 'examples/arduino-external-libs/lib/OneWire' (https://github.com/PaulStoffregen/OneWire.git) registered for path 'examples/arduino-external-libs/lib/OneWire' + Cloning into 'examples/arduino-external-libs/lib/OneWire'... + remote: Counting objects: 91, done. + remote: Total 91 (delta 0), reused 0 (delta 0), pack-reused 91 + Unpacking objects: 100% (91/91), done. + Checking connectivity... done. + Submodule path 'examples/arduino-external-libs/lib/OneWire': checked out '57c18c6de80c13429275f70875c7c341f1719201' + atmelavr @ 0.0.0 has been successfully installed! + PackageManager: Installing tool-scons @ >=2.3.0,<2.6.0 + Downloading [####################################] 100% + Unpacking [####################################] 100% + tool-scons @ 2.4.1 has been successfully installed! + PackageManager: Installing toolchain-atmelavr @ ~1.40801.0 + Downloading [####################################] 100% + Unpacking [####################################] 100% + toolchain-atmelavr @ 1.40801.0 has been successfully installed! + The platform 'https://github.com/platformio/platform-atmelavr.git' has been successfully installed! + The rest of packages will be installed automatically depending on your build environment. diff --git a/docs/userguide/platforms/cmd_list.rst b/docs/userguide/platforms/cmd_list.rst index ebc72141..9aacba4c 100644 --- a/docs/userguide/platforms/cmd_list.rst +++ b/docs/userguide/platforms/cmd_list.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -9,10 +9,10 @@ See the License for the specific language governing permissions and limitations under the License. -.. _cmd_platforms_list: +.. _cmd_platform_list: -platformio platforms list -========================= +platformio platform list +======================== .. contents:: @@ -21,7 +21,7 @@ Usage .. code-block:: bash - platformio platforms list [OPTIONS] + platformio platform list [OPTIONS] Description @@ -32,7 +32,7 @@ List installed :ref:`platforms` Options ~~~~~~~ -.. program:: platformio platforms list +.. program:: platformio platform list .. option:: --json-output @@ -42,15 +42,31 @@ Return the output in `JSON `_ format Examples -------- -.. code-block:: bash +.. code:: - $ platformio platforms list - atmelavr with packages: toolchain-atmelavr, tool-avrdude, framework-arduinoavr, tool-micronucleus - atmelsam with packages: framework-arduinosam, ldscripts, toolchain-gccarmnoneeabi, tool-bossac - freescalekinetis with packages: framework-mbed, toolchain-gccarmnoneeabi - nordicnrf51 with packages: framework-mbed, toolchain-gccarmnoneeabi - nxplpc with packages: framework-mbed, toolchain-gccarmnoneeabi - ststm32 with packages: framework-libopencm3, toolchain-gccarmnoneeabi, tool-stlink, framework-spl, framework-cmsis, framework-mbed, ldscripts - teensy with packages: toolchain-atmelavr, ldscripts, framework-arduinoteensy, toolchain-gccarmnoneeabi, tool-teensy - timsp430 with packages: toolchain-timsp430, tool-mspdebug, framework-energiamsp430, framework-arduinomsp430 - titiva with packages: ldscripts, framework-libopencm3, toolchain-gccarmnoneeabi, tool-lm4flash, framework-energiativa + > platformio platform list + + atmelavr ~ Atmel AVR + ==================== + Atmel AVR 8- and 32-bit MCUs deliver a unique combination of performance, power efficiency and design flexibility. Optimized to speed time to market-and easily adapt to new ones-they are based on the industrys most code-efficient architecture for C and assembly programming. + + Home: http://platformio.org/platforms/atmelavr + Packages: toolchain-atmelavr, framework-simba + Version: 0.0.0 + + atmelsam ~ Atmel SAM + ==================== + Atmel | SMART offers Flash- based ARM products based on the ARM Cortex-M0+, Cortex-M3 and Cortex-M4 architectures, ranging from 8KB to 2MB of Flash including a rich peripheral and feature mix. + + Home: http://platformio.org/platforms/atmelsam + Packages: framework-arduinosam, framework-mbed, framework-simba, toolchain-gccarmnoneeabi, tool-bossac + Version: 0.0.0 + + espressif ~ Espressif + ===================== + Espressif Systems is a privately held fabless semiconductor company. They provide wireless communications and Wi-Fi chips which are widely used in mobile devices and the Internet of Things applications. + + Home: http://platformio.org/platforms/espressif + Packages: framework-simba, tool-esptool, framework-arduinoespressif, sdk-esp8266, toolchain-xtensa + Version: 0.0.0 + ... diff --git a/docs/userguide/platforms/cmd_search.rst b/docs/userguide/platforms/cmd_search.rst index 1bb7104d..00a3f63a 100644 --- a/docs/userguide/platforms/cmd_search.rst +++ b/docs/userguide/platforms/cmd_search.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -9,10 +9,10 @@ See the License for the specific language governing permissions and limitations under the License. -.. _cmd_platforms_search: +.. _cmd_platform_search: -platformio platforms search -=========================== +platformio platform search +========================== .. contents:: @@ -21,7 +21,7 @@ Usage .. code-block:: bash - platformio platforms search QUERY [OPTIONS] + platformio platform search QUERY [OPTIONS] Description @@ -32,7 +32,7 @@ Search for development :ref:`platforms` Options ~~~~~~~ -.. program:: platformio platforms search +.. program:: platformio platform search .. option:: --json-output @@ -45,75 +45,105 @@ Examples 1. Print all available development platforms -.. code-block:: bash +.. code:: - $ platformio platforms search - atmelavr (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - -------- - Atmel AVR 8- and 32-bit MCUs deliver a unique combination of performance... + > platformio platform search - atmelsam (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - -------- - Atmel | SMART offers Flash- based ARM products based on the ... + atmelavr ~ Atmel AVR + ==================== + Atmel AVR 8- and 32-bit MCUs deliver a unique combination of performance, power efficiency and design flexibility. Optimized to speed time to market-and easily adapt to new ones-they are based on the industrys most code-efficient architecture for C and assembly programming. - freescalekinetis (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - ---------------- - Freescale Kinetis Microcontrollers is family of multiple hardware- and ... + Home: http://platformio.org/platforms/atmelavr + Packages: toolchain-atmelavr, framework-simba + Version: 0.0.0 - nordicnrf51 (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - ----------- - The Nordic nRF51 Series is a family of highly flexible, multi-protocol ... + atmelsam ~ Atmel SAM + ==================== + Atmel | SMART offers Flash- based ARM products based on the ARM Cortex-M0+, Cortex-M3 and Cortex-M4 architectures, ranging from 8KB to 2MB of Flash including a rich peripheral and feature mix. - nxplpc (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - ------ - The NXP LPC is a family of 32-bit microcontroller integrated circuits ... + Home: http://platformio.org/platforms/atmelsam + Packages: framework-arduinosam, framework-mbed, framework-simba, toolchain-gccarmnoneeabi, tool-bossac + Version: 0.0.0 - ststm32 (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - ------- - The STM32 family of 32-bit Flash MCUs based on the ARM Cortex-M ... + espressif ~ Espressif + ===================== + Espressif Systems is a privately held fabless semiconductor company. They provide wireless communications and Wi-Fi chips which are widely used in mobile devices and the Internet of Things applications. - teensy (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - ------ - Teensy is a complete USB-based microcontroller development syste ... - - timsp430 (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - -------- - MSP430 microcontrollers (MCUs) from Texas Instruments (TI) are ... - - titiva (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - ------ - Texas Instruments TM4C12x MCUs offer the industrys most popular ... + Home: http://platformio.org/platforms/espressif + Packages: framework-simba, tool-esptool, framework-arduinoespressif, sdk-esp8266, toolchain-xtensa + Version: 0.0.0 + ... 2. Search for TI development platforms -.. code-block:: bash +.. code:: - $ platformio platforms search ti - timsp430 (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - -------- - MSP430 microcontrollers (MCUs) from Texas Instruments (TI) are ... + > platformio platform search texas - titiva (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - ------ - Texas Instruments TM4C12x MCUs offer the industrys most popular ... + timsp430 ~ TI MSP430 + ==================== + MSP430 microcontrollers (MCUs) from Texas Instruments (TI) are 16-bit, RISC-based, mixed-signal processors designed for ultra-low power. These MCUs offer the lowest power consumption and the perfect mix of integrated peripherals for thousands of applications. -3. Search for development platforms which support "mbed Framework" + Home: http://platformio.org/platforms/timsp430 + Packages: toolchain-timsp430, tool-mspdebug, framework-energiamsp430, framework-arduinomsp430 -.. code-block:: bash + titiva ~ TI TIVA + ================ + Texas Instruments TM4C12x MCUs offer the industrys most popular ARM Cortex-M4 core with scalable memory and package options, unparalleled connectivity peripherals, advanced application functions, industry-leading analog integration, and extensive software solutions. - $ platformio platforms search mbed - freescalekinetis (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - ---------------- - Freescale Kinetis Microcontrollers is family of multiple hardware- and ... + Home: http://platformio.org/platforms/titiva + Packages: ldscripts, framework-libopencm3, toolchain-gccarmnoneeabi, tool-lm4flash, framework-energiativa - nordicnrf51 (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - ----------- - The Nordic nRF51 Series is a family of highly flexible, multi-protocol ... +.. code:: - nxplpc (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - ------ - The NXP LPC is a family of 32-bit microcontroller integrated circuits ... + > platformio platform search framework-mbed - ststm32 (available packages: ldscripts, toolchain-gccarmnoneeabi, tool-lm4flash, framework-opencm3, framework-energiativa) - ------- - The STM32 family of 32-bit Flash MCUs based on the ARM Cortex-M ... + atmelsam ~ Atmel SAM + ==================== + Atmel | SMART offers Flash- based ARM products based on the ARM Cortex-M0+, Cortex-M3 and Cortex-M4 architectures, ranging from 8KB to 2MB of Flash including a rich peripheral and feature mix. + + Home: http://platformio.org/platforms/atmelsam + Packages: toolchain-gccarmnoneeabi, framework-arduinosam, framework-simba, tool-openocd, framework-mbed, ldscripts, tool-bossac + + freescalekinetis ~ Freescale Kinetis + ==================================== + Freescale Kinetis Microcontrollers is family of multiple hardware- and software-compatible ARM Cortex-M0+, Cortex-M4 and Cortex-M7-based MCU series. Kinetis MCUs offer exceptional low-power performance, scalability and feature integration. + + Home: http://platformio.org/platforms/freescalekinetis + Packages: framework-mbed, toolchain-gccarmnoneeabi + + nordicnrf51 ~ Nordic nRF51 + ========================== + The Nordic nRF51 Series is a family of highly flexible, multi-protocol, system-on-chip (SoC) devices for ultra-low power wireless applications. nRF51 Series devices support a range of protocol stacks including Bluetooth Smart (previously called Bluetooth low energy), ANT and proprietary 2.4GHz protocols such as Gazell. + + Home: http://platformio.org/platforms/nordicnrf51 + Packages: framework-mbed, tool-rfdloader, toolchain-gccarmnoneeabi, framework-arduinonordicnrf51 + + nxplpc ~ NXP LPC + ================ + 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. + + Home: http://platformio.org/platforms/nxplpc + Packages: framework-mbed, toolchain-gccarmnoneeabi + + siliconlabsefm32 ~ Silicon Labs EFM32 + ===================================== + 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. + + Home: http://platformio.org/platforms/siliconlabsefm32 + Packages: framework-mbed, toolchain-gccarmnoneeabi + + ststm32 ~ ST STM32 + ================== + 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. + + Home: http://platformio.org/platforms/ststm32 + Packages: framework-libopencm3, toolchain-gccarmnoneeabi, tool-stlink, framework-spl, framework-cmsis, framework-mbed, ldscripts + + teensy ~ Teensy + =============== + Teensy is a complete USB-based microcontroller development system, in a very small footprint, capable of implementing many types of projects. All programming is done via the USB port. No special programmer is needed, only a standard USB cable and a PC or Macintosh with a USB port. + + Home: http://platformio.org/platforms/teensy + Packages: framework-arduinoteensy, tool-teensy, toolchain-gccarmnoneeabi, framework-mbed, toolchain-atmelavr, ldscripts + ... diff --git a/docs/userguide/platforms/cmd_show.rst b/docs/userguide/platforms/cmd_show.rst index 3f66d3d3..35ec16c3 100644 --- a/docs/userguide/platforms/cmd_show.rst +++ b/docs/userguide/platforms/cmd_show.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -9,10 +9,10 @@ See the License for the specific language governing permissions and limitations under the License. -.. _cmd_platforms_show: +.. _cmd_platform_show: -platformio platforms show -========================= +platformio platform show +======================== .. contents:: @@ -21,7 +21,7 @@ Usage .. code-block:: bash - platformio platforms show PLATFORM + platformio platform show PLATFORM Description @@ -33,24 +33,56 @@ Show details about the installed :ref:`platforms` Examples -------- -.. code-block:: bash +.. code:: - $ platformio platforms show atmelavr - atmelavr - An embedded platform for Atmel AVR microcontrollers (with Arduino Framework) - ---------- - Package: toolchain-atmelavr - Alias: toolchain - Version: 1 - Installed: 2014-12-13 23:58:48 - ---------- - Package: tool-avrdude - Version: 2 - Installed: 2015-02-13 22:23:17 - ---------- - Package: framework-arduinoavr - Version: 12 - Installed: 2015-02-23 20:57:40 - ---------- - Package: tool-micronucleus - Version: 1 - Installed: 2015-02-23 21:20:14 + > platformio platform show atmelavr + + atmelavr ~ Atmel AVR + ==================== + Atmel AVR 8- and 32-bit MCUs deliver a unique combination of performance, power efficiency and design flexibility. Optimized to speed time to market-and easily adapt to new ones-they are based on the industrys most code-efficient architecture for C and assembly programming. + + Version: 0.0.0 + Home: http://platformio.org/platforms/atmelavr + License: Apache-2.0 + Frameworks: simba, arduino + + Package toolchain-atmelavr + -------------------------- + Type: toolchain + Optional: No + Requirements: ~1.40801.0 + Installed: Yes + Description: avr-gcc + Url: https://gcc.gnu.org/wiki/avr-gcc + Version: 1.40801.0 + + Package framework-arduinoavr + ---------------------------- + Type: framework + Optional: Yes + Requirements: ~1.10608.0 + Installed: No (optional) + + Package framework-simba + ----------------------- + Type: framework + Optional: Yes + Requirements: ~1.50.0 + Installed: Yes + Description: framework-simba + Url: https://github.com/eerimoq/simba + Version: 1.50.0 + + Package tool-avrdude + -------------------- + Type: uploader + Optional: Yes + Requirements: >=1.60001.0,<=1.60100.0 + Installed: No (optional) + + Package tool-micronucleus + ------------------------- + Type: uploader + Optional: Yes + Requirements: ~1.200.0 + Installed: No (optional) diff --git a/docs/userguide/platforms/cmd_uninstall.rst b/docs/userguide/platforms/cmd_uninstall.rst index 0a4545a9..d26c4c23 100644 --- a/docs/userguide/platforms/cmd_uninstall.rst +++ b/docs/userguide/platforms/cmd_uninstall.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -9,10 +9,10 @@ See the License for the specific language governing permissions and limitations under the License. -.. _cmd_platforms_uninstall: +.. _cmd_platform_uninstall: -platformio platforms uninstall -============================== +platformio platform uninstall +============================= .. contents:: @@ -21,7 +21,10 @@ Usage .. code-block:: bash - platformio platforms uninstall PLATFORM + platformio platform uninstall [PLATFORM...] + + # uninstall specific platform version using Semantic Versioning + platformio platform uninstall PLATFORM@X.Y.Z Description @@ -33,10 +36,10 @@ Uninstall specified :ref:`platforms` Examples -------- -.. code-block:: bash +.. code:: - $ platformio platforms uninstall timsp430 - Uninstalling toolchain-timsp430 package: [OK] - Uninstalling tool-mspdebug package: [OK] - Uninstalling framework-energiamsp430 package: [OK] - The platform 'timsp430' has been successfully uninstalled! + > platformio platform uninstall atmelavr + Uninstalling platform atmelavr @ 0.0.0: [OK] + Uninstalling package tool-scons @ 2.4.1: [OK] + Uninstalling package toolchain-atmelavr @ 1.40801.0: [OK] + The platform 'atmelavr' has been successfully uninstalled! diff --git a/docs/userguide/platforms/cmd_update.rst b/docs/userguide/platforms/cmd_update.rst index 96e52d68..581c2c35 100644 --- a/docs/userguide/platforms/cmd_update.rst +++ b/docs/userguide/platforms/cmd_update.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-present Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -9,10 +9,10 @@ See the License for the specific language governing permissions and limitations under the License. -.. _cmd_platforms_update: +.. _cmd_platform_update: -platformio platforms update -=========================== +platformio platform update +========================== .. contents:: @@ -21,7 +21,10 @@ Usage .. code-block:: bash - platformio platforms update + platformio platform update [OPTIONS] [PLATFORM...] + + # update specific platform version using Semantic Versioning + platformio platform update PLATFORM@X.Y.Z Description @@ -29,82 +32,55 @@ Description Check or update installed :ref:`platforms` +Options +------- + +.. program:: platformio platform update + +.. option:: + -p, --only-packages + +Update only platform related packages. Do not update development platform +build scripts, board configs and etc. + +.. option:: + -c, --only-check + +Do not update, only check for new version Examples -------- -.. code-block:: bash +.. code:: - $ platformio platforms update + > platformio platform update Platform atmelavr -------- - Updating toolchain-atmelavr package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-avrdude package: - Versions: Current=2, Latest=2 [Up-to-date] - Updating framework-arduinoavr package: - Versions: Current=12, Latest=12 [Up-to-date] - Updating tool-micronucleus package: - Versions: Current=1, Latest=1 [Up-to-date] + Updating atmelavr @ 0.0.0: [Up-to-date] + Updating framework-arduinoavr @ 1.10608.1: [Up-to-date] + Updating tool-avrdude @ 1.60001.1: [Up-to-date] + Updating toolchain-atmelavr @ 1.40801.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] - Platform atmelsam + Platform espressif -------- - Updating framework-arduinosam package: - Versions: Current=3, Latest=3 [Up-to-date] - Updating ldscripts package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating toolchain-gccarmnoneeabi package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-bossac package: - Versions: Current=1, Latest=1 [Up-to-date] - - Platform stm32 - -------- - Updating toolchain-gccarmnoneeabi package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-stlink package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-spl package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-cmsis package: - Versions: Current=2, Latest=2 [Up-to-date] - Updating framework-opencm3 package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating ldscripts package: - Versions: Current=1, Latest=1 [Up-to-date] + Updating espressif @ 0.0.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + Updating toolchain-xtensa @ 1.40802.0: [Up-to-date] + Updating tool-esptool @ 1.409.0: [Up-to-date] + Updating tool-mkspiffs @ 1.102.0: [Up-to-date] + Updating framework-arduinoespressif @ 1.20300.0: [Up-to-date] + Updating sdk-esp8266 @ 1.10502.0: [Up-to-date] Platform teensy -------- - Updating toolchain-atmelavr package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating ldscripts package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-arduinoteensy package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating toolchain-gccarmnoneeabi package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-teensy package: - Versions: Current=1, Latest=1 [Up-to-date] + Updating teensy @ 0.0.0: [Up-to-date] + Updating framework-arduinoteensy @ 1.128.0: [Up-to-date] + Updating tool-teensy @ 1.1.0: [Up-to-date] + Updating framework-mbed @ 1.121.0: [Up-to-date] + Updating tool-scons @ 2.4.1: [Up-to-date] + Updating toolchain-atmelavr @ 1.40801.0: [Up-to-date] + Updating toolchain-gccarmnoneeabi @ 1.40804.0: [Up-to-date] - Platform timsp430 - -------- - Updating toolchain-timsp430 package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-mspdebug package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-energiamsp430 package: - Versions: Current=2, Latest=2 [Up-to-date] - - Platform titiva - -------- - Updating ldscripts package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating toolchain-gccarmnoneeabi package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating tool-lm4flash package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-opencm3 package: - Versions: Current=1, Latest=1 [Up-to-date] - Updating framework-energiativa package: - Versions: Current=4, Latest=4 [Up-to-date] + ... diff --git a/docs/userguide/platforms/index.rst b/docs/userguide/platforms/index.rst index 1d084ccd..b9402f61 100644 --- a/docs/userguide/platforms/index.rst +++ b/docs/userguide/platforms/index.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -9,7 +9,7 @@ See the License for the specific language governing permissions and limitations under the License. -.. _userguide_platforms: +.. _userguide_platform: Platform Manager ================ @@ -18,8 +18,8 @@ To print all available commands and options use: .. code-block:: bash - $ platformio platforms --help - $ platformio platforms COMMAND --help + platformio platform --help + platformio platform COMMAND --help .. image:: ../../_static/platformio-demo-platforms.gif diff --git a/docs/what-is-platformio.rst b/docs/what-is-platformio.rst index 0eb61dd5..13fd7a2b 100644 --- a/docs/what-is-platformio.rst +++ b/docs/what-is-platformio.rst @@ -1,4 +1,4 @@ -.. Copyright 2014-2016 Ivan Kravets +.. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -76,7 +76,7 @@ Alright, so PlatformIO can run on different operating systems. But more importantly, from development perspective at least, is a list of supported boards and MCUs. To keep things short: PlatformIO supports approximately 200 `Embedded Boards `_ and all major -:ref:`Development Platforms `. +:ref:`platforms`. User SHOULD have a choice ------------------------- diff --git a/platformio/__init__.py b/platformio/__init__.py index 1282de0a..706fe860 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,16 +14,14 @@ import sys -VERSION = (2, 11, 2) +VERSION = (3, 0, "0.dev22") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" -__description__ = ( - "An open source ecosystem for IoT development. " - "Cross-platform build system and library manager. " - "Continuous and IDE integration. " - "Arduino and MBED compatible. Ready for Cloud compiling." -) +__description__ = ("An open source ecosystem for IoT development. " + "Cross-platform build system and library manager. " + "Continuous and IDE integration. " + "Arduino and MBED compatible. Ready for Cloud compiling.") __url__ = "http://platformio.org" __author__ = "Ivan Kravets" @@ -35,8 +33,7 @@ __copyright__ = "Copyright 2014-2016 Ivan Kravets" __apiurl__ = "http://api.platformio.org" __apiip__ = "198.7.57.247" - -if sys.version_info >= (3, 0, 0): +if sys.version_info < (2, 7, 0) or sys.version_info >= (3, 0, 0): msg = ("PlatformIO version %s does not run under Python version %s.\n" "Python 3 is not yet supported.\n") sys.stderr.write(msg % (__version__, sys.version.split()[0])) diff --git a/platformio/__main__.py b/platformio/__main__.py index d6ade4d6..08679523 100644 --- a/platformio/__main__.py +++ b/platformio/__main__.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,8 +40,8 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904 def get_command(self, ctx, name): mod = None try: - mod = __import__("platformio.commands." + name, - None, None, ["cli"]) + mod = __import__("platformio.commands." + name, None, None, + ["cli"]) except ImportError: try: return self._handle_obsolate_command(name) @@ -51,23 +51,21 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904 @staticmethod def _handle_obsolate_command(name): - if name in ("install", "list", "search", "show", "uninstall"): - click.secho( - "Warning! `platformio %s` command is deprecated and will be " - "removed in the next release! Please use " - "`platformio platforms %s` instead." % (name, name), - fg="yellow" - ) - from platformio.commands import platforms - return getattr(platforms, "platforms_" + name) + if name == "platforms": + from platformio.commands import platform + return platform.cli raise AttributeError() -@click.command(cls=PlatformioCLI, - context_settings=dict(help_option_names=["-h", "--help"])) +@click.command( + cls=PlatformioCLI, + context_settings=dict(help_option_names=["-h", "--help"])) @click.version_option(__version__, prog_name="PlatformIO") -@click.option("--force", "-f", is_flag=True, - help="Force to accept any confirmation prompts.") +@click.option( + "--force", + "-f", + is_flag=True, + help="Force to accept any confirmation prompts.") @click.option("--caller", "-c", help="Caller ID (service).") @click.pass_context def cli(ctx, force, caller): diff --git a/platformio/app.py b/platformio/app.py index 20f2f55e..3bacc180 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,29 +44,28 @@ DEFAULT_SETTINGS = { "description": "Automatically update libraries (Yes/No)", "value": False }, + "force_verbose": { + "description": "Force verbose output when processing environments", + "value": False + }, "enable_telemetry": { - "description": ( - "Telemetry service (Yes/No)"), + "description": + ("Telemetry service (Yes/No)"), "value": True }, "enable_prompts": { - "description": ( - "Can PlatformIO communicate with you via prompts: " - "propose to install platforms which aren't installed yet, " - "paginate over library search results and etc.)? ATTENTION!!! " - "If you call PlatformIO like subprocess, " - "please disable prompts to avoid blocking (Yes/No)"), + "description": + ("Can PlatformIO communicate with you via prompts: " + "propose to install platforms which aren't installed yet, " + "paginate over library search results and etc.)? ATTENTION!!! " + "If you call PlatformIO like subprocess, " + "please disable prompts to avoid blocking (Yes/No)"), "value": True } } - -SESSION_VARS = { - "command_ctx": None, - "force_option": False, - "caller_id": None -} +SESSION_VARS = {"command_ctx": None, "force_option": False, "caller_id": None} class State(object): @@ -104,8 +103,8 @@ class State(object): return self._lockfile = LockFile(self.path) - if (self._lockfile.is_locked() and - (time() - getmtime(self._lockfile.lock_file)) > 10): + if self._lockfile.is_locked() and \ + (time() - getmtime(self._lockfile.lock_file)) > 10: self._lockfile.break_lock() self._lockfile.acquire() diff --git a/platformio/boards/adafruit.json b/platformio/boards/adafruit.json deleted file mode 100644 index fc5ef21c..00000000 --- a/platformio/boards/adafruit.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "flora8": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_FLORA8", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "usb_product": "Adafruit Flora", - "variant": "flora", - "hwids": [ - ["0x239A", "0x8004"] - ] - }, - "frameworks": ["arduino"], - "name": "Adafruit Flora", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.adafruit.com/product/659", - "vendor": "Adafruit" - }, - - "bluefruitmicro": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_BLUEFRUITMICRO", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "usb_product": "Bluefruit Micro", - "variant": "bluefruitmicro", - "hwids": [ - ["0x239A", "0x800A"] - ] - }, - "frameworks": ["arduino"], - "name": "Adafruit Bluefruit Micro", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.adafruit.com/products/2661", - "vendor": "Adafruit" - }, - - "gemma": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_GEMMA", - "f_cpu": "8000000L", - "mcu": "attiny85", - "variant": "tiny8" - }, - "frameworks": ["arduino"], - "name": "Adafruit Gemma", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 512, - "maximum_size": 8192, - "protocol": "usbtiny" - }, - "url": "http://www.adafruit.com/products/1222", - "vendor": "Adafruit" - }, - - "feather32u4": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_FEATHER32U4", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "usb_product": "Feather 32u4", - "variant": "feather32u4", - "hwids": [ - ["0x239A", "0x800C"] - ] - }, - "frameworks": ["arduino"], - "name": "Adafruit Feather", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://learn.adafruit.com/adafruit-feather-32u4-bluefruit-le/", - "vendor": "Adafruit" - }, - - "trinket3": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_TRINKET3", - "f_cpu": "8000000L", - "mcu": "attiny85", - "variant": "tiny8" - }, - "frameworks": ["arduino"], - "name": "Adafruit Trinket 3V/8MHz", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 512, - "maximum_size": 8192, - "protocol": "usbtiny" - }, - "url": "http://www.adafruit.com/products/1500", - "vendor": "Adafruit" - }, - - "trinket5": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_TRINKET5", - "f_cpu": "16000000L", - "mcu": "attiny85", - "variant": "tiny8" - }, - "frameworks": ["arduino"], - "name": "Adafruit Trinket 5V/16MHz", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 512, - "maximum_size": 8192, - "protocol": "usbtiny" - }, - "url": "http://www.adafruit.com/products/1501", - "vendor": "Adafruit" - }, - - "metro": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_METRO", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "Adafruit Metro", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.adafruit.com/products/2466", - "vendor": "Adafruit" - }, - - "protrinket3": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PROTRINKET3", - "f_cpu": "12000000L", - "mcu": "atmega328p", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Adafruit Pro Trinket 3V/12MHz (USB)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 28672, - "protocol": "usbtiny" - }, - "url": "http://www.adafruit.com/products/2010", - "vendor": "Adafruit" - }, - - "protrinket5": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PROTRINKET5", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Adafruit Pro Trinket 5V/16MHz (USB)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 28672, - "protocol": "usbtiny" - }, - "url": "http://www.adafruit.com/products/2000", - "vendor": "Adafruit" - }, - "protrinket3ftdi": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PROTRINKET3FTDI", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Adafruit Pro Trinket 3V/12MHz (FTDI)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 28672, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.adafruit.com/products/2010", - "vendor": "Adafruit" - }, - "protrinket5ftdi": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PROTRINKET5FTDI", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Adafruit Pro Trinket 5V/16MHz (USB)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 28672, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.adafruit.com/products/2000", - "vendor": "Adafruit" - }, - "adafruit_feather_m0_usb": { - "build": { - "core": "arduino_zero", - "extra_flags": "-DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", - "f_cpu": "48000000L", - "mcu": "samd21g18a", - "cpu": "cortex-m0plus", - "usb_product": "Adafruit Feather M0", - "variant": "arduino_zero", - "ldscript": "flash_with_bootloader.ld", - "hwids": [ - ["0x239A", "0x800B"], - ["0x239A", "0x000B"] - ] - }, - "frameworks": ["arduino"], - "name": "Adafruit Feather M0", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "sam-ba", - "require_upload_port" : true, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.adafruit.com/product/2772", - "vendor": "Adafruit" - } -} diff --git a/platformio/boards/arduino.json b/platformio/boards/arduino.json deleted file mode 100644 index 99ab8a54..00000000 --- a/platformio/boards/arduino.json +++ /dev/null @@ -1,1093 +0,0 @@ -{ - "LilyPadUSB": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_LILYPAD_USB", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "usb_product": "LilyPad USB", - "variant": "leonardo", - "hwids": [ - ["0x1B4F", "0x9207"], - ["0x1B4F", "0x9208"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino LilyPad USB", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardLilyPadUSB", - "vendor": "Arduino" - }, - "atmegangatmega168": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_NG", - "f_cpu": "16000000L", - "mcu": "atmega168", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "Arduino NG or older ATmega168", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://arduino.cc/en/main/boards", - "vendor": "Arduino" - }, - "atmegangatmega8": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_NG", - "f_cpu": "16000000L", - "mcu": "atmega8", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "Arduino NG or older ATmega8", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 7168, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://arduino.cc/en/main/boards", - "vendor": "Arduino" - }, - "btatmega168": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_BT", - "f_cpu": "16000000L", - "mcu": "atmega168", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Arduino BT ATmega168", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://arduino.cc/en/main/boards", - "vendor": "Arduino" - }, - "btatmega328": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_BT", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Arduino BT ATmega328", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2048, - "maximum_size": 28672, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://arduino.cc/en/main/boards", - "vendor": "Arduino" - }, - "diecimilaatmega168": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_DUEMILANOVE", - "f_cpu": "16000000L", - "mcu": "atmega168", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "Arduino Duemilanove or Diecimila ATmega168", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardDiecimila", - "vendor": "Arduino" - }, - "diecimilaatmega328": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_DUEMILANOVE", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "Arduino Duemilanove or Diecimila ATmega328", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 30720, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardDiecimila", - "vendor": "Arduino" - }, - "esplora": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ESPLORA", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Arduino Esplora", - "variant": "leonardo", - "hwids": [ - ["0x2341", "0x003C"], - ["0x2341", "0x803C"], - ["0x2A03", "0x003C"], - ["0x2A03", "0x803C"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Esplora", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-esplora", - "vendor": "Arduino" - }, - "ethernet": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ETHERNET", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "ethernet" - }, - "frameworks": ["arduino"], - "name": "Arduino Ethernet", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-ethernet", - "vendor": "Arduino" - }, - "fio": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_FIO", - "f_cpu": "8000000L", - "mcu": "atmega328p", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Arduino Fio", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 30720, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardFio", - "vendor": "Arduino" - }, - "leonardo": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_LEONARDO", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Arduino Leonardo", - "variant": "leonardo", - "hwids": [ - ["0x2341", "0x0036"], - ["0x2341", "0x8036"], - ["0x2A03", "0x0036"], - ["0x2A03", "0x8036"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Leonardo", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-leonardo", - "vendor": "Arduino" - }, - "leonardoeth": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_LEONARDO", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Arduino Leonardo ETH", - "variant": "leonardo", - "hwids": [ - ["0x2A03", "0x8040"], - ["0x2A03", "0x0040"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Leonardo ETH", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-leonardo-eth", - "vendor": "Arduino" - }, - "lilypadatmega168": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_LILYPAD", - "f_cpu": "8000000L", - "mcu": "atmega168", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "Arduino LilyPad ATmega168", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardLilyPad", - "vendor": "Arduino" - }, - "lilypadatmega328": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_LILYPAD", - "f_cpu": "8000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "Arduino LilyPad ATmega328", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 30720, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardLilyPad", - "vendor": "Arduino" - }, - "megaADK": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ADK", - "f_cpu": "16000000L", - "mcu": "atmega2560", - "variant": "mega" - }, - "frameworks": ["arduino"], - "name": "Arduino Mega ADK", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 253952, - "protocol": "wiring", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-mega-adk", - "vendor": "Arduino" - }, - "megaatmega1280": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_MEGA", - "f_cpu": "16000000L", - "mcu": "atmega1280", - "variant": "mega" - }, - "frameworks": ["arduino"], - "name": "Arduino Mega or Mega 2560 ATmega1280", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 126976, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-mega-2560", - "vendor": "Arduino" - }, - "megaatmega2560": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_MEGA2560", - "f_cpu": "16000000L", - "mcu": "atmega2560", - "variant": "mega" - }, - "frameworks": ["arduino", "simba"], - "name": "Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 253952, - "protocol": "wiring", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-mega-2560", - "vendor": "Arduino" - }, - "micro": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_MICRO", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Arduino Micro", - "variant": "micro", - "hwids": [ - ["0x2341", "0x0037"], - ["0x2341", "0x8037"], - ["0x2A03", "0x0037"], - ["0x2A03", "0x8037"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Micro", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-micro", - "vendor": "Arduino" - }, - "miniatmega168": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_MINI", - "f_cpu": "16000000L", - "mcu": "atmega168", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Arduino Mini ATmega168", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardMini", - "vendor": "Arduino" - }, - "miniatmega328": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_MINI", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Arduino Mini ATmega328", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 28672, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardMini", - "vendor": "Arduino" - }, - "nanoatmega168": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_NANO", - "f_cpu": "16000000L", - "mcu": "atmega168", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Arduino Nano ATmega168", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-nano", - "vendor": "Arduino" - }, - "nanoatmega328": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_NANO", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino", "simba"], - "name": "Arduino Nano ATmega328", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 30720, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-nano", - "vendor": "Arduino" - }, - "pro16MHzatmega168": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PRO", - "f_cpu": "16000000L", - "mcu": "atmega168", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Arduino Pro or Pro Mini ATmega168 (5V, 16 MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardProMini", - "vendor": "Arduino" - }, - "pro16MHzatmega328": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PRO", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Arduino Pro or Pro Mini ATmega328 (5V, 16 MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 30720, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardProMini", - "vendor": "Arduino" - }, - "pro8MHzatmega168": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PRO", - "f_cpu": "8000000L", - "mcu": "atmega168", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Arduino Pro or Pro Mini ATmega168 (3.3V, 8 MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 14336, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardProMini", - "vendor": "Arduino" - }, - "pro8MHzatmega328": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PRO", - "f_cpu": "8000000L", - "mcu": "atmega328p", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "Arduino Pro or Pro Mini ATmega328 (3.3V, 8 MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 30720, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "http://arduino.cc/en/Main/ArduinoBoardProMini", - "vendor": "Arduino" - }, - "robotControl": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ROBOT_CONTROL", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Robot Control", - "variant": "robot_control", - "hwids": [ - ["0x2341", "0x0038"], - ["0x2341", "0x8038"], - ["0x2A03", "0x0038"], - ["0x2A03", "0x8038"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Robot Control", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-robot", - "vendor": "Arduino" - }, - "robotMotor": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ROBOT_MOTOR", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Robot Motor", - "variant": "robot_motor", - "hwids": [ - ["0x2341", "0x0039"], - ["0x2341", "0x8039"], - ["0x2A03", "0x0039"], - ["0x2A03", "0x8039"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Robot Motor", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-robot", - "vendor": "Arduino" - }, - "uno": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "standard", - "hwids": [ - ["0x2341", "0x0043"], - ["0x2341", "0x0001"], - ["0x2A03", "0x0043"] - ] - }, - "frameworks": ["arduino", "simba"], - "name": "Arduino Uno", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-uno", - "vendor": "Arduino" - }, - "yun": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_YUN", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Arduino Yun", - "variant": "yun", - "hwids": [ - ["0x2341", "0x0041"], - ["0x2341", "0x8041"], - ["0x2A03", "0x0041"], - ["0x2A03", "0x8041"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Yun", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "via_ssh": true, - "wait_for_upload_port": true - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-yun", - "vendor": "Arduino" - }, - "yunmini": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_YUN", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Arduino Yun Mini", - "variant": "yun", - "hwids": [ - ["0x2A03", "0x8050"], - ["0x2A03", "0x0050"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Yun Mini", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "via_ssh": true, - "wait_for_upload_port": true - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-yun-mini", - "vendor": "Arduino" - }, - "chiwawa": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_YUN", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Arduino Industrial 101", - "variant": "yun", - "hwids": [ - ["0x2A03", "0x8056"], - ["0x2A03", "0x0056"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Industrial 101", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "via_ssh": true, - "wait_for_upload_port": true - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-industrial-101", - "vendor": "Arduino" - }, - "one": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_YUN", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Linino One", - "variant": "yun", - "hwids": [ - ["0x2A03", "0x8001"], - ["0x2A03", "0x0001"] - ] - }, - "frameworks": ["arduino"], - "name": "Linino One", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "via_ssh": true, - "wait_for_upload_port": true - }, - "url": "http://www.linino.org/portfolio/linino-one/", - "vendor": "Linino" - }, - "due": { - "build": { - "core": "arduino", - "extra_flags": "-D__SAM3X8E__ -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM", - "f_cpu": "84000000L", - "mcu": "sam3x8e", - "cpu": "cortex-m3", - "usb_product": "Arduino Due", - "variant": "arduino_due_x", - "ldscript": "sam3x8e.ld", - "hwids": [ - ["0x2341", "0x003D"], - ["0x2A03", "0x003D"] - ] - }, - "frameworks": ["arduino", "simba"], - "name": "Arduino Due (Programming Port)", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 524288, - "protocol": "sam-ba", - "require_upload_port" : true, - "use_1200bps_touch": true, - "wait_for_upload_port": false - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-due", - "vendor": "Arduino" - }, - "dueUSB": { - "build": { - "core": "arduino", - "extra_flags": "-D__SAM3X8E__ -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM", - "f_cpu": "84000000L", - "mcu": "sam3x8e", - "cpu": "cortex-m3", - "usb_product": "Arduino Due", - "variant": "arduino_due_x", - "ldscript": "sam3x8e.ld", - "hwids": [ - ["0x2341", "0x003E"], - ["0x2A03", "0x003E"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Due (USB Native Port)", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 524288, - "protocol": "sam-ba", - "require_upload_port" : true, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-due", - "vendor": "Arduino" - }, - "zero": { - "build": { - "core": "arduino_zero", - "extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", - "f_cpu": "48000000L", - "mcu": "samd21g18a", - "cpu": "cortex-m0plus", - "usb_product": "Arduino Zero", - "variant": "arduino_zero", - "ldscript": "flash_with_bootloader.ld", - "hwids": [ - ["0x2341", "0x804D"], - ["0x03EB", "0x2157"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Zero (Programming Port)", - "platform": "atmelsam", - "debug": { - "openocdcfg": "arduino_zero.cfg" - }, - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "openocd", - "require_upload_port" : false, - "use_1200bps_touch": false, - "wait_for_upload_port": false, - "section_start": "0x2000" - }, - "url": "https://www.arduino.cc/en/Main/ArduinoBoardZero", - "vendor": "Arduino" - }, - "zeroUSB": { - "build": { - "core": "arduino_zero", - "extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", - "f_cpu": "48000000L", - "mcu": "samd21g18a", - "cpu": "cortex-m0plus", - "usb_product": "Arduino Zero", - "variant": "arduino_zero", - "ldscript": "flash_with_bootloader.ld", - "hwids": [ - ["0x2341", "0x804D"], - ["0x2341", "0x004D"], - ["0x2341", "0x824D"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Zero (USB Native Port)", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "sam-ba", - "require_upload_port" : true, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.arduino.cc/en/Main/ArduinoBoardZero", - "vendor": "Arduino" - }, - "mkr1000USB": { - "build": { - "core": "arduino_zero", - "extra_flags": "-DARDUINO_SAMD_MKR1000 -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", - "f_cpu": "48000000L", - "mcu": "samd21g18a", - "cpu": "cortex-m0plus", - "usb_product": "Arduino MKR1000", - "variant": "mkr1000", - "ldscript": "flash_with_bootloader.ld", - "hwids": [ - ["0x2341", "0x804E"], - ["0x2341", "0x004E"], - ["0x2341", "0x824E"], - ["0x2341", "0x024E"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino MKR1000", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "sam-ba", - "require_upload_port" : true, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.arduino.cc/en/Main/ArduinoMKR1000", - "vendor": "Arduino" - }, - "mzeropro": { - "build": { - "core": "arduino_zero_org", - "extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", - "f_cpu": "48000000L", - "mcu": "samd21g18a", - "cpu": "cortex-m0plus", - "usb_product": "Arduino M0 Pro", - "variant": "arduino_zero_org", - "ldscript": "samd21g18a_bootloader_org.ld", - "hwids": [ - ["0x2A03", "0x804F"], - ["0x03EB", "0x2111"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino M0 Pro (Programming Port)", - "platform": "atmelsam", - "debug": { - "openocdcfg": "arduino_zero_org.cfg" - }, - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "openocd", - "require_upload_port" : false, - "use_1200bps_touch": false, - "wait_for_upload_port": false, - "section_start": "0x4000" - }, - "url": "http://www.arduino.org/products/boards/arduino-m0-pro", - "vendor": "Arduino" - }, - "mzeroproUSB": { - "build": { - "core": "arduino_zero_org", - "extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", - "f_cpu": "48000000L", - "mcu": "samd21g18a", - "cpu": "cortex-m0plus", - "usb_product": "Arduino M0 Pro", - "variant": "arduino_zero_org", - "ldscript": "samd21g18a_bootloader_org.ld", - "hwids": [ - ["0x2A03", "0x804F"], - ["0x2A03", "0x004F"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino M0 Pro (Native USB Port)", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true, - "section_start": "0x4000" - }, - "url": "http://www.arduino.org/products/boards/arduino-m0-pro", - "vendor": "Arduino" - }, - "mzeroUSB": { - "build": { - "core": "arduino_zero_org", - "extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", - "f_cpu": "48000000L", - "mcu": "samd21g18a", - "cpu": "cortex-m0plus", - "usb_product": "Arduino M0", - "variant": "arduino_zero_org", - "ldscript": "samd21g18a_bootloader_org.ld", - "hwids": [ - ["0x2A03", "0x804E"], - ["0x2A03", "0x004E"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino M0", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true, - "section_start": "0x4000" - }, - "url": "http://www.arduino.org/products/boards/arduino-m0", - "vendor": "Arduino" - }, - "tian": { - "build": { - "core": "arduino_zero_org", - "extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", - "f_cpu": "48000000L", - "mcu": "samd21g18a", - "cpu": "cortex-m0plus", - "usb_product": "Arduino Tian", - "variant": "arduino_zero_org", - "ldscript": "samd21g18a_bootloader_org.ld", - "hwids": [ - ["0x2A03", "0x8052"], - ["0x10C4", "0xEA70"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino Tian", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true, - "section_start": "0x4000" - }, - "url": "http://www.arduino.org/products/boards/arduino-tian", - "vendor": "Arduino" - } -} diff --git a/platformio/boards/atmelsam.json b/platformio/boards/atmelsam.json deleted file mode 100644 index fc956996..00000000 --- a/platformio/boards/atmelsam.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "samr21_xpro": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0plus", - "mcu": "atsamr21g18a" - }, - "frameworks": ["mbed"], - "name": "Atmel ATSAMR21-XPRO", - "platform": "atmelsam", - "debug": { - "openocdcfg": "atmel_samr21_xplained_pro.cfg" - }, - "upload": { - "protocol": "openocd", - "maximum_ram_size": 32768, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/SAMR21-XPRO/", - "vendor": "Atmel" - }, - "saml21_xpro_b": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0plus", - "mcu": "atsaml21j18b" - }, - "frameworks": ["mbed"], - "name": "Atmel SAML21-XPRO-B", - "platform": "atmelsam", - "debug": { - "openocdcfg": "atmel_saml21_xplained_pro.cfg" - }, - "upload": { - "protocol": "openocd", - "maximum_ram_size": 32768, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/SAML21-XPRO/", - "vendor": "Atmel" - }, - "samd21_xpro": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0plus", - "mcu": "atsamd21j18a" - }, - "frameworks": ["mbed"], - "name": "Atmel SAMD21-XPRO", - "platform": "atmelsam", - "debug": { - "openocdcfg": "atmel_samd21_xplained_pro.cfg" - }, - "upload": { - "protocol": "openocd", - "maximum_ram_size": 32768, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/SAMD21-XPRO/", - "vendor": "Atmel" - } -} diff --git a/platformio/boards/digistump.json b/platformio/boards/digistump.json deleted file mode 100644 index 87e4b4b5..00000000 --- a/platformio/boards/digistump.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "digispark-tiny": { - "build": { - "core": "digispark_tiny", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_DIGISPARK", - "f_cpu": "16000000L", - "mcu": "attiny85", - "variant": "digispark_tiny" - }, - "frameworks": ["arduino"], - "name": "Digistump Digispark (Default - 16 MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 512, - "maximum_size": 6012, - "protocol": "digispark" - }, - "url": "http://digistump.com/products/1", - "vendor": "Digistump" - }, - "digispark-pro": { - "build": { - "core": "digispark_pro", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_DIGISPARKPRO", - "f_cpu": "16000000L", - "mcu": "attiny167", - "variant": "digispark_pro" - }, - "frameworks": ["arduino"], - "name": "Digistump Digispark Pro (Default 16 MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 512, - "maximum_size": 14844, - "protocol": "digispark" - }, - "url": "http://digistump.com/products/109", - "vendor": "Digistump" - }, - "digispark-pro32": { - "build": { - "core": "digispark_pro", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_DIGISPARKPRO", - "f_cpu": "16000000L", - "mcu": "attiny167", - "variant": "digispark_pro32" - }, - "frameworks": ["arduino"], - "name": "Digistump Digispark Pro (16 MHz) (32 byte buffer)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 512, - "maximum_size": 14844, - "protocol": "digispark" - }, - "url": "http://digistump.com/products/109", - "vendor": "Digistump" - }, - "digispark-pro64": { - "build": { - "core": "digispark_pro", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_DIGISPARKPRO", - "f_cpu": "16000000L", - "mcu": "attiny167", - "variant": "digispark_pro64" - }, - "frameworks": ["arduino"], - "name": "Digistump Digispark Pro (16 MHz) (64 byte buffer)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 512, - "maximum_size": 14844, - "protocol": "digispark" - }, - "url": "http://digistump.com/products/109", - "vendor": "Digistump" - }, - "digix": { - "build": { - "core": "digispark_digix", - "extra_flags": "-w -D__SAM3X8E__ -DARDUINO_SAM_DIGIX -DARDUINO_ARCH_SAM", - "f_cpu": "84000000L", - "mcu": "at91sam3x8e", - "cpu": "cortex-m3", - "ldscript": "sam3x8e.ld", - "usb_product": "Digistump DigiX", - "variant": "digispark_digix", - "hwids": [ - ["0x16D0", "0x078A"] - ] - }, - "frameworks": ["arduino"], - "name": "Digistump DigiX", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 28672, - "maximum_size": 524288, - "protocol": "sam-ba", - "require_upload_port" : true, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://digistump.com/products/50", - "vendor": "Digistump" - } -} \ No newline at end of file diff --git a/platformio/boards/engduino.json b/platformio/boards/engduino.json deleted file mode 100644 index 9d76376e..00000000 --- a/platformio/boards/engduino.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "engduinov1": { - "build": { - "board": "AVR_ENGDUINOV1", - "core": "arduino", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "usb_product": "EngduinoV1", - "variant": "engduinov1", - "hwids": [ - ["0x1B4F", "0x9208"] - ] - }, - "frameworks": ["arduino"], - "name": "Engduino 1", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.engduino.org", - "vendor": "Engduino" - }, - "engduinov2": { - "build": { - "board": "AVR_ENGDUINOV2", - "core": "arduino", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "usb_product": "EngduinoV2", - "variant": "engduinov2", - "hwids": [ - ["0x1B4F", "0x9208"] - ] - }, - "frameworks": ["arduino"], - "name": "Engduino 2", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.engduino.org", - "vendor": "Engduino" - }, - "engduinov3": { - "build": { - "board": "AVR_ENGDUINOV3", - "core": "arduino", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "usb_product": "EngduinoV3", - "variant": "engduinov3", - "hwids": [ - ["0x1B4F", "0x9208"] - ] - }, - "frameworks": ["arduino"], - "name": "Engduino 3", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.engduino.org", - "vendor": "Engduino" - } -} \ No newline at end of file diff --git a/platformio/boards/espressif.json b/platformio/boards/espressif.json deleted file mode 100644 index 3c9d21be..00000000 --- a/platformio/boards/espressif.json +++ /dev/null @@ -1,582 +0,0 @@ -{ - "esp01": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP01", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.512k64.ld", - "mcu": "esp8266", - "variant": "generic" - }, - "frameworks": ["arduino", "simba"], - "name": "Espressif Generic ESP8266 ESP-01 512k", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 524288, - "resetmethod": "ck", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family", - "vendor": "Espressif" - }, - - "esp01_1m": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP01", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.1m256.ld", - "mcu": "esp8266", - "variant": "generic" - }, - "frameworks": ["arduino", "simba"], - "name": "Espressif Generic ESP8266 ESP-01 1M", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 1048576, - "resetmethod": "ck", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family", - "vendor": "Espressif" - }, - - "esp07": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP07", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "nodemcu" - }, - "frameworks": ["arduino"], - "name": "Espressif Generic ESP8266 ESP-07", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family#esp-07", - "vendor": "Espressif" - }, - - "esp12e": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "dio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "nodemcu" - }, - "frameworks": ["arduino", "simba"], - "name": "Espressif ESP8266 ESP-12E", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family", - "vendor": "Espressif" - }, - - "espduino": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP13", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "dio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "ESPDuino" - }, - "frameworks": ["arduino"], - "name": "ESPDuino (ESP-13 Module)", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "ck", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.tindie.com/products/doit/espduinowifi-uno-r3/", - "vendor": "Doit" - }, - - "nodemcu": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "nodemcu", - "hwids": [ - ["0x10C4", "0xEA60"] - ] - }, - "frameworks": ["arduino", "simba"], - "name": "NodeMCU 0.9 (ESP-12 Module)", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.nodemcu.com/", - "vendor": "NodeMCU" - }, - - "nodemcuv2": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "dio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "nodemcu", - "hwids": [ - ["0x10C4", "0xEA60"] - ] - }, - "frameworks": ["arduino", "simba"], - "name": "NodeMCU 1.0 (ESP-12E Module)", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.nodemcu.com/", - "vendor": "NodeMCU" - }, - - "huzzah": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "adafruit" - }, - "frameworks": ["arduino", "simba"], - "name": "Adafruit HUZZAH ESP8266", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.adafruit.com/products/2471", - "vendor": "Adafruit" - }, - - "espresso_lite_v1": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESPRESSO_LITE_V1", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "dio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "espresso_lite_v1" - }, - "frameworks": ["arduino"], - "name": "ESPresso Lite 1.0", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.espert.co", - "vendor": "ESPert" - }, - - "espresso_lite_v2": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESPRESSO_LITE_V2", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "dio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "espresso_lite_v2" - }, - "frameworks": ["arduino"], - "name": "ESPresso Lite 2.0", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "ck", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.espert.co", - "vendor": "ESPert" - }, - - "modwifi": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_MOD_WIFI_ESP8266", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.2m.ld", - "mcu": "esp8266", - "variant": "generic" - }, - "frameworks": ["arduino"], - "name": "Olimex MOD-WIFI-ESP8266(-DEV)", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 2097152, - "resetmethod": "ck", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.olimex.com/Products/IoT/MOD-WIFI-ESP8266-DEV/open-source-hardware", - "vendor": "Olimex" - }, - - "thing": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_THING", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.512k64.ld", - "mcu": "esp8266", - "variant": "thing" - }, - "frameworks": ["arduino"], - "name": "SparkFun ESP8266 Thing", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 524288, - "resetmethod": "ck", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.sparkfun.com/products/13231", - "vendor": "SparkFun" - }, - - "thingdev": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_THING", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "dio", - "ldscript": "esp8266.flash.512k64.ld", - "mcu": "esp8266", - "variant": "thing" - }, - "frameworks": ["arduino"], - "name": "SparkFun ESP8266 Thing Dev", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 524288, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.sparkfun.com/products/13231", - "vendor": "SparkFun" - }, - - "esp210": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP210", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "generic" - }, - "frameworks": ["arduino"], - "name": "SweetPea ESP-210", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "ck", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://wiki.sweetpeas.se/index.php?title=ESP-210", - "vendor": "SweetPea" - }, - - "d1": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_WEMOS_D1MINI", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "dio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "d1" - }, - "frameworks": ["arduino"], - "name": "WeMos D1(Retired)", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.wemos.cc/wiki/doku.php?id=en:d1", - "vendor": "WeMos" - }, - - "d1_mini": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_WEMOS_D1MINI", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "dio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "d1_mini" - }, - "frameworks": ["arduino"], - "name": "WeMos D1 R2 & mini", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.wemos.cc/wiki/doku.php?id=en:d1_mini", - "vendor": "WeMos" - }, - - "espino": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "espino" - }, - "frameworks": ["arduino"], - "name": "ESPino", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "ck", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.espino.io", - "vendor": "ESPino" - }, - - "espinotee": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP13", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "espinotee" - }, - "frameworks": ["arduino"], - "name": "ThaiEasyElec ESPino", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 4194304, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.thaieasyelec.com/products/wireless-modules/wifi-modules/espino-wifi-development-board-detail.html", - "vendor": "ThaiEasyElec" - }, - - "esp_wroom_02": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP_WROOM_02", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "nodemcu" - }, - "frameworks": ["arduino"], - "name": "ESP-WROOM-02", - "platform": "espressif", - "upload": { - "maximum_ram_size": 51200, - "maximum_size": 4194304, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family", - "vendor": "Espressif" - }, - - "esp8285": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_ESP01", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "dout", - "ldscript": "esp8266.flash.1m256.ld", - "mcu": "esp8266", - "variant": "generic" - }, - "frameworks": ["arduino"], - "name": "Generic ESP8285 Module", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 434160, - "resetmethod": "ck", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family", - "vendor": "Espressif" - }, - - "phoenix_v1": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_PHOENIX_V1", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "dio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "phoenix_v1" - }, - "frameworks": ["arduino"], - "name": "Phoenix 1.0", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 1044464, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family", - "vendor": "Espressif" - }, - - "phoenix_v2": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_PHOENIX_V2", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "dio", - "ldscript": "esp8266.flash.4m1m.ld", - "mcu": "esp8266", - "variant": "phoenix_v2" - }, - "frameworks": ["arduino"], - "name": "Phoenix 2.0", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 1044464, - "resetmethod": "ck", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family", - "vendor": "Espressif" - }, - - "wifinfo": { - "build": { - "core": "esp8266", - "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DWIFINFO", - "f_cpu": "80000000L", - "f_flash": "40000000L", - "flash_mode": "qio", - "ldscript": "esp8266.flash.1m256.ld", - "mcu": "esp8266", - "variant": "wifinfo" - }, - "frameworks": ["arduino"], - "name": "WifInfo", - "platform": "espressif", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 434160, - "resetmethod": "nodemcu", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family", - "vendor": "Espressif" - } -} diff --git a/platformio/boards/freescalekinetis.json b/platformio/boards/freescalekinetis.json deleted file mode 100644 index 869a977a..00000000 --- a/platformio/boards/freescalekinetis.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "frdm_kl25z": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0plus", - "mcu": "mkl25z128vlk4" - }, - "frameworks": ["mbed"], - "name": "Freescale Kinetis FRDM-KL25Z", - "platform": "freescalekinetis", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 131072 - }, - "url": "https://developer.mbed.org/platforms/KL25Z/", - "vendor": "Freescale" - }, - "frdm_kl46z": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0plus", - "mcu": "mkl46z256vll4" - }, - "frameworks": ["mbed"], - "name": "Freescale Kinetis FRDM-KL46Z", - "platform": "freescalekinetis", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/FRDM-KL46Z/", - "vendor": "Freescale" - }, - "frdm_k64f": { - "build": { - "f_cpu": "120000000L", - "cpu": "cortex-m4", - "mcu": "mk64fn1m0vll12" - }, - "frameworks": ["mbed"], - "name": "Freescale Kinetis FRDM-K64F", - "platform": "freescalekinetis", - "upload": { - "maximum_ram_size": 262144, - "maximum_size": 1048576 - }, - "url": "https://developer.mbed.org/platforms/FRDM-K64F/", - "vendor": "Freescale" - }, - "frdm_kl05z": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0plus", - "mcu": "mkl05z32vfm4" - }, - "frameworks": ["mbed"], - "name": "Freescale Kinetis FRDM-KL05Z", - "platform": "freescalekinetis", - "upload": { - "maximum_ram_size": 4096, - "maximum_size": 32768 - }, - "url": "https://developer.mbed.org/platforms/FRDM-KL05Z/", - "vendor": "Freescale" - }, - "frdm_k20d50m": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m4", - "mcu": "mk20dx128vlh5" - }, - "frameworks": ["mbed"], - "name": "Freescale Kinetis FRDM-K20D50M", - "platform": "freescalekinetis", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 131072 - }, - "url": "https://developer.mbed.org/platforms/FRDM-K20D50M/", - "vendor": "Freescale" - }, - "frdm_k22f": { - "build": { - "f_cpu": "120000000L", - "cpu": "cortex-m4", - "mcu": "mk22fn512vlh12" - }, - "frameworks": ["mbed"], - "name": "Freescale Kinetis FRDM-K22F", - "platform": "freescalekinetis", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/FRDM-K22F/", - "vendor": "Freescale" - }, - "IBMEthernetKit": { - "build": { - "f_cpu": "120000000L", - "cpu": "cortex-m4", - "mcu": "mk64fn1m0vll12" - }, - "frameworks": ["mbed"], - "name": "Ethernet IoT Starter Kit", - "platform": "freescalekinetis", - "upload": { - "maximum_ram_size": 262144, - "maximum_size": 1048576 - }, - "url": "http://developer.mbed.org/platforms/IBMEthernetKit/", - "vendor": "Freescale" - } -} \ No newline at end of file diff --git a/platformio/boards/intel.json b/platformio/boards/intel.json deleted file mode 100644 index 34950dc8..00000000 --- a/platformio/boards/intel.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "genuino101": { - "build": { - "core": "arc32", - "extra_flags": "-DARDUINO_ARCH_ARC32 -D__ARDUINO_ARC__", - "f_cpu": "32000000L", - "ldscript": "flash.ld", - "mcu": "ARCv2EM", - "cpu": "quarkse_em", - "usb_product": "Genuino 101", - "variant": "arduino_101", - "hwids": [ - ["0x8087", "0x0AB6"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduino/Genuino 101", - "platform": "intel_arc32", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 155648, - "protocol": "script", - "require_upload_port" : true, - "use_1200bps_touch": true - }, - "url": "https://www.arduino.cc/en/Main/ArduinoBoard101", - "vendor": "Intel" - } -} - diff --git a/platformio/boards/lattice.json b/platformio/boards/lattice.json deleted file mode 100755 index 02e699f9..00000000 --- a/platformio/boards/lattice.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "icestick": { - "build": { - "core": "icestick", - "f_cpu": "12000000L", - "cpu": "fpga", - "mcu": "ice40hx1k", - "variant": "1k", - "hwids": [ - ["0x0403", "0x6010"] - ] - }, - "frameworks": ["icestorm"], - "name": "Lattice iCEstick FPGA Evaluation Kit", - "platform": "lattice_ice40", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 32768 - }, - "url": "http://www.latticesemi.com/icestick", - "vendor": "Lattice" - }, - - "icezum": { - "build": { - "core": "icezum", - "f_cpu": "12000000L", - "cpu": "fpga", - "mcu": "ice40hx1k", - "variant": "1k", - "hwids": [ - ["0x0403", "0x6010"] - ] - }, - "frameworks": ["icestorm"], - "name": "BQ IceZUM Alhambra FPGA", - "platform": "lattice_ice40", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 32768 - }, - "url": "https://github.com/bqlabs/icezum/wiki", - "vendor": "BQ" - } -} diff --git a/platformio/boards/microchippic32.json b/platformio/boards/microchippic32.json deleted file mode 100644 index 0b569c03..00000000 --- a/platformio/boards/microchippic32.json +++ /dev/null @@ -1,576 +0,0 @@ -{ - "cerebot32mx4": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_CEREBOT_32MX4_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX460F512.ld", - "mcu": "32MX460F512L", - "variant": "Cerebot_32MX4" - }, - "frameworks": ["arduino"], - "name": "Digilent Cerebot 32MX4", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/cerebot-32mx4-limited-time-see-chipkit-pro-mx4/", - "vendor": "Digilent" - }, - - "cerebot32mx7": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_CEREBOT_32MX7_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX795F512.ld", - "mcu": "32MX795F512L", - "variant": "Cerebot_32MX7" - }, - "frameworks": ["arduino"], - "name": "Digilent Cerebot 32MX7", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=TDGL004", - "vendor": "Digilent" - }, - - "chipkit_mx3": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_CEREBOT_MX3CK_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX320F128.ld", - "mcu": "32MX320F128H", - "variant": "Cerebot_MX3cK" - }, - "frameworks": ["arduino"], - "name": "Digilent chipKIT MX3", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 126976, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/chipkit-mx3-microcontroller-board-with-pmod-headers/", - "vendor": "Digilent" - }, - - "chipkit_pro_mx4": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_CEREBOT_MX4CK_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX460F512.ld", - "mcu": "32MX460F512L", - "variant": "Cerebot_MX4cK" - }, - "frameworks": ["arduino"], - "name": "Digilent chipKIT Pro MX4", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/chipkit-pro-mx4-embedded-systems-trainer-board/", - "vendor": "Digilent" - }, - - "chipkit_pro_mx7": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_CEREBOT_MX7CK_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX795F512.ld", - "mcu": "32MX795F512L", - "variant": "Cerebot_MX7cK" - }, - "frameworks": ["arduino"], - "name": "Digilent chipKIT Pro MX7", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/chipkit-pro-mx7-advanced-peripherals-embedded-systems-trainer-board/", - "vendor": "Digilent" - }, - - "chipkit_pi": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_CHIPKIT_PI_", - "f_cpu": "40000000L", - "ldscript": "chipKIT-application-32MX250F128.ld", - "mcu": "32MX250F128B", - "variant": "ChipKIT_Pi" - }, - "frameworks": ["arduino"], - "name": "Element14 chipKIT Pi", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 122880, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.element14.com/community/community/knode/dev_platforms_kits/element14_dev_kits/microchip-chipkit/chipkit_pi", - "vendor": "element14" - }, - - "chipkit_cmod": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_CMOD_", - "f_cpu": "40000000L", - "ldscript": "chipKIT-application-32MX150F128.ld", - "mcu": "32MX150F128D", - "variant": "Cmod" - }, - "frameworks": ["arduino"], - "name": "Digilent chipKIT Cmod", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 126976, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/chipkit-cmod-breadboardable-mz-microcontroller-board/", - "vendor": "Digilent" - }, - - "cui32stem": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_CUI32_ -D_USE_USB_FOR_SERIAL_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX795F512.ld", - "mcu": "32MX795F512H", - "variant": "CUI32stem" - }, - "frameworks": ["arduino"], - "name": "SeeedStudio CUI32stem", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.seeedstudio.com/wiki/CUI32Stem", - "vendor": "SeeedStudio" - }, - - "ubw32_mx460": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_UBW32_MX460_ -D_USE_USB_FOR_SERIAL_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX460F512.ld", - "mcu": "32MX460F512L", - "variant": "Default_100" - }, - "frameworks": ["arduino"], - "name": "UBW32 MX460", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.schmalzhaus.com/UBW32/", - "vendor": "UBW32" - }, - - "ubw32_mx795": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_UBW32_MX795_ -D_USE_USB_FOR_SERIAL_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX795F512.ld", - "mcu": "32MX795F512L", - "variant": "Default_100" - }, - "frameworks": ["arduino"], - "name": "UBW32 MX795", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.schmalzhaus.com/UBW32/", - "vendor": "UBW32" - }, - - "usbono_pic32": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_PONTECH_UAV100_ -D_USE_USB_FOR_SERIAL_ -Danything=1", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX440F512.ld", - "mcu": "32MX440F512H", - "variant": "PONTECH_UAV100" - }, - "frameworks": ["arduino"], - "name": "PONTECH UAV100", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.pontech.com/productdisplay/uav100", - "vendor": "PONTECH" - }, - - "chipkit_dp32": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_DP32_ -D_USE_USB_FOR_SERIAL_", - "f_cpu": "40000000L", - "ldscript": "chipKIT-application-32MX250F128.ld", - "mcu": "32MX250F128B", - "variant": "DP32" - }, - "frameworks": ["arduino"], - "name": "Digilent chipKIT DP32", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 122880, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/chipkit-dp32-dip-package-prototyping-microcontroller-board/", - "vendor": "Digilent" - }, - - "fubarino_mini": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_FUBARINO_MINI_ -D_USE_USB_FOR_SERIAL_", - "f_cpu": "48000000L", - "ldscript": "chipKIT-application-32MX250F128.ld", - "mcu": "32MX250F128D", - "variant": "Fubarino_Mini" - }, - "frameworks": ["arduino"], - "name": "Fubarino Mini", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 122880, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://fubarino.org/mini/", - "vendor": "Fubarino" - }, - - "fubarino_sd": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_FUBARINO_SD_ -D_USE_USB_FOR_SERIAL_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX795F512.ld", - "mcu": "32MX795F512H", - "variant": "Fubarino_SD" - }, - "frameworks": ["arduino"], - "name": "Fubarino SD (1.5)", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://fubarino.org/sd/index.html", - "vendor": "Fubarino" - }, - - "mega_pic32": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_MEGA_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX795F512.ld", - "mcu": "32MX795F512L", - "variant": "Max32" - }, - "frameworks": ["arduino"], - "name": "Digilent chipKIT MAX32", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/chipkit-max32-microcontroller-board-with-mega-r3-headers/", - "vendor": "Digilent" - }, - - "pinguino32": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_OLIMEX_PIC32_PINGUINO_ -D_USE_USB_FOR_SERIAL_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX440F256.ld", - "mcu": "32MX440F256H", - "variant": "Olimex_PIC32_Pinguino" - }, - "frameworks": ["arduino"], - "name": "Olimex PIC32-PINGUINO", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 258048, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.olimex.com/Products/Duino/PIC32/PIC32-PINGUINO/open-source-hardware", - "vendor": "Olimex" - }, - - "picadillo_35t": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_PICADILLO_35T_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX795F512.ld", - "mcu": "32MX795F512L", - "variant": "picadillo_35t" - }, - "frameworks": ["arduino"], - "name": "4DSystems PICadillo 35T", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://www.4dsystems.com.au/product/Picadillo_35T/", - "vendor": "4DSystems" - }, - - "quick240_usb": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_PONTECH_QUICK240_USB_ -D_USE_USB_FOR_SERIAL_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX795F512.ld", - "mcu": "32MX795F512L", - "variant": "quicK240" - }, - "frameworks": ["arduino"], - "name": "PONTECH quicK240", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://quick240.com/quicki/", - "vendor": "PONTECH" - }, - - "chipkit_uc32": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_UC32_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX340F512.ld", - "mcu": "32MX340F512H", - "variant": "uC32" - }, - "frameworks": ["arduino"], - "name": "Digilent chipKIT uC32", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/chipkit-uc32-basic-microcontroller-board-with-uno-r3-headers/", - "vendor": "Digilent" - }, - - "uno_pic32": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_UNO_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX320F128.ld", - "mcu": "32MX320F128H", - "variant": "Uno32" - }, - "frameworks": ["arduino"], - "name": "Digilent chipKIT UNO32", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 126976, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/chipkit-uno32-basic-microcontroller-board-retired-see-chipkit-uc32/", - "vendor": "Digilent" - }, - - "chipkit_wf32": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_WF32_", - "f_cpu": "80000000L", - "ldscript": "chipKIT-application-32MX695F512.ld", - "mcu": "32MX695F512L", - "variant": "WF32" - }, - "frameworks": ["arduino"], - "name": "Digilent chipKIT WF32", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 520192, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/chipkit-wf32-wifi-enabled-microntroller-board-with-uno-r3-headers/", - "vendor": "Digilent" - }, - - "chipkit_wifire": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_WIFIRE_", - "f_cpu": "200000000L", - "ldscript": "MZ-application-32MZ2048ECX.ld", - "mcu": "32MZ2048ECG100", - "variant": "WiFire" - }, - "frameworks": ["arduino"], - "name": "Digilent chipKIT WiFire", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 524288, - "maximum_size": 2080768, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/chipkit-wi-fire-wifi-enabled-mz-microcontroller-board/", - "vendor": "Digilent" - }, - - "openscope": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_OPENSCOPE_", - "f_cpu": "200000000L", - "ldscript": "OpenScope.ld", - "mcu": "32MZ2048EFG124", - "variant": "OpenScope" - }, - "frameworks": ["arduino"], - "name": "Digilent OpenScope", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 524288, - "maximum_size": 2080768, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://store.digilentinc.com/", - "vendor": "Digilent" - }, - - "openbci": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_DP32_ -D_USE_USB_FOR_SERIAL_", - "f_cpu": "40000000L", - "ldscript": "chipKIT-application-32MX250F128.ld", - "mcu": "32MX250F128B", - "variant": "OpenBCI" - }, - "frameworks": ["arduino"], - "name": "OpenBCI 32bit", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 122880, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://shop.openbci.com/", - "vendor": "OpenBCI" - }, - - "lenny": { - "build": { - "core": "pic32", - "extra_flags": "-D_BOARD_LENNY_ -D_USE_USB_FOR_SERIAL_", - "f_cpu": "40000000L", - "ldscript": "chipKIT-application-32MX270F256.ld", - "mcu": "32MX270F256D", - "variant": "Lenny" - }, - "frameworks": ["arduino"], - "name": "chipKIT Lenny", - "platform": "microchippic32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 122880, - "protocol": "stk500v2", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://chipkit.net/tag/lenny/", - "vendor": "chipKIT" - } -} diff --git a/platformio/boards/microduino.json b/platformio/boards/microduino.json deleted file mode 100644 index 1a0aa341..00000000 --- a/platformio/boards/microduino.json +++ /dev/null @@ -1,197 +0,0 @@ -{ - "1284p16m": { - "build": { - "board": "AVR_MICRODUINO_CORE_PLUS", - "core": "arduino", - "f_cpu": "16000000L", - "mcu": "atmega1284p", - "variant": "plus" - }, - "frameworks": ["arduino"], - "name": "Microduino Core+ (ATmega1284P@16M,5V)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 130048, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.microduino.cc/wiki/index.php?title=Microduino-Core%2B", - "vendor": "Microduino" - }, - "1284p8m": { - "build": { - "board": "AVR_MICRODUINO_CORE_PLUS", - "core": "arduino", - "f_cpu": "8000000L", - "mcu": "atmega1284p", - "variant": "plus" - }, - "frameworks": ["arduino"], - "name": "Microduino Core+ (ATmega1284P@8M,3.3V)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 130048, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "https://www.microduino.cc/wiki/index.php?title=Microduino-Core%2B", - "vendor": "Microduino" - }, - "168pa16m": { - "build": { - "board": "AVR_MICRODUINO_CORE", - "core": "arduino", - "f_cpu": "16000000L", - "mcu": "atmega168p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "Microduino Core (Atmega168PA@16M,5V)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 15872, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.microduino.cc/wiki/index.php?title=Microduino-Core", - "vendor": "Microduino" - }, - "168pa8m": { - "build": { - "board": "AVR_MICRODUINO_CORE", - "core": "arduino", - "f_cpu": "8000000L", - "mcu": "atmega168p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "Microduino Core (Atmega168PA@8M,3.3V)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 15872, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "https://www.microduino.cc/wiki/index.php?title=Microduino-Core", - "vendor": "Microduino" - }, - "328p16m": { - "build": { - "board": "AVR_MICRODUINO_CORE", - "core": "arduino", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "Microduino Core (Atmega328P@16M,5V)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.microduino.cc/wiki/index.php?title=Microduino-Core", - "vendor": "Microduino" - }, - "328p8m": { - "build": { - "board": "AVR_MICRODUINO_CORE", - "core": "arduino", - "f_cpu": "8000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "Microduino Core (Atmega328P@8M,3.3V)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "require_upload_port" : true, - "protocol": "arduino", - "speed": 57600 - }, - "url": "https://www.microduino.cc/wiki/index.php?title=Microduino-Core", - "vendor": "Microduino" - }, - "32u416m": { - "build": { - "board": "AVR_MICRODUINO_CORE_USB", - "core": "arduino", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "variant": "32u4", - "hwids": [ - ["0x2341", "0x8036"] - ] - }, - "frameworks": ["arduino"], - "name": "Microduino Core USB (ATmega32U4@16M,5V)", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.microduino.cc/wiki/index.php?title=Microduino-CoreUSB", - "vendor": "Microduino" - }, - "644pa16m": { - "build": { - "board": "AVR_MICRODUINO_CORE_PLUS", - "core": "arduino", - "f_cpu": "16000000L", - "mcu": "atmega644p", - "variant": "plus" - }, - "frameworks": ["arduino"], - "name": "Microduino Core+ (Atmega644PA@16M,5V)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 4096, - "maximum_size": 64512, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.microduino.cc/wiki/index.php?title=Microduino-Core%2B", - "vendor": "Microduino" - }, - "644pa8m": { - "build": { - "board": "AVR_MICRODUINO_CORE_PLUS", - "core": "arduino", - "f_cpu": "8000000L", - "mcu": "atmega644p", - "variant": "plus" - }, - "frameworks": ["arduino"], - "name": "Microduino Core+ (Atmega644PA@8M,3.3V)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 4096, - "maximum_size": 64512, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "https://www.microduino.cc/wiki/index.php?title=Microduino-Core%2B", - "vendor": "Microduino" - } -} \ No newline at end of file diff --git a/platformio/boards/mightycore.json b/platformio/boards/mightycore.json deleted file mode 100644 index 7ee7913f..00000000 --- a/platformio/boards/mightycore.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "mightycore1284": { - "build": { - "core": "MightyCore", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATmega1284", - "f_cpu": "16000000L", - "mcu": "atmega1284p", - "variant": "mightycore" - }, - "frameworks": ["arduino"], - "name": "MightyCore ATmega1284", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 130048, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.tindie.com/products/MCUdude/dip-40-arduino-compatible-development-board", - "vendor": "Mcudude" - }, - - "mightycore644": { - "build": { - "core": "MightyCore", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATmega644", - "f_cpu": "16000000L", - "mcu": "atmega644p", - "variant": "mightycore" - }, - "frameworks": ["arduino"], - "name": "MightyCore ATmega644", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 4096, - "maximum_size": 64512, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.tindie.com/products/MCUdude/dip-40-arduino-compatible-development-board", - "vendor": "Mcudude" - }, - - "mightycore324": { - "build": { - "core": "MightyCore", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATmega324", - "f_cpu": "16000000L", - "mcu": "atmega324p", - "variant": "mightycore" - }, - "frameworks": ["arduino"], - "name": "MightyCore ATmega324", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.tindie.com/products/MCUdude/dip-40-arduino-compatible-development-board", - "vendor": "Mcudude" - }, - - "mightycore164": { - "build": { - "core": "MightyCore", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATmega164", - "f_cpu": "16000000L", - "mcu": "atmega164p", - "variant": "mightycore" - }, - "frameworks": ["arduino"], - "name": "MightyCore ATmega164", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 15872, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.tindie.com/products/MCUdude/dip-40-arduino-compatible-development-board", - "vendor": "Mcudude" - }, - - "mightycore32": { - "build": { - "core": "MightyCore", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATmega32", - "f_cpu": "16000000L", - "mcu": "atmega32", - "variant": "mightycore" - }, - "frameworks": ["arduino"], - "name": "MightyCore ATmega32", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.tindie.com/products/MCUdude/dip-40-arduino-compatible-development-board", - "vendor": "Mcudude" - }, - - "mightycore16": { - "build": { - "core": "MightyCore", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATmega16", - "f_cpu": "16000000L", - "mcu": "atmega16", - "variant": "mightycore" - }, - "frameworks": ["arduino"], - "name": "MightyCore ATmega16", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 15872, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.tindie.com/products/MCUdude/dip-40-arduino-compatible-development-board", - "vendor": "Mcudude" - }, - - "mightycore8535": { - "build": { - "core": "MightyCore", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATmega8535", - "f_cpu": "16000000L", - "mcu": "atmega16", - "variant": "mightycore" - }, - "frameworks": ["arduino"], - "name": "MightyCore ATmega8535", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 512, - "maximum_size": 7680, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.tindie.com/products/MCUdude/dip-40-arduino-compatible-development-board", - "vendor": "Mcudude" - } -} diff --git a/platformio/boards/misc.json b/platformio/boards/misc.json deleted file mode 100644 index 0a9be48e..00000000 --- a/platformio/boards/misc.json +++ /dev/null @@ -1,846 +0,0 @@ -{ - "ardhat": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_ARDHAT", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "ubIQio Ardhat", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://ardhat.com", - "vendor": "ubIQio" - }, - - "raspduino": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_RASPDUINO", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "BitWizard Raspduino", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 30720, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "http://www.bitwizard.nl/wiki/index.php/Raspduino", - "vendor": "BitWizard" - }, - - "emonpi": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_EMONPI", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "OpenEnergyMonitor emonPi", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 30720, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://github.com/openenergymonitor/emonpi", - "vendor": "OpenEnergyMonitor" - }, - - "sainSmartDue": { - "build": { - "core": "arduino", - "extra_flags": "-D__SAM3X8E__ -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM", - "f_cpu": "84000000L", - "mcu": "at91sam3x8e", - "cpu": "cortex-m3", - "usb_product": "Arduino Due", - "variant": "arduino_due_x", - "ldscript": "sam3x8e.ld", - "hwids": [ - ["0x2341", "0x003E"] - ] - }, - "frameworks": ["arduino"], - "name": "SainSmart Due (Programming Port)", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 524288, - "protocol": "sam-ba", - "require_upload_port" : true, - "use_1200bps_touch": true, - "wait_for_upload_port": false - }, - "url": "http://www.sainsmart.com/arduino/control-boards/sainsmart-due-atmel-sam3x8e-arm-cortex-m3-board-black.html", - "vendor": "SainSmart" - }, - "sainSmartDueUSB": { - "build": { - "core": "arduino", - "extra_flags": "-D__SAM3X8E__ -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM", - "f_cpu": "84000000L", - "mcu": "at91sam3x8e", - "cpu": "cortex-m3", - "usb_product": "Arduino Due", - "variant": "arduino_due_x", - "ldscript": "sam3x8e.ld", - "hwids": [ - ["0x2341", "0x003E"] - ] - }, - "frameworks": ["arduino"], - "name": "SainSmart Due (USB Native Port)", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 524288, - "protocol": "sam-ba", - "require_upload_port" : true, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://www.sainsmart.com/arduino/control-boards/sainsmart-due-atmel-sam3x8e-arm-cortex-m3-board-black.html", - "vendor": "SainSmart" - }, - - "panStampAVR": { - "build": { - "core": "panstamp", - "extra_flags": "-DPANSTAMP_AVR", - "f_cpu": "8000000L", - "mcu": "atmega328p", - "variant": "panstamp" - }, - "frameworks": ["arduino"], - "name": "PanStamp AVR", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "http://www.panstamp.com/product/panstamp-avr/", - "vendor": "PanStamp" - }, - - "panStampNRG": { - "build": { - "core": "panstamp", - "f_cpu": "12000000L", - "mcu": "cc430f5137", - "variant": "panstamp_nrg_1.1" - }, - "frameworks": ["arduino"], - "name": "PanStamp NRG 1.1", - "platform": "timsp430", - "upload": { - "maximum_ram_size": 4096, - "maximum_size": 32640, - "protocol": "flash-bsl" - }, - "url": "http://www.panstamp.com/product/197/", - "vendor": "PanStamp" - }, - "reprap_rambo": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_RAMBO", - "f_cpu": "16000000L", - "mcu": "atmega2560", - "variant": "rambo" - }, - "frameworks": ["arduino"], - "name": "RepRap RAMBo", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 258048, - "protocol": "wiring", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://reprap.org/wiki/Rambo", - "vendor": "RepRap" - }, - - "sanguino_atmega1284p": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_SANGUINO", - "f_cpu": "16000000L", - "mcu": "atmega1284p", - "variant": "sanguino" - }, - "frameworks": ["arduino"], - "name": "Sanguino ATmega1284p (16MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 130048, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://code.google.com/p/sanguino/", - "vendor": "Sanguino" - }, - - "sanguino_atmega1284_8m": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_SANGUINO", - "f_cpu": "8000000L", - "mcu": "atmega1284p", - "variant": "sanguino" - }, - "frameworks": ["arduino"], - "name": "Sanguino ATmega1284p (8MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 130048, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "https://code.google.com/p/sanguino/", - "vendor": "Sanguino" - }, - - "sanguino_atmega644": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_SANGUINO", - "f_cpu": "16000000L", - "mcu": "atmega644", - "variant": "sanguino" - }, - "frameworks": ["arduino"], - "name": "Sanguino ATmega644 or ATmega644A (16 MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 4096, - "maximum_size": 64512, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://code.google.com/p/sanguino/", - "vendor": "Sanguino" - }, - - "sanguino_atmega644_8m": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_SANGUINO", - "f_cpu": "8000000L", - "mcu": "atmega644", - "variant": "sanguino" - }, - "frameworks": ["arduino"], - "name": "Sanguino ATmega644 or ATmega644A (8 MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 4096, - "maximum_size": 64512, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "https://code.google.com/p/sanguino/", - "vendor": "Sanguino" - }, - - "sanguino_atmega644p": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_SANGUINO", - "f_cpu": "16000000L", - "mcu": "atmega644p", - "variant": "sanguino" - }, - "frameworks": ["arduino"], - "name": "Sanguino ATmega644P or ATmega644PA (16 MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 4096, - "maximum_size": 64512, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://code.google.com/p/sanguino/", - "vendor": "Sanguino" - }, - - "sanguino_atmega644p_8m": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_SANGUINO", - "f_cpu": "8000000L", - "mcu": "atmega644p", - "variant": "sanguino" - }, - "frameworks": ["arduino"], - "name": "Sanguino ATmega644P or ATmega644PA (8 MHz)", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 4096, - "maximum_size": 64512, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "https://code.google.com/p/sanguino/", - "vendor": "Sanguino" - }, - - "tinyduino": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_LILYPAD", - "f_cpu": "8000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "TinyCircuits TinyDuino Processor Board", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 30720, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "https://tiny-circuits.com/tinyduino-processor-board.html", - "vendor": "TinyCircuits" - }, - - "blend": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "RedBearLab Blend", - "variant": "leonardo", - "hwids": [ - ["0x2341", "0x8036"] - ] - }, - "frameworks": ["arduino"], - "name": "RedBearLab Blend", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://redbearlab.com/blend/", - "vendor": "RedBearLab" - }, - - "blendmicro8": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "usb_product": "RedBearLab Blend", - "variant": "micro", - "hwids": [ - ["0x03EB", "0x2404"] - ] - }, - "frameworks": ["arduino"], - "name": "RedBearLab Blend Micro 3.3V/8MHz", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://redbearlab.com/blendmicro/", - "vendor": "RedBearLab" - }, - - "blendmicro16": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "RedBearLab Blend", - "variant": "micro", - "hwids": [ - ["0x03EB", "0x2404"] - ] - }, - "frameworks": ["arduino"], - "name": "RedBearLab Blend Micro 3.3V/16MHz (overclock)", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://redbearlab.com/blendmicro/", - "vendor": "RedBearLab" - }, - - "tinylily": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_LILYPAD", - "f_cpu": "8000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "TinyCircuits TinyLily Mini Processor", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 30720, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 57600 - }, - "url": "https://tiny-circuits.com/tiny-lily-mini-processor.html", - "vendor": "TinyCircuits" - }, - - "lightup": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_LEONARDO", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "usb_product": "LightUp", - "variant": "leonardo", - "hwids": [ - ["0x1d50", "0x6096"] - ] - }, - "frameworks": ["arduino"], - "name": "LightUp", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.lightup.io/", - "vendor": "LightUp" - }, - - "moteino": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_MOTEINO", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "LowPowerLab Moteino", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 31744, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://lowpowerlab.com/shop/moteino-r4", - "vendor": "LowPowerLab" - }, - - "moteinomega": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_MOTEINOMEGA", - "f_cpu": "16000000L", - "mcu": "atmega1284p", - "variant": "moteinomega" - }, - "frameworks": ["arduino"], - "name": "LowPowerLab MoteinoMEGA", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 130048, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://lowpowerlab.com/blog/2014/08/09/moteinomega-available-now/", - "vendor": "LowPowerLab" - }, - - "zumbt328": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_BT", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "eightanaloginputs" - }, - "frameworks": ["arduino"], - "name": "BQ ZUM BT-328", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2048, - "maximum_size": 28672, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://www.bq.com/gb/products/zum.html", - "vendor": "BQ" - }, - - "quirkbot": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DQUIRKBOT", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "variant" : "quirkbot", - "usb_product": "Quirkbot", - "hwids": [ - ["0x2886", "0xf004"], - ["0x2886", "0xf005"], - ["0x2886", "0xf006"], - ["0x2886", "0xf007"] - ] - }, - "frameworks": ["arduino"], - "name": "Quirkbot", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "http://quirkbot.com", - "vendor": "Quirkbot" - }, - - "wildfirev2": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_MEGA", - "f_cpu": "16000000L", - "mcu": "atmega1284p", - "variant": "wildfirev2" - }, - "frameworks": ["arduino"], - "name": "Wicked Device WildFire V2", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 122878, - "protocol": "wiring", - "require_upload_port" : true, - "speed": 38400 - }, - "url": "http://shop.wickeddevice.com/resources/wildfire/", - "vendor": "Wicked Device" - }, - - "wildfirev3": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_MEGA", - "f_cpu": "16000000L", - "mcu": "atmega1284p", - "variant": "wildfirev3" - }, - "frameworks": ["arduino"], - "name": "Wicked Device WildFire V3", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 130048, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "http://shop.wickeddevice.com/resources/wildfire/", - "vendor": "Wicked Device" - }, - - "attiny13": { - "build": { - "core": "core13", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATTINY13", - "f_cpu": "9600000L", - "mcu": "attiny13" - }, - "frameworks": ["arduino"], - "name": "Generic ATTiny13", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 64, - "maximum_size": 1024, - "protocol": "arduinoisp", - "require_upload_port" : true, - "speed": 19200 - }, - "url": "http://www.atmel.com/devices/ATTINY13.aspx", - "vendor": "Generic ATTiny" - }, - - "attiny24": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATTINY24", - "f_cpu": "8000000L", - "mcu": "attiny24", - "variant": "tiny14" - }, - "frameworks": ["arduino"], - "name": "Generic ATTiny24", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 128, - "maximum_size": 2048, - "protocol": "usbtiny" - }, - "url": "http://www.atmel.com/devices/ATTINY24.aspx", - "vendor": "Generic ATTiny" - }, - - "attiny25": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATTINY25", - "f_cpu": "8000000L", - "mcu": "attiny25", - "variant": "tiny8" - }, - "frameworks": ["arduino"], - "name": "Generic ATTiny25", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 128, - "maximum_size": 2048, - "protocol": "usbtiny" - }, - "url": "http://www.atmel.com/devices/ATTINY25.aspx", - "vendor": "Generic ATTiny" - }, - - "attiny44": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATTINY44", - "f_cpu": "8000000L", - "mcu": "attiny44", - "variant": "tiny14" - }, - "frameworks": ["arduino"], - "name": "Generic ATTiny44", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 256, - "maximum_size": 4096, - "protocol": "usbtiny" - }, - "url": "http://www.atmel.com/devices/ATTINY44.aspx", - "vendor": "Generic ATTiny" - }, - - "attiny45": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATTINY45", - "f_cpu": "8000000L", - "mcu": "attiny45", - "variant": "tiny8" - }, - "frameworks": ["arduino"], - "name": "Generic ATTiny45", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 256, - "maximum_size": 4096, - "protocol": "usbtiny" - }, - "url": "http://www.atmel.com/devices/ATTINY45.aspx", - "vendor": "Generic ATTiny" - }, - - "attiny84": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATTINY84", - "f_cpu": "8000000L", - "mcu": "attiny84", - "variant": "tiny14" - }, - "frameworks": ["arduino"], - "name": "Generic ATTiny84", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 512, - "maximum_size": 8192, - "protocol": "usbtiny" - }, - "url": "http://www.atmel.com/devices/ATTINY84.aspx", - "vendor": "Generic ATTiny" - }, - - "attiny85": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATTINY85", - "f_cpu": "8000000L", - "mcu": "attiny85", - "variant": "tiny8" - }, - "frameworks": ["arduino"], - "name": "Generic ATTiny85", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 512, - "maximum_size": 8192, - "protocol": "usbtiny" - }, - "url": "http://www.atmel.com/devices/ATTINY85.aspx", - "vendor": "Generic ATTiny" - }, - - "arduboy": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ARDUBOY -DARDUBOY_10", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Arduboy", - "variant": "leonardo", - "hwids": [ - ["0x2341", "0x0036"], - ["0x2341", "0x8036"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduboy", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.arduboy.com", - "vendor": "Arduboy" - }, - - "arduboy_devkit": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ARDUBOY_DEVKIT -DAB_DEVKIT", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "Arduboy DevKit", - "variant": "leonardo", - "hwids": [ - ["0x2341", "0x0036"], - ["0x2341", "0x8036"] - ] - }, - "frameworks": ["arduino"], - "name": "Arduboy DevKit", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.arduboy.com", - "vendor": "Arduboy" - }, - - "pinoccio": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_PINOCCIO -D__PROG_TYPES_COMPAT__", - "f_cpu": "16000000L", - "mcu": "atmega256rfr2", - "variant": "pinoccio" - }, - "frameworks": ["arduino"], - "name": "Pinoccio Scout", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 253952, - "protocol": "wiring", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.crowdsupply.com/pinoccio/mesh-sensor-network", - "vendor": "Pinoccio" - } -} diff --git a/platformio/boards/nordicnrf51.json b/platformio/boards/nordicnrf51.json deleted file mode 100644 index 1a80b2fd..00000000 --- a/platformio/boards/nordicnrf51.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "nrf51_mkit": { - "build": { - "f_cpu": "16000000L", - "cpu": "cortex-m0", - "mcu": "nrf51822" - }, - "frameworks": ["mbed"], - "name": "Nordic nRF51822-mKIT", - "platform": "nordicnrf51", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 131072 - }, - "url": "http://developer.mbed.org/platforms/Nordic-nRF51822/", - "vendor": "Nordic" - }, - "hrm1017": { - "build": { - "f_cpu": "16000000L", - "cpu": "cortex-m0", - "mcu": "nrf51822" - }, - "frameworks": ["mbed"], - "name": "Switch Science mbed HRM1017", - "platform": "nordicnrf51", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/mbed-HRM1017/", - "vendor": "Switch Science" - }, - "redBearLab": { - "build": { - "f_cpu": "16000000L", - "cpu": "cortex-m0", - "mcu": "nrf51822" - }, - "frameworks": ["mbed"], - "name": "RedBearLab nRF51822", - "platform": "nordicnrf51", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/RedBearLab-nRF51822/", - "vendor": "RedBearLab" - }, - "nrf51_dk": { - "build": { - "f_cpu": "32000000L", - "cpu": "cortex-m0", - "mcu": "nrf51822" - }, - "frameworks": ["mbed"], - "name": "Nordic nRF51-DK", - "platform": "nordicnrf51", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/Nordic-nRF51-DK/", - "vendor": "Nordic" - }, - "redBearLabBLENano": { - "build": { - "f_cpu": "16000000L", - "cpu": "cortex-m0", - "mcu": "nrf51822" - }, - "frameworks": ["mbed"], - "name": "RedBearLab BLE Nano", - "platform": "nordicnrf51", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/RedBearLab-BLE-Nano/", - "vendor": "RedBearLab" - }, - "nrf51_dongle": { - "build": { - "f_cpu": "32000000L", - "cpu": "cortex-m0", - "mcu": "nrf51822" - }, - "frameworks": ["mbed"], - "name": "Nordic nRF51-Dongle", - "platform": "nordicnrf51", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/Nordic-nRF51-Dongle/", - "vendor": "Nordic" - }, - "wallBotBLE": { - "build": { - "f_cpu": "16000000L", - "cpu": "cortex-m0", - "mcu": "nrf51822" - }, - "frameworks": ["mbed"], - "name": "JKSoft Wallbot BLE", - "platform": "nordicnrf51", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 131072 - }, - "url": "https://developer.mbed.org/platforms/JKSoft-Wallbot-BLE/", - "vendor": "JKSoft" - }, - "seeedTinyBLE": { - "build": { - "f_cpu": "16000000L", - "cpu": "cortex-m0", - "mcu": "nrf51822" - }, - "frameworks": ["mbed"], - "name": "SeeedStudio Seeed Tiny BLE", - "platform": "nordicnrf51", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 262144 - }, - "url": "http://developer.mbed.org/platforms/Seeed-Tiny-BLE/", - "vendor": "SeeedStudio" - }, - "dfcm_nnn40": { - "build": { - "f_cpu": "32000000L", - "cpu": "cortex-m0", - "mcu": "nrf51822" - }, - "frameworks": ["mbed"], - "name": "Delta DFCM-NNN40", - "platform": "nordicnrf51", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/Delta-DFCM-NNN40/", - "vendor": "Delta" - }, - "rfduino": { - "build": { - "core": "arduino", - "extra_flags": "-D__RFduino__", - "f_cpu": "16000000L", - "ldscript": "RFduino.ld", - "cpu": "cortex-m0", - "mcu": "nrf51822", - "variant": "RFduino" - }, - "frameworks": ["arduino"], - "name": "RFduino", - "platform": "nordicnrf51", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 131072 - }, - "url": "http://www.rfduino.com/product/rfd22102-rfduino-dip/index.html", - "vendor": "RFduino" - }, - "bbcmicrobit": { - "build": { - "f_cpu": "16000000L", - "cpu": "cortex-m0", - "mcu": "nrf51822" - }, - "frameworks": ["mbed"], - "name": "BBC micro:bit", - "platform": "nordicnrf51", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/Microbit/", - "vendor": "BBC" - } -} diff --git a/platformio/boards/nxplpc.json b/platformio/boards/nxplpc.json deleted file mode 100644 index de29b022..00000000 --- a/platformio/boards/nxplpc.json +++ /dev/null @@ -1,210 +0,0 @@ -{ - "lpc1768": { - "build": { - "f_cpu": "96000000L", - "cpu": "cortex-m3", - "mcu": "lpc1768" - }, - "frameworks": ["mbed"], - "name": "NXP mbed LPC1768", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 65536, - "maximum_size": 524288 - }, - "url": "http://developer.mbed.org/platforms/mbed-LPC1768/", - "vendor": "NXP" - }, - "lpc11u24": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "lpc11u24" - }, - "frameworks": ["mbed"], - "name": "NXP mbed LPC11U24", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 32768 - }, - "url": "https://developer.mbed.org/platforms/mbed-LPC11U24/", - "vendor": "NXP" - }, - "lpc4088": { - "build": { - "f_cpu": "120000000L", - "cpu": "cortex-m4", - "mcu": "lpc4088" - }, - "frameworks": ["mbed"], - "name": "Embedded Artists LPC4088 QuickStart Board", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 98304, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/EA-LPC4088/", - "vendor": "Embedded Artists" - }, - "dipcortexm0": { - "build": { - "f_cpu": "50000000L", - "cpu": "cortex-m0", - "mcu": "lpc11u24" - }, - "frameworks": ["mbed"], - "name": "Solder Splash Labs DipCortex M0", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 32768 - }, - "url": "https://developer.mbed.org/platforms/DipCortex-M0/", - "vendor": "Solder Splash Labs" - }, - "blueboard_lpc11u24": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "lpc11u24" - }, - "frameworks": ["mbed"], - "name": "NGX Technologies BlueBoard-LPC11U24", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 32768 - }, - "url": "https://developer.mbed.org/platforms/BlueBoard-LPC11U24/", - "vendor": "NGX Technologies" - }, - "seeeduinoArchPro": { - "build": { - "f_cpu": "96000000L", - "cpu": "cortex-m3", - "mcu": "lpc1768" - }, - "frameworks": ["mbed"], - "name": "SeeedStudio Seeeduino-Arch-Pro", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 65536, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/Seeeduino-Arch-Pro/", - "vendor": "SeeedStudio" - }, - "ubloxc027": { - "build": { - "f_cpu": "96000000L", - "cpu": "cortex-m3", - "mcu": "lpc1768" - }, - "frameworks": ["mbed"], - "name": "u-blox C027", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 65536, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/u-blox-C027/", - "vendor": "u-blox" - }, - "lpc1114fn28": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "lpc1114fn28" - }, - "frameworks": ["mbed"], - "name": "Switch Science mbed LPC1114FN28", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 4096, - "maximum_size": 32768 - }, - "url": "https://developer.mbed.org/platforms/LPC1114FN28/", - "vendor": "Switch Science" - }, - "lpc11u35": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "lpc11u35" - }, - "frameworks": ["mbed"], - "name": "Embedded Artists LPC11U35 QuickStart Board", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 10240, - "maximum_size": 65536 - }, - "url": "https://developer.mbed.org/platforms/EA-LPC11U35/", - "vendor": "Embedded Artists" - }, - "lpc11u35_501": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "lpc11u35" - }, - "frameworks": ["mbed"], - "name": "CQ Publishing TG-LPC11U35-501", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 10240, - "maximum_size": 65536 - }, - "url": "https://developer.mbed.org/platforms/TG-LPC11U35-501/", - "vendor": "CQ Publishing" - }, - "lpc1549": { - "build": { - "f_cpu": "72000000L", - "cpu": "cortex-m3", - "mcu": "lpc1549" - }, - "frameworks": ["mbed"], - "name": "NXP LPCXpresso1549", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 36864, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/LPCXpresso1549/", - "vendor": "NXP" - }, - "mbuino": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "lpc11u24" - }, - "frameworks": ["mbed"], - "name": "Outrageous Circuits mBuino", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 32768 - }, - "url": "https://developer.mbed.org/platforms/Outrageous-Circuits-mBuino/", - "vendor": "Outrageous Circuits" - }, - "lpc4088_dm": { - "build": { - "f_cpu": "120000000L", - "cpu": "cortex-m4", - "mcu": "lpc4088" - }, - "frameworks": ["mbed"], - "name": "Embedded Artists LPC4088 Display Module", - "platform": "nxplpc", - "upload": { - "maximum_ram_size": 98304, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/EA-LPC4088-Display-Module/", - "vendor": "Embedded Artists" - } -} \ No newline at end of file diff --git a/platformio/boards/punchthrough.json b/platformio/boards/punchthrough.json deleted file mode 100644 index 6e7d41ed..00000000 --- a/platformio/boards/punchthrough.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "lightblue-bean": { - "name": "LightBlue Bean", - "vendor": "Punch Through", - "url": "https://punchthrough.com/bean", - - "platform": "atmelavr", - "frameworks": ["arduino"], - - "build": { - "core": "bean", - "variant": "bean", - "extra_flags": "-DARDUINO_ARCH_AVR", - "mcu": "atmega328p", - "f_cpu": "8000000L" - }, - "upload": { - "maximum_size": 32256, - "maximum_ram_size": 2048 - } - } -} diff --git a/platformio/boards/raspberrypi.json b/platformio/boards/raspberrypi.json deleted file mode 100644 index 25c3485a..00000000 --- a/platformio/boards/raspberrypi.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "raspberrypi_1b": { - "build": { - "extra_flags": "-DRASPBERRYPI -DRASPBERRYPI1", - "f_cpu": "700000000L", - "mcu": "bcm2835" - }, - "frameworks": ["wiringpi"], - "name": "Raspberry Pi 1 Model B", - "platform": "linux_arm", - "upload": { - "maximum_ram_size": 536870912, - "maximum_size": 536870912 - }, - "url": "https://www.raspberrypi.org", - "vendor": "Raspberry Pi" - }, - - "raspberrypi_2b": { - "build": { - "extra_flags": "-DRASPBERRYPI -DRASPBERRYPI2", - "f_cpu": "900000000L", - "mcu": "bcm2836" - }, - "frameworks": ["wiringpi"], - "name": "Raspberry Pi 2 Model B", - "platform": "linux_arm", - "upload": { - "maximum_ram_size": 1073741824, - "maximum_size": 1073741824 - }, - "url": "https://www.raspberrypi.org", - "vendor": "Raspberry Pi" - }, - - "raspberrypi_zero": { - "build": { - "extra_flags": "-DRASPBERRYPI -DRASPBERRYPIZERO", - "f_cpu": "1000000000L", - "mcu": "bcm2835" - }, - "frameworks": ["wiringpi"], - "name": "Raspberry Pi Zero", - "platform": "linux_arm", - "upload": { - "maximum_ram_size": 536870912, - "maximum_size": 536870912 - }, - "url": "https://www.raspberrypi.org", - "vendor": "Raspberry Pi" - } -} diff --git a/platformio/boards/siliconlabsefm32.json b/platformio/boards/siliconlabsefm32.json deleted file mode 100644 index e4d55f18..00000000 --- a/platformio/boards/siliconlabsefm32.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "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" - }, - - "efm32pg_stk3401": { - "build": { - "f_cpu": "40000000L", - "cpu": "cortex-m4", - "mcu": "efm32pg1b200f256" - }, - "frameworks": ["mbed"], - "name": "Silicon Labs SLSTK3401A (Pearl Gecko)", - "platform": "siliconlabsefm32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/EFM32-Pearl-Gecko/", - "vendor": "Silicon Labs" - } -} diff --git a/platformio/boards/sparkfun.json b/platformio/boards/sparkfun.json deleted file mode 100644 index b14a9ab9..00000000 --- a/platformio/boards/sparkfun.json +++ /dev/null @@ -1,304 +0,0 @@ - { - "sparkfun_redboard": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "SparkFun RedBoard", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.sparkfun.com/products/12757", - "vendor": "SparkFun" - }, - "sparkfun_promicro16": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_PROMICRO16", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "SparkFun Pro Micro", - "variant": "sparkfun_promicro", - "hwids": [ - ["0x1B4F", "0x9205"], - ["0x1B4F", "0x9206"] - ] - }, - "frameworks": ["arduino"], - "name": "SparkFun Pro Micro 5V/16MHz", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.sparkfun.com/products/12640", - "vendor": "SparkFun" - }, - "sparkfun_promicro8": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_PROMICRO8", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "usb_product": "SparkFun Pro Micro", - "variant": "sparkfun_promicro", - "hwids": [ - ["0x1B4F", "0x9203"], - ["0x1B4F", "0x9204"] - ] - }, - "frameworks": ["arduino"], - "name": "SparkFun Pro Micro 3.3V/8MHz", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.sparkfun.com/products/12587", - "vendor": "SparkFun" - }, - "sparkfun_fiov3": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_FIOV3", - "f_cpu": "8000000L", - "mcu": "atmega32u4", - "usb_product": "SparkFun Fio v3", - "variant": "sparkfun_promicro", - "hwids": [ - ["0x1B4F", "0xF100"], - ["0x1B4F", "0xF101"] - ] - }, - "frameworks": ["arduino"], - "name": "SparkFun Fio V3 3.3V/8MHz", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.sparkfun.com/products/11520", - "vendor": "SparkFun" - }, - "sparkfun_makeymakey": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_MAKEYMAKEY", - "f_cpu": "16000000L", - "mcu": "atmega32u4", - "usb_product": "SparkFun MaKey", - "variant": "sparkfun_promicro", - "hwids": [ - ["0x1B4F", "0x2B74"], - ["0x1B4F", "0x2B75"] - ] - }, - "frameworks": ["arduino"], - "name": "SparkFun Makey Makey", - "platform": "atmelavr", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 2560, - "maximum_size": 28672, - "protocol": "avr109", - "require_upload_port" : true, - "speed": 57600, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.sparkfun.com/products/11511", - "vendor": "SparkFun" - }, - "sparkfun_megapro16MHz": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_MEGA2560", - "f_cpu": "16000000L", - "mcu": "atmega2560", - "variant": "mega" - }, - "frameworks": ["arduino"], - "name": "SparkFun Mega Pro 5V/16MHz", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 258048, - "protocol": "stk500v2", - "speed": 57600 - }, - "url": "https://www.sparkfun.com/products/11007", - "vendor": "SparkFun" - }, - "sparkfun_megapro8MHz": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_MEGA2560", - "f_cpu": "8000000L", - "mcu": "atmega2560", - "variant": "mega" - }, - "frameworks": ["arduino"], - "name": "SparkFun Mega Pro 3.3V/8MHz", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 258048, - "protocol": "stk500v2", - "speed": 57600 - }, - "url": "https://www.sparkfun.com/products/10744", - "vendor": "SparkFun" - }, - "sparkfun_megamini": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_MEGA2560", - "f_cpu": "8000000L", - "mcu": "atmega2560", - "variant": "mega" - }, - "frameworks": ["arduino"], - "name": "SparkFun Mega Pro Mini 3.3V", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 258048, - "protocol": "stk500v2", - "speed": 57600 - }, - "url": "https://www.sparkfun.com/products/10743", - "vendor": "SparkFun" - }, - "sparkfun_digitalsandbox": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "SparkFun Digital Sandbox", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.sparkfun.com/products/12651", - "vendor": "SparkFun" - }, - - "uview": { - "build": { - "core": "arduino", - "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO", - "f_cpu": "16000000L", - "mcu": "atmega328p", - "variant": "standard" - }, - "frameworks": ["arduino"], - "name": "SparkFun MicroView", - "platform": "atmelavr", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 32256, - "protocol": "arduino", - "require_upload_port" : true, - "speed": 115200 - }, - "url": "https://www.sparkfun.com/products/12923", - "vendor": "SparkFun" - }, - - "sparkfun_samd21_dev_usb": { - "build": { - "core": "arduino_zero", - "extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", - "f_cpu": "48000000L", - "mcu": "samd21g18a", - "cpu": "cortex-m0plus", - "usb_product": "SparkFun SAMD21", - "variant": "arduino_zero", - "ldscript": "flash_with_bootloader.ld", - "hwids": [ - ["0x1B4F", "0x8D21"], - ["0x1B4F", "0x0D21"] - ] - }, - "frameworks": ["arduino"], - "name": "SparkFun SAMD21 Dev Breakout", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "sam-ba", - "require_upload_port" : true, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.sparkfun.com/products/13672", - "vendor": "SparkFun" - }, - - "sparkfun_samd21_mini_usb": { - "build": { - "core": "arduino_zero", - "extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", - "f_cpu": "48000000L", - "mcu": "samd21g18a", - "cpu": "cortex-m0plus", - "usb_product": "SparkFun SAMD21", - "variant": "SparkFun_SAMD_Mini", - "ldscript": "flash_with_bootloader.ld", - "hwids": [ - ["0x1B4F", "0x8D21"], - ["0x1B4F", "0x0D21"] - ] - }, - "frameworks": ["arduino"], - "name": "SparkFun SAMD21 Mini Breakout", - "platform": "atmelsam", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "sam-ba", - "require_upload_port" : true, - "use_1200bps_touch": true, - "wait_for_upload_port": true - }, - "url": "https://www.sparkfun.com/products/13664", - "vendor": "SparkFun" - } -} diff --git a/platformio/boards/ststm32.json b/platformio/boards/ststm32.json deleted file mode 100644 index 1366a4e4..00000000 --- a/platformio/boards/ststm32.json +++ /dev/null @@ -1,653 +0,0 @@ -{ - "disco_f407vg": { - "build": { - "core": "stm32", - "extra_flags": "-DSTM32F4 -DSTM32F407xx -DSTM32F40_41xxx", - "f_cpu": "168000000L", - "ldscript": "stm32f405x6.ld", - "cpu": "cortex-m4", - "mcu": "stm32f407vgt6", - "variant": "stm32f407xx" - }, - "frameworks": ["mbed", "cmsis", "spl", "libopencm3"], - "name": "ST STM32F4DISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 1048576, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF252419", - "vendor": "ST" - }, - "disco_l152rb": { - "build": { - "core": "stm32", - "extra_flags": "-DSTM32L1 -DSTM32L152xB -DSTM32L1XX_MD", - "f_cpu": "32000000L", - "ldscript": "stm32l15xx6.ld", - "cpu": "cortex-m3", - "mcu": "stm32l152rbt6", - "variant": "stm32l152xb" - }, - "frameworks": ["cmsis", "spl", "libopencm3"], - "name": "ST STM32LDISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 131072, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF258515", - "vendor": "ST" - }, - "disco_f303vc": { - "build": { - "core": "stm32", - "extra_flags": "-DSTM32F3 -DSTM32F303xC", - "f_cpu": "72000000L", - "ldscript": "stm32f30xx.ld", - "cpu": "cortex-m4", - "mcu": "stm32f303vct6", - "variant": "stm32f303xc" - }, - "frameworks": ["mbed", "cmsis", "spl", "libopencm3"], - "name": "ST STM32F3DISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 49152, - "maximum_size": 262144, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF254044", - "vendor": "ST" - }, - "disco_f100rb": { - "build": { - "f_cpu": "24000000L", - "cpu": "cortex-m3", - "mcu": "stm32f100rbt6" - }, - "frameworks": ["mbed"], - "name": "ST STM32VLDISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 131072, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF250863", - "vendor": "ST" - }, - "disco_f051r8": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "stm32f051r8t6" - }, - "frameworks": ["mbed"], - "name": "ST STM32F0DISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 65536, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF253215", - "vendor": "ST" - }, - "disco_f334c8": { - "build": { - "f_cpu": "72000000L", - "cpu": "cortex-m4", - "mcu": "stm32f334c8t6" - }, - "frameworks": ["mbed"], - "name": "ST 32F3348DISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 65536, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF260318", - "vendor": "ST" - }, - "disco_f401vc": { - "build": { - "f_cpu": "84000000L", - "cpu": "cortex-m4", - "mcu": "stm32f401vct6" - }, - "frameworks": ["mbed"], - "name": "ST 32F401CDISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 65536, - "maximum_size": 262144, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF259098", - "vendor": "ST" - }, - "disco_f429zi": { - "build": { - "f_cpu": "180000000L", - "cpu": "cortex-m4", - "mcu": "stm32f429zit6" - }, - "frameworks": ["mbed"], - "name": "ST 32F429IDISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 262144, - "maximum_size": 2097152, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF259090", - "vendor": "ST" - }, - "nucleo_f030r8": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "stm32f030r8t6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F030R8", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 65536 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F030R8/", - "vendor": "ST" - }, - "nucleo_f070rb": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "stm32f070rbt6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F070RB", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 131072 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F070RB/", - "vendor": "ST" - }, - "nucleo_f072rb": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "stm32f072rbt6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F072RB", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 131072 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F072RB/", - "vendor": "ST" - }, - "nucleo_f091rc": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "stm32f091rct6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F091RC", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 262144 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F091RC/", - "vendor": "ST" - }, - "nucleo_f103rb": { - "build": { - "core": "stm32", - "f_cpu": "72000000L", - "ldscript": "stm32f103xb.ld", - "cpu": "cortex-m3", - "mcu": "stm32f103rbt6", - "variant": "stm32f1" - }, - "frameworks": ["mbed","libopencm3"], - "name": "ST Nucleo F103RB", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 20480, - "maximum_size": 131072 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F103RB/", - "vendor": "ST" - }, - "nucleo_f302r8": { - "build": { - "f_cpu": "72000000L", - "cpu": "cortex-m4", - "mcu": "stm32f302r8t6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F302R8", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 65536 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F302R8/", - "vendor": "ST" - }, - "nucleo_f303re": { - "build": { - "f_cpu": "72000000L", - "cpu": "cortex-m4", - "mcu": "stm32f303ret6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F303RE", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 65536, - "maximum_size": 524288 - }, - "url": "http://developer.mbed.org/platforms/ST-Nucleo-F303RE/", - "vendor": "ST" - }, - "nucleo_f334r8": { - "build": { - "f_cpu": "72000000L", - "cpu": "cortex-m4", - "mcu": "stm32f334r8t6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F334R8", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 65536 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F334R8/", - "vendor": "ST" - }, - "nucleo_f401re": { - "build": { - "core": "stm32", - "extra_flags": "-DSTM32F4 -DSTM32F401xE -DSTM32F40_41xxx", - "f_cpu": "84000000L", - "ldscript": "stm32f401xe.ld", - "cpu": "cortex-m4", - "mcu": "stm32f401ret6", - "variant": "stm32f401xe" - }, - "frameworks": ["mbed", "cmsis", "spl"], - "name": "ST Nucleo F401RE", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 98304, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F401RE/", - "vendor": "ST" - }, - "nucleo_f411re": { - "build": { - "f_cpu": "100000000L", - "cpu": "cortex-m4", - "mcu": "stm32f411ret6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F411RE", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F411RE/", - "vendor": "ST" - }, - "nucleo_f446re": { - "build": { - "f_cpu": "180000000L", - "cpu": "cortex-m4", - "mcu": "stm32f446ret6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F446RE", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F446RE/", - "vendor": "ST" - }, - "nucleo_l053r8": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "stm32l053r8t6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo L053R8", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 65536 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-L053R8/", - "vendor": "ST" - }, - "nucleo_l152re": { - "build": { - "f_cpu": "32000000L", - "cpu": "cortex-m3", - "mcu": "stm32l152ret6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo L152RE", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 81920, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-L152RE/", - "vendor": "ST" - }, - "armstrap_eagle512": { - "build": { - "core": "stm32", - "extra_flags": "-DSTM32F40_41xxx", - "f_cpu": "168000000L", - "ldscript": "armstrap_eagle_512.ld", - "cpu": "cortex-m4", - "mcu": "stm32f407vet6", - "variant": "stm32f4" - }, - "frameworks": ["cmsis", "spl"], - "name": "Armstrap Eagle 512", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 196608, - "maximum_size": 524288 - }, - "url": "http://docs.armstrap.org/en/latest/hardware-overview.html", - "vendor": "Armstrap" - }, - "armstrap_eagle1024": { - "build": { - "core": "stm32", - "extra_flags": "-DSTM32F40_41xxx", - "f_cpu": "168000000L", - "ldscript": "armstrap_eagle_1024.ld", - "cpu": "cortex-m4", - "mcu": "stm32f417vgt6", - "variant": "stm32f4" - }, - "frameworks": ["cmsis", "spl"], - "name": "Armstrap Eagle 1024", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 196608, - "maximum_size": 1048576 - }, - "url": "http://docs.armstrap.org/en/latest/hardware-overview.html", - "vendor": "Armstrap" - }, - "armstrap_eagle2048": { - "build": { - "core": "stm32", - "extra_flags": "-DSTM32F427_437xx", - "f_cpu": "168000000L", - "ldscript": "armstrap_eagle_2048.ld", - "cpu": "cortex-m4", - "mcu": "stm32f427vit6", - "variant": "stm32f4" - }, - "frameworks": ["cmsis", "spl"], - "name": "Armstrap Eagle 2048", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 262144, - "maximum_size": 2091752 - }, - "url": "http://docs.armstrap.org/en/latest/hardware-overview.html", - "vendor": "Armstrap" - }, - "disco_l053c8": { - "build": { - "f_cpu": "32000000L", - "cpu": "cortex-m0plus", - "mcu": "stm32l053c8t6" - }, - "frameworks": ["mbed"], - "name": "ST 32L0538DISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 65536, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/en/catalog/tools/PF260319", - "vendor": "ST" - }, - "disco_f334c8": { - "build": { - "f_cpu": "72000000L", - "cpu": "cortex-m4", - "mcu": "stm32f334c8t6" - }, - "frameworks": ["mbed"], - "name": "ST 32F3348DISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 12288, - "maximum_size": 65536, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/en/catalog/tools/PF260318", - "vendor": "ST" - }, - "disco_f469ni": { - "build": { - "f_cpu": "180000000L", - "cpu": "cortex-m4", - "mcu": "stm32f469nih6" - }, - "frameworks": ["mbed"], - "name": "ST 32F469IDISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 393216, - "maximum_size": 1048576, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/catalog/tools/FM116/CL1620/SC959/SS1532/LN1848/PF262395", - "vendor": "ST" - }, - "disco_l476vg": { - "build": { - "f_cpu": "80000000L", - "cpu": "cortex-m4", - "mcu": "stm32l476vgt6" - }, - "frameworks": ["mbed"], - "name": "ST 32L476GDISCOVERY", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 1048576, - "protocol": "stlink" - }, - "url": "http://www.st.com/web/catalog/tools/FM116/CL1620/SC959/SS1532/LN1848/PF261635", - "vendor": "ST" - }, - "nucleo_f031k6": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "stm32f031k6t6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F031K6", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 4096, - "maximum_size": 32768 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F031K6/", - "vendor": "ST" - }, - "nucleo_f042k6": { - "build": { - "f_cpu": "48000000L", - "cpu": "cortex-m0", - "mcu": "stm32f042k6t6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F042K6", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 6144, - "maximum_size": 32768 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F042K6/", - "vendor": "ST" - }, - "nucleo_f303k8": { - "build": { - "f_cpu": "72000000L", - "cpu": "cortex-m4", - "mcu": "stm32f303k8t6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F303K8", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 65536 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F303K8/", - "vendor": "ST" - }, - "nucleo_l476rg": { - "build": { - "f_cpu": "80000000L", - "cpu": "cortex-m4", - "mcu": "stm32l476rgt6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo L476RG", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 1048576 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-L476RG/", - "vendor": "ST" - }, - "nucleo_f410rb": { - "build": { - "f_cpu": "100000000L", - "cpu": "cortex-m4", - "mcu": "stm32f410rbt6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo F410RB", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 131072 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-F410RB/", - "vendor": "ST" - }, - "nucleo_l073rz": { - "build": { - "f_cpu": "32000000L", - "cpu": "cortex-m0plus", - "mcu": "stm32l073rz" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo L073RZ", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 20480, - "maximum_size": 196608 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-L073RZ/", - "vendor": "ST" - }, - "nucleo_l031k6": { - "build": { - "f_cpu": "32000000L", - "cpu": "cortex-m0plus", - "mcu": "stm32l031k6t6" - }, - "frameworks": ["mbed"], - "name": "ST Nucleo L031K6", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 32768 - }, - "url": "https://developer.mbed.org/platforms/ST-Nucleo-L031K6/", - "vendor": "ST" - }, - "seeedArchMax": { - "build": { - "f_cpu": "168000000L", - "cpu": "cortex-m4", - "mcu": "stm32f407vet6" - }, - "frameworks": ["mbed"], - "name": "SeeedStudio Arch Max", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 196608, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/Seeed-Arch-Max/", - "vendor": "SeeedStudio" - }, - "b96b_f446ve": { - "build": { - "f_cpu": "168000000L", - "cpu": "cortex-m4", - "mcu": "stm32f446vet6" - }, - "frameworks": ["mbed"], - "name": "96Boards B96B-F446VE", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/ST-B96B-F446VE/", - "vendor": "96Boards" - }, - "mts_mdot_f411re": { - "build": { - "f_cpu": "100000000L", - "cpu": "cortex-m4", - "mcu": "stm32f411ret6" - }, - "frameworks": ["mbed"], - "name": "MultiTech mDot F411", - "platform": "ststm32", - "upload": { - "maximum_ram_size": 131072, - "maximum_size": 524288 - }, - "url": "https://developer.mbed.org/platforms/MTS-mDot-F411/", - "vendor": "MultiTech" - } -} diff --git a/platformio/boards/teensy.json b/platformio/boards/teensy.json deleted file mode 100644 index dd4816ae..00000000 --- a/platformio/boards/teensy.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "teensy20": { - "build": { - "core": "teensy", - "f_cpu": "16000000L", - "mcu": "atmega32u4" - }, - "frameworks": ["arduino"], - "name": "Teensy 2.0", - "platform": "teensy", - "upload": { - "maximum_ram_size": 2560, - "maximum_size": 32256 - }, - "url": "https://www.pjrc.com/store/teensy.html", - "vendor": "Teensy" - }, - - "teensy20pp": { - "build": { - "core": "teensy", - "f_cpu": "16000000L", - "mcu": "at90usb1286" - }, - "frameworks": ["arduino"], - "name": "Teensy++ 2.0", - "platform": "teensy", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 130048 - }, - "url": "https://www.pjrc.com/store/teensypp.html", - "vendor": "Teensy" - }, - - "teensy30": { - "build": { - "core": "teensy3", - "extra_flags": "-D__MK20DX128__", - "f_cpu": "48000000L", - "ldscript": "mk20dx128.ld", - "mcu": "mk20dx128", - "cpu": "cortex-m4" - }, - "frameworks": ["arduino"], - "name": "Teensy 3.0", - "platform": "teensy", - "upload": { - "maximum_ram_size": 16384, - "maximum_size": 131072 - }, - "url": "https://www.pjrc.com/store/teensy3.html", - "vendor": "Teensy" - }, - - "teensy31": { - "build": { - "core": "teensy3", - "extra_flags": "-D__MK20DX256__", - "f_cpu": "72000000L", - "ldscript": "mk20dx256.ld", - "mcu": "mk20dx256", - "cpu": "cortex-m4" - }, - "frameworks": ["arduino", "mbed"], - "name": "Teensy 3.1 / 3.2", - "platform": "teensy", - "upload": { - "maximum_ram_size": 65536, - "maximum_size": 262144 - }, - "url": "https://www.pjrc.com/store/teensy31.html", - "vendor": "Teensy" - }, - - "teensylc": { - "build": { - "core": "teensy3", - "extra_flags": "-D__MKL26Z64__", - "f_cpu": "48000000L", - "ldscript": "mkl26z64.ld", - "mcu": "mkl26z64", - "cpu": "cortex-m0plus" - }, - "frameworks": ["arduino"], - "name": "Teensy LC", - "platform": "teensy", - "upload": { - "maximum_ram_size": 8192, - "maximum_size": 63488 - }, - "url": "http://www.pjrc.com/teensy/teensyLC.html", - "vendor": "Teensy" - } -} diff --git a/platformio/boards/timsp430.json b/platformio/boards/timsp430.json deleted file mode 100644 index 5b8544a6..00000000 --- a/platformio/boards/timsp430.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "lpmsp430f5529": { - "build": { - "core": "msp430", - "f_cpu": "16000000L", - "mcu": "msp430f5529", - "variant": "launchpad_f5529" - }, - "frameworks": ["energia"], - "name": "TI LaunchPad w/ msp430f5529 (16MHz)", - "platform": "timsp430", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 131072, - "protocol": "tilib" - }, - "url": "http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430f5529lp.html", - "vendor": "TI" - }, - "lpmsp430f5529_25": { - "build": { - "core": "msp430", - "f_cpu": "25000000L", - "mcu": "msp430f5529", - "variant": "launchpad_f5529" - }, - "frameworks": ["energia"], - "name": "TI LaunchPad w/ msp430f5529 (25MHz)", - "platform": "timsp430", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 131072, - "protocol": "tilib" - }, - "url": "http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430f5529lp.html", - "vendor": "TI" - }, - "lpmsp430fr5739": { - "build": { - "core": "msp430", - "f_cpu": "16000000L", - "mcu": "msp430fr5739", - "variant": "fraunchpad" - }, - "frameworks": ["energia"], - "name": "TI FraunchPad w/ msp430fr5739", - "platform": "timsp430", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 15872, - "protocol": "rf2500" - }, - "url": "http://www.ti.com/tool/msp-exp430fr5739", - "vendor": "TI" - }, - "lpmsp430fr5969": { - "build": { - "core": "msp430", - "f_cpu": "8000000L", - "mcu": "msp430fr5969", - "variant": "launchpad_fr5969" - }, - "frameworks": ["energia"], - "name": "TI LaunchPad w/ msp430fr5969", - "platform": "timsp430", - "upload": { - "maximum_ram_size": 1024, - "maximum_size": 65536, - "protocol": "tilib" - }, - "url": "http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430fr5969.html", - "vendor": "TI" - }, - "lpmsp430g2231": { - "build": { - "core": "msp430", - "f_cpu": "1000000L", - "mcu": "msp430g2231", - "variant": "launchpad" - }, - "frameworks": ["energia"], - "name": "TI LaunchPad w/ msp430g2231 (1 MHz)", - "platform": "timsp430", - "upload": { - "maximum_ram_size": 128, - "maximum_size": 2048, - "protocol": "rf2500" - }, - "url": "http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430g2.html", - "vendor": "TI" - }, - "lpmsp430g2452": { - "build": { - "core": "msp430", - "f_cpu": "16000000L", - "mcu": "msp430g2452", - "variant": "launchpad" - }, - "frameworks": ["energia"], - "name": "TI LaunchPad w/ msp430g2452 (16MHz)", - "platform": "timsp430", - "upload": { - "maximum_ram_size": 256, - "maximum_size": 8192, - "protocol": "rf2500" - }, - "url": "http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430g2.html", - "vendor": "TI" - }, - "lpmsp430g2553": { - "build": { - "core": "msp430", - "f_cpu": "16000000L", - "mcu": "msp430g2553", - "variant": "launchpad" - }, - "frameworks": ["energia"], - "name": "TI LaunchPad w/ msp430g2553 (16MHz)", - "platform": "timsp430", - "upload": { - "maximum_ram_size": 512, - "maximum_size": 16384, - "protocol": "rf2500" - }, - "url": "http://www.ti.com/ww/en/launchpad/launchpads-msp430-msp-exp430g2.html", - "vendor": "TI" - }, - "lpmsp430fr4133": { - "build": { - "core": "msp430", - "f_cpu": "16000000L", - "mcu": "msp430fr4133", - "variant": "launchpad_fr4133" - }, - "frameworks": ["energia"], - "name": "TI LaunchPad w/ msp430fr4133", - "platform": "timsp430", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 15360, - "protocol": "tilib" - }, - "url": "http://www.ti.com/tool/msp-exp430fr4133", - "vendor": "TI" - }, - "lpmsp430fr6989": { - "build": { - "core": "msp430", - "f_cpu": "16000000L", - "mcu": "msp430fr6989", - "variant": "launchpad_fr6989" - }, - "frameworks": ["energia"], - "name": "TI LaunchPad w/ msp430fr6989", - "platform": "timsp430", - "upload": { - "maximum_ram_size": 2048, - "maximum_size": 130048, - "protocol": "tilib" - }, - "url": "http://www.ti.com/tool/msp-exp430fr6989", - "vendor": "TI" - } -} diff --git a/platformio/boards/titiva.json b/platformio/boards/titiva.json deleted file mode 100644 index 29b7944f..00000000 --- a/platformio/boards/titiva.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "lplm4f120h5qr": { - "build": { - "core": "lm4f", - "f_cpu": "80000000L", - "ldscript": "lm4fcpp_blizzard.ld", - "cpu": "cortex-m4", - "mcu": "lplm4f120h5qr", - "variant": "stellarpad" - }, - "frameworks": ["energia", "libopencm3"], - "name": "TI LaunchPad (Stellaris) w/ lm4f120 (80MHz)", - "platform": "titiva", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 262144 - }, - "url": "http://www.ti.com/tool/ek-lm4f120xl", - "vendor": "TI" - }, - "lptm4c1230c3pm": { - "build": { - "core": "lm4f", - "f_cpu": "80000000L", - "ldscript": "lm4fcpp_blizzard.ld", - "cpu": "cortex-m4", - "mcu": "lptm4c1230c3pm", - "variant": "stellarpad" - }, - "frameworks": ["energia", "libopencm3"], - "name": "TI LaunchPad (Tiva C) w/ tm4c123 (80MHz)", - "platform": "titiva", - "upload": { - "maximum_ram_size": 32768, - "maximum_size": 262144 - }, - "url": "http://www.ti.com/ww/en/launchpad/launchpads-connected-ek-tm4c123gxl.html", - "vendor": "TI" - }, - "lptm4c1294ncpdt": { - "build": { - "core": "lm4f", - "f_cpu": "120000000L", - "ldscript": "lm4fcpp_snowflake.ld", - "cpu": "cortex-m4", - "mcu": "lptm4c1294ncpdt", - "variant": "launchpad_129" - }, - "frameworks": ["energia", "libopencm3"], - "name": "TI LaunchPad (Tiva C) w/ tm4c129 (120MHz)", - "platform": "titiva", - "upload": { - "maximum_ram_size": 262144, - "maximum_size": 1048576 - }, - "url": "http://www.ti.com/ww/en/launchpad/launchpads-connected-ek-tm4c1294xl.html", - "vendor": "TI" - } -} \ No newline at end of file diff --git a/platformio/builder/__init__.py b/platformio/builder/__init__.py index 0c05c3b0..95899c71 100644 --- a/platformio/builder/__init__.py +++ b/platformio/builder/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 8b01c7b2..5bbabd15 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,35 +19,36 @@ from os import environ from os.path import join, normpath from time import time -from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, Variables +from SCons.Script import (COMMAND_LINE_TARGETS, AllowSubstExceptions, + DefaultEnvironment, Progress, Variables) from platformio import util -from platformio.exception import UnknownBoard -# AllowSubstExceptions() +AllowSubstExceptions(NameError) # allow common variables from INI file commonvars = Variables(None) commonvars.AddVariables( + ("PLATFORM_MANIFEST",), ("BUILD_SCRIPT",), ("EXTRA_SCRIPT",), ("PIOENV",), - ("PLATFORM",), + ("PIOTEST",), + ("PIOPLATFORM",), + ("PIOFRAMEWORK",), - # package aliases - ("PIOPACKAGE_TOOLCHAIN",), - ("PIOPACKAGE_FRAMEWORK",), - ("PIOPACKAGE_UPLOADER",), - - # options - ("FRAMEWORK",), + # build options ("BUILD_FLAGS",), ("SRC_BUILD_FLAGS",), ("BUILD_UNFLAGS",), ("SRC_FILTER",), - ("LIB_DFCYCLIC",), + + # library options + ("LIB_LDF_MODE",), + ("LIB_COMPAT_MODE",), ("LIB_IGNORE",), - ("LIB_USE",), + ("LIB_FORCE",), + ("LIB_EXTRA_DIRS",), # board options ("BOARD",), @@ -62,107 +63,72 @@ commonvars.AddVariables( ("UPLOAD_SPEED",), ("UPLOAD_FLAGS",), ("UPLOAD_RESETMETHOD",) -) +) # yapf: disable DefaultEnvironment( tools=[ - "gcc", "g++", "as", "ar", "gnulink", - "platformio", "pioupload", "pioar", "piomisc" - ], - toolpath=[join("$PIOBUILDER_DIR", "tools")], + "ar", "as", "gcc", "g++", "gnulink", + "platformio", "pioplatform", + "piolib", "piotest", "pioupload", "pioar", "piomisc" + ], # yapf: disable + toolpath=[join(util.get_source_dir(), "builder", "tools")], variables=commonvars, # Propagating External Environment ENV=environ, - UNIX_TIME=int(time()), PROGNAME="program", - PIOHOME_DIR=util.get_home_dir(), PROJECT_DIR=util.get_project_dir(), - PROJECTLIB_DIR=util.get_projectlib_dir(), PROJECTSRC_DIR=util.get_projectsrc_dir(), + PROJECTTEST_DIR=util.get_projecttest_dir(), PROJECTDATA_DIR=util.get_projectdata_dir(), - PIOENVS_DIR=util.get_pioenvs_dir(), - - PIOBUILDER_DIR=join(util.get_source_dir(), "builder"), - PIOPACKAGES_DIR=join("$PIOHOME_DIR", "packages"), - - BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"), + PROJECTPIOENVS_DIR=util.get_projectpioenvs_dir(), + BUILD_DIR=join("$PROJECTPIOENVS_DIR", "$PIOENV"), BUILDSRC_DIR=join("$BUILD_DIR", "src"), + BUILDTEST_DIR=join("$BUILD_DIR", "test"), LIBSOURCE_DIRS=[ - "$PROJECTLIB_DIR", - util.get_lib_dir(), - join("$PLATFORMFW_DIR", "libraries") + util.get_projectlib_dir(), util.get_projectlibdeps_dir(), + join("$PIOHOME_DIR", "lib") ], - - PYTHONEXE=normpath(sys.executable) -) + PYTHONEXE=normpath(sys.executable)) env = DefaultEnvironment() +if env.GetOption("silent"): + print "Verbose mode can be enabled via `-v, --verbose` option" + Progress(env.ProgressHandler) + # decode common variables for k in commonvars.keys(): if k in env: env[k] = base64.b64decode(env[k]) -env.Prepend(LIBPATH=[join("$PIOPACKAGES_DIR", "ldscripts")]) - -if "BOARD" in env: - try: - env.Replace(BOARD_OPTIONS=util.get_boards(env.subst("$BOARD"))) - except UnknownBoard as e: - env.Exit("Error: %s" % str(e)) - - for k in commonvars.keys(): - if (k in env or - not any([k.startswith("BOARD_"), k.startswith("UPLOAD_")])): - continue - _opt, _val = k.lower().split("_", 1) - if _opt == "board": - _opt = "build" - if _val in env['BOARD_OPTIONS'][_opt]: - env.Replace(**{k: "${BOARD_OPTIONS['%s']['%s']}" % (_opt, _val)}) - - if "ldscript" in env.get("BOARD_OPTIONS", {}).get("build", {}): - env.Replace( - LDSCRIPT_PATH="${BOARD_OPTIONS['build']['ldscript']}" - ) - - if env['PLATFORM'] != env.get("BOARD_OPTIONS", {}).get("platform"): - env.Exit( - "Error: '%s' platform doesn't support this board. " - "Use '%s' platform instead." % ( - env['PLATFORM'], env.get("BOARD_OPTIONS", {}).get("platform"))) - - -for opt in ("LIB_IGNORE", "LIB_USE"): - if opt not in env: - continue - env[opt] = [l.strip() for l in env[opt].split(",") if l.strip()] - -if env.subst("$PIOPACKAGE_TOOLCHAIN"): - env.PrependENVPath( - "PATH", - env.subst(join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN", "bin")) - ) - -# handle custom variable from system environment +# Handle custom variables from system environment for var in ("BUILD_FLAGS", "SRC_BUILD_FLAGS", "SRC_FILTER", "EXTRA_SCRIPT", - "UPLOAD_PORT", "UPLOAD_FLAGS"): + "UPLOAD_PORT", "UPLOAD_FLAGS", "LIB_EXTRA_DIRS"): k = "PLATFORMIO_%s" % var if environ.get(k): env[var] = environ.get(k) +# Parse comma separated items +for opt in ("LIB_IGNORE", "LIB_FORCE", "LIB_EXTRA_DIRS"): + if opt not in env: + continue + env[opt] = [l.strip() for l in env[opt].split(",") if l.strip()] + +env.Prepend(LIBSOURCE_DIRS=env.get("LIB_EXTRA_DIRS", [])) +env.LoadPioPlatform(commonvars) + env.SConscriptChdir(0) -env.SConsignFile(join("$PIOENVS_DIR", ".sconsign.dblite")) +env.SConsignFile(join("$PROJECTPIOENVS_DIR", ".sconsign.dblite")) env.SConscript("$BUILD_SCRIPT") if "UPLOAD_FLAGS" in env: env.Append(UPLOADERFLAGS=["$UPLOAD_FLAGS"]) if env.get("EXTRA_SCRIPT"): - env.SConscript(env.get("EXTRA_SCRIPT")) + env.SConscript(env.get("EXTRA_SCRIPT"), exports="env") if "envdump" in COMMAND_LINE_TARGETS: print env.Dump() diff --git a/platformio/builder/scripts/atmelavr.py b/platformio/builder/scripts/atmelavr.py deleted file mode 100644 index 2500084e..00000000 --- a/platformio/builder/scripts/atmelavr.py +++ /dev/null @@ -1,168 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Atmel AVR series of microcontrollers -""" - -from os.path import join -from time import sleep - -from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, - DefaultEnvironment, SConscript) - -from platformio.util import get_serialports - - -def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621 - - if "program" in COMMAND_LINE_TARGETS: - return - - if "micronucleus" in env['UPLOADER']: - print "Please unplug/plug device ..." - - upload_options = env.get("BOARD_OPTIONS", {}).get("upload", {}) - - # Deprecated: compatibility with old projects. Use `program` instead - 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 upload_options and not upload_options.get("require_upload_port", False): - return - - env.AutodetectUploadPort() - env.Append(UPLOADERFLAGS=["-P", '"$UPLOAD_PORT"']) - - if env.subst("$BOARD") in ("raspduino", "emonpi"): - - def _rpi_sysgpio(path, value): - with open(path, "w") as f: - f.write(str(value)) - - pin_num = 18 if env.subst("$BOARD") == "raspduino" else 4 - _rpi_sysgpio("/sys/class/gpio/export", pin_num) - _rpi_sysgpio("/sys/class/gpio/gpio%d/direction" % pin_num, "out") - _rpi_sysgpio("/sys/class/gpio/gpio%d/value" % pin_num, 1) - sleep(0.1) - _rpi_sysgpio("/sys/class/gpio/gpio%d/value" % pin_num, 0) - _rpi_sysgpio("/sys/class/gpio/unexport", pin_num) - else: - if not upload_options.get("disable_flushing", False): - env.FlushSerialBuffer("$UPLOAD_PORT") - - before_ports = get_serialports() - - if upload_options.get("use_1200bps_touch", False): - env.TouchSerialPort("$UPLOAD_PORT", 1200) - - if upload_options.get("wait_for_upload_port", False): - env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports)) - - -env = DefaultEnvironment() - -SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py"))) - -env.Append( - CFLAGS=[ - "-std=gnu11" - ], - - CXXFLAGS=[ - "-std=gnu++11" - ] -) - -if "digispark" in env.get( - "BOARD_OPTIONS", {}).get("build", {}).get("core", ""): - env.Replace( - UPLOADER=join("$PIOPACKAGES_DIR", "tool-micronucleus", "micronucleus"), - UPLOADERFLAGS=[ - "-c", "$UPLOAD_PROTOCOL", - "--timeout", "60" - ], - UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES' - ) - -else: - env.Replace( - UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"), - UPLOADERFLAGS=[ - "-v", - "-p", "$BOARD_MCU", - "-C", - '"%s"' % join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude.conf"), - "-c", "$UPLOAD_PROTOCOL" - ], - UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS -D -U flash:w:$SOURCES:i', - UPLOADEEPCMD='"$UPLOADER" $UPLOADERFLAGS -U eeprom:w:$SOURCES:i', - PROGRAMHEXCMD='"$UPLOADER" $UPLOADERFLAGS -U flash:w:$SOURCES:i' - ) - -# -# Target: Build executable and linkable firmware -# - -target_elf = env.BuildProgram() - -# -# Target: Build the .hex file -# - -if "uploadlazy" in COMMAND_LINE_TARGETS: - target_firm = join("$BUILD_DIR", "firmware.hex") -else: - target_firm = env.ElfToHex(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 .hex file -# - -upload = env.Alias(["upload", "uploadlazy"], target_firm, - [BeforeUpload, "$UPLOADHEXCMD"]) -AlwaysBuild(upload) - -# -# Target: Upload EEPROM data (from EEMEM directive) -# - -uploadeep = env.Alias("uploadeep", - env.ElfToEep(join("$BUILD_DIR", "firmware"), target_elf), - [BeforeUpload, "$UPLOADEEPCMD"]) -AlwaysBuild(uploadeep) - -# -# Target: Upload firmware using external programmer -# - -program = env.Alias("program", target_firm, [BeforeUpload, "$PROGRAMHEXCMD"]) -AlwaysBuild(program) - -# -# Setup default targets -# - -Default([target_firm, target_size]) diff --git a/platformio/builder/scripts/atmelsam.py b/platformio/builder/scripts/atmelsam.py deleted file mode 100644 index 0901364e..00000000 --- a/platformio/builder/scripts/atmelsam.py +++ /dev/null @@ -1,249 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Atmel SAM series of microcontrollers -""" - -from os.path import basename, join - -from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, - DefaultEnvironment, SConscript) - -from platformio.util import get_serialports - - -def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621 - - upload_options = env.get("BOARD_OPTIONS", {}).get("upload", {}) - - if not upload_options.get("disable_flushing", False): - env.FlushSerialBuffer("$UPLOAD_PORT") - - before_ports = get_serialports() - - if upload_options.get("use_1200bps_touch", False): - env.TouchSerialPort("$UPLOAD_PORT", 1200) - - if upload_options.get("wait_for_upload_port", False): - env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports)) - - # use only port name for BOSSA - if ("/" in env.subst("$UPLOAD_PORT") and - env.subst("$UPLOAD_PROTOCOL") == "sam-ba"): - env.Replace(UPLOAD_PORT=basename(env.subst("$UPLOAD_PORT"))) - - -env = DefaultEnvironment() - -SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) - -BOARD_OPTIONS = env.get("BOARD_OPTIONS", {}) - - -env.Append( - - CCFLAGS=[ - "--param", "max-inline-insns-single=500", - "-MMD" - ], - - CFLAGS=[ - "-std=gnu11" - ], - - CXXFLAGS=[ - "-std=gnu++11", - "-fno-threadsafe-statics" - ], - - CPPDEFINES=[ - "USBCON" - ], - - LINKFLAGS=[ - "-Wl,--check-sections", - "-Wl,--unresolved-symbols=report-all", - "-Wl,--warn-common", - "-Wl,--warn-section-align" - ] -) - -user_code_section = BOARD_OPTIONS.get("upload", {}).get("section_start", False) - -if user_code_section: - env.Append( - CPPDEFINES=[ - "printf=iprintf" - ], - - LINKFLAGS=[ - "-Wl,--entry=Reset_Handler", - "-Wl,--section-start=.text=%s" % user_code_section - ] - ) - -if "sam3x8e" in BOARD_OPTIONS.get("build", {}).get("mcu", ""): - env.Append( - CPPDEFINES=[ - "printf=iprintf" - ], - - LINKFLAGS=[ - "-Wl,--entry=Reset_Handler", - "-Wl,--start-group" - ] - - ) -elif "samd" in BOARD_OPTIONS.get("build", {}).get("mcu", ""): - env.Append( - LINKFLAGS=[ - "--specs=nosys.specs", - "--specs=nano.specs" - ] - ) - - -upload_protocol = BOARD_OPTIONS.get("upload", {}).get("protocol", None) - -if upload_protocol == "openocd": - env.Replace( - UPLOADER=join("$PIOPACKAGES_DIR", "tool-openocd", "bin", "openocd"), - UPLOADERFLAGS=[ - "-f", join(BOARD_OPTIONS.get("debug", {}).get("openocdcfg", "")), - "-s", '"%s"' % join("$PIOPACKAGES_DIR", "tool-openocd", - "share", "openocd", "scripts"), - "-s", '"%s"' % join("$PIOPACKAGES_DIR", "tool-openocd", - "share", "openocd", "scripts", "board") - ], - - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS' - ) - - if "zero" in env.subst("$BOARD"): - env.Append( - UPLOADERFLAGS=[ - "-s", '"%s"' % join("$PLATFORMFW_DIR", "variants", - "${BOARD_OPTIONS['build']['variant']}", - "openocd_scripts") - ] - ) - - env.Append( - UPLOADERFLAGS=[ - "-c", ("telnet_port disabled; program {{$SOURCES}} " - "verify reset %s; shutdown" % ( - user_code_section if user_code_section else "")) - ] - ) - -elif upload_protocol == "sam-ba": - - board_type = env.subst("$BOARD") - - env.Replace( - UPLOADER=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_UPLOADER", "bossac"), - UPLOADERFLAGS=[ - "--info", - "--port", '"$UPLOAD_PORT"', - "--erase", - "--write", - "--verify", - "--reset", - "--debug", - "-U", - "true" if ("usb" in board_type.lower( - ) or board_type == "digix") else "false" - ], - - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES' - ) - - if "sam3x8e" in BOARD_OPTIONS.get("build", {}).get("mcu", ""): - env.Append(UPLOADERFLAGS=["--boot"]) - -elif upload_protocol == "stk500v2": - env.Append( - BUILDERS=dict( - ElfToHex=Builder( - action=" ".join([ - "$OBJCOPY", - "-O", - "ihex", - "-R", - ".eeprom", - "$SOURCES", - "$TARGET"]), - suffix=".hex" - ) - ) - ) - - env.Replace( - UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"), - UPLOADERFLAGS=[ - "-C", '"%s"' % join("$PIOPACKAGES_DIR", - "tool-avrdude", "avrdude.conf"), - "-v", - "-p", "atmega2560", # Arduino M0/Tian upload hook - "-c", "$UPLOAD_PROTOCOL", - "-P", '"$UPLOAD_PORT"', - "-b", "$UPLOAD_SPEED" - ], - - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS -U flash:w:$SOURCES:i' - ) - -# -# Target: Build executable and linkable firmware -# - -target_elf = env.BuildProgram() - -# -# Target: Build the .bin file -# - -if "uploadlazy" in COMMAND_LINE_TARGETS: - target_firm = join("$BUILD_DIR", "firmware.bin") -elif upload_protocol == "stk500v2": - target_firm = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf) -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 -# - -if upload_protocol == "openocd": - upload = env.Alias(["upload", "uploadlazy"], target_firm, "$UPLOADCMD") -else: - upload = env.Alias( - ["upload", "uploadlazy"], target_firm, - [env.AutodetectUploadPort, BeforeUpload, "$UPLOADCMD"]) - -AlwaysBuild(upload) - -# -# Setup default targets -# - -Default([target_firm, target_size]) diff --git a/platformio/builder/scripts/basearm.py b/platformio/builder/scripts/basearm.py deleted file mode 100644 index 20892b18..00000000 --- a/platformio/builder/scripts/basearm.py +++ /dev/null @@ -1,97 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Base for ARM microcontrollers. -""" - -from SCons.Script import Builder, DefaultEnvironment - -env = DefaultEnvironment() - -env.Replace( - AR="arm-none-eabi-ar", - AS="arm-none-eabi-as", - CC="arm-none-eabi-gcc", - CXX="arm-none-eabi-g++", - OBJCOPY="arm-none-eabi-objcopy", - RANLIB="arm-none-eabi-ranlib", - SIZETOOL="arm-none-eabi-size", - - ARFLAGS=["rcs"], - - ASFLAGS=["-x", "assembler-with-cpp"], - - CCFLAGS=[ - "-g", # include debugging info (so errors include line numbers) - "-Os", # optimize for size - "-ffunction-sections", # place each function in its own section - "-fdata-sections", - "-Wall", - "-mthumb", - "-mcpu=${BOARD_OPTIONS['build']['cpu']}", - "-nostdlib" - ], - - CXXFLAGS=[ - "-fno-rtti", - "-fno-exceptions" - ], - - CPPDEFINES=[ - "F_CPU=$BOARD_F_CPU" - ], - - LINKFLAGS=[ - "-Os", - "-Wl,--gc-sections,--relax", - "-mthumb", - "-mcpu=${BOARD_OPTIONS['build']['cpu']}" - ], - - LIBS=["c", "gcc", "m"], - - SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES', - - PROGNAME="firmware", - PROGSUFFIX=".elf" -) - - -env.Append( - ASFLAGS=env.get("CCFLAGS", [])[:], - - BUILDERS=dict( - ElfToBin=Builder( - action=" ".join([ - "$OBJCOPY", - "-O", - "binary", - "$SOURCES", - "$TARGET"]), - suffix=".bin" - ), - ElfToHex=Builder( - action=" ".join([ - "$OBJCOPY", - "-O", - "ihex", - "-R", - ".eeprom", - "$SOURCES", - "$TARGET"]), - suffix=".hex" - ) - ) -) diff --git a/platformio/builder/scripts/baseavr.py b/platformio/builder/scripts/baseavr.py deleted file mode 100644 index 055fb742..00000000 --- a/platformio/builder/scripts/baseavr.py +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Base for Atmel AVR series of microcontrollers -""" - -from SCons.Script import Builder, DefaultEnvironment - -env = DefaultEnvironment() - -env.Replace( - AR="avr-ar", - AS="avr-as", - CC="avr-gcc", - CXX="avr-g++", - OBJCOPY="avr-objcopy", - RANLIB="avr-ranlib", - SIZETOOL="avr-size", - - ARFLAGS=["rcs"], - - ASFLAGS=["-x", "assembler-with-cpp"], - - CCFLAGS=[ - "-g", # include debugging info (so errors include line numbers) - "-Os", # optimize for size - "-Wall", # show warnings - "-ffunction-sections", # place each function in its own section - "-fdata-sections", - "-mmcu=$BOARD_MCU" - ], - - CXXFLAGS=[ - "-fno-exceptions", - "-fno-threadsafe-statics" - ], - - CPPDEFINES=["F_CPU=$BOARD_F_CPU"], - - LINKFLAGS=[ - "-Os", - "-mmcu=$BOARD_MCU", - "-Wl,--gc-sections,--relax" - ], - - LIBS=["m"], - - SIZEPRINTCMD='"$SIZETOOL" --mcu=$BOARD_MCU -C -d $SOURCES', - - PROGNAME="firmware", - PROGSUFFIX=".elf" -) - -env.Append( - ASFLAGS=env.get("CCFLAGS", [])[:], - - BUILDERS=dict( - ElfToEep=Builder( - action=" ".join([ - "$OBJCOPY", - "-O", - "ihex", - "-j", - ".eeprom", - '--set-section-flags=.eeprom="alloc,load"', - "--no-change-warnings", - "--change-section-lma", - ".eeprom=0", - "$SOURCES", - "$TARGET"]), - suffix=".eep" - ), - - ElfToHex=Builder( - action=" ".join([ - "$OBJCOPY", - "-O", - "ihex", - "-R", - ".eeprom", - "$SOURCES", - "$TARGET"]), - suffix=".hex" - ) - ) -) diff --git a/platformio/builder/scripts/espressif.py b/platformio/builder/scripts/espressif.py deleted file mode 100644 index d9cef77b..00000000 --- a/platformio/builder/scripts/espressif.py +++ /dev/null @@ -1,356 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# pylint: disable=redefined-outer-name - -""" - Builder for Espressif MCUs -""" - -import re -from os.path import join - -from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, - DefaultEnvironment) - - -def _get_flash_size(env): - # use board's flash size by default - board_max_size = int( - env.get("BOARD_OPTIONS", {}).get("upload", {}).get("maximum_size", 0)) - - # check if user overrides LD Script - match = re.search(r"\.flash\.(\d+)(m|k).*\.ld", env.GetActualLDScript()) - if match: - if match.group(2) == "k": - board_max_size = int(match.group(1)) * 1024 - elif match.group(2) == "m": - board_max_size = int(match.group(1)) * 1024 * 1024 - - return ("%dK" % (board_max_size / 1024) if board_max_size < 1048576 - else "%dM" % (board_max_size / 1048576)) - - -def _get_board_f_flash(env): - frequency = env.subst("$BOARD_F_FLASH") - frequency = str(frequency).replace("L", "") - return int(int(frequency) / 1000000) - - -env = DefaultEnvironment() - -env.Replace( - __get_flash_size=_get_flash_size, - __get_board_f_flash=_get_board_f_flash, - - AR="xtensa-lx106-elf-ar", - AS="xtensa-lx106-elf-as", - CC="xtensa-lx106-elf-gcc", - CXX="xtensa-lx106-elf-g++", - OBJCOPY=join("$PIOPACKAGES_DIR", "tool-esptool", "esptool"), - RANLIB="xtensa-lx106-elf-ranlib", - SIZETOOL="xtensa-lx106-elf-size", - - ARFLAGS=["rcs"], - - ASFLAGS=["-x", "assembler-with-cpp"], - - CFLAGS=[ - "-std=gnu99", - "-Wpointer-arith", - "-Wno-implicit-function-declaration", - "-Wl,-EL", - "-fno-inline-functions", - "-nostdlib" - ], - - CCFLAGS=[ - "-Os", # optimize for size - "-mlongcalls", - "-mtext-section-literals", - "-falign-functions=4", - "-U__STRICT_ANSI__", - "-ffunction-sections", - "-fdata-sections" - ], - - CXXFLAGS=[ - "-fno-rtti", - "-fno-exceptions", - "-std=c++11" - ], - - CPPDEFINES=[ - "F_CPU=$BOARD_F_CPU", - "__ets__", - "ICACHE_FLASH" - ], - - LINKFLAGS=[ - "-Os", - "-nostdlib", - "-Wl,--no-check-sections", - "-u", "call_user_start", - "-Wl,-static", - "-Wl,--gc-sections" - ], - - # - # Upload - # - - UPLOADER=join("$PIOPACKAGES_DIR", "tool-esptool", "esptool"), - UPLOADEROTA=join("$PLATFORMFW_DIR", "tools", "espota.py"), - - UPLOADERFLAGS=[ - "-vv", - "-cd", "$UPLOAD_RESETMETHOD", - "-cb", "$UPLOAD_SPEED", - "-cp", '"$UPLOAD_PORT"' - ], - UPLOADEROTAFLAGS=[ - "--debug", - "--progress", - "-i", "$UPLOAD_PORT", - "$UPLOAD_FLAGS" - ], - - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS -cf $SOURCE', - UPLOADOTACMD='"$PYTHONEXE" "$UPLOADEROTA" $UPLOADEROTAFLAGS -f $SOURCE', - - # - # Misc - # - - MKSPIFFSTOOL=join("$PIOPACKAGES_DIR", "tool-mkspiffs", "mkspiffs"), - SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES', - - PROGNAME="firmware", - PROGSUFFIX=".elf" -) - -env.Append( - ASFLAGS=env.get("CCFLAGS", [])[:], - - BUILDERS=dict( - ElfToBin=Builder( - action=" ".join([ - '"$OBJCOPY"', - "-eo", - '"%s"' % join("$PLATFORMFW_DIR", "bootloaders", - "eboot", "eboot.elf"), - "-bo", "$TARGET", - "-bm", "$BOARD_FLASH_MODE", - "-bf", "${__get_board_f_flash(__env__)}", - "-bz", "${__get_flash_size(__env__)}", - "-bs", ".text", - "-bp", "4096", - "-ec", - "-eo", "$SOURCES", - "-bs", ".irom0.text", - "-bs", ".text", - "-bs", ".data", - "-bs", ".rodata", - "-bc", "-ec" - ]), - suffix=".bin" - ) - ) -) - - -# -# SPIFFS -# - -def _fetch_spiffs_size(target, source, env): - spiffs_re = re.compile( - r"PROVIDE\s*\(\s*_SPIFFS_(\w+)\s*=\s*(0x[\dA-F]+)\s*\)") - with open(env.GetActualLDScript()) as f: - for line in f.readlines(): - match = spiffs_re.search(line) - if not match: - continue - env["SPIFFS_%s" % match.group(1).upper()] = match.group(2) - - assert all([k in env for k in ["SPIFFS_START", "SPIFFS_END", "SPIFFS_PAGE", - "SPIFFS_BLOCK"]]) - - # esptool flash starts from 0 - for k in ("SPIFFS_START", "SPIFFS_END"): - _value = 0 - if int(env[k], 16) < 0x40300000: - _value = int(env[k], 16) & 0xFFFFF - else: - _value = int(env[k], 16) & 0xFFFFFF - _value -= 0x200000 # esptool offset - - env[k] = hex(_value) - - return (target, source) - - -env.Append( - BUILDERS=dict( - DataToBin=Builder( - action=" ".join([ - '"$MKSPIFFSTOOL"', - "-c", "$SOURCES", - "-p", "${int(SPIFFS_PAGE, 16)}", - "-b", "${int(SPIFFS_BLOCK, 16)}", - "-s", "${int(SPIFFS_END, 16) - int(SPIFFS_START, 16)}", - "$TARGET" - ]), - emitter=_fetch_spiffs_size, - source_factory=env.Dir, - suffix=".bin" - ) - ) -) - -if "uploadfs" in COMMAND_LINE_TARGETS: - env.Append( - UPLOADERFLAGS=["-ca", "$SPIFFS_START"], - UPLOADEROTAFLAGS=["-s"] - ) - -# -# Framework and SDK specific configuration -# - -if "FRAMEWORK" in env: - env.Append( - LINKFLAGS=[ - "-Wl,-wrap,system_restart_local", - "-Wl,-wrap,register_chipv6_phy" - ] - ) - - # Handle uploading via OTA - ota_port = None - if env.get("UPLOAD_PORT"): - ota_port = re.match( - r"\"?((([0-9]{1,3}\.){3}[0-9]{1,3})|.+\.local)\"?$", - env.get("UPLOAD_PORT")) - if ota_port: - env.Replace(UPLOADCMD="$UPLOADOTACMD") - -# Configure native SDK -else: - env.Append( - CPPPATH=[ - join("$PIOPACKAGES_DIR", "sdk-esp8266", "include"), - "$PROJECTSRC_DIR" - ], - - LIBPATH=[ - join("$PIOPACKAGES_DIR", "sdk-esp8266", "lib"), - join("$PIOPACKAGES_DIR", "sdk-esp8266", "ld") - ], - - BUILDERS=dict( - ElfToBin=Builder( - action=" ".join([ - '"$OBJCOPY"', - "-eo", "$SOURCES", - "-bo", "${TARGETS[0]}", - "-bm", "$BOARD_FLASH_MODE", - "-bf", "${__get_board_f_flash(__env__)}", - "-bz", "${__get_flash_size(__env__)}", - "-bs", ".text", - "-bs", ".data", - "-bs", ".rodata", - "-bc", "-ec", - "-eo", "$SOURCES", - "-es", ".irom0.text", "${TARGETS[1]}", - "-ec", "-v" - ]), - suffix=".bin" - ) - ) - ) - env.Replace( - LIBS=[ - "c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "wpa2", - "main", "wps", "crypto", "json", "ssl", "pwm", "upgrade", - "smartconfig", "airkiss", "at" - ], - - UPLOADERFLAGS=[ - "-vv", - "-cd", "$UPLOAD_RESETMETHOD", - "-cb", "$UPLOAD_SPEED", - "-cp", '"$UPLOAD_PORT"', - "-ca", "0x00000", - "-cf", "${SOURCES[0]}", - "-ca", "0x40000", - "-cf", "${SOURCES[1]}" - ], - - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS', - ) - -# -# Target: Build executable and linkable firmware -# - -target_elf = env.BuildProgram() - -# -# Target: Build the .hex or SPIFFS image -# - -if set(["uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS): - target_firm = env.DataToBin( - join("$BUILD_DIR", "spiffs"), "$PROJECTDATA_DIR") - AlwaysBuild(target_firm) - -elif "uploadlazy" in COMMAND_LINE_TARGETS: - if "FRAMEWORK" not in env: - target_firm = [ - join("$BUILD_DIR", "firmware_00000.bin"), - join("$BUILD_DIR", "firmware_40000.bin") - ] - else: - target_firm = join("$BUILD_DIR", "firmware.bin") -else: - if "FRAMEWORK" not in env: - target_firm = env.ElfToBin( - [join("$BUILD_DIR", "firmware_00000"), - join("$BUILD_DIR", "firmware_40000")], target_elf) - 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 firmware or SPIFFS image -# - -target_upload = env.Alias( - ["upload", "uploadlazy", "uploadfs"], target_firm, - [env.AutodetectUploadPort, "$UPLOADCMD"]) -env.AlwaysBuild(target_upload) - - -# -# Target: Define targets -# - -Default([target_firm, target_size]) diff --git a/platformio/builder/scripts/frameworks/__init__.py b/platformio/builder/scripts/frameworks/__init__.py deleted file mode 100644 index 0c05c3b0..00000000 --- a/platformio/builder/scripts/frameworks/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. diff --git a/platformio/builder/scripts/frameworks/arduino.py b/platformio/builder/scripts/frameworks/arduino.py deleted file mode 100644 index 17300c75..00000000 --- a/platformio/builder/scripts/frameworks/arduino.py +++ /dev/null @@ -1,372 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Arduino - -Arduino Wiring-based Framework allows writing cross-platform software to -control devices attached to a wide range of Arduino boards to create all -kinds of creative coding, interactive objects, spaces or physical experiences. - -http://arduino.cc/en/Reference/HomePage -""" - -from os import listdir, walk -from os.path import isdir, isfile, join - -from SCons.Script import DefaultEnvironment - -env = DefaultEnvironment() - -BOARD_OPTS = env.get("BOARD_OPTIONS", {}) -BOARD_BUILDOPTS = BOARD_OPTS.get("build", {}) -BOARD_CORELIBDIRNAME = BOARD_BUILDOPTS.get("core") - -# -# Determine framework directory -# based on development platform -# - -PLATFORMFW_DIR = join("$PIOPACKAGES_DIR", - "framework-arduino${PLATFORM.replace('atmel', '')}") - -if "digispark" in BOARD_BUILDOPTS.get("core"): - BOARD_CORELIBDIRNAME = "digispark" - PLATFORMFW_DIR = join( - "$PIOPACKAGES_DIR", - "framework-arduino%s" % ( - "sam" if BOARD_BUILDOPTS.get("cpu") == "cortex-m3" else "avr") - ) -elif env.get("PLATFORM") == "timsp430": - PLATFORMFW_DIR = join( - "$PIOPACKAGES_DIR", - "framework-arduinomsp430" - ) -elif env.get("PLATFORM") == "espressif": - env.Prepend( - CPPDEFINES=["LWIP_OPEN_SRC"], - CPPPATH=[ - join("$PLATFORMFW_DIR", "tools", "sdk", "include"), - join("$PLATFORMFW_DIR", "tools", "sdk", "lwip", "include") - ], - LIBPATH=[join("$PLATFORMFW_DIR", "tools", "sdk", "lib")], - LIBS=[ - "mesh", "wpa2", "smartconfig", "pp", "main", "wpa", "lwip_gcc", - "net80211", "wps", "crypto", "phy", "hal", "axtls", "gcc", - "m", "stdc++" - ] - ) - env.VariantDirWrap( - join("$BUILD_DIR", "generic"), - join("$PIOPACKAGES_DIR", "framework-arduinoespressif", - "variants", "generic") - ) - -elif env.get("PLATFORM") == "nordicnrf51": - PLATFORMFW_DIR = join( - "$PIOPACKAGES_DIR", - "framework-arduinonordicnrf51" - ) - env.Prepend( - CPPPATH=[ - join("$PLATFORMFW_DIR", "system", "CMSIS", "CMSIS", "Include"), - join("$PLATFORMFW_DIR", "system", "RFduino"), - join("$PLATFORMFW_DIR", "system", "RFduino", "include") - ], - LIBPATH=[ - join( - "$PLATFORMFW_DIR", - "variants", - "${BOARD_OPTIONS['build']['variant']}" - ), - join( - "$PLATFORMFW_DIR", - "variants", - "${BOARD_OPTIONS['build']['variant']}", - "linker_scripts", - "gcc" - ), - ], - LIBS=["RFduino", "RFduinoBLE", "RFduinoGZLL", "RFduinoSystem"] - ) - -elif env.get("PLATFORM") == "microchippic32": - PLATFORMFW_DIR = join( - "$PIOPACKAGES_DIR", - "framework-arduinomicrochippic32" - ) - env.Prepend( - LIBPATH=[ - join( - "$PLATFORMFW_DIR", "cores", - "${BOARD_OPTIONS['build']['core']}" - ), - join( - "$PLATFORMFW_DIR", "variants", - "${BOARD_OPTIONS['build']['variant']}" - ) - ], - - CPPDEFINES=["ARDUINO_ARCH_PIC32"] - - ) - -elif "intel" in env.get("PLATFORM"): - PLATFORMFW_DIR = join( - "$PIOPACKAGES_DIR", - "framework-arduinointel" - ) - - if BOARD_CORELIBDIRNAME == "arc32": - env.Prepend( - CPPPATH=[ - join("$PLATFORMFW_DIR", "system", - "libarc32_arduino101", "drivers"), - join("$PLATFORMFW_DIR", "system", - "libarc32_arduino101", "common"), - join("$PLATFORMFW_DIR", "system", - "libarc32_arduino101", "framework", "include"), - join("$PLATFORMFW_DIR", "system", - "libarc32_arduino101", "bootcode"), - join("$BUILD_DIR", "IntelDrivers") - ] - ) - - env.Prepend( - LIBPATH=[ - join( - "$PLATFORMFW_DIR", "variants", - "${BOARD_OPTIONS['build']['variant']}" - ), - join( - "$PLATFORMFW_DIR", "variants", - "${BOARD_OPTIONS['build']['variant']}", - "linker_scripts" - ) - ] - ) - -env.Replace(PLATFORMFW_DIR=PLATFORMFW_DIR) - -# -# Lookup for specific core's libraries -# - -if isdir(join(env.subst("$PLATFORMFW_DIR"), "libraries", "__cores__", - BOARD_CORELIBDIRNAME)): - lib_dirs = env.get("LIBSOURCE_DIRS") - lib_dirs.insert( - lib_dirs.index(join("$PLATFORMFW_DIR", "libraries")), - join(PLATFORMFW_DIR, "libraries", "__cores__", BOARD_CORELIBDIRNAME) - ) - env.Replace( - LIBSOURCE_DIRS=lib_dirs - ) - -# -# Base -# - -ARDUINO_VERSION = int( - open(join(env.subst("$PLATFORMFW_DIR"), - "version.txt")).read().replace(".", "").strip()) - -# usb flags -ARDUINO_USBDEFINES = [] -if "usb_product" in BOARD_BUILDOPTS: - ARDUINO_USBDEFINES = [ - "USB_VID=${BOARD_OPTIONS['build']['hwids'][0][0]}", - "USB_PID=${BOARD_OPTIONS['build']['hwids'][0][1]}", - 'USB_PRODUCT=\\"%s\\"' % (env.subst( - "${BOARD_OPTIONS['build']['usb_product']}").replace('"', "")), - 'USB_MANUFACTURER=\\"%s\\"' % (env.subst( - "${BOARD_OPTIONS['vendor']}").replace('"', "")) - ] - -if env.get("PLATFORM") == "teensy": - ARDUINO_USBDEFINES += [ - "ARDUINO=10600", - "TEENSYDUINO=%d" % ARDUINO_VERSION - ] - - USB_FLAGS = ( - "USB_HID", - "USB_SERIAL_HID", - "USB_DISK", - "USB_DISK_SDFLASH", - "USB_MIDI", - "USB_RAWHID", - "USB_FLIGHTSIM", - "USB_DISABLED" - ) - - if not any(f in env.get("BUILD_FLAGS", []) for f in USB_FLAGS): - env.Append(CPPDEFINES=["USB_SERIAL"]) -else: - ARDUINO_USBDEFINES += ["ARDUINO=%d" % ARDUINO_VERSION] - -env.Append( - CPPDEFINES=ARDUINO_USBDEFINES, - - CPPPATH=[ - join("$BUILD_DIR", "FrameworkArduino") - ] -) - -# -# Atmel SAM platform -# - -if env.subst("${PLATFORMFW_DIR}")[-3:] == "sam": - env.VariantDirWrap( - join("$BUILD_DIR", "FrameworkCMSISInc"), - join( - "$PLATFORMFW_DIR", "system", - "CMSIS%s" % ( - "_ORG" if BOARD_CORELIBDIRNAME.endswith("_org") else ""), - "CMSIS", "Include" - ) - ) - env.VariantDirWrap( - join("$BUILD_DIR", "FrameworkDeviceInc"), - join( - "$PLATFORMFW_DIR", "system", - "CMSIS%s" % ( - "_ORG" if BOARD_CORELIBDIRNAME.endswith("_org") else ""), - "Device", "ATMEL" - ) - ) - env.VariantDirWrap( - join("$BUILD_DIR", "FrameworkLibSam"), - join("$PLATFORMFW_DIR", "system", "libsam") - ) - - env.VariantDirWrap( - join("$BUILD_DIR", "FrameworkArduinoInc"), - join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}") - ) - env.Append( - CPPPATH=[ - join("$BUILD_DIR", "FrameworkCMSISInc"), - join("$BUILD_DIR", "FrameworkLibSam"), - join("$BUILD_DIR", "FrameworkLibSam", "include"), - join("$BUILD_DIR", "FrameworkDeviceInc"), - join( - "$BUILD_DIR", - "FrameworkDeviceInc", - "${BOARD_OPTIONS['build']['mcu'][3:]}", - "include" - ) - ], - - LIBPATH=[ - join( - "$PLATFORMFW_DIR", - "variants", - "${BOARD_OPTIONS['build']['variant']}", - "linker_scripts", - "gcc" - ) - ] - ) - - # search relative includes in lib SAM directories - core_dir = join(env.subst("$PLATFORMFW_DIR"), "system", "libsam") - for root, _, files in walk(core_dir): - for lib_file in files: - file_path = join(root, lib_file) - if not isfile(file_path): - continue - content = None - content_changed = False - with open(file_path) as fp: - content = fp.read() - if '#include "../' in content: - content_changed = True - content = content.replace('#include "../', '#include "') - if not content_changed: - continue - with open(file_path, "w") as fp: - fp.write(content) - -# -# Teensy platform -# - -# Teensy 2.x Core -if BOARD_BUILDOPTS.get("core", None) == "teensy": - # search relative includes in teensy directories - core_dir = join(env.get("PIOHOME_DIR"), "packages", - "framework-arduinoteensy", "cores", "teensy") - for item in sorted(listdir(core_dir)): - file_path = join(core_dir, item) - if not isfile(file_path): - continue - content = None - content_changed = False - with open(file_path) as fp: - content = fp.read() - if '#include "../' in content: - content_changed = True - content = content.replace('#include "../', '#include "') - if not content_changed: - continue - with open(file_path, "w") as fp: - fp.write(content) - - env.Append(CPPPATH=[join("$PLATFORMFW_DIR", "cores")]) - -# -# Target: Build Core Library -# - -libs = [] - -if "variant" in BOARD_BUILDOPTS: - env.Append( - CPPPATH=[ - join("$BUILD_DIR", "FrameworkArduinoVariant") - ] - ) - libs.append(env.BuildLibrary( - join("$BUILD_DIR", "FrameworkArduinoVariant"), - join("$PLATFORMFW_DIR", "variants", - "${BOARD_OPTIONS['build']['variant']}") - )) - -envsafe = env.Clone() - -if BOARD_BUILDOPTS.get("core", None) == "teensy3": - libs.append("arm_cortex%sl_math" % ( - "M4" if BOARD_BUILDOPTS.get("cpu") == "cortex-m4" else "M0")) - -if env.subst("$BOARD") == "genuino101": - libs.append("libarc32drv_arduino101") - -libs.append(envsafe.BuildLibrary( - join("$BUILD_DIR", "FrameworkArduino"), - join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}") -)) - -if "sam3x8e" in BOARD_BUILDOPTS.get("mcu", ""): - env.Append( - LIBPATH=[ - join("$PLATFORMFW_DIR", "variants", - "${BOARD_OPTIONS['build']['variant']}") - ] - ) - - libs.append("sam_sam3x8e_gcc_rel") - -env.Prepend(LIBS=libs) diff --git a/platformio/builder/scripts/frameworks/cmsis.py b/platformio/builder/scripts/frameworks/cmsis.py deleted file mode 100644 index e0ea99d5..00000000 --- a/platformio/builder/scripts/frameworks/cmsis.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -CMSIS - -The ARM Cortex Microcontroller Software Interface Standard (CMSIS) is a -vendor-independent hardware abstraction layer for the Cortex-M processor -series and specifies debugger interfaces. The CMSIS enables consistent and -simple software interfaces to the processor for interface peripherals, -real-time operating systems, and middleware. It simplifies software -re-use, reducing the learning curve for new microcontroller developers -and cutting the time-to-market for devices. - -http://www.arm.com/products/processors/cortex-m/cortex-microcontroller-software-interface-standard.php -""" - -from os.path import isfile, join - -from SCons.Script import DefaultEnvironment - -env = DefaultEnvironment() - -env.Replace( - PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-cmsis") -) - -env.VariantDirWrap( - join("$BUILD_DIR", "FrameworkCMSIS"), - join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}") -) - -env.Append( - CPPPATH=[ - join("$BUILD_DIR", "FrameworkCMSIS"), - join("$BUILD_DIR", "FrameworkCMSISCommon"), - join("$BUILD_DIR", "FrameworkCMSISVariant") - ] -) - -envsafe = env.Clone() - -# -# Target: Build Core Library -# - -# use mbed ldscript with bootloader section -ldscript = env.get("BOARD_OPTIONS", {}).get("build", {}).get("ldscript") -if not isfile(join(env.subst("$PIOPACKAGES_DIR"), "ldscripts", ldscript)): - if "mbed" in env.get("BOARD_OPTIONS", {}).get("frameworks", {}): - env.Append( - LINKFLAGS=[ - '-Wl,-T"%s"' % - join( - "$PIOPACKAGES_DIR", "framework-mbed", "variant", - env.subst("$BOARD").upper(), "mbed", - "TARGET_%s" % env.subst( - "$BOARD").upper(), "TOOLCHAIN_GCC_ARM", - "%s.ld" % ldscript.upper()[:-3] - ) - ] - ) - -libs = [] -libs.append(envsafe.BuildLibrary( - join("$BUILD_DIR", "FrameworkCMSISVariant"), - join( - "$PLATFORMFW_DIR", "variants", - env.subst("${BOARD_OPTIONS['build']['variant']}")[0:7], - "${BOARD_OPTIONS['build']['variant']}" - ) -)) - -libs.append(envsafe.BuildLibrary( - join("$BUILD_DIR", "FrameworkCMSISCommon"), - join( - "$PLATFORMFW_DIR", "variants", - env.subst("${BOARD_OPTIONS['build']['variant']}")[0:7], "common" - ) -)) - -env.Append(LIBS=libs) diff --git a/platformio/builder/scripts/frameworks/energia.py b/platformio/builder/scripts/frameworks/energia.py deleted file mode 100644 index 24bc9760..00000000 --- a/platformio/builder/scripts/frameworks/energia.py +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Energia - -Energia Wiring-based framework enables pretty much anyone to start easily -creating microcontroller-based projects and applications. Its easy-to-use -libraries and functions provide developers of all experience levels to start -blinking LEDs, buzzing buzzers and sensing sensors more quickly than ever -before. - -http://energia.nu/reference/ -""" - -from os.path import join - -from SCons.Script import DefaultEnvironment - -env = DefaultEnvironment() - -env.Replace( - PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-energia${PLATFORM[2:]}") -) - -ENERGIA_VERSION = int( - open(join(env.subst("$PLATFORMFW_DIR"), - "version.txt")).read().replace(".", "").strip()) - -# include board variant -env.VariantDirWrap( - join("$BUILD_DIR", "FrameworkEnergiaVariant"), - join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}") -) - -env.Append( - CPPDEFINES=[ - "ARDUINO=101", - "ENERGIA=%d" % ENERGIA_VERSION - ], - CPPPATH=[ - join("$BUILD_DIR", "FrameworkEnergia"), - join("$BUILD_DIR", "FrameworkEnergiaVariant") - ] -) - -if env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "lm4f": - env.Append( - LINKFLAGS=["-Wl,--entry=ResetISR"] - ) - -# -# Target: Build Core Library -# - -libs = [] - -libs.append(env.BuildLibrary( - join("$BUILD_DIR", "FrameworkEnergia"), - join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}") -)) - -env.Append(LIBS=libs) diff --git a/platformio/builder/scripts/frameworks/libopencm3.py b/platformio/builder/scripts/frameworks/libopencm3.py deleted file mode 100644 index e48e61a3..00000000 --- a/platformio/builder/scripts/frameworks/libopencm3.py +++ /dev/null @@ -1,191 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -libOpenCM3 - -The libOpenCM3 framework aims to create a free/libre/open-source -firmware library for various ARM Cortex-M0(+)/M3/M4 microcontrollers, -including ST STM32, Ti Tiva and Stellaris, NXP LPC 11xx, 13xx, 15xx, -17xx parts, Atmel SAM3, Energy Micro EFM32 and others. - -http://www.libopencm3.org/wiki/Main_Page -""" - -from __future__ import absolute_import - -import re -from os import listdir, sep, walk -from os.path import isfile, join, normpath - -from SCons.Script import DefaultEnvironment - -from platformio.util import exec_command - -env = DefaultEnvironment() - -env.Replace( - PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-libopencm3") -) - -BOARD_BUILDOPTS = env.get("BOARD_OPTIONS", {}).get("build", {}) - - -def find_ldscript(src_dir): - ldscript = None - matches = [] - for item in sorted(listdir(src_dir)): - _path = join(src_dir, item) - if not isfile(_path) or not item.endswith(".ld"): - continue - matches.append(_path) - - if len(matches) == 1: - ldscript = matches[0] - elif isfile(join(src_dir, BOARD_BUILDOPTS['ldscript'])): - ldscript = join(src_dir, BOARD_BUILDOPTS['ldscript']) - - return ldscript - - -def generate_nvic_files(): - fw_dir = env.subst("$PLATFORMFW_DIR") - for root, _, files in walk(join(fw_dir, "include", "libopencm3")): - if "irq.json" not in files or isfile(join(root, "nvic.h")): - continue - - exec_command( - ["python", join("scripts", "irq2nvic_h"), - join("." + root.replace(fw_dir, ""), - "irq.json").replace("\\", "/")], - cwd=fw_dir - ) - - -def parse_makefile_data(makefile): - data = {"includes": [], "objs": [], "vpath": ["./"]} - - with open(makefile) as f: - content = f.read() - - # fetch "includes" - re_include = re.compile(r"^include\s+([^\r\n]+)", re.M) - for match in re_include.finditer(content): - data['includes'].append(match.group(1)) - - # fetch "vpath"s - re_vpath = re.compile(r"^VPATH\s+\+?=\s+([^\r\n]+)", re.M) - for match in re_vpath.finditer(content): - data['vpath'] += match.group(1).split(":") - - # fetch obj files - objs_match = re.search( - r"^OBJS\s+\+?=\s+([^\.]+\.o\s*(?:\s+\\s+)?)+", content, re.M) - assert objs_match - data['objs'] = re.sub( - r"(OBJS|[\+=\\\s]+)", "\n", objs_match.group(0)).split() - return data - - -def get_source_files(src_dir): - mkdata = parse_makefile_data(join(src_dir, "Makefile")) - - for include in mkdata['includes']: - _mkdata = parse_makefile_data(normpath(join(src_dir, include))) - for key, value in _mkdata.iteritems(): - for v in value: - if v not in mkdata[key]: - mkdata[key].append(v) - - sources = [] - lib_root = env.subst("$PLATFORMFW_DIR") - for obj_file in mkdata['objs']: - src_file = obj_file[:-1] + "c" - for search_path in mkdata['vpath']: - src_path = normpath(join(src_dir, search_path, src_file)) - if isfile(src_path): - sources.append(join("$BUILD_DIR", "FrameworkLibOpenCM3", - src_path.replace(lib_root + sep, ""))) - break - return sources - - -def merge_ld_scripts(main_ld_file): - - def _include_callback(match): - included_ld_file = match.group(1) - # search included ld file in lib directories - for root, _, files in walk(env.subst(join("$PLATFORMFW_DIR", "lib"))): - if included_ld_file not in files: - continue - with open(join(root, included_ld_file)) as fp: - return fp.read() - return match.group(0) - - content = "" - with open(main_ld_file) as f: - content = f.read() - - incre = re.compile(r"^INCLUDE\s+\"?([^\.]+\.ld)\"?", re.M) - with open(main_ld_file, "w") as f: - f.write(incre.sub(_include_callback, content)) - -# -# Processing ... -# - -if BOARD_BUILDOPTS.get("core") == "lm4f": - env.Append( - CPPDEFINES=["LM4F"] - ) - -env.VariantDirWrap( - join("$BUILD_DIR", "FrameworkLibOpenCM3Variant"), - join("$PLATFORMFW_DIR", "include") -) - -env.Append( - CPPPATH=[ - join("$BUILD_DIR", "FrameworkLibOpenCM3"), - join("$BUILD_DIR", "FrameworkLibOpenCM3Variant") - ] -) - -root_dir = env.subst( - join("$PLATFORMFW_DIR", "lib", BOARD_BUILDOPTS.get("core"))) -if BOARD_BUILDOPTS.get("core") == "stm32": - root_dir = join(root_dir, BOARD_BUILDOPTS.get("variant")[5:7]) - -ldscript_path = find_ldscript(root_dir) -if ldscript_path: - merge_ld_scripts(ldscript_path) -generate_nvic_files() - -# override ldscript by libopencm3 -assert "LDSCRIPT_PATH" in env -env.Replace( - LDSCRIPT_PATH=ldscript_path -) - -libs = [] -env.VariantDirWrap( - join("$BUILD_DIR", "FrameworkLibOpenCM3"), - "$PLATFORMFW_DIR" -) -libs.append(env.Library( - join("$BUILD_DIR", "FrameworkLibOpenCM3"), - get_source_files(root_dir) -)) - -env.Append(LIBS=libs) diff --git a/platformio/builder/scripts/frameworks/mbed.py b/platformio/builder/scripts/frameworks/mbed.py deleted file mode 100644 index 76aca7fa..00000000 --- a/platformio/builder/scripts/frameworks/mbed.py +++ /dev/null @@ -1,349 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -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. - -http://mbed.org/ -""" - -from __future__ import print_function - -import json -import re -import sys -import xml.etree.ElementTree as ElementTree -from binascii import crc32 -from os import walk -from os.path import basename, isfile, join, normpath - -from SCons.Script import DefaultEnvironment - -env = DefaultEnvironment() - -BOARD_OPTS = env.get("BOARD_OPTIONS", {}).get("build", {}) - -env.Replace( - PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-mbed") -) - -MBED_VARIANTS = { - "blueboard_lpc11u24": "LPC11U24", - "dipcortexm0": "LPC11U24", - "seeeduinoArchPro": "ARCH_PRO", - "seeedArchMax": "ARCH_MAX", - "ubloxc027": "UBLOX_C027", - "lpc1114fn28": "LPC1114", - "lpc11u35": "LPC11U35_401", - "mbuino": "LPC11U24", - "nrf51_mkit": "NRF51822", - "seeedTinyBLE": "SEEED_TINY_BLE", - "redBearLab": "RBLAB_NRF51822", - "nrf51-dt": "NRF51_DK", - "redBearLabBLENano": "RBLAB_BLENANO", - "wallBotBLE": "NRF51822", - "frdm_kl25z": "KL25Z", - "frdm_kl46z": "KL46Z", - "frdm_k64f": "K64F", - "frdm_kl05z": "KL05Z", - "frdm_k20d50m": "K20D50M", - "frdm_k22f": "K22F", - "teensy31": "TEENSY3_1", - "dfcm_nnn40": "DELTA_DFCM_NNN40", - "samr21_xpro": "SAMR21G18A", - "saml21_xpro_b": "SAML21J18A", - "samd21_xpro": "SAMD21J18A", - "bbcmicrobit": "NRF51_MICROBIT" -} - -MBED_LIBS_MAP = { - "dsp": {"ar": ["dsp", "cmsis_dsp"]}, - "eth": {"ar": ["eth"], "deps": ["rtos"]}, - "fat": {"ar": ["fat"]}, - "rtos": {"ar": ["rtos", "rtx"]}, - "usb": {"ar": ["USBDevice"]}, - "usb_host": {"ar": ["USBHost"]} -} - - -def get_mbedlib_includes(): - result = [] - for lib in MBED_LIBS_MAP: - includes = [] - lib_dir = join(env.subst("$PLATFORMFW_DIR"), "libs", lib) - for _, _, files in walk(lib_dir): - for libfile in files: - if libfile.endswith(".h"): - includes.append(libfile) - result.append((lib, set(includes))) - return result - - -def get_used_mbedlibs(): - re_includes = re.compile(r"^(#include\s+(?:\<|\")([^\r\n\"]+))", - re.M | re.I) - srcincs = [] - for root, _, files in walk(env.get("PROJECTSRC_DIR")): - for pfile in files: - if not any([pfile.endswith(ext) for ext in (".h", ".c", ".cpp")]): - continue - with open(join(root, pfile)) as fp: - srcincs.extend([i[1] for i in re_includes.findall(fp.read())]) - srcincs = set(srcincs) - - result = {} - for libname, libincs in get_mbedlib_includes(): - if libincs & srcincs and libname not in result: - result[libname] = MBED_LIBS_MAP[libname] - - return result - - -def add_mbedlib(libname, libar): - if libar in env.get("LIBS"): - return - - lib_dir = join(env.subst("$PLATFORMFW_DIR"), "libs", libname) - if not isfile(join(lib_dir, "TARGET_%s" % variant, - "TOOLCHAIN_GCC_ARM", "lib%s.a" % libar)): - print( - "Warning: %s board doesn't have native support for '%s' library!" % - (env.get("BOARD"), libname), file=sys.stderr) - return - - env.Append( - LIBPATH=[ - join(env.subst("$PLATFORMFW_DIR"), "libs", libname, - "TARGET_%s" % variant, "TOOLCHAIN_GCC_ARM") - ], - LIBS=[libar] - ) - - sysincdirs = ( - "eth", - "include", - "ipv4", - "lwip-eth", - "lwip-sys" - ) - - target_map = { - "nxplpc": "NXP", - "freescalekinetis": "Freescale", - "ststm32": "STM" - } - - target_includes = ( - "TARGET_%s" % target_map.get(env.subst("$PLATFORM"), ""), - "TARGET_%s" % variant, - "TARGET_CORTEX_M" - ) - - for root, _, files in walk(lib_dir): - if (not any(f.endswith(".h") for f in files) and - basename(root) not in sysincdirs): - continue - - if "TARGET_" in root: - if all([p not in root for p in target_includes]): - continue - - var_dir = join("$BUILD_DIR", "FrameworkMbed%sInc%d" % - (libname.upper(), crc32(root))) - if var_dir in env.get("CPPPATH"): - continue - env.VariantDirWrap(var_dir, root) - env.Append(CPPPATH=[var_dir]) - - -def parse_eix_file(filename): - result = {} - paths = ( - ("CFLAGS", "./Target/Source/CC/Switch"), - ("CXXFLAGS", "./Target/Source/CPPC/Switch"), - ("CPPDEFINES", "./Target/Source/Symbols/Symbol"), - ("FILES", "./Target/Files/File"), - ("LINKFLAGS", "./Target/Source/LD/Switch"), - ("OBJFILES", "./Target/Source/Addobjects/Addobject"), - ("LIBPATH", "./Target/Linker/Librarypaths/Librarypath"), - ("STDLIBS", "./Target/Source/Syslibs/Library"), - ("LDSCRIPT_PATH", "./Target/Source/Scriptfile"), - ("CPPPATH", "./Target/Compiler/Includepaths/Includepath") - ) - - tree = ElementTree.parse(filename) - - for (key, path) in paths: - if key not in result: - result[key] = [] - - for node in tree.findall(path): - _nkeys = node.keys() - result[key].append( - node.get(_nkeys[0]) if len(_nkeys) == 1 else node.attrib) - - if "LINKFLAGS" in result: - for i, flag in enumerate(result["LINKFLAGS"]): - if flag.startswith("-u "): - result["LINKFLAGS"][i] = result["LINKFLAGS"][i].split(" ") - - return result - - -def get_build_flags(data): - flags = {} - cflags = set(data.get("CFLAGS", [])) - cxxflags = set(data.get("CXXFLAGS", [])) - ccflags = set(cflags & cxxflags) - flags['CCFLAGS'] = list(ccflags) - flags['CXXFLAGS'] = list(cxxflags - ccflags) - flags['CFLAGS'] = list(cflags - ccflags) - return flags - - -def _mbed_whole_archive_hook(libs_): - if (not isinstance(libs_, list) or - env.subst("$PLATFORM") == "nordicnrf51"): - return libs_ - - _dynlibs = [] - _stlibs = [] - for l_ in libs_: - if isinstance(l_, basestring): - _stlibs.append(l_) - else: - _dynlibs.append(l_) - - libs_ = [] - if _dynlibs: - libs_.append("-Wl,-whole-archive") - libs_.extend(_dynlibs) - libs_.append("-Wl,-no-whole-archive") - libs_.extend(_stlibs) - - return libs_ - - -board_type = env.subst("$BOARD") -variant = MBED_VARIANTS[ - board_type] if board_type in MBED_VARIANTS else board_type.upper() -eixdata = parse_eix_file( - join(env.subst("$PLATFORMFW_DIR"), "variant", variant, "%s.eix" % variant)) - -build_flags = get_build_flags(eixdata) -variant_dir = join("$PLATFORMFW_DIR", "variant", variant) - - -def _find_soft_device_hex(): - - if not isfile(join(env.subst("$PLATFORMFW_DIR"), "targets.json")): - return None - - with open(join(env.subst("$PLATFORMFW_DIR"), "targets.json")) as fp: - data = json.load(fp) - - def _find_hex(target_name): - assert isinstance(data, dict) - if target_name not in data: - return None - target = data[target_name] - if "EXPECTED_SOFTDEVICES_WITH_OFFSETS" not in target: - try: - return _find_hex(target.get("inherits", [])[0]) - except IndexError: - return None - else: - return target['EXPECTED_SOFTDEVICES_WITH_OFFSETS'][0]['name'] - - softdevice_name = _find_hex(variant) - if softdevice_name: - for root, _, files in walk(env.subst(variant_dir)): - if softdevice_name in files: - return join(root, softdevice_name) - - env.Exit("Error: Cannot find SoftDevice binary file for your board!") - - -env.Replace( - _mbed_whole_archive_hook=_mbed_whole_archive_hook, - _LIBFLAGS="${_mbed_whole_archive_hook(%s)}" % env.get("_LIBFLAGS")[2:-1], - CCFLAGS=build_flags.get("CCFLAGS", []), - CFLAGS=build_flags.get("CFLAGS", []), - CXXFLAGS=build_flags.get("CXXFLAGS", []), - LINKFLAGS=eixdata.get("LINKFLAGS", []), - CPPDEFINES=[define for define in eixdata.get("CPPDEFINES", [])], - LDSCRIPT_PATH=normpath( - join(variant_dir, eixdata.get("LDSCRIPT_PATH")[0])) -) - - -if env.get("PLATFORM") == "nordicnrf51": - env.Append(SOFTDEVICEHEX=_find_soft_device_hex()) - -# restore external build flags -env.ProcessFlags( - env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags")) -# remove base flags -env.ProcessUnFlags(env.get("BUILD_UNFLAGS")) -# apply user flags -env.ProcessFlags(env.get("BUILD_FLAGS")) - -# Hook for K64F and K22F -if board_type in ("frdm_k22f", "frdm_k64f"): - env.Append( - LINKFLAGS=["-Wl,--start-group"] - ) - -for lib_path in eixdata.get("CPPPATH"): - _vdir = join("$BUILD_DIR", "FrameworkMbedInc%d" % crc32(lib_path)) - env.VariantDirWrap(_vdir, join(variant_dir, lib_path)) - env.Append(CPPPATH=[_vdir]) - -env.Append( - LIBPATH=[join(variant_dir, lib_path) - for lib_path in eixdata.get("LIBPATH", []) - if lib_path.startswith("mbed")] -) - -# -# Target: Build mbed Library -# - -libs = [l for l in eixdata.get("STDLIBS", []) if l not in env.get("LIBS", [])] -libs.extend(["mbed", "c", "gcc"]) - -libs.append(env.Library( - join("$BUILD_DIR", "FrameworkMbed"), - [join(variant_dir, f) - for f in eixdata.get("OBJFILES", [])] -)) - -env.Prepend(LIBS=libs) - -for _libname, _libdata in get_used_mbedlibs().iteritems(): - for _libar in _libdata['ar']: - add_mbedlib(_libname, _libar) - if "deps" not in _libdata: - continue - for libdep in _libdata['deps']: - for _libar in MBED_LIBS_MAP[libdep]['ar']: - add_mbedlib(libdep, _libar) diff --git a/platformio/builder/scripts/frameworks/simba.py b/platformio/builder/scripts/frameworks/simba.py deleted file mode 100755 index 52c875e4..00000000 --- a/platformio/builder/scripts/frameworks/simba.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Simba - -Simba is an RTOS and build framework. It aims to make embedded -programming easy and portable. - -http://simba-os.readthedocs.org - -""" - -from os.path import join - -from SCons.Script import DefaultEnvironment, SConscript - -env = DefaultEnvironment() - -env.Replace( - PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-simba") -) - -SConscript( - [env.subst(join("$PLATFORMFW_DIR", "make", "platformio.sconscript"))]) diff --git a/platformio/builder/scripts/frameworks/spl.py b/platformio/builder/scripts/frameworks/spl.py deleted file mode 100644 index e521ae9f..00000000 --- a/platformio/builder/scripts/frameworks/spl.py +++ /dev/null @@ -1,119 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -SPL - -The ST Standard Peripheral Library provides a set of functions for -handling the peripherals on the STM32 Cortex-M3 family. -The idea is to save the user (the new user, in particular) having to deal -directly with the registers. - -http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743?sc=stm32embeddedsoftware -""" - -from os.path import isfile, join - -from SCons.Script import DefaultEnvironment - -env = DefaultEnvironment() - -env.Replace( - PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-spl") -) - -env.VariantDirWrap( - join("$BUILD_DIR", "FrameworkCMSIS"), - join("$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}", - "cmsis", "cores", "${BOARD_OPTIONS['build']['core']}") -) - -env.VariantDirWrap( - join("$BUILD_DIR", "FrameworkSPLInc"), - join( - "$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}", "spl", - "variants", env.subst("${BOARD_OPTIONS['build']['variant']}")[0:7], - "inc" - ) -) - -env.Append( - CPPPATH=[ - join("$BUILD_DIR", "FrameworkCMSIS"), - join("$BUILD_DIR", "FrameworkCMSISVariant"), - join("$BUILD_DIR", "FrameworkSPLInc"), - join("$BUILD_DIR", "FrameworkSPL") - ] -) - -envsafe = env.Clone() - -envsafe.Append( - CPPPATH=["$BUILDSRC_DIR"], - CPPDEFINES=[ - "USE_STDPERIPH_DRIVER" - ] -) - -# -# Target: Build SPL Library -# - -# use mbed ldscript with bootloader section -ldscript = env.get("BOARD_OPTIONS", {}).get("build", {}).get("ldscript") -if not isfile(join(env.subst("$PIOPACKAGES_DIR"), "ldscripts", ldscript)): - if "mbed" in env.get("BOARD_OPTIONS", {}).get("frameworks", {}): - env.Append( - LINKFLAGS=[ - '-Wl,-T"%s"' % - join( - "$PIOPACKAGES_DIR", "framework-mbed", "variant", - env.subst("$BOARD").upper(), "mbed", - "TARGET_%s" % env.subst( - "$BOARD").upper(), "TOOLCHAIN_GCC_ARM", - "%s.ld" % ldscript.upper()[:-3] - ) - ] - ) - -extra_flags = env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags") -src_filter_patterns = ["+<*>"] -if "STM32F40_41xxx" in extra_flags: - src_filter_patterns += ["-"] -if "STM32F427_437xx" in extra_flags: - src_filter_patterns += ["-"] -elif "STM32F303xC" in extra_flags: - src_filter_patterns += ["-"] -elif "STM32L1XX_MD" in extra_flags: - src_filter_patterns += ["-"] - -libs = [] - -libs.append(envsafe.BuildLibrary( - join("$BUILD_DIR", "FrameworkCMSISVariant"), - join( - "$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}", "cmsis", - "variants", env.subst("${BOARD_OPTIONS['build']['variant']}")[0:7] - ) -)) - -libs.append(envsafe.BuildLibrary( - join("$BUILD_DIR", "FrameworkSPL"), - join("$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}", - "spl", "variants", - env.subst("${BOARD_OPTIONS['build']['variant']}")[0:7], "src"), - src_filter=" ".join(src_filter_patterns) -)) - -env.Append(LIBS=libs) diff --git a/platformio/builder/scripts/frameworks/wiringpi.py b/platformio/builder/scripts/frameworks/wiringpi.py deleted file mode 100644 index c17b4801..00000000 --- a/platformio/builder/scripts/frameworks/wiringpi.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -WiringPi - -WiringPi is a GPIO access library written in C for the BCM2835 used in the -Raspberry Pi. It's designed to be familiar to people who have used the Arduino -"wiring" system. - -http://wiringpi.com -""" - -from os.path import join - -from SCons.Script import DefaultEnvironment - -env = DefaultEnvironment() - -env.Replace( - CPPFLAGS=[ - "-O2", - "-Wformat=2", - "-Wall", - "-Winline", - "-pipe", - "-fPIC" - ], - - LIBS=["pthread"] -) - -env.Append( - CPPDEFINES=[ - "_GNU_SOURCE" - ], - - CPPPATH=[ - join("$BUILD_DIR", "FrameworkWiringPi") - ] -) - - -# -# Target: Build Core Library -# - -libs = [] -libs.append(env.BuildLibrary( - join("$BUILD_DIR", "FrameworkWiringPi"), - join("$PIOPACKAGES_DIR", "framework-wiringpi", "wiringPi") -)) - -env.Append(LIBS=libs) diff --git a/platformio/builder/scripts/freescalekinetis.py b/platformio/builder/scripts/freescalekinetis.py deleted file mode 100644 index af832d00..00000000 --- a/platformio/builder/scripts/freescalekinetis.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Freescale Kinetis 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.BuildProgram() - -# -# 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/scripts/intel_arc32.py b/platformio/builder/scripts/intel_arc32.py deleted file mode 100644 index f654234f..00000000 --- a/platformio/builder/scripts/intel_arc32.py +++ /dev/null @@ -1,196 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Intel ARC32 microcontrollers -""" - -from os.path import join - -from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, - DefaultEnvironment) - -env = DefaultEnvironment() - - -def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621 - - if env.get("BOARD_OPTIONS", {}).get("upload", {}).get( - "use_1200bps_touch", False): - env.TouchSerialPort("$UPLOAD_PORT", 1200) - - -env.Replace( - AR="arc-elf32-ar", - AS="arc-elf32-as", - CC="arc-elf32-gcc", - CXX="arc-elf32-g++", - OBJCOPY="arc-elf32-objcopy", - RANLIB="arc-elf32-ranlib", - SIZETOOL="arc-elf32-size", - - ARFLAGS=["rcs"], - - ASFLAGS=["-x", "assembler-with-cpp"], - - CCFLAGS=[ - "-g", - "-Os", - "-ffunction-sections", - "-fdata-sections", - "-Wall", - "-mlittle-endian", - "-mcpu=${BOARD_OPTIONS['build']['cpu']}", - "-fno-reorder-functions", - "-fno-asynchronous-unwind-tables", - "-fno-omit-frame-pointer", - "-fno-defer-pop", - "-Wno-unused-but-set-variable", - "-Wno-main", - "-ffreestanding", - "-fno-stack-protector", - "-mno-sdata", - "-fsigned-char" - ], - - CXXFLAGS=[ - "-fno-rtti", - "-std=c++11", - "-fno-exceptions" - ], - - CPPDEFINES=[ - "F_CPU=$BOARD_F_CPU", - "ARDUINO_ARC32_TOOLS", - "__CPU_ARC__", - "CLOCK_SPEED=%d" % ( - int(env.subst("${BOARD_OPTIONS['build']['f_cpu']}").replace( - "L", ""))/1000000), - "CONFIG_SOC_GPIO_32", - "CONFIG_SOC_GPIO_AON", - "INFRA_MULTI_CPU_SUPPORT", - "CFW_MULTI_CPU_SUPPORT", - "HAS_SHARED_MEM" - ], - - LINKFLAGS=[ - "-Os", - "-Wl,--gc-sections", - "-Wl,-X", - "-Wl,-N", - "-Wl,-mcpu=${BOARD_OPTIONS['build']['cpu']}", - "-Wl,-marcelf", - "-static", - "-nostdlib", - "-nodefaultlibs", - "-nostartfiles", - "-Wl,--whole-archive", - "-larc32drv_arduino101", - "-Wl,--no-whole-archive" - ], - - LIBS=["nsim", "c", "m", "gcc"], - - SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES', - - UPLOADER=join("$PIOPACKAGES_DIR", "tool-arduino101load", "arduino101load"), - UPLOADERFLAGS=[ - '"$UPLOAD_PORT"' - ], - DFUUTIL=join("$PIOPACKAGES_DIR", "tool-arduino101load", "dfu-util"), - UPLOADCMD='"$UPLOADER" "$DFUUTIL" $SOURCES $UPLOADERFLAGS verbose', - - PROGNAME="firmware", - PROGSUFFIX=".elf" -) - - -env.Append( - ASFLAGS=env.get("CCFLAGS", [])[:], - - BUILDERS=dict( - ElfToBin=Builder( - action=" ".join([ - "$OBJCOPY", - "-S", - "-O", - "binary", - "-R", - ".note", - "-R", - ".comment", - "-R", - "COMMON", - "-R", - ".eh_frame", - "$SOURCES", - "$TARGET"]), - suffix=".bin" - ), - ElfToHex=Builder( - action=" ".join([ - "$OBJCOPY", - "-S", - "-O", - "binary", - "-R", - ".note", - "-R", - ".comment", - "-R", - "COMMON", - "-R", - ".eh_frame", - "$SOURCES", - "$TARGET"]), - suffix=".hex" - ) - ) -) - -# -# Target: Build executable and linkable firmware -# - -target_elf = env.BuildProgram() - -# -# Target: Build the .bin -# - -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 firmware -# - -upload = env.Alias(["upload", "uploadlazy"], target_firm, - [env.AutodetectUploadPort, BeforeUpload, "$UPLOADCMD"]) -AlwaysBuild(upload) - -# -# Target: Define targets -# - -Default([target_firm, target_size]) diff --git a/platformio/builder/scripts/lattice_ice40.py b/platformio/builder/scripts/lattice_ice40.py deleted file mode 100755 index c2059a11..00000000 --- a/platformio/builder/scripts/lattice_ice40.py +++ /dev/null @@ -1,149 +0,0 @@ -""" - Build script for lattice ice40 FPGAs - latticeice40-builder.py -""" -import os -from os.path import join - -from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, - DefaultEnvironment, Environment, Exit, GetOption, - Glob) - -env = DefaultEnvironment() -env.Replace(PROGNAME="hardware") -env.Append(SIMULNAME="simulation") - -# -- Get the local folder in which the icestorm tools should be installed -piopackages_dir = env.subst('$PIOPACKAGES_DIR') -bin_dir = join(piopackages_dir, 'toolchain-icestorm', 'bin') - -# -- Add this path to the PATH env variable. First the building tools will be -# -- searched in the local PATH. If they are not founde, the global ones will -# -- be executed (if installed) -env.PrependENVPath('PATH', bin_dir) - -# -- Target name for synthesis -TARGET = join(env['BUILD_DIR'], env['PROGNAME']) - -# -- Target name for simulation -# TARGET_SIM = join(env['PROJECT_DIR'], env['SIMULNAME']) - -# -- Get a list of all the verilog files in the src folfer, in ASCII, with -# -- the full path. All these files are used for the simulation -v_nodes = Glob(join(env['PROJECTSRC_DIR'], '*.v')) -src_sim = [str(f) for f in v_nodes] - -# --------- Get the Testbench file (there should be only 1) -# -- Create a list with all the files finished in _tb.v. It should contain -# -- the test bench -list_tb = [f for f in src_sim if f[-5:].upper() == "_TB.V"] - -if len(list_tb) > 1: - print "---> WARNING: More than one testbenches used" - -# -- Error checking -try: - testbench = list_tb[0] - -# -- there is no testbench -except IndexError: - testbench = None - -if 'sim' in COMMAND_LINE_TARGETS: - if testbench is None: - print "ERROR!!! NO testbench found for simulation" - Exit(1) - - # -- Simulation name - testbench_file = os.path.split(testbench)[-1] - SIMULNAME, ext = os.path.splitext(testbench_file) -else: - SIMULNAME = '' - - -TARGET_SIM = join(env.subst('$BUILD_DIR'), SIMULNAME) - -# -------- Get the synthesis files. They are ALL the files except the -# -------- testbench -src_synth = [f for f in src_sim if f not in list_tb] - -# -- For debugging -print "Testbench: %s" % testbench - -# -- Get the PCF file -src_dir = env.subst('$PROJECTSRC_DIR') -PCFs = join(src_dir, '*.pcf') -PCF_list = Glob(PCFs) - -try: - PCF = PCF_list[0] -except IndexError: - print "\n--------> ERROR: no .pcf file found <----------\n" - Exit(2) - -# -- Debug -print "----> PCF Found: %s" % PCF - -# -- Builder 1 (.v --> .blif) -synth = Builder(action='yosys -p \"synth_ice40 -blif %s.blif\" \ - $SOURCES' % TARGET, - suffix='.blif', - src_suffix='.v') - -# -- Builder 2 (.blif --> .asc) -pnr = Builder(action='arachne-pnr -d 1k -o $TARGET -p %s \ - $SOURCE' % PCF, - suffix='.asc', - src_suffix='.blif') - -# -- Builder 3 (.asc --> .bin) -bitstream = Builder(action='icepack $SOURCE $TARGET', - suffix='.bin', - src_suffix='.asc') - -# -- Builder 4 (.asc --> .rpt) -time_rpt = Builder(action='icetime -mtr $TARGET $SOURCE', - suffix='.rpt', - src_suffix='.asc') - -env.Append(BUILDERS={'Synth': synth, 'PnR': pnr, 'Bin': bitstream, - 'Time': time_rpt}) - -blif = env.Synth(TARGET, [src_synth]) -asc = env.PnR(TARGET, [blif, PCF]) -binf = env.Bin(TARGET, asc) - -upload = env.Alias('upload', binf, 'iceprog ' + ' $SOURCE') -AlwaysBuild(upload) - -# -- Target for calculating the time (.rpt) -# rpt = env.Time(asc) -t = env.Alias('time', env.Time('time.rpt', asc)) - -# -------------------- Simulation ------------------ -# -- Constructor para generar simulacion: icarus Verilog -iverilog = Builder(action='iverilog -o $TARGET $SOURCES ', - suffix='.out', - src_suffix='.v') - -vcd = Builder(action=' $SOURCE', - suffix='.vcd', src_suffix='.out') - -simenv = Environment(BUILDERS={'IVerilog': iverilog, 'VCD': vcd}, - ENV=os.environ) - -out = simenv.IVerilog(TARGET_SIM, src_sim) -vcd_file = simenv.VCD(SIMULNAME, out) - -waves = simenv.Alias('sim', vcd_file, 'gtkwave ' + - join(env['PROJECT_DIR'], "%s " % vcd_file[0]) + - join(env['PROJECTSRC_DIR'], SIMULNAME) + - '.gtkw') -AlwaysBuild(waves) - -Default([binf]) - -# -- These is for cleaning the files generated using the alias targets -if GetOption('clean'): - env.Default([t]) - simenv.Default([out, vcd_file]) diff --git a/platformio/builder/scripts/linux_arm.py b/platformio/builder/scripts/linux_arm.py deleted file mode 100644 index 15e73370..00000000 --- a/platformio/builder/scripts/linux_arm.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Linux ARM -""" - -from SCons.Script import AlwaysBuild, Default, DefaultEnvironment - -from platformio.util import get_systype - -env = DefaultEnvironment() - -env.Replace( - _BINPREFIX="", - AR="${_BINPREFIX}ar", - AS="${_BINPREFIX}as", - CC="${_BINPREFIX}gcc", - CXX="${_BINPREFIX}g++", - OBJCOPY="${_BINPREFIX}objcopy", - RANLIB="${_BINPREFIX}ranlib", - SIZETOOL="${_BINPREFIX}size", - - SIZEPRINTCMD='"$SIZETOOL" $SOURCES' -) - -if get_systype() == "darwin_x86_64": - env.Replace( - _BINPREFIX="arm-linux-gnueabihf-" - ) - -# -# Target: Build executable program -# - -target_bin = env.BuildProgram() - -# -# Target: Print binary size -# - -target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") -AlwaysBuild(target_size) - -# -# Target: Define targets -# - -Default([target_bin]) diff --git a/platformio/builder/scripts/linux_i686.py b/platformio/builder/scripts/linux_i686.py deleted file mode 100644 index b9aaecde..00000000 --- a/platformio/builder/scripts/linux_i686.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Linux Linux i686 / 32-bit -""" - -from SCons.Script import AlwaysBuild, Default, DefaultEnvironment - -from platformio.util import get_systype - -env = DefaultEnvironment() - -env.Replace( - _BINPREFIX="", - AR="${_BINPREFIX}ar", - AS="${_BINPREFIX}as", - CC="${_BINPREFIX}gcc", - CXX="${_BINPREFIX}g++", - OBJCOPY="${_BINPREFIX}objcopy", - RANLIB="${_BINPREFIX}ranlib", - SIZETOOL="${_BINPREFIX}size", - - SIZEPRINTCMD='"$SIZETOOL" $SOURCES' -) - -if get_systype() == "darwin_x86_64": - env.Replace( - _BINPREFIX="i586-pc-linux-" - ) - -# -# Target: Build executable program -# - -target_bin = env.BuildProgram() - -# -# Target: Print binary size -# - -target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") -AlwaysBuild(target_size) - -# -# Target: Define targets -# - -Default([target_bin]) diff --git a/platformio/builder/scripts/linux_x86_64.py b/platformio/builder/scripts/linux_x86_64.py deleted file mode 100644 index e837d2a5..00000000 --- a/platformio/builder/scripts/linux_x86_64.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Linux Linux x64_64 / 64-bit -""" - -from SCons.Script import AlwaysBuild, Default, DefaultEnvironment - -from platformio.util import get_systype - -env = DefaultEnvironment() - -env.Replace( - _BINPREFIX="", - AR="${_BINPREFIX}ar", - AS="${_BINPREFIX}as", - CC="${_BINPREFIX}gcc", - CXX="${_BINPREFIX}g++", - OBJCOPY="${_BINPREFIX}objcopy", - RANLIB="${_BINPREFIX}ranlib", - SIZETOOL="${_BINPREFIX}size", - - SIZEPRINTCMD='"$SIZETOOL" $SOURCES' -) - -if get_systype() == "darwin_x86_64": - env.Replace( - _BINPREFIX="x86_64-pc-linux-" - ) - -# -# Target: Build executable program -# - -target_bin = env.BuildProgram() - -# -# Target: Print binary size -# - -target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") -AlwaysBuild(target_size) - -# -# Target: Define targets -# - -Default([target_bin]) diff --git a/platformio/builder/scripts/microchippic32.py b/platformio/builder/scripts/microchippic32.py deleted file mode 100644 index da44457f..00000000 --- a/platformio/builder/scripts/microchippic32.py +++ /dev/null @@ -1,190 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Microchip PIC32 microcontrollers -""" - -from os.path import join - -from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, - DefaultEnvironment) - -env = DefaultEnvironment() - -env.Replace( - AR="pic32-ar", - AS="pic32-as", - CC="pic32-gcc", - CXX="pic32-g++", - OBJCOPY="pic32-objcopy", - RANLIB="pic32-ranlib", - SIZETOOL="pic32-size", - - ARFLAGS=["rcs"], - - ASFLAGS=[ - "-g1", - "-O2", - "-Wa,--gdwarf-2", - "-mprocessor=$BOARD_MCU" - ], - - CCFLAGS=[ - "-w", - "-g", - "-O2", - "-MMD", - "-mdebugger", - "-mno-smart-io", - "-mprocessor=$BOARD_MCU", - "-ffunction-sections", - "-fdata-sections", - "-Wcast-align", - "-fno-short-double", - "-ftoplevel-reorder" - ], - - CXXFLAGS=["-fno-exceptions"], - - CPPDEFINES=[ - "F_CPU=$BOARD_F_CPU", - "MPIDEVER=16777998", - "MPIDE=150" - ], - - LINKFLAGS=[ - "-w", - "-Os", - "-mdebugger", - "-mprocessor=$BOARD_MCU", - "-mno-peripheral-libs", - "-nostartfiles", - "-Wl,--gc-sections", - join( - "$PLATFORMFW_DIR", - "cores", - "${BOARD_OPTIONS['build']['core']}", - "cpp-startup.S" - ), - join( - "$PLATFORMFW_DIR", - "cores", - "${BOARD_OPTIONS['build']['core']}", - "crti.S" - ) - ], - - LIBS=["m"], - - SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES', - - UPLOADER=join("$PIOPACKAGES_DIR", "tool-pic32prog", "pic32prog"), - UPLOADERFLAGS=[ - "-b", "$UPLOAD_SPEED", - "-d", '"$UPLOAD_PORT"' - ], - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES', - - PROGNAME="firmware", - PROGSUFFIX=".elf" -) - -if int(env.get("BOARD_OPTIONS", {}).get( - "upload", {}).get("maximum_ram_size", 0)) < 65535: - env.Append( - ASFLAGS=["-G1024"], - CCFLAGS=["-G1024"] - ) - - -env.Append( - BUILDERS=dict( - ElfToEep=Builder( - action=" ".join([ - "$OBJCOPY", - "-O", - "ihex", - "-j", - ".eeprom", - '--set-section-flags=.eeprom="alloc,load"', - "--no-change-warnings", - "--change-section-lma", - ".eeprom=0", - "$SOURCES", - "$TARGET"]), - suffix=".eep" - ), - - ElfToHex=Builder( - action=" ".join(["pic32-bin2hex", "-a", "$SOURCES"]), suffix=".hex" - ) - ) -) - -# -# Target: Build executable and linkable firmware -# - -target_elf = env.BuildProgram() - -# -# Hook: Fix option for LD script -# - -_new_linkflags = [] -for f in env['LINKFLAGS']: - if not f.startswith("-Wl,-T"): - _new_linkflags.append(f) - else: - _new_linkflags.append("-Wl,--script=%s" % f[6:]) - -env.Replace(LINKFLAGS=_new_linkflags) -env.Append( - LINKFLAGS=[ - "-Wl,--script=chipKIT-application-COMMON%s.ld" % ( - "-MZ" if "MZ" in env.get("BOARD_OPTIONS", {}).get( - "build", {}).get("mcu") else "") - ] -) - -# -# Target: Build the .hex -# - -if "uploadlazy" in COMMAND_LINE_TARGETS: - target_firm = join("$BUILD_DIR", "firmware.hex") -else: - target_firm = env.ElfToHex(target_elf) - -# -# Target: Print binary size -# - -target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD") -AlwaysBuild(target_size) - -# -# Target: Upload firmware -# - -upload = env.Alias(["upload", "uploadlazy"], target_firm, - [env.AutodetectUploadPort, "$UPLOADCMD"]) -AlwaysBuild(upload) - -# -# Target: Define targets -# - -Default([target_firm, target_size]) diff --git a/platformio/builder/scripts/native.py b/platformio/builder/scripts/native.py deleted file mode 100644 index 41259514..00000000 --- a/platformio/builder/scripts/native.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for native platform -""" - -from SCons.Script import AlwaysBuild, Default, DefaultEnvironment - -env = DefaultEnvironment() - -env.Replace( - SIZEPRINTCMD="size $SOURCES" -) - -# -# Target: Build executable program -# - -target_bin = env.BuildProgram() - -# -# Target: Print binary size -# - -target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") -AlwaysBuild(target_size) - -# -# Target: Define targets -# - -Default([target_bin]) diff --git a/platformio/builder/scripts/nordicnrf51.py b/platformio/builder/scripts/nordicnrf51.py deleted file mode 100644 index ae4626c1..00000000 --- a/platformio/builder/scripts/nordicnrf51.py +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Nordic nRF51 series ARM microcontrollers. -""" - -from os.path import join - -from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, - DefaultEnvironment, SConscript) - -env = DefaultEnvironment() - -SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) - -if env.subst("$BOARD") == "rfduino": - env.Append( - CCFLAGS=["-fno-builtin"], - LINKFLAGS=["--specs=nano.specs"] - ) - env.Replace( - UPLOADER=join("$PIOPACKAGES_DIR", "tool-rfdloader", "rfdloader"), - UPLOADERFLAGS=["-q", '"$UPLOAD_PORT"'], - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES' - ) -else: - env.Append( - BUILDERS=dict( - MergeHex=Builder( - action=" ".join([ - join("$PIOPACKAGES_DIR", "tool-sreccat", "srec_cat"), - "$SOFTDEVICEHEX", - "-intel", - "$SOURCES", - "-intel", - "-o", - "$TARGET", - "-intel", - "--line-length=44" - ]), - suffix=".hex" - ) - ) - ) - -# -# Target: Build executable and linkable firmware -# - -target_elf = env.BuildProgram() - -# -# Target: Build the .bin file -# - -if "uploadlazy" in COMMAND_LINE_TARGETS: - target_firm = join("$BUILD_DIR", "firmware.hex") -else: - if env.subst("$BOARD") == "rfduino": - target_firm = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf) - else: - target_firm = env.MergeHex( - join("$BUILD_DIR", "firmware"), - env.ElfToHex(join("$BUILD_DIR", "userfirmware"), target_elf) - ) - -# -# Target: Print binary size -# - -target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD") -AlwaysBuild(target_size) - -# -# Target: Upload by default .bin file -# - -if env.subst("$BOARD") == "rfduino": - upload = env.Alias(["upload", "uploadlazy"], target_firm, - [env.AutodetectUploadPort, "$UPLOADCMD"]) -else: - upload = env.Alias(["upload", "uploadlazy"], target_firm, env.UploadToDisk) -AlwaysBuild(upload) - -# -# Target: Define targets -# - -Default([target_firm, target_size]) diff --git a/platformio/builder/scripts/nxplpc.py b/platformio/builder/scripts/nxplpc.py deleted file mode 100644 index 727c9c8b..00000000 --- a/platformio/builder/scripts/nxplpc.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for NXP LPC 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.BuildProgram() - -# -# 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/scripts/siliconlabsefm32.py b/platformio/builder/scripts/siliconlabsefm32.py deleted file mode 100644 index ca2d617d..00000000 --- a/platformio/builder/scripts/siliconlabsefm32.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - 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.BuildProgram() - -# -# 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/scripts/ststm32.py b/platformio/builder/scripts/ststm32.py deleted file mode 100644 index 8dbd70ef..00000000 --- a/platformio/builder/scripts/ststm32.py +++ /dev/null @@ -1,112 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for ST STM32 Series ARM microcontrollers. -""" - -from os.path import isfile, join - -from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, - DefaultEnvironment, SConscript) - -env = DefaultEnvironment() - -SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) - -if env.subst("$UPLOAD_PROTOCOL") == "gdb": - if not isfile(join(env.subst("$PROJECT_DIR"), "upload.gdb")): - env.Exit( - "Error: You are using GDB as firmware uploader. " - "Please specify upload commands in upload.gdb " - "file in project directory!" - ) - env.Replace( - UPLOADER=join( - "$PIOPACKAGES_DIR", "toolchain-gccarmnoneeabi", - "bin", "arm-none-eabi-gdb" - ), - UPLOADERFLAGS=[ - join("$BUILD_DIR", "firmware.elf"), - "-batch", - "-x", - '"%s"' % join("$PROJECT_DIR", "upload.gdb") - ], - - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS' - ) -else: - env.Replace( - UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"), - UPLOADERFLAGS=[ - "write", # write in flash - "$SOURCES", # firmware path to flash - "0x08000000" # flash start adress - ], - - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS' - ) - - -env.Append( - CPPDEFINES=[ - env.get("BOARD_OPTIONS", {}).get( - "build", {}).get("variant", "").upper() - ], - - LIBS=["stdc++", "nosys"], - - LINKFLAGS=[ - "-nostartfiles", - "-nostdlib" - ] -) - -# -# Target: Build executable and linkable firmware -# - -target_elf = env.BuildProgram() - -# -# 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 -# - -if "mbed" in env.subst("$FRAMEWORK") and not env.subst("$UPLOAD_PROTOCOL"): - upload = env.Alias(["upload", "uploadlazy"], target_firm, env.UploadToDisk) -else: - upload = env.Alias(["upload", "uploadlazy"], target_firm, "$UPLOADCMD") -AlwaysBuild(upload) - -# -# Target: Define targets -# - -Default([target_firm, target_size]) diff --git a/platformio/builder/scripts/teensy.py b/platformio/builder/scripts/teensy.py deleted file mode 100644 index c01c67e8..00000000 --- a/platformio/builder/scripts/teensy.py +++ /dev/null @@ -1,114 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Teensy boards -""" - -from os.path import isfile, join - -from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, - DefaultEnvironment, SConscript) - -env = DefaultEnvironment() - -if env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy": - SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py"))) -elif env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy3": - SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) - env.Append( - LINKFLAGS=[ - "-Wl,--defsym=__rtc_localtime=$UNIX_TIME", - "-fsingle-precision-constant", - "--specs=nano.specs" - ], - CCFLAGS=[ - "-fsingle-precision-constant" - ] - ) - -env.Append( - CPPDEFINES=[ - "LAYOUT_US_ENGLISH" - ], - - CXXFLAGS=[ - "-std=gnu++0x", - "-felide-constructors" - ] -) - -if isfile(env.subst(join( - "$PIOPACKAGES_DIR", "tool-teensy", "teensy_loader_cli"))): - env.Append( - UPLOADER=join( - "$PIOPACKAGES_DIR", "tool-teensy", "teensy_loader_cli"), - UPLOADERFLAGS=[ - "-mmcu=$BOARD_MCU", - "-w", # wait for device to apear - "-s", # soft reboot if device not online - "-v" # verbose output - ], - UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES' - ) -else: - env.Append( - REBOOTER=join( - "$PIOPACKAGES_DIR", "tool-teensy", "teensy_reboot"), - UPLOADER=join( - "$PIOPACKAGES_DIR", "tool-teensy", "teensy_post_compile"), - UPLOADERFLAGS=[ - "-file=firmware", - '-path="$BUILD_DIR"', - '-tools="%s"' % join("$PIOPACKAGES_DIR", "tool-teensy") - ], - UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS' - ) - -# -# Target: Build executable and linkable firmware -# - -target_elf = env.BuildProgram() - -# -# Target: Build the firmware file -# - -if "uploadlazy" in COMMAND_LINE_TARGETS: - target_firm = join("$BUILD_DIR", "firmware.hex") -else: - target_firm = env.ElfToHex(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 firmware file -# - -upload = env.Alias( - ["upload", "uploadlazy"], target_firm, - ["$UPLOADHEXCMD"] + (["$REBOOTER"] if "REBOOTER" in env else [])) -AlwaysBuild(upload) - -# -# Target: Define targets -# - -Default([target_firm, target_size]) diff --git a/platformio/builder/scripts/timsp430.py b/platformio/builder/scripts/timsp430.py deleted file mode 100644 index a0cd720c..00000000 --- a/platformio/builder/scripts/timsp430.py +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Texas Instruments - MSP430 Ultra-Low Power 16-bit microcontrollers -""" - -from os.path import join -from platform import system - -from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, - DefaultEnvironment) - -env = DefaultEnvironment() - -env.Replace( - AR="msp430-ar", - AS="msp430-as", - CC="msp430-gcc", - CXX="msp430-g++", - OBJCOPY="msp430-objcopy", - RANLIB="msp430-ranlib", - SIZETOOL="msp430-size", - - ARFLAGS=["rcs"], - - ASFLAGS=["-x", "assembler-with-cpp"], - - CCFLAGS=[ - "-g", # include debugging info (so errors include line numbers) - "-Os", # optimize for size - # "-Wall", # show warnings - "-ffunction-sections", # place each function in its own section - "-fdata-sections", - "-mmcu=$BOARD_MCU" - ], - - CPPDEFINES=[ - "F_CPU=$BOARD_F_CPU" - ], - - LINK="$CC", - LINKFLAGS=[ - "-Os", - "-mmcu=$BOARD_MCU", - "-Wl,-gc-sections,-u,main" - ], - - LIBS=["m"], - - SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES', - - UPLOADER=join("$PIOPACKAGES_DIR", "tool-mspdebug", "mspdebug"), - UPLOADERFLAGS=[ - "$UPLOAD_PROTOCOL" if system() != "Windows" else "tilib", - "--force-reset" - ], - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS "prog $SOURCES"', - - PROGNAME="firmware", - PROGSUFFIX=".elf" -) - -env.Append( - ASFLAGS=env.get("CCFLAGS", [])[:], - - BUILDERS=dict( - ElfToHex=Builder( - action=" ".join([ - "$OBJCOPY", - "-O", - "ihex", - "-R", - ".eeprom", - "$SOURCES", - "$TARGET"]), - suffix=".hex" - ) - ) -) - -# -# Target: Build executable and linkable firmware -# - -target_elf = env.BuildProgram() - -# -# Target: Build the .hex -# - -if "uploadlazy" in COMMAND_LINE_TARGETS: - target_firm = join("$BUILD_DIR", "firmware.hex") -else: - target_firm = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf) - -# -# Target: Print binary size -# - -target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD") -AlwaysBuild(target_size) - -# -# Target: Upload firmware -# - -upload = env.Alias(["upload", "uploadlazy"], target_firm, "$UPLOADCMD") -AlwaysBuild(upload) - -# -# Target: Define targets -# - -Default([target_firm, target_size]) diff --git a/platformio/builder/scripts/titiva.py b/platformio/builder/scripts/titiva.py deleted file mode 100644 index e705cd62..00000000 --- a/platformio/builder/scripts/titiva.py +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Texas Instruments - Tiva C Series ARM Cortex-M4 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"))) - -env.Replace( - UPLOADER=join("$PIOPACKAGES_DIR", "tool-lm4flash", "lm4flash"), - UPLOADCMD='"$UPLOADER" $SOURCES' -) - -env.Append( - LINKFLAGS=[ - "-nostartfiles", - "-nostdlib" - ] -) - -# -# Target: Build executable and linkable firmware -# - -target_elf = env.BuildProgram() - -# -# 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 firmware -# - -upload = env.Alias(["upload", "uploadlazy"], target_firm, "$UPLOADCMD") -AlwaysBuild(upload) - -# -# Target: Define targets -# - -Default([target_firm, target_size]) diff --git a/platformio/builder/scripts/windows_x86.py b/platformio/builder/scripts/windows_x86.py deleted file mode 100644 index db78f6c1..00000000 --- a/platformio/builder/scripts/windows_x86.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" - Builder for Windows x86 / 32bit -""" - -from SCons.Script import AlwaysBuild, Default, DefaultEnvironment - -from platformio.util import get_systype - -env = DefaultEnvironment() - -env.Replace( - _BINPREFIX="", - AR="${_BINPREFIX}ar", - AS="${_BINPREFIX}as", - CC="${_BINPREFIX}gcc", - CXX="${_BINPREFIX}g++", - OBJCOPY="${_BINPREFIX}objcopy", - RANLIB="${_BINPREFIX}ranlib", - SIZETOOL="${_BINPREFIX}size", - - SIZEPRINTCMD='"$SIZETOOL" $SOURCES', - PROGSUFFIX=".exe" -) - -if get_systype() == "darwin_x86_64": - env.Replace( - _BINPREFIX="i586-mingw32-" - ) -elif get_systype() in ("linux_x86_64", "linux_i686"): - env.Replace( - _BINPREFIX="i686-w64-mingw32-" - ) - -# -# Target: Build executable program -# - -target_bin = env.BuildProgram() - -# -# Target: Print binary size -# - -target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") -AlwaysBuild(target_size) - -# -# Target: Define targets -# - -Default([target_bin]) diff --git a/platformio/builder/tools/__init__.py b/platformio/builder/tools/__init__.py index 0c05c3b0..95899c71 100644 --- a/platformio/builder/tools/__init__.py +++ b/platformio/builder/tools/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/platformio/builder/tools/pioar.py b/platformio/builder/tools/pioar.py index 6d8a2be0..d530892a 100644 --- a/platformio/builder/tools/pioar.py +++ b/platformio/builder/tools/pioar.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ def generate(env): env.Replace( _huge_sources_hook=_huge_sources_hook, - ARCOM=env.get("ARCOM", "").replace( - "$SOURCES", "${_huge_sources_hook(SOURCES)}")) + ARCOM=env.get("ARCOM", "").replace("$SOURCES", + "${_huge_sources_hook(SOURCES)}")) return env diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py new file mode 100644 index 00000000..35fba8cd --- /dev/null +++ b/platformio/builder/tools/piolib.py @@ -0,0 +1,543 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# pylint: disable=no-member, no-self-use, unused-argument + +from __future__ import absolute_import + +import os +import sys +from os.path import basename, commonprefix, isdir, isfile, join, realpath + +import SCons.Scanner + +from platformio import util +from platformio.builder.tools import platformio as piotool + + +class LibBuilderFactory(object): + + @staticmethod + def new(env, path): + clsname = "UnknownLibBuilder" + if isfile(join(path, "library.json")): + clsname = "PlatformIOLibBuilder" + else: + env_frameworks = [ + f.lower().strip() + for f in env.get("PIOFRAMEWORK", "").split(",") + ] + used_frameworks = LibBuilderFactory.get_used_frameworks(env, path) + common_frameworks = set(env_frameworks) & set(used_frameworks) + if common_frameworks: + clsname = "%sLibBuilder" % list(common_frameworks)[0].title() + elif used_frameworks: + clsname = "%sLibBuilder" % used_frameworks[0].title() + + obj = getattr(sys.modules[__name__], clsname)(env, path) + assert isinstance(obj, LibBuilderBase) + return obj + + @staticmethod + def get_used_frameworks(env, path): + if any([isfile(join(path, fname)) + for fname in ("library.properties", "keywords.txt")]): + return ["arduino"] + + if isfile(join(path, "module.json")): + return ["mbed"] + + # check source files + for root, _, files in os.walk(path, followlinks=True): + for fname in files: + if not env.IsFileWithExt(fname, ("c", "cpp", "h", "hpp")): + continue + with open(join(root, fname)) as f: + content = f.read() + if "Arduino.h" in content: + return ["arduino"] + elif "mbed.h" in content: + return ["mbed"] + return [] + + +class LibBuilderBase(object): # pylint: disable=too-many-instance-attributes + + INC_SCANNER = SCons.Scanner.C.CScanner() + + def __init__(self, env, path): + self.env = env.Clone() + self.envorigin = env.Clone() + self.path = env.subst(path) + self._manifest = self.load_manifest() + self._is_dependent = False + self._depbuilders = tuple() + self._scanned_paths = tuple() + self._built_node = None + + # process extra options and append to build environment + self.process_extra_options() + + def __repr__(self): + return "%s(%r)" % (self.__class__, self.path) + + def __contains__(self, path): + return commonprefix((self.path, path)) == self.path + + @property + def name(self): + return self._manifest.get("name", basename(self.path)) + + @property + def version(self): + return self._manifest.get("version") + + @property + def dependencies(self): + deps = self._manifest.get("dependencies") + if not deps: + return deps + items = [] + if isinstance(deps, dict): + if "name" in deps: + items.append(deps) + else: + for name, version in deps.items(): + items.append({"name": name, "version": version}) + elif isinstance(deps, list): + items = [d for d in deps if "name" in d] + for item in items: + for k in ("frameworks", "platforms"): + if k not in item or isinstance(k, list): + continue + if item[k] == "*": + del item[k] + elif isinstance(item[k], basestring): + item[k] = [i.strip() for i in item[k].split(",") + if i.strip()] + return items + + @property + def src_filter(self): + return piotool.SRC_FILTER_DEFAULT + [ + "-" % os.sep, "-" % os.sep, "-" % + os.sep, "-" % os.sep + ] + + @property + def src_dir(self): + return (join(self.path, "src") + if isdir(join(self.path, "src")) else self.path) + + @property + def build_dir(self): + return join("$BUILD_DIR", "lib", self.name) + + def get_inc_dirs(self, use_build_dir=False): + return [self.build_dir if use_build_dir else self.src_dir] + + @property + def build_flags(self): + return None + + @property + def build_unflags(self): + return None + + @property + def extra_script(self): + return None + + @property + def lib_archive(self): + return True + + @property + def depbuilders(self): + return self._depbuilders + + @property + def dependent(self): + return self._is_dependent + + def is_platform_compatible(self, platform): + return True + + def is_framework_compatible(self, framework): + return True + + def load_manifest(self): + return {} + + def process_extra_options(self): + with util.cd(self.path): + self.env.ProcessUnFlags(self.build_unflags) + self.env.ProcessFlags(self.build_flags) + if self.extra_script: + self.env.SConscript( + realpath(self.extra_script), + exports={"env": self.env, + "pio_lib_builder": self}) + + def _process_dependencies(self, lib_builders): + if not self.dependencies: + return + for item in self.dependencies: + found = False + for lb in lib_builders: + if item['name'] != lb.name: + continue + elif "frameworks" in item and \ + not any([lb.is_framework_compatible(f) + for f in item["frameworks"]]): + continue + elif "platforms" in item and \ + not any([lb.is_platform_compatible(p) + for p in item["platforms"]]): + continue + found = True + self.depend_recursive(lb, lib_builders) + break + + if not found: + sys.stderr.write( + "Error: Could not find `%s` dependency for `%s` " + "library\n" % (item['name'], self.name)) + self.env.Exit(2) + + def _validate_search_paths(self, search_paths=None): + if not search_paths: + search_paths = tuple() + assert isinstance(search_paths, tuple) + deep_search = int(self.env.get("LIB_LDF_MODE", 2)) == 2 + + if not self._scanned_paths and ( + isinstance(self, ProjectAsLibBuilder) or deep_search): + for item in self.env.MatchSourceFiles(self.src_dir, + self.src_filter): + path = join(self.src_dir, item) + if (path not in self._scanned_paths and + path not in search_paths): + search_paths += (path, ) + + _search_paths = tuple() + for path in search_paths: + if path not in self._scanned_paths: + _search_paths += (path, ) + self._scanned_paths += (path, ) + + return _search_paths + + def _get_found_includes(self, lib_builders, search_paths=None): + inc_dirs = tuple() + used_inc_dirs = tuple() + for lb in (self, ) + lib_builders: + items = tuple(self.env.Dir(d) for d in lb.get_inc_dirs()) + if lb.dependent: + used_inc_dirs += items + else: + inc_dirs += items + inc_dirs = used_inc_dirs + inc_dirs + + result = tuple() + for path in self._validate_search_paths(search_paths): + for inc in self.env.File(path).get_found_includes( + self.env, LibBuilderBase.INC_SCANNER, inc_dirs): + if inc not in result: + result += (inc, ) + return result + + def depend_recursive(self, lb, lib_builders, search_paths=None): + assert isinstance(lb, LibBuilderBase) + if self != lb: + if self in lb.depbuilders: + sys.stderr.write("Warning! Circular dependencies detected " + "between `%s` and `%s`\n" % + (self.path, lb.path)) + elif lb not in self._depbuilders: + self._depbuilders += (lb, ) + lb.search_deps_recursive(lib_builders, search_paths) + + def search_deps_recursive(self, lib_builders, search_paths=None): + self._is_dependent = True + + self._process_dependencies(lib_builders) + + # when LDF is disabled + if "LIB_LDF_MODE" in self.env and \ + int(self.env.get("LIB_LDF_MODE")) == 0: + return + + lib_inc_map = {} + for inc in self._get_found_includes(lib_builders, search_paths): + for lb in lib_builders: + if inc.get_abspath() in lb: + if lb not in lib_inc_map: + lib_inc_map[lb] = tuple() + lib_inc_map[lb] += (inc.get_abspath(), ) + break + + for lb, lb_src_files in lib_inc_map.items(): + self.depend_recursive(lb, lib_builders, lb_src_files) + + def build(self): + libs = [] + for lb in self.depbuilders: + libs.extend(lb.build()) + # copy shared information to self env + for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"): + self.env.AppendUnique(**{key: lb.env.get(key)}) + + if not self._built_node: + self.env.AppendUnique(CPPPATH=self.get_inc_dirs( + use_build_dir=True)) + if self.lib_archive: + self._built_node = self.env.BuildLibrary( + self.build_dir, self.src_dir, self.src_filter) + else: + self._built_node = self.env.BuildSources( + self.build_dir, self.src_dir, self.src_filter) + return libs + [self._built_node] + + +class UnknownLibBuilder(LibBuilderBase): + pass + + +class ProjectAsLibBuilder(LibBuilderBase): + + @property + def src_filter(self): + return self.env.get("SRC_FILTER", LibBuilderBase.src_filter.fget(self)) + + def process_extra_options(self): + # skip for project, options are already processed + pass + + def search_deps_recursive(self, lib_builders, search_paths=None): + for lib_name in self.env.get("LIB_FORCE", []): + for lb in lib_builders: + if lb.name == lib_name: + if lb not in self.depbuilders: + self.depend_recursive(lb, lib_builders) + break + return LibBuilderBase.search_deps_recursive(self, lib_builders, + search_paths) + + def build(self): + # dummy mark that project is built + self._built_node = "dummy" + return [l for l in LibBuilderBase.build(self) if l != "dummy"] + + +class ArduinoLibBuilder(LibBuilderBase): + + def load_manifest(self): + manifest = {} + if not isfile(join(self.path, "library.properties")): + return manifest + with open(join(self.path, "library.properties")) as fp: + for line in fp.readlines(): + if "=" not in line: + continue + key, value = line.split("=", 1) + manifest[key.strip()] = value.strip() + return manifest + + def get_inc_dirs(self, use_build_dir=False): + inc_dirs = LibBuilderBase.get_inc_dirs(self, use_build_dir) + if not isdir(join(self.src_dir, "utility")): + return inc_dirs + inc_dirs.append( + join(self.build_dir if use_build_dir else self.src_dir, "utility")) + return inc_dirs + + @property + def src_filter(self): + if isdir(join(self.path, "src")): + return LibBuilderBase.src_filter.fget(self) + return ["+<*.%s>" % ext + for ext in piotool.SRC_BUILD_EXT + piotool.SRC_HEADER_EXT] + + def is_framework_compatible(self, framework): + return framework.lower() in ("arduino", "energia") + + +class MbedLibBuilder(LibBuilderBase): + + def load_manifest(self): + if not isfile(join(self.path, "module.json")): + return {} + return util.load_json(join(self.path, "module.json")) + + @property + def src_dir(self): + if isdir(join(self.path, "source")): + return join(self.path, "source") + return LibBuilderBase.src_dir.fget(self) + + def get_inc_dirs(self, use_build_dir=False): + inc_dirs = LibBuilderBase.get_inc_dirs(self, use_build_dir) + if self.path not in inc_dirs: + inc_dirs.append(self.path) + for p in self._manifest.get("extraIncludes", []): + inc_dirs.append(join(self.path, p)) + return inc_dirs + + def is_framework_compatible(self, framework): + return framework.lower() == "mbed" + + +class PlatformIOLibBuilder(LibBuilderBase): + + def load_manifest(self): + assert isfile(join(self.path, "library.json")) + manifest = util.load_json(join(self.path, "library.json")) + assert "name" in manifest + return manifest + + @property + def src_filter(self): + if "srcFilter" in self._manifest.get("build", {}): + return self._manifest.get("build").get("srcFilter") + return LibBuilderBase.src_filter.fget(self) + + @property + def build_flags(self): + if "flags" in self._manifest.get("build", {}): + return self._manifest.get("build").get("flags") + return LibBuilderBase.build_flags.fget(self) + + @property + def build_unflags(self): + if "unflags" in self._manifest.get("build", {}): + return self._manifest.get("build").get("unflags") + return LibBuilderBase.build_unflags.fget(self) + + @property + def extra_script(self): + if "extraScript" in self._manifest.get("build", {}): + return self._manifest.get("build").get("extraScript") + return LibBuilderBase.extra_script.fget(self) + + @property + def lib_archive(self): + if "libArchive" in self._manifest.get("build", {}): + return self._manifest.get("build").get("libArchive") + return LibBuilderBase.lib_archive.fget(self) + + def is_platform_compatible(self, platform): + items = self._manifest.get("platforms") + if not items: + return LibBuilderBase.is_platform_compatible(self, platform) + return self._item_in_list(platform, items) + + def is_framework_compatible(self, framework): + items = self._manifest.get("frameworks") + if not items: + return LibBuilderBase.is_framework_compatible(self, framework) + return self._item_in_list(framework, items) + + def _item_in_list(self, item, ilist): + if ilist == "*": + return True + if not isinstance(ilist, list): + ilist = [i.strip() for i in ilist.split(",")] + return item.lower() in [i.lower() for i in ilist] + + def get_inc_dirs(self, use_build_dir=False): + inc_dirs = LibBuilderBase.get_inc_dirs(self, use_build_dir) + for path in self.env['CPPPATH']: + if path not in self.envorigin['CPPPATH']: + inc_dirs.append( + path if use_build_dir else self.env.subst(path)) + return inc_dirs + + +def GetLibBuilders(env): + items = tuple() + env_frameworks = [ + f.lower().strip() for f in env.get("PIOFRAMEWORK", "").split(",") + ] + compat_mode = int(env.get("LIB_COMPAT_MODE", 1)) + verbose = not (env.GetOption("silent") or env.GetOption('clean')) + + for libs_dir in env['LIBSOURCE_DIRS']: + libs_dir = env.subst(libs_dir) + if not isdir(libs_dir): + continue + for item in sorted(os.listdir(libs_dir)): + if item == "__cores__" or not isdir(join(libs_dir, item)): + continue + lb = LibBuilderFactory.new(env, join(libs_dir, item)) + if lb.name in env.get("LIB_IGNORE", []): + if verbose: + sys.stderr.write("Ignored library %s\n" % lb.path) + continue + if compat_mode > 1 and not lb.is_platform_compatible(env[ + 'PIOPLATFORM']): + if verbose: + sys.stderr.write("Platform incompatible library %s\n" % + lb.path) + continue + if compat_mode > 0 and not any([lb.is_framework_compatible(f) + for f in env_frameworks]): + if verbose: + sys.stderr.write("Framework incompatible library %s\n" % + lb.path) + continue + items += (lb, ) + return items + + +def BuildDependentLibraries(env, src_dir): + + def print_deps_tree(root, level=0): + margin = "| " * (level) + for lb in root.depbuilders: + title = "<%s>" % lb.name + if lb.version: + title += " v%s" % lb.version + if not env.GetOption("silent"): + title += " (%s)" % lb.path + print "%s|-- %s" % (margin, title) + if lb.depbuilders: + print_deps_tree(lb, level + 1) + + lib_builders = env.GetLibBuilders() + + print "Collected %d compatible libraries" % len(lib_builders) + print "Looking for dependencies..." + + project = ProjectAsLibBuilder(env, src_dir) + project.env = env + project.search_deps_recursive(lib_builders) + + if project.depbuilders: + print "Library Dependency Map" + print_deps_tree(project) + else: + print "Project does not have dependencies" + + return project.build() + + +def exists(_): + return True + + +def generate(env): + env.AddMethod(GetLibBuilders) + env.AddMethod(BuildDependentLibraries) + return env diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index b24fca21..b4f4735e 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,23 +17,20 @@ from __future__ import absolute_import import atexit import re from glob import glob -from os import environ, listdir, remove -from os.path import isdir, isfile, join +from os import environ, remove +from os.path import isfile, join -from platformio.util import exec_command, where_is_program +from platformio import util class InoToCPPConverter(object): - PROTOTYPE_RE = re.compile( - r"""^( + PROTOTYPE_RE = re.compile(r"""^( (\s*[a-z_\d]+\*?){1,2} # return type (\s+[a-z_\d]+\s*) # name of prototype \([a-z_,\.\*\&\[\]\s\d]*\) # arguments )\s*\{ # must end with { - """, - re.X | re.M | re.I - ) + """, re.X | re.M | re.I) DETECTMAIN_RE = re.compile(r"void\s+(setup|loop)\s*\(", re.M | re.I) PROTOPTRS_TPLRE = r"\([^&\(]*&(%s)[^\)]*\)" @@ -66,20 +63,18 @@ class InoToCPPConverter(object): split_pos = item['match'].start() break - match_ptrs = re.search( - self.PROTOPTRS_TPLRE % ("|".join(prototype_names)), - contents[:split_pos], - re.M - ) + match_ptrs = re.search(self.PROTOPTRS_TPLRE % + ("|".join(prototype_names)), + contents[:split_pos], re.M) if match_ptrs: split_pos = contents.rfind("\n", 0, match_ptrs.start()) result.append(contents[:split_pos].strip()) result.append("%s;" % ";\n".join([p['match'].group(1) for p in prototypes])) - result.append('#line %d "%s"' % ( - contents.count("\n", 0, split_pos) + 2, - file_path.replace("\\", "/"))) + result.append('#line %d "%s"' % + (contents.count("\n", 0, split_pos) + 2, + file_path.replace("\\", "/"))) result.append(contents[split_pos:].strip()) return result @@ -106,8 +101,8 @@ class InoToCPPConverter(object): result.append('#line 1 "%s"' % file_path.replace("\\", "/")) if is_first and prototypes: - result += self.append_prototypes( - file_path, contents, prototypes) + result += self.append_prototypes(file_path, contents, + prototypes) else: result.append(contents) is_first = False @@ -143,10 +138,9 @@ def ConvertInoToCpp(env): def DumpIDEData(env): - BOARD_CORE = env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") - def get_includes(env_): includes = [] + for item in env_.get("CPPPATH", []): invardir = False for vardiritem in env_.get("VARIANT_DIRS", []): @@ -158,45 +152,24 @@ def DumpIDEData(env): includes.append(env_.subst(item)) # installed libs - for d in env_.get("LIBSOURCE_DIRS", []): - lsd_dir = env_.subst(d) - _append_lib_includes(env_, lsd_dir, includes) + for lb in env.GetLibBuilders(): + includes.extend(lb.get_inc_dirs()) - # includes from toolchain - 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: - includes.extend(glob(g)) + # includes from toolchains + p = env.PioPlatform() + for name in p.get_installed_packages(): + if p.get_package_type(name) != "toolchain": + continue + toolchain_dir = p.get_package_dir(name) + toolchain_incglobs = [ + join(toolchain_dir, "*", "include*"), + join(toolchain_dir, "lib", "gcc", "*", "*", "include*") + ] + for g in toolchain_incglobs: + includes.extend(glob(g)) return includes - def _append_lib_includes(env_, libs_dir, includes): - if not isdir(libs_dir): - return - for name in env_.get("LIB_USE", []) + sorted(listdir(libs_dir)): - if not isdir(join(libs_dir, name)): - continue - # ignore user's specified libs - if name in env_.get("LIB_IGNORE", []): - continue - if name == "__cores__": - if isdir(join(libs_dir, name, BOARD_CORE)): - _append_lib_includes( - env_, join(libs_dir, name, BOARD_CORE), includes) - return - - include = ( - join(libs_dir, name, "src") - if isdir(join(libs_dir, name, "src")) - else join(libs_dir, name) - ) - if include not in includes: - includes.append(include) - def get_defines(env_): defines = [] # global symbols @@ -206,13 +179,10 @@ def DumpIDEData(env): defines.append(env_.subst(item).replace('\\"', '"')) # special symbol for Atmel AVR MCU - board = env_.get("BOARD_OPTIONS", {}) - if board and board['platform'] == "atmelavr": + if env['PIOPLATFORM'] == "atmelavr": defines.append( - "__AVR_%s__" % board['build']['mcu'].upper() - .replace("ATMEGA", "ATmega") - .replace("ATTINY", "ATtiny") - ) + "__AVR_%s__" % env.BoardConfig().get("build.mcu").upper() + .replace("ATMEGA", "ATmega").replace("ATTINY", "ATtiny")) return defines LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS" @@ -224,9 +194,9 @@ def DumpIDEData(env): "includes": get_includes(env_), "cc_flags": env_.subst(LINTCCOM), "cxx_flags": env_.subst(LINTCXXCOM), - "cc_path": where_is_program( + "cc_path": util.where_is_program( env_.subst("$CC"), env_.subst("${ENV['PATH']}")), - "cxx_path": where_is_program( + "cxx_path": util.where_is_program( env_.subst("$CXX"), env_.subst("${ENV['PATH']}")) } @@ -254,7 +224,7 @@ def GetCompilerType(env): try: sysenv = environ.copy() sysenv['PATH'] = str(env['ENV']['PATH']) - result = exec_command([env.subst("$CC"), "-v"], env=sysenv) + result = util.exec_command([env.subst("$CC"), "-v"], env=sysenv) except OSError: return None if result['returncode'] != 0: @@ -280,12 +250,21 @@ def GetActualLDScript(env): return path if script: - env.Exit("Error: Could not find '%s' LD script in LDPATH '%s'" % ( - script, env.subst("$LIBPATH"))) + env.Exit("Error: Could not find '%s' LD script in LDPATH '%s'" % + (script, env.subst("$LIBPATH"))) return None +def ProgressHandler(env, node): + item = str(node) + if ("toolchain-" in item or "tool-" in item) or \ + item.endswith((".o", ".h", ".hpp", ".ipp")): + return + item = item.replace(env['PIOHOME_DIR'], ".platformio") + print "Processing %s" % item + + def exists(_): return True @@ -295,4 +274,5 @@ def generate(env): env.AddMethod(DumpIDEData) env.AddMethod(GetCompilerType) env.AddMethod(GetActualLDScript) + env.AddMethod(ProgressHandler) return env diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py new file mode 100644 index 00000000..2cec0992 --- /dev/null +++ b/platformio/builder/tools/pioplatform.py @@ -0,0 +1,104 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +from os.path import isdir, isfile, join + +from SCons.Script import COMMAND_LINE_TARGETS + +from platformio import exception, util +from platformio.managers.platform import PlatformFactory + + +@util.memoized +def initPioPlatform(name): + return PlatformFactory.newPlatform(name) + + +def PioPlatform(env): + variables = {} + for key in ("board", "pioframework"): + if key not in env: + continue + variables[key] = env[key.upper()] + p = initPioPlatform(env['PLATFORM_MANIFEST']) + p.configure_default_packages(variables, COMMAND_LINE_TARGETS) + return p + + +def BoardConfig(env, board=None): + p = initPioPlatform(env['PLATFORM_MANIFEST']) + try: + config = p.board_config(board if board else env['BOARD']) + except exception.UnknownBoard as e: + env.Exit("Error: %s" % str(e)) + return config + + +def GetFrameworkScript(env, framework): + p = env.PioPlatform() + assert p.frameworks and framework in p.frameworks + script_path = env.subst(p.frameworks[framework]['script']) + if not isfile(script_path): + script_path = join(p.get_dir(), script_path) + return script_path + + +def LoadPioPlatform(env, variables): + p = env.PioPlatform() + installed_packages = p.get_installed_packages() + + # Add toolchains and uploaders to $PATH + for name in installed_packages: + type_ = p.get_package_type(name) + if type_ not in ("toolchain", "uploader"): + continue + path = p.get_package_dir(name) + if isdir(join(path, "bin")): + path = join(path, "bin") + env.PrependENVPath("PATH", path) + + # Platform specific LD Scripts + if isdir(join(p.get_dir(), "ldscripts")): + env.Prepend(LIBPATH=[join(p.get_dir(), "ldscripts")]) + + if "BOARD" not in env: + return + + board_config = env.BoardConfig() + for k in variables.keys(): + if (k in env or + not any([k.startswith("BOARD_"), k.startswith("UPLOAD_")])): + continue + _opt, _val = k.lower().split("_", 1) + if _opt == "board": + _opt = "build" + if _val in board_config.get(_opt): + env.Replace(**{k: board_config.get("%s.%s" % (_opt, _val))}) + + if "build.ldscript" in board_config: + env.Replace(LDSCRIPT_PATH=board_config.get("build.ldscript")) + + +def exists(_): + return True + + +def generate(env): + env.AddMethod(PioPlatform) + env.AddMethod(BoardConfig) + env.AddMethod(GetFrameworkScript) + env.AddMethod(LoadPioPlatform) + return env diff --git a/platformio/builder/tools/piotest.py b/platformio/builder/tools/piotest.py new file mode 100644 index 00000000..3789e73f --- /dev/null +++ b/platformio/builder/tools/piotest.py @@ -0,0 +1,139 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import atexit +from os import remove +from os.path import isdir, isfile, join, sep +from string import Template + +FRAMEWORK_PARAMETERS = { + "arduino": { + "framework": "Arduino.h", + "serial_obj": "", + "serial_putc": "Serial.write(a)", + "serial_flush": "Serial.flush()", + "serial_begin": "Serial.begin(9600)", + "serial_end": "Serial.end()" + }, + "mbed": { + "framework": "mbed.h", + "serial_obj": "Serial pc(USBTX, USBRX);", + "serial_putc": "pc.putc(a)", + "serial_flush": "", + "serial_begin": "pc.baud(9600)", + "serial_end": "" + }, + "energia": { + "framework": "Energia.h", + "serial_obj": "", + "serial_putc": "Serial.write(a)", + "serial_flush": "Serial.flush()", + "serial_begin": "Serial.begin(9600)", + "serial_end": "Serial.end()" + } +} + + +def ProcessTest(env): + env.Append( + CPPDEFINES=[ + "UNIT_TEST", "UNITY_INCLUDE_CONFIG_H" + ], + CPPPATH=[ + join("$BUILD_DIR", "UnityTestLib") + ]) + unitylib = env.BuildLibrary( + join("$BUILD_DIR", "UnityTestLib"), + env.PioPlatform().get_package_dir("tool-unity")) + env.Prepend(LIBS=[unitylib]) + + test_dir = env.subst("$PROJECTTEST_DIR") + env.GenerateOutputReplacement(test_dir) + src_filter = None + if "PIOTEST" in env: + src_filter = "+" + src_filter += " +<%s%s>" % (env['PIOTEST'], sep) + + return env.CollectBuildFiles( + "$BUILDTEST_DIR", test_dir, src_filter=src_filter, duplicate=False) + + +def GenerateOutputReplacement(env, destination_dir): + + if not isdir(env.subst(destination_dir)): + env.Exit( + "Error: Test folder doesn't exist. Please put your test suite " + 'to \"test\" folder in project\'s root directory.') + + TEMPLATECPP = """ +# include <$framework> +# include + +$serial_obj + +void output_char(int a) +{ + $serial_putc; +} + +void output_flush(void) +{ + $serial_flush; +} + +void output_start(unsigned int baudrate) +{ + $serial_begin; +} + +void output_complete(void) +{ + $serial_end; +} + +""" + + def delete_tmptest_file(file_): + try: + remove(file_) + except: # pylint: disable=bare-except + if isfile(file_): + print("Warning: Could not remove temporary file '%s'. " + "Please remove it manually." % file_) + + framework = env.subst("$PIOFRAMEWORK").lower() + if framework not in FRAMEWORK_PARAMETERS: + env.Exit("Error: %s framework doesn't support testing feature!" % + framework) + else: + data = Template(TEMPLATECPP).substitute(FRAMEWORK_PARAMETERS[ + framework]) + + tmp_file = join(destination_dir, "output_export.cpp") + with open(tmp_file, "w") as f: + f.write(data) + + atexit.register(delete_tmptest_file, tmp_file) + + +def exists(_): + return True + + +def generate(env): + env.AddMethod(ProcessTest) + env.AddMethod(GenerateOutputReplacement) + return env diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index bc81941a..65d80b79 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -94,8 +94,9 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument def _look_for_serial_port(): port = None - board_hwids = env.get("BOARD_OPTIONS", {}).get( - "build", {}).get("hwids", []) + board_hwids = [] + if "BOARD" in env and "build.hwids" in env.BoardConfig(): + board_hwids = env.BoardConfig().get("build.hwids") for item in util.get_serialports(): if "VID:PID" not in item['hwid']: continue @@ -110,7 +111,7 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument print env.subst("Manually specified: $UPLOAD_PORT") return - if env.subst("$FRAMEWORK") == "mbed": + if env.subst("$PIOFRAMEWORK") == "mbed": env.Replace(UPLOAD_PORT=_look_for_mbed_disk()) else: if (system() == "Linux" and @@ -119,8 +120,7 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument "\nWarning! Please install `99-platformio-udev.rules` and " "check that your board's PID and VID are listed in the rules." "\n https://raw.githubusercontent.com/platformio/platformio" - "/develop/scripts/99-platformio-udev.rules\n" - ) + "/develop/scripts/99-platformio-udev.rules\n") env.Replace(UPLOAD_PORT=_look_for_serial_port()) if env.subst("$UPLOAD_PORT"): @@ -146,8 +146,9 @@ def UploadToDisk(_, target, source, env): # pylint: disable=W0613,W0621 def CheckUploadSize(_, target, source, env): # pylint: disable=W0613,W0621 - max_size = int(env.get("BOARD_OPTIONS", {}).get("upload", {}).get( - "maximum_size", 0)) + if "BOARD" not in env: + return + max_size = int(env.BoardConfig().get("upload.maximum_size", 0)) if max_size == 0 or "SIZETOOL" not in env: return diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index a10f7cf1..0db54cfd 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ from __future__ import absolute_import import re from glob import glob -from os import listdir, sep, walk -from os.path import basename, dirname, isdir, isfile, join, normpath, realpath +from os import sep, walk +from os.path import basename, dirname, isdir, join, realpath from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, SConscript from SCons.Util import case_sensitive_suffixes @@ -26,40 +26,33 @@ from platformio.util import pioversion_to_intstr SRC_BUILD_EXT = ["c", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"] SRC_HEADER_EXT = ["h", "hpp"] -SRC_DEFAULT_FILTER = " ".join([ - "+<*>", "-<.git%s>" % sep, "-" % sep, - "-" % sep, "-" % sep, - "-" % sep, "-" % sep -]) +SRC_FILTER_DEFAULT = ["+<*>", "-<.git%s>" % sep, "-" % sep] def BuildProgram(env): def _append_pio_macros(): - env.AppendUnique( - CPPDEFINES=["PLATFORMIO={0:02d}{1:02d}{2:02d}".format( - *pioversion_to_intstr())]) + env.AppendUnique(CPPDEFINES=["PLATFORMIO={0:02d}{1:02d}{2:02d}".format( + *pioversion_to_intstr())]) _append_pio_macros() # fix ASM handling under non-casitive OS if not case_sensitive_suffixes(".s", ".S"): - env.Replace( - AS="$CC", - ASCOM="$ASPPCOM" - ) + env.Replace(AS="$CC", ASCOM="$ASPPCOM") # process extra flags from board - env.ProcessFlags( - env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags")) + if "BOARD" in env and "build.extra_flags" in env.BoardConfig(): + env.ProcessFlags(env.BoardConfig().get("build.extra_flags")) # remove base flags env.ProcessUnFlags(env.get("BUILD_UNFLAGS")) # apply user flags env.ProcessFlags(env.get("BUILD_FLAGS")) - if env.get("FRAMEWORK"): + if env.get("PIOFRAMEWORK"): env.BuildFrameworks([ - f.lower().strip() for f in env.get("FRAMEWORK", "").split(",")]) + f.lower().strip() for f in env['PIOFRAMEWORK'].split(",") + ]) # restore PIO macros if it was deleted by framework _append_pio_macros() @@ -70,18 +63,12 @@ def BuildProgram(env): # append specified LD_SCRIPT if ("LDSCRIPT_PATH" in env and not any(["-Wl,-T" in f for f in env['LINKFLAGS']])): - env.Append( - LINKFLAGS=['-Wl,-T"$LDSCRIPT_PATH"'] - ) + env.Append(LINKFLAGS=['-Wl,-T"$LDSCRIPT_PATH"']) # enable "cyclic reference" for linker if env.get("LIBS", deplibs) and env.GetCompilerType() == "gcc": - env.Prepend( - _LIBFLAGS="-Wl,--start-group " - ) - env.Append( - _LIBFLAGS=" -Wl,--end-group" - ) + env.Prepend(_LIBFLAGS="-Wl,--start-group ") + env.Append(_LIBFLAGS=" -Wl,--end-group") # Handle SRC_BUILD_FLAGS env.ProcessFlags(env.get("SRC_BUILD_FLAGS")) @@ -89,22 +76,22 @@ def BuildProgram(env): env.Append( CPPPATH=["$PROJECTSRC_DIR"], LIBS=deplibs, - LIBPATH=["$BUILD_DIR"] - ) + LIBPATH=["$BUILD_DIR"], + PIOBUILDFILES=env.CollectBuildFiles( + "$BUILDSRC_DIR", + "$PROJECTSRC_DIR", + src_filter=env.get("SRC_FILTER"), + duplicate=False)) - sources = env.LookupSources( - "$BUILDSRC_DIR", "$PROJECTSRC_DIR", duplicate=False, - src_filter=env.get("SRC_FILTER")) + if "test" in COMMAND_LINE_TARGETS: + env.Append(PIOBUILDFILES=env.ProcessTest()) - if not sources and not COMMAND_LINE_TARGETS: - env.Exit( - "Error: Nothing to build. Please put your source code files " - "to '%s' folder" % env.subst("$PROJECTSRC_DIR")) + if not env['PIOBUILDFILES'] and not COMMAND_LINE_TARGETS: + env.Exit("Error: Nothing to build. Please put your source code files " + "to '%s' folder" % env.subst("$PROJECTSRC_DIR")) program = env.Program( - join("$BUILD_DIR", env.subst("$PROGNAME")), - sources - ) + join("$BUILD_DIR", env.subst("$PROGNAME")), env['PIOBUILDFILES']) if set(["upload", "uploadlazy", "program"]) & set(COMMAND_LINE_TARGETS): env.AddPostAction(program, env.CheckUploadSize) @@ -174,12 +161,7 @@ def IsFileWithExt(env, file_, ext): # pylint: disable=W0613 return False -def VariantDirWrap(env, variant_dir, src_dir, duplicate=True): - DefaultEnvironment().Append(VARIANT_DIRS=[(variant_dir, src_dir)]) - env.VariantDir(variant_dir, src_dir, duplicate) - - -def LookupSources(env, variant_dir, src_dir, duplicate=True, src_filter=None): +def MatchSourceFiles(env, src_dir, src_filter=None): SRC_FILTER_PATTERNS_RE = re.compile(r"(\+|\-)<([^>]+)>") @@ -187,25 +169,40 @@ def LookupSources(env, variant_dir, src_dir, duplicate=True, src_filter=None): if env.IsFileWithExt(item, SRC_BUILD_EXT + SRC_HEADER_EXT): items.add(item.replace(src_dir + sep, "")) - def _match_sources(src_dir, src_filter): - matches = set() - # correct fs directory separator - src_filter = src_filter.replace("/", sep).replace("\\", sep) - for (action, pattern) in SRC_FILTER_PATTERNS_RE.findall(src_filter): - items = set() - for item in glob(join(src_dir, pattern)): - if isdir(item): - for root, _, files in walk(item, followlinks=True): - for f in files: - _append_build_item(items, join(root, f), src_dir) - else: - _append_build_item(items, item, src_dir) - if action == "+": - matches |= items - else: - matches -= items - return sorted(list(matches)) + src_dir = env.subst(src_dir) + src_filter = src_filter or SRC_FILTER_DEFAULT + if isinstance(src_filter, list) or isinstance(src_filter, tuple): + src_filter = " ".join(src_filter) + matches = set() + # correct fs directory separator + src_filter = src_filter.replace("/", sep).replace("\\", sep) + for (action, pattern) in SRC_FILTER_PATTERNS_RE.findall(src_filter): + items = set() + for item in glob(join(src_dir, pattern)): + if isdir(item): + for root, _, files in walk(item, followlinks=True): + for f in files: + _append_build_item(items, join(root, f), src_dir) + else: + _append_build_item(items, item, src_dir) + if action == "+": + matches |= items + else: + matches -= items + return sorted(list(matches)) + + +def VariantDirWrap(env, variant_dir, src_dir, duplicate=False): + DefaultEnvironment().Append(VARIANT_DIRS=[(variant_dir, src_dir)]) + env.VariantDir(variant_dir, src_dir, duplicate) + + +def CollectBuildFiles(env, + variant_dir, + src_dir, + src_filter=None, + duplicate=False): sources = [] variants = [] @@ -213,7 +210,7 @@ def LookupSources(env, variant_dir, src_dir, duplicate=True, src_filter=None): if src_dir.endswith(sep): src_dir = src_dir[:-1] - for item in _match_sources(src_dir, src_filter or SRC_DEFAULT_FILTER): + for item in env.MatchSourceFiles(src_dir, src_filter): _reldir = dirname(item) _src_dir = join(src_dir, _reldir) if _reldir else src_dir _var_dir = join(variant_dir, _reldir) if _reldir else variant_dir @@ -232,173 +229,38 @@ def BuildFrameworks(env, frameworks): if not frameworks or "uploadlazy" in COMMAND_LINE_TARGETS: return - board_frameworks = env.get("BOARD_OPTIONS", {}).get("frameworks", []) + if "BOARD" not in env: + env.Exit("Please specify `board` in `platformio.ini` to use " + "with '%s' framework" % ", ".join(frameworks)) + + board_frameworks = env.BoardConfig().get("frameworks", []) if frameworks == ["platformio"]: if board_frameworks: frameworks.insert(0, board_frameworks[0]) else: - env.Exit("Error: Please specify board type") + env.Exit("Error: Please specify `board` in `platformio.ini`") for f in frameworks: if f in ("arduino", "energia"): env.ConvertInoToCpp() if f in board_frameworks: - SConscript(env.subst( - join("$PIOBUILDER_DIR", "scripts", "frameworks", "%s.py" % f))) + SConscript(env.GetFrameworkScript(f)) else: env.Exit("Error: This board doesn't support %s framework!" % f) def BuildLibrary(env, variant_dir, src_dir, src_filter=None): lib = env.Clone() - return lib.Library( + return lib.StaticLibrary( lib.subst(variant_dir), - lib.LookupSources(variant_dir, src_dir, src_filter=src_filter) - ) + lib.CollectBuildFiles( + variant_dir, src_dir, src_filter=src_filter)) -def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914 - - INCLUDES_RE = re.compile( - r"^\s*#include\s+(\<|\")([^\>\"\']+)(?:\>|\")", re.M) - LIBSOURCE_DIRS = [env.subst(d) for d in env.get("LIBSOURCE_DIRS", [])] - - # start internal prototypes - - class IncludeFinder(object): - - def __init__(self, base_dir, name, is_system=False): - self.base_dir = base_dir - self.name = name - self.is_system = is_system - - self._inc_path = None - self._lib_dir = None - self._lib_name = None - - def getIncPath(self): - return self._inc_path - - def getLibDir(self): - return self._lib_dir - - def getLibName(self): - return self._lib_name - - def run(self): - if not self.is_system and self._find_in_local(): - return True - return self._find_in_system() - - def _find_in_local(self): - if isfile(join(self.base_dir, self.name)): - self._inc_path = join(self.base_dir, self.name) - return True - else: - return False - - def _find_in_system(self): - for lsd_dir in LIBSOURCE_DIRS: - if not isdir(lsd_dir): - continue - - for ld in env.get("LIB_USE", []) + sorted(listdir(lsd_dir)): - if not isdir(join(lsd_dir, ld)): - continue - - inc_path = normpath(join(lsd_dir, ld, self.name)) - try: - lib_dir = inc_path[:inc_path.index( - sep, len(lsd_dir) + 1)] - except ValueError: - continue - lib_name = basename(lib_dir) - - # ignore user's specified libs - if lib_name in env.get("LIB_IGNORE", []): - continue - - if not isfile(inc_path): - # if source code is in "src" dir - lib_dir = join(lsd_dir, lib_name, "src") - inc_path = join(lib_dir, self.name) - - if isfile(inc_path): - self._lib_dir = lib_dir - self._lib_name = lib_name - self._inc_path = inc_path - return True - return False - - def _get_dep_libs(src_dir): - state = { - "paths": set(), - "libs": set(), - "ordered": set() - } - - state = _process_src_dir(state, env.subst(src_dir)) - - result = [] - for item in sorted(state['ordered'], key=lambda s: s[0]): - result.append((item[1], item[2])) - return result - - def _process_src_dir(state, src_dir): - for root, _, files in walk(src_dir, followlinks=True): - for f in files: - if env.IsFileWithExt(f, SRC_BUILD_EXT + SRC_HEADER_EXT): - state = _parse_includes(state, env.File(join(root, f))) - return state - - def _parse_includes(state, node): - skip_includes = ("arduino.h", "energia.h") - matches = INCLUDES_RE.findall(node.get_text_contents()) - for (inc_type, inc_name) in matches: - base_dir = dirname(node.get_abspath()) - if inc_name.lower() in skip_includes: - continue - if join(base_dir, inc_name) in state['paths']: - continue - else: - state['paths'].add(join(base_dir, inc_name)) - - finder = IncludeFinder(base_dir, inc_name, inc_type == "<") - if finder.run(): - _parse_includes(state, env.File(finder.getIncPath())) - - _lib_dir = finder.getLibDir() - if _lib_dir and _lib_dir not in state['libs']: - state['ordered'].add(( - len(state['ordered']) + 1, finder.getLibName(), - _lib_dir)) - state['libs'].add(_lib_dir) - - if env.subst("$LIB_DFCYCLIC").lower() == "true": - state = _process_src_dir(state, _lib_dir) - return state - - # end internal prototypes - - deplibs = _get_dep_libs(src_dir) - for l, ld in deplibs: - env.Append( - CPPPATH=[join("$BUILD_DIR", l)] - ) - # add automatically "utility" dir from the lib (Arduino issue) - if isdir(join(ld, "utility")): - env.Append( - CPPPATH=[join("$BUILD_DIR", l, "utility")] - ) - - libs = [] - for (libname, inc_dir) in deplibs: - lib = env.BuildLibrary( - join("$BUILD_DIR", libname), inc_dir) - env.Clean(libname, lib) - libs.append(lib) - return libs +def BuildSources(env, variant_dir, src_dir, src_filter=None): + DefaultEnvironment().Append(PIOBUILDFILES=env.Clone().CollectBuildFiles( + variant_dir, src_dir, src_filter=src_filter)) def exists(_): @@ -410,9 +272,10 @@ def generate(env): env.AddMethod(ProcessFlags) env.AddMethod(ProcessUnFlags) env.AddMethod(IsFileWithExt) + env.AddMethod(MatchSourceFiles) env.AddMethod(VariantDirWrap) - env.AddMethod(LookupSources) + env.AddMethod(CollectBuildFiles) env.AddMethod(BuildFrameworks) env.AddMethod(BuildLibrary) - env.AddMethod(BuildDependentLibraries) + env.AddMethod(BuildSources) return env diff --git a/platformio/commands/__init__.py b/platformio/commands/__init__.py index 0c05c3b0..95899c71 100644 --- a/platformio/commands/__init__.py +++ b/platformio/commands/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/platformio/commands/boards.py b/platformio/commands/boards.py index 0ccdfa6f..572e39a3 100644 --- a/platformio/commands/boards.py +++ b/platformio/commands/boards.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,30 +16,31 @@ import json import click -from platformio.util import get_boards +from platformio.exception import APIRequestError +from platformio.managers.platform import PlatformManager -@click.command("list", short_help="Pre-configured Embedded Boards") +@click.command("boards", short_help="Pre-configured Embedded Boards") @click.argument("query", required=False) +@click.option("--installed", is_flag=True) @click.option("--json-output", is_flag=True) -def cli(query, json_output): # pylint: disable=R0912 - +def cli(query, installed, json_output): # pylint: disable=R0912 if json_output: - return ouput_boards_json(query) + return _ouput_boards_json(query, installed) BOARDLIST_TPL = ("{type:<30} {mcu:<14} {frequency:<8} " " {flash:<7} {ram:<6} {name}") terminal_width, _ = click.get_terminal_size() grpboards = {} - for type_, data in get_boards().items(): - if data['platform'] not in grpboards: - grpboards[data['platform']] = {} - grpboards[data['platform']][type_] = data + for board in _get_boards(installed): + if board['platform'] not in grpboards: + grpboards[board['platform']] = [] + grpboards[board['platform']].append(board) - for (platform, boards) in sorted(grpboards.items()): + for (platform, pboards) in sorted(grpboards.items()): if query: - search_data = json.dumps(boards).lower() + search_data = json.dumps(pboards).lower() if query.lower() not in search_data.lower(): continue @@ -47,46 +48,68 @@ def cli(query, json_output): # pylint: disable=R0912 click.echo("Platform: ", nl=False) click.secho(platform, bold=True) click.echo("-" * terminal_width) - click.echo(BOARDLIST_TPL.format( - type=click.style("Type", fg="cyan"), mcu="MCU", - frequency="Frequency", flash="Flash", ram="RAM", name="Name")) + click.echo( + BOARDLIST_TPL.format( + type=click.style( + "ID", fg="cyan"), + mcu="MCU", + frequency="Frequency", + flash="Flash", + ram="RAM", + name="Name")) click.echo("-" * terminal_width) - for type_, data in sorted(boards.items(), key=lambda b: b[1]['name']): + for board in sorted(pboards, key=lambda b: b['id']): if query: - search_data = "%s %s" % (type_, json.dumps(data).lower()) + search_data = "%s %s" % (board['id'], + json.dumps(board).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) + flash_size = "%dkB" % (board['rom'] / 1024) - ram_size = "" - if "maximum_ram_size" in data.get("upload", None): - ram_size = int(data['upload']['maximum_ram_size']) - if ram_size >= 1024: - if ram_size % 1024: - ram_size = "%.1fkB" % (ram_size / 1024.0) - else: - ram_size = "%dkB" % (ram_size / 1024) + ram_size = board['ram'] + if ram_size >= 1024: + if ram_size % 1024: + ram_size = "%.1fkB" % (ram_size / 1024.0) else: - ram_size = "%dB" % ram_size + 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'])) + click.echo( + BOARDLIST_TPL.format( + type=click.style( + board['id'], fg="cyan"), + mcu=board['mcu'], + frequency="%dMhz" % (board['fcpu'] / 1000000), + flash=flash_size, + ram=ram_size, + name=board['name'])) -def ouput_boards_json(query): - result = {} - for type_, data in get_boards().items(): +def _get_boards(installed=False): + boards = PlatformManager().get_installed_boards() + if not installed: + know_boards = ["%s:%s" % (b['platform'], b['id']) for b in boards] + for board in PlatformManager().get_registered_boards(): + key = "%s:%s" % (board['platform'], board['id']) + if key not in know_boards: + boards.append(board) + return boards + + +def _ouput_boards_json(query, installed=False): + result = [] + try: + boards = _get_boards(installed) + except APIRequestError: + if not installed: + boards = _get_boards(True) + for board in boards: if query: - search_data = "%s %s" % (type_, json.dumps(data).lower()) + search_data = "%s %s" % (board['id'], json.dumps(board).lower()) if query.lower() not in search_data.lower(): continue - result[type_] = data + result.append(board) click.echo(json.dumps(result)) diff --git a/platformio/commands/ci.py b/platformio/commands/ci.py index bb503e40..c7da3943 100644 --- a/platformio/commands/ci.py +++ b/platformio/commands/ci.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,20 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import stat from glob import glob -from os import chmod, getenv, makedirs, remove +from os import getenv, makedirs, remove from os.path import abspath, basename, expanduser, isdir, isfile, join -from shutil import copyfile, copytree, rmtree +from shutil import copyfile, copytree from tempfile import mkdtemp import click -from platformio import app +from platformio import app, util from platformio.commands.init import cli as cmd_init +from platformio.commands.init import validate_boards from platformio.commands.run import cli as cmd_run from platformio.exception import CIBuildEnvsEmpty -from platformio.util import get_boards # pylint: disable=wrong-import-order try: @@ -51,33 +50,41 @@ def validate_path(ctx, param, value): # pylint: disable=W0613 raise click.BadParameter("Found invalid path: %s" % invalid_path) -def validate_boards(ctx, param, value): # pylint: disable=W0613 - unknown_boards = set(value) - set(get_boards().keys()) - try: - assert not unknown_boards - return value - except AssertionError: - raise click.BadParameter( - "%s. Please search for the board types using " - "`platformio boards` command" % ", ".join(unknown_boards)) - - @click.command("ci", short_help="Continuous Integration") @click.argument("src", nargs=-1, callback=validate_path) -@click.option("--lib", "-l", multiple=True, callback=validate_path) +@click.option("-l", "--lib", multiple=True, callback=validate_path) @click.option("--exclude", multiple=True) -@click.option("--board", "-b", multiple=True, callback=validate_boards) -@click.option("--build-dir", default=mkdtemp, - type=click.Path(exists=True, file_okay=False, dir_okay=True, - writable=True, resolve_path=True)) +@click.option( + "-b", "--board", multiple=True, metavar="ID", callback=validate_boards) +@click.option( + "--build-dir", + default=mkdtemp, + type=click.Path( + exists=True, + file_okay=False, + dir_okay=True, + writable=True, + resolve_path=True)) @click.option("--keep-build-dir", is_flag=True) -@click.option("--project-conf", - type=click.Path(exists=True, file_okay=True, dir_okay=False, - readable=True, resolve_path=True)) -@click.option("--verbose", "-v", count=True, default=3) +@click.option( + "--project-conf", + type=click.Path( + exists=True, + file_okay=True, + dir_okay=False, + readable=True, + resolve_path=True)) +@click.option("-v", "--verbose", is_flag=True) @click.pass_context -def cli(ctx, src, lib, exclude, board, # pylint: disable=R0913 - build_dir, keep_build_dir, project_conf, verbose): +def cli(ctx, # pylint: disable=R0913 + src, + lib, + exclude, + board, + build_dir, + keep_build_dir, + project_conf, + verbose): if not src: src = getenv("PLATFORMIO_CI_SRC", "").split(":") @@ -111,22 +118,16 @@ def cli(ctx, src, lib, exclude, board, # pylint: disable=R0913 ctx.invoke(cmd_run, project_dir=build_dir, verbose=verbose) finally: if not keep_build_dir: - rmtree( - build_dir, onerror=lambda action, name, exc: - (chmod(name, stat.S_IWRITE), remove(name)) - ) + util.rmtree_(build_dir) def _clean_dir(dirpath): - rmtree(dirpath) + util.rmtree_(dirpath) makedirs(dirpath) def _copy_contents(dst_dir, contents): - items = { - "dirs": set(), - "files": set() - } + items = {"dirs": set(), "files": set()} for path in contents: if isdir(path): @@ -160,7 +161,7 @@ def _exclude_contents(dst_dir, patterns): for path in contents: path = abspath(path) if isdir(path): - rmtree(path) + util.rmtree_(path) elif isfile(path): remove(path) diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 6a9e964c..7d9fb2ed 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,36 +19,53 @@ from shutil import copyfile import click from platformio import app, exception, util -from platformio.commands.platforms import \ - platforms_install as cli_platforms_install +from platformio.commands.platform import \ + platform_install as cli_platform_install from platformio.ide.projectgenerator import ProjectGenerator -from platformio.platforms.base import PlatformFactory +from platformio.managers.platform import PlatformManager def validate_boards(ctx, param, value): # pylint: disable=W0613 - unknown_boards = set(value) - set(util.get_boards().keys()) + pm = PlatformManager() + # check installed boards + known_boards = set([b['id'] for b in pm.get_installed_boards()]) + # if boards are not listed as installed, check registered boards + if set(value) - known_boards: + known_boards = set([b['id'] for b in pm.get_registered_boards()]) + unknown_boards = set(value) - known_boards try: assert not unknown_boards return value except AssertionError: - raise click.BadParameter( - "%s. Please search for the board types using " - "`platformio boards` command" % ", ".join(unknown_boards)) + raise click.BadParameter("%s. Please search for the board ID using " + "`platformio boards` command" % + ", ".join(unknown_boards)) @click.command("init", short_help="Initialize new PlatformIO based project") -@click.option("--project-dir", "-d", default=getcwd, - type=click.Path(exists=True, file_okay=False, dir_okay=True, - writable=True, resolve_path=True)) -@click.option("--board", "-b", multiple=True, metavar="TYPE", - callback=validate_boards) -@click.option("--ide", - type=click.Choice(ProjectGenerator.get_supported_ides())) +@click.option( + "--project-dir", + "-d", + default=getcwd, + type=click.Path( + exists=True, + file_okay=False, + dir_okay=True, + writable=True, + resolve_path=True)) +@click.option( + "-b", "--board", multiple=True, metavar="ID", callback=validate_boards) +@click.option( + "--ide", type=click.Choice(ProjectGenerator.get_supported_ides())) @click.option("--enable-auto-uploading", is_flag=True) @click.option("--env-prefix", default="") @click.pass_context -def cli(ctx, project_dir, board, ide, # pylint: disable=R0913 - enable_auto_uploading, env_prefix): +def cli(ctx, # pylint: disable=R0913 + project_dir, + board, + ide, + enable_auto_uploading, + env_prefix): if project_dir == getcwd(): click.secho("\nThe current working directory", fg="yellow", nl=False) @@ -57,18 +74,20 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913 "will be used for project.\n" "You can specify another project directory via\n" "`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.", - fg="yellow" - ) + fg="yellow") click.echo("") click.echo("The next files/directories will be created in %s" % - click.style(project_dir, fg="cyan")) + click.style( + project_dir, fg="cyan")) click.echo("%s - Project Configuration File. |-> PLEASE EDIT ME <-|" % - click.style("platformio.ini", fg="cyan")) - click.echo("%s - Put your source files here" % - click.style("src", fg="cyan")) + click.style( + "platformio.ini", fg="cyan")) + click.echo("%s - Put your source files here" % click.style( + "src", fg="cyan")) click.echo("%s - Put here project specific (private) libraries" % - click.style("lib", fg="cyan")) + click.style( + "lib", fg="cyan")) if (app.get_setting("enable_prompts") and not click.confirm("Do you want to continue?")): @@ -77,10 +96,8 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913 init_base_project(project_dir) if board: - fill_project_envs( - ctx, join(project_dir, "platformio.ini"), board, - enable_auto_uploading, env_prefix, ide is not None - ) + fill_project_envs(ctx, project_dir, board, enable_auto_uploading, + env_prefix, ide is not None) if ide: if not board: @@ -93,11 +110,10 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913 click.secho( "Warning! You have initialised project with more than 1 board" " for the specified IDE.\n" - "However, the IDE features (code autocompletion, syntax lint)" - " have been configured for the first board '%s' from your list" - " '%s'." % (board[0], ", ".join(board)), - fg="yellow" - ) + "However, the IDE features (code autocompletion, syntax " + "linter) have been configured for the first board '%s' from " + "your list '%s'." % (board[0], ", ".join(board)), + fg="yellow") pg = ProjectGenerator(project_dir, ide, board[0]) pg.generate() @@ -110,30 +126,28 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913 "`platformio run --target clean` - clean project (remove compiled " "files)\n" "`platformio run --help` - additional information", - fg="green" - ) + fg="green") def get_first_board(project_dir): - with util.cd(project_dir): - config = util.get_project_config() - for section in config.sections(): - if not section.startswith("env:"): - continue - elif config.has_option(section, "board"): - return config.get(section, "board") + config = util.load_project_config(project_dir) + for section in config.sections(): + if not section.startswith("env:"): + continue + elif config.has_option(section, "board"): + return config.get(section, "board") return None def init_base_project(project_dir): - platformio_ini = join(project_dir, "platformio.ini") - if not isfile(platformio_ini): - copyfile(join(util.get_source_dir(), "projectconftpl.ini"), - platformio_ini) + if not util.is_platformio_project(project_dir): + copyfile( + join(util.get_source_dir(), "projectconftpl.ini"), + join(project_dir, "platformio.ini")) lib_dir = join(project_dir, "lib") src_dir = join(project_dir, "src") - config = util.get_project_config(platformio_ini) + config = util.load_project_config(project_dir) if config.has_option("platformio", "src_dir"): src_dir = join(project_dir, config.get("platformio", "src_dir")) @@ -259,7 +273,7 @@ def init_ci_conf(project_dir): # - pip install -U platformio # # script: -# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N """) @@ -271,37 +285,44 @@ def init_cvs_ignore(project_dir): def fill_project_envs( # pylint: disable=too-many-arguments,too-many-locals - ctx, platformio_ini, board_types, enable_auto_uploading, - env_prefix, force_download): - builtin_boards = util.get_boards() + ctx, project_dir, board_ids, enable_auto_uploading, env_prefix, + force_download): + installed_boards = PlatformManager().get_installed_boards() content = [] used_boards = [] used_platforms = [] - config = util.get_project_config(platformio_ini) + config = util.load_project_config(project_dir) for section in config.sections(): if not all([section.startswith("env:"), config.has_option(section, "board")]): continue used_boards.append(config.get(section, "board")) - for type_ in board_types: - data = builtin_boards[type_] - used_platforms.append(data['platform']) + for id_ in board_ids: + manifest = None + for boards in (installed_boards, + PlatformManager.get_registered_boards()): + for b in boards: + if b['id'] == id_: + manifest = b + break + assert manifest is not None - if type_ in used_boards: + used_platforms.append(manifest['platform']) + if id_ in used_boards: continue content.append("") - content.append("[env:%s%s]" % (env_prefix, type_)) - content.append("platform = %s" % data['platform']) + content.append("[env:%s%s]" % (env_prefix, id_)) + content.append("platform = %s" % manifest['platform']) # find default framework for board - frameworks = data.get("frameworks") + frameworks = manifest.get("frameworks") if frameworks: content.append("framework = %s" % frameworks[0]) - content.append("board = %s" % type_) + content.append("board = %s" % id_) if enable_auto_uploading: content.append("targets = upload") @@ -311,16 +332,17 @@ def fill_project_envs( # pylint: disable=too-many-arguments,too-many-locals if not content: return - with open(platformio_ini, "a") as f: + with open(join(project_dir, "platformio.ini"), "a") as f: content.append("") f.write("\n".join(content)) def _install_dependent_platforms(ctx, platforms): - installed_platforms = PlatformFactory.get_platforms(installed=True).keys() + installed_platforms = [ + p['name'] for p in PlatformManager().get_installed() + ] if set(platforms) <= set(installed_platforms): return ctx.invoke( - cli_platforms_install, - platforms=list(set(platforms) - set(installed_platforms)) - ) + cli_platform_install, + platforms=list(set(platforms) - set(installed_platforms))) diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index b48b23dc..67c8ff59 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,51 +13,136 @@ # limitations under the License. import json +from os.path import join import click -from platformio import app, exception -from platformio.libmanager import LibraryManager +from platformio import app, exception, util +from platformio.managers.lib import LibraryManager from platformio.util import get_api_result + +@click.group(short_help="Library Manager") +@click.option( + "-g", + "--global", + is_flag=True, + help="Manager global PlatformIO" + " library storage `%s`" % join(util.get_home_dir(), "lib")) +@click.option( + "-d", + "--storage-dir", + default=None, + type=click.Path( + exists=True, + file_okay=False, + dir_okay=True, + writable=True, + resolve_path=True), + help="Manage custom library storage") +@click.pass_context +def cli(ctx, **options): + # skip commands that don't need storage folder + if ctx.invoked_subcommand in ("search", "register") or \ + (len(ctx.args) == 2 and ctx.args[1] in ("-h", "--help")): + return + storage_dir = options['storage_dir'] + if not storage_dir and options['global']: + storage_dir = join(util.get_home_dir(), "lib") + + if not storage_dir and not util.is_platformio_project(): + raise exception.PlatformioException( + "The `%s` is not a PlatformIO project.\nTo manage libraries " + "in the global storage `%s`, please use " + "`platformio lib --global %s` instead." % + (util.get_project_dir(), join(util.get_home_dir(), "lib"), + ctx.invoked_subcommand)) + + ctx.obj = LibraryManager(storage_dir) + click.echo("Library Storage: " + storage_dir) + + +@cli.command("install", short_help="Install library") +@click.argument("libraries", required=False, nargs=-1, metavar="[LIBRARY...]") +@click.option( + "--save", + is_flag=True, + help="Save installed libraries into the project's platformio.ini " + "library dependencies") +@click.option( + "-q", "--quiet", is_flag=True, help="Suppress progress reporting") +@click.pass_obj +def lib_install(lm, libraries, save, quiet): # pylint: disable=unused-argument + # @TODO "save" option + for library in libraries: + lm.install(library, quiet=quiet) + + +@cli.command("uninstall", short_help="Uninstall libraries") +@click.argument("libraries", nargs=-1, metavar="[LIBRARY...]") +@click.pass_obj +def lib_uninstall(lm, libraries): + for library in libraries: + lm.uninstall(library) + + +@cli.command("update", short_help="Update installed libraries") +@click.argument("libraries", required=False, nargs=-1, metavar="[LIBRARY...]") +@click.option( + "-c", + "--only-check", + is_flag=True, + help="Do not update, only check for new version") +@click.pass_obj +def lib_update(lm, libraries, only_check): + if not libraries: + libraries = [str(m.get("id", m['name'])) for m in lm.get_installed()] + for library in libraries: + lm.update(library, only_check=only_check) + +####### + LIBLIST_TPL = ("[{id:^14}] {name:<25} {compatibility:<30} " "\"{authornames}\": {description}") def echo_liblist_header(): - click.echo(LIBLIST_TPL.format( - id=click.style("ID", fg="green"), - name=click.style("Name", fg="cyan"), - compatibility=click.style("Compatibility", fg="yellow"), - authornames="Authors", - description="Description" - )) + click.echo( + LIBLIST_TPL.format( + id=click.style( + "ID", fg="green"), + name=click.style( + "Name", fg="cyan"), + compatibility=click.style( + "Compatibility", fg="yellow"), + authornames="Authors", + description="Description")) terminal_width, _ = click.get_terminal_size() click.echo("-" * terminal_width) def echo_liblist_item(item): - click.echo(LIBLIST_TPL.format( - id=click.style(str(item['id']), fg="green"), - name=click.style(item['name'], fg="cyan"), - compatibility=click.style( - ", ".join(item['frameworks'] + item['platforms']), - fg="yellow" - ), - authornames=", ".join(item['authornames']), - description=item['description'] - )) - - -@click.group(short_help="Library Manager") -def cli(): - pass + click.echo( + LIBLIST_TPL.format( + id=click.style( + str(item.get("id", "VCS")), fg="green"), + name=click.style( + item['name'], fg="cyan"), + compatibility=click.style( + ", ".join( + item.get("frameworks", ["-"]) + item.get("platforms", [])), + fg="yellow"), + authornames=", ".join(item.get("authornames", ["Unknown"])), + description=item.get("description", item.get("url", ""))) + + (" | @" + click.style( + item['version'], fg="yellow") if "version" in item else "")) @cli.command("search", short_help="Search for library") @click.option("--json-output", is_flag=True) @click.option("--page", type=click.INT, default=1) +@click.option("-n", "--name", multiple=True) @click.option("-a", "--author", multiple=True) @click.option("-k", "--keyword", multiple=True) @click.option("-f", "--framework", multiple=True) @@ -73,8 +158,9 @@ def lib_search(query, json_output, page, **filters): for value in values: query.append('%s:"%s"' % (key, value)) - result = get_api_result("/lib/search", - dict(query=" ".join(query), page=page)) + result = get_api_result( + "/lib/search", dict( + query=" ".join(query), page=page)) if json_output: click.echo(json.dumps(result)) @@ -84,17 +170,22 @@ def lib_search(query, json_output, page, **filters): 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) + "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.org" - "/en/stable/userguide/lib/cmd_search.html\n", fg="cyan") + click.secho( + "http://docs.platformio.org" + "/en/stable/userguide/lib/cmd_search.html\n", + fg="cyan") return - click.secho("Found %d libraries:\n" % result['total'], - fg="green" if result['total'] else "yellow") + click.secho( + "Found %d libraries:\n" % result['total'], + fg="green" if result['total'] else "yellow") if result['total']: echo_liblist_header() @@ -111,94 +202,17 @@ def lib_search(query, json_output, page, **filters): click.confirm("Show next libraries?")): result = get_api_result( "/lib/search", - dict(query=" ".join(query), page=int(result['page']) + 1) - ) + dict( + query=" ".join(query), page=int(result['page']) + 1)) else: break -@cli.command("install", short_help="Install library") -@click.argument("libid", type=click.INT, nargs=-1, metavar="[LIBRARY_ID]") -@click.option("-v", "--version") -@click.pass_context -def lib_install(ctx, libid, version): - lm = LibraryManager() - for id_ in libid: - click.echo( - "Installing library [ %s ]:" % click.style(str(id_), fg="green")) - try: - if not lm.install(id_, version): - continue - - info = lm.get_info(id_) - click.secho( - "The library #%s '%s' has been successfully installed!" - % (str(id_), info['name']), fg="green") - - if "dependencies" in info: - click.secho("Installing dependencies:", fg="yellow") - _dependencies = info['dependencies'] - if not isinstance(_dependencies, list): - _dependencies = [_dependencies] - for item in _dependencies: - try: - lib_install_dependency(ctx, item) - except AssertionError: - raise exception.LibInstallDependencyError(str(item)) - - except exception.LibAlreadyInstalled: - click.secho("Already installed", fg="yellow") - - -def lib_install_dependency(ctx, data): - assert isinstance(data, dict) - query = [] - for key in data: - if key in ("authors", "frameworks", "platforms", "keywords"): - values = data[key] - if not isinstance(values, list): - values = [v.strip() for v in values.split(",") if v] - for value in values: - query.append('%s:"%s"' % (key[:-1], value)) - elif isinstance(data[key], basestring): - query.append('+"%s"' % data[key]) - - result = get_api_result("/lib/search", dict(query=" ".join(query))) - assert result['total'] > 0 - - if result['total'] == 1 or not app.get_setting("enable_prompts"): - ctx.invoke(lib_install, libid=[result['items'][0]['id']]) - else: - click.secho( - "Conflict: More than one dependent libraries have been found " - "by request %s:" % json.dumps(data), fg="red") - - echo_liblist_header() - for item in result['items']: - echo_liblist_item(item) - - deplib_id = click.prompt( - "Please choose one dependent library ID", - type=click.Choice([str(i['id']) for i in result['items']])) - ctx.invoke(lib_install, libid=[int(deplib_id)]) - - -@cli.command("uninstall", short_help="Uninstall libraries") -@click.argument("libid", type=click.INT, nargs=-1) -def lib_uninstall(libid): - lm = LibraryManager() - for id_ in libid: - info = lm.get_info(id_) - if lm.uninstall(id_): - click.secho("The library #%s '%s' has been successfully " - "uninstalled!" % (str(id_), info['name']), fg="green") - - @cli.command("list", short_help="List installed libraries") @click.option("--json-output", is_flag=True) -def lib_list(json_output): - lm = LibraryManager() - items = lm.get_installed().values() +@click.pass_obj +def lib_list(lm, json_output): + items = lm.get_installed() if json_output: click.echo(json.dumps(items)) @@ -208,21 +222,34 @@ def lib_list(json_output): return echo_liblist_header() - for item in sorted(items, key=lambda i: i['id']): - item['authornames'] = [i['name'] for i in item['authors']] + for item in sorted(items, key=lambda i: i['name']): + if "authors" in item: + item['authornames'] = [i['name'] for i in item['authors']] echo_liblist_item(item) @cli.command("show", short_help="Show details about installed library") -@click.argument("libid", type=click.INT) -def lib_show(libid): - lm = LibraryManager() - info = lm.get_info(libid) - click.secho(info['name'], fg="cyan") - click.echo("-" * len(info['name'])) +@click.pass_obj +@click.argument("library", metavar="[LIBRARY]") +def lib_show(lm, library): # pylint: disable=too-many-branches + name, requirements, url = lm.parse_pkg_name(library) + installed_dir = lm.get_installed_dir(name, requirements, url) + if not installed_dir: + click.secho( + "%s @ %s is not installed" % (name, requirements or "*"), + fg="yellow") + return + + manifest = lm.load_manifest(installed_dir) + + click.secho(manifest['name'], fg="cyan") + click.echo("=" * len(manifest['name'])) + if "description" in manifest: + click.echo(manifest['description']) + click.echo() _authors = [] - for author in info['authors']: + for author in manifest.get("authors", []): _data = [] for key in ("name", "email", "url", "maintainer"): if not author[key]: @@ -234,61 +261,29 @@ def lib_show(libid): else: _data.append(author[key]) _authors.append(" ".join(_data)) - click.echo("Authors: %s" % ", ".join(_authors)) + if _authors: + click.echo("Authors: %s" % ", ".join(_authors)) - click.echo("Keywords: %s" % ", ".join(info['keywords'])) - if "frameworks" in info: - click.echo("Frameworks: %s" % ", ".join(info['frameworks'])) - if "platforms" in info: - click.echo("Platforms: %s" % ", ".join(info['platforms'])) - click.echo("Version: %s" % info['version']) - click.echo() - click.echo(info['description']) - click.echo() - - -@cli.command("update", short_help="Update installed libraries") -@click.argument("libid", type=click.INT, nargs=-1, required=False, - metavar="[LIBRARY_ID]") -@click.pass_context -def lib_update(ctx, libid): - lm = LibraryManager() - for id_, latest_version in (lm.get_latest_versions() or {}).items(): - if libid and int(id_) not in libid: - continue - - info = lm.get_info(int(id_)) - - click.echo("Updating [ %s ] %s library:" % ( - click.style(id_, fg="yellow"), - click.style(info['name'], fg="cyan"))) - - current_version = info['version'] - if latest_version is None: - click.secho("Unknown library", fg="red") - continue - - click.echo("Versions: Current=%s, Latest=%s \t " % ( - current_version, latest_version), nl=False) - - if current_version == latest_version: - click.echo("[%s]" % (click.style("Up-to-date", fg="green"))) + for key in ("keywords", "frameworks", "platforms", "license", "url", + "version"): + if key not in manifest: continue + if isinstance(manifest[key], list): + click.echo("%s: %s" % (key.title(), ", ".join(manifest[key]))) else: - click.echo("[%s]" % (click.style("Out-of-date", fg="red"))) - - ctx.invoke(lib_uninstall, libid=[int(id_)]) - ctx.invoke(lib_install, libid=[int(id_)]) + click.echo("%s: %s" % (key.title(), manifest[key])) @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://")): + 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 - result['successed'] else "red") + click.secho( + result['message'], + fg="green" + if "successed" in result and result['successed'] else "red") diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py new file mode 100644 index 00000000..fd72f402 --- /dev/null +++ b/platformio/commands/platform.py @@ -0,0 +1,195 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json + +import click + +from platformio import app, exception, util +from platformio.managers.platform import PlatformFactory, PlatformManager + + +@click.group(short_help="Platform Manager") +def cli(): + pass + + +def _print_platforms(platforms): + for platform in platforms: + click.echo("{name} ~ {title}".format( + name=click.style( + platform['name'], fg="cyan"), + title=platform['title'])) + click.echo("=" * (3 + len(platform['name'] + platform['title']))) + click.echo(platform['description']) + click.echo() + click.echo("Home: %s" % "http://platformio.org/platforms/" + platform[ + 'name']) + if platform['packages']: + click.echo("Packages: %s" % ", ".join(platform['packages'])) + if "version" in platform: + click.echo("Version: " + platform['version']) + click.echo() + + +@cli.command("search", short_help="Search for development platforms") +@click.argument("query", required=False) +@click.option("--json-output", is_flag=True) +def platform_search(query, json_output): + platforms = [] + for platform in util.get_api_result("/platforms"): + if query == "all": + query = "" + + search_data = json.dumps(platform) + if query and query.lower() not in search_data.lower(): + continue + + # @TODO update API with NAME/TITLE + platforms.append({ + "name": platform['type'], + "title": platform['name'], + "description": platform['description'], + "packages": platform['packages'] + }) + + if json_output: + click.echo(json.dumps(platforms)) + else: + _print_platforms(platforms) + + +@cli.command("install", short_help="Install new platforms") +@click.argument("platforms", nargs=-1, required=True, metavar="[PLATFORM...]") +@click.option("--with-package", multiple=True) +@click.option("--without-package", multiple=True) +@click.option("--skip-default-package", is_flag=True) +def platform_install(platforms, with_package, without_package, + skip_default_package): + pm = PlatformManager() + for platform in platforms: + if pm.install( + name=platform, + with_packages=with_package, + without_packages=without_package, + skip_default_package=skip_default_package): + click.secho( + "The platform '%s' has been successfully installed!\n" + "The rest of packages will be installed automatically " + "depending on your build environment." % platform, + fg="green") + + +@cli.command("uninstall", short_help="Uninstall platforms") +@click.argument("platforms", nargs=-1, required=True, metavar="[PLATFORM...]") +def platform_uninstall(platforms): + pm = PlatformManager() + for platform in platforms: + if pm.uninstall(platform): + click.secho( + "The platform '%s' has been successfully " + "uninstalled!" % platform, + fg="green") + + +@cli.command("update", short_help="Update installed Platforms") +@click.argument("platforms", nargs=-1, required=False, metavar="[PLATFORM...]") +@click.option( + "-p", + "--only-packages", + is_flag=True, + help="Update only platform packages") +@click.option( + "-c", + "--only-check", + is_flag=True, + help="Do not update, only check for new version") +def platform_update(platforms, only_packages, only_check): + pm = PlatformManager() + if not platforms: + platforms = set([m['name'] for m in pm.get_installed()]) + for platform in platforms: + click.echo("Platform %s" % click.style(platform, fg="cyan")) + click.echo("--------") + pm.update(platform, only_packages=only_packages, only_check=only_check) + click.echo() + + +@cli.command("list", short_help="List installed platforms") +@click.option("--json-output", is_flag=True) +def platform_list(json_output): + platforms = [] + pm = PlatformManager() + for manifest in pm.get_installed(): + p = PlatformFactory.newPlatform( + pm.get_manifest_path(manifest['__pkg_dir'])) + platforms.append({ + "name": p.name, + "title": p.title, + "description": p.description, + "version": p.version, + "packages": p.get_installed_packages().keys() + }) + + if json_output: + click.echo(json.dumps(platforms)) + else: + _print_platforms(platforms) + + +@cli.command("show", short_help="Show details about installed Platform") +@click.argument("platform") +@click.pass_context +def platform_show(ctx, platform): + try: + p = PlatformFactory.newPlatform(platform) + except exception.UnknownPlatform: + 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(platform_install, platforms=[platform]) + else: + raise exception.PlatformNotInstalledYet(platform) + + click.echo("{name} ~ {title}".format( + name=click.style( + p.name, fg="cyan"), title=p.title)) + click.echo("=" * (3 + len(p.name + p.title))) + click.echo(p.description) + click.echo() + click.echo("Version: %s" % p.version) + if p.homepage: + click.echo("Home: %s" % p.homepage) + if p.license: + click.echo("License: %s" % p.license.get("type")) + if p.frameworks: + click.echo("Frameworks: %s" % ", ".join(p.frameworks.keys())) + + if not p.packages: + return + + installed_pkgs = p.get_installed_packages() + for name, opts in p.packages.items(): + click.echo() + click.echo("Package %s" % click.style(name, fg="yellow")) + click.echo("-" * (8 + len(name))) + if p.get_package_type(name): + click.echo("Type: %s" % p.get_package_type(name)) + click.echo("Requirements: %s" % opts.get("version")) + click.echo("Installed: %s" % ("Yes" if name in installed_pkgs else + "No (optional)")) + if name in installed_pkgs: + for key, value in installed_pkgs[name].items(): + if key in ("url", "version", "description"): + click.echo("%s: %s" % (key.title(), value)) diff --git a/platformio/commands/platforms.py b/platformio/commands/platforms.py deleted file mode 100644 index 70af83b3..00000000 --- a/platformio/commands/platforms.py +++ /dev/null @@ -1,169 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import json -from datetime import datetime - -import click - -from platformio import app -from platformio.exception import PlatformNotInstalledYet -from platformio.pkgmanager import PackageManager -from platformio.platforms.base import PlatformFactory - - -@click.group(short_help="Platforms and Packages Manager") -def cli(): - pass - - -@cli.command("install", short_help="Install new platforms") -@click.argument("platforms", nargs=-1, required=True) -@click.option("--with-package", multiple=True, metavar="") -@click.option("--without-package", multiple=True, metavar="") -@click.option("--skip-default-package", is_flag=True) -def platforms_install(platforms, with_package, without_package, - skip_default_package): - for platform in platforms: - p = PlatformFactory.newPlatform(platform) - if p.install(with_package, without_package, skip_default_package): - click.secho( - "The platform '%s' has been successfully installed!\n" - "The rest of packages will be installed automatically " - "depending on your build environment." % platform, - fg="green") - - -@cli.command("list", short_help="List installed platforms") -@click.option("--json-output", is_flag=True) -def platforms_list(json_output): - - installed_platforms = PlatformFactory.get_platforms( - installed=True).keys() - installed_platforms.sort() - - data = [] - for platform in installed_platforms: - p = PlatformFactory.newPlatform(platform) - data.append({ - "name": platform, - "packages": p.get_installed_packages() - }) - - if json_output: - click.echo(json.dumps(data)) - else: - for item in data: - click.echo("{name:<20} with packages: {pkgs}".format( - name=click.style(item['name'], fg="cyan"), - pkgs=", ".join(item['packages']) - )) - - -@cli.command("search", short_help="Search for development platforms") -@click.argument("query", required=False) -@click.option("--json-output", is_flag=True) -def platforms_search(query, json_output): - - data = [] - platforms = PlatformFactory.get_platforms().keys() - platforms.sort() - for platform in platforms: - p = PlatformFactory.newPlatform(platform) - type_ = p.get_type() - description = p.get_description() - - if query == "all": - query = "" - - search_data = "%s %s %s" % (type_, description, p.get_packages()) - if query and query.lower() not in search_data.lower(): - continue - - data.append({ - "type": type_, - "description": description, - "packages": p.get_packages() - }) - - if json_output: - click.echo(json.dumps(data)) - else: - terminal_width, _ = click.get_terminal_size() - for item in data: - click.secho(item['type'], fg="cyan", nl=False) - click.echo(" (available packages: %s)" % ", ".join( - item.get("packages").keys())) - click.echo("-" * terminal_width) - click.echo(item['description']) - click.echo() - - -@cli.command("show", short_help="Show details about installed platform") -@click.argument("platform") -@click.pass_context -def platforms_show(ctx, platform): - - installed_platforms = PlatformFactory.get_platforms( - installed=True).keys() - - if platform not in installed_platforms: - if (not app.get_setting("enable_prompts") or - click.confirm("The platform '%s' has not been installed yet. " - "Would you like to install it now?" % platform)): - ctx.invoke(platforms_install, platforms=[platform]) - else: - raise PlatformNotInstalledYet(platform) - - p = PlatformFactory.newPlatform(platform) - click.echo("{name:<20} - {description} [ {url} ]".format( - name=click.style(p.get_type(), fg="cyan"), - description=p.get_description(), url=p.get_vendor_url())) - - installed_packages = PackageManager.get_installed() - for name in p.get_installed_packages(): - data = installed_packages[name] - pkgalias = p.get_package_alias(name) - click.echo("----------") - click.echo("Package: %s" % click.style(name, fg="yellow")) - if pkgalias: - click.echo("Alias: %s" % pkgalias) - click.echo("Version: %d" % int(data['version'])) - click.echo("Installed: %s" % datetime.fromtimestamp( - data['time']).strftime("%Y-%m-%d %H:%M:%S")) - - -@cli.command("uninstall", short_help="Uninstall platforms") -@click.argument("platforms", nargs=-1, required=True) -def platforms_uninstall(platforms): - - for platform in platforms: - p = PlatformFactory.newPlatform(platform) - if p.uninstall(): - click.secho("The platform '%s' has been successfully " - "uninstalled!" % platform, fg="green") - - -@cli.command("update", short_help="Update installed Platforms and Packages") -def platforms_update(): - - installed_platforms = PlatformFactory.get_platforms( - installed=True).keys() - installed_platforms.sort() - - for platform in installed_platforms: - click.echo("\nPlatform %s" % click.style(platform, fg="cyan")) - click.echo("--------") - p = PlatformFactory.newPlatform(platform) - p.update() diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 023d0a34..3309cf07 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,59 +16,64 @@ from datetime import datetime from hashlib import sha1 from os import getcwd, makedirs, walk from os.path import getmtime, isdir, isfile, join -from shutil import rmtree from time import time import click -from platformio import __version__, app, exception, telemetry, util +from platformio import __version__, exception, telemetry, util from platformio.commands.lib import lib_install as cmd_lib_install -from platformio.libmanager import LibraryManager -from platformio.platforms.base import PlatformFactory +from platformio.commands.platform import \ + platform_install as cmd_platform_install +from platformio.managers.lib import LibraryManager +from platformio.managers.platform import PlatformFactory @click.command("run", short_help="Process project environments") -@click.option("--environment", "-e", multiple=True, metavar="") -@click.option("--target", "-t", multiple=True, metavar="") -@click.option("--upload-port", metavar="") -@click.option("--project-dir", "-d", default=getcwd, - type=click.Path(exists=True, file_okay=False, dir_okay=True, - writable=True, resolve_path=True)) -@click.option("--verbose", "-v", count=True, default=3) +@click.option("-e", "--environment", multiple=True) +@click.option("-t", "--target", multiple=True) +@click.option("--upload-port") +@click.option( + "-d", + "--project-dir", + default=getcwd, + type=click.Path( + exists=True, + file_okay=False, + dir_okay=True, + writable=True, + resolve_path=True)) +@click.option("-v", "--verbose", is_flag=True) @click.option("--disable-auto-clean", is_flag=True) @click.pass_context -def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914 - project_dir, verbose, disable_auto_clean): +def cli(ctx, # pylint: disable=R0913,R0914 + environment, + target, + upload_port, + project_dir, + verbose, + disable_auto_clean): with util.cd(project_dir): - config = util.get_project_config() - - if not config.sections(): - raise exception.ProjectEnvsNotAvailable() - - known = set([s[4:] for s in config.sections() - if s.startswith("env:")]) - unknown = set(environment) - known - if unknown: - raise exception.UnknownEnvNames( - ", ".join(unknown), ", ".join(known)) - # clean obsolete .pioenvs dir if not disable_auto_clean: try: - _clean_pioenvs_dir(util.get_pioenvs_dir()) + _clean_pioenvs_dir(util.get_projectpioenvs_dir()) except: # pylint: disable=bare-except click.secho( "Can not remove temporary directory `%s`. Please remove " "`.pioenvs` directory from the project manually to avoid " - "build issues" % util.get_pioenvs_dir(), - fg="yellow" - ) + "build issues" % util.get_projectpioenvs_dir(), + fg="yellow") + + config = util.load_project_config() + check_project_defopts(config) + assert check_project_envs(config, environment) env_default = None if config.has_option("platformio", "env_default"): env_default = [ e.strip() - for e in config.get("platformio", "env_default").split(",")] + for e in config.get("platformio", "env_default").split(",") + ] results = [] for section in config.sections(): @@ -80,9 +85,10 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914 raise exception.InvalidEnvName(section) envname = section[4:] - if ((environment and envname not in environment) or - (not environment and env_default and - envname not in env_default)): + skipenv = any([environment and envname not in environment, + not environment and env_default and + envname not in env_default]) + if skipenv: # echo("Skipped %s environment" % style(envname, fg="yellow")) continue @@ -92,9 +98,11 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914 options = {} for k, v in config.items(section): options[k] = v + if "piotest" not in options and "piotest" in ctx.meta: + options['piotest'] = ctx.meta['piotest'] - ep = EnvironmentProcessor( - ctx, envname, options, target, upload_port, verbose) + ep = EnvironmentProcessor(ctx, envname, options, target, + upload_port, verbose) results.append(ep.process()) if not all(results): @@ -103,63 +111,82 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914 class EnvironmentProcessor(object): - RENAMED_OPTIONS = { - "INSTALL_LIBS": "LIB_INSTALL", - "IGNORE_LIBS": "LIB_IGNORE", - "USE_LIBS": "LIB_USE", - "LDF_CYCLIC": "LIB_DFCYCLIC", - "SRCBUILD_FLAGS": "SRC_BUILD_FLAGS" - } + KNOWN_OPTIONS = ("platform", "framework", "board", "board_mcu", + "board_f_cpu", "board_f_flash", "board_flash_mode", + "build_flags", "src_build_flags", "build_unflags", + "src_filter", "extra_script", "targets", "upload_port", + "upload_protocol", "upload_speed", "upload_flags", + "upload_resetmethod", "lib_install", "lib_deps", + "lib_force", "lib_ignore", "lib_extra_dirs", + "lib_ldf_mode", "lib_compat_mode", "piotest") - def __init__(self, cmd_ctx, name, options, # pylint: disable=R0913 - targets, upload_port, verbose): + REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} + + RENAMED_OPTIONS = {"lib_use": "lib_force"} + + def __init__(self, # pylint: disable=R0913 + cmd_ctx, + name, + options, + targets, + upload_port, + verbose): self.cmd_ctx = cmd_ctx self.name = name - self.options = self._validate_options(options) + self.options = options self.targets = targets self.upload_port = upload_port - self.verbose_level = int(verbose) + self.verbose = verbose def process(self): terminal_width, _ = click.get_terminal_size() start_time = time() - click.echo("[%s] Processing %s (%s)" % ( - datetime.now().strftime("%c"), - click.style(self.name, fg="cyan", bold=True), - ", ".join(["%s: %s" % (k, v) for k, v in self.options.iteritems()]) - )) + process_opts = [] + for k, v in self.options.items(): + if "\n" in v: + process_opts.append((k, "; ".join( + [s.strip() for s in v.split("\n") if s.strip()]))) + else: + process_opts.append((k, v)) + + click.echo("[%s] Processing %s (%s)" % + (datetime.now().strftime("%c"), click.style( + self.name, fg="cyan", bold=True), + ", ".join(["%s: %s" % opts for opts in process_opts]))) click.secho("-" * terminal_width, bold=True) + self.options = self._validate_options(self.options) result = self._run() is_error = result['returncode'] != 0 - summary_text = " Took %.2f seconds " % (time() - start_time) - half_line = "=" * ((terminal_width - len(summary_text) - 10) / 2) - click.echo("%s [%s]%s%s" % ( - half_line, - (click.style(" ERROR ", fg="red", bold=True) - if is_error else click.style("SUCCESS", fg="green", bold=True)), - summary_text, - half_line - ), err=is_error) + if is_error or "piotest_processor" not in self.cmd_ctx.meta: + print_header( + "[%s] Took %.2f seconds" % ((click.style( + "ERROR", fg="red", bold=True) if is_error else click.style( + "SUCCESS", fg="green", bold=True)), + time() - start_time), + is_error=is_error) return not is_error def _validate_options(self, options): result = {} for k, v in options.items(): - _k = k.upper() # process obsolete options - if _k in self.RENAMED_OPTIONS: + if k in self.RENAMED_OPTIONS: click.secho( "Warning! `%s` option is deprecated and will be " "removed in the next release! Please use " - "`%s` instead." % ( - k, self.RENAMED_OPTIONS[_k].lower()), - fg="yellow" - ) - k = self.RENAMED_OPTIONS[_k].lower() + "`%s` instead." % (k, self.RENAMED_OPTIONS[k]), + fg="yellow") + k = self.RENAMED_OPTIONS[k] + # warn about unknown options + if k not in self.KNOWN_OPTIONS: + click.secho( + "Warning! Ignore unknown `%s` option from `[env:]` section" + % k, + fg="yellow") result[k] = v return result @@ -168,7 +195,8 @@ class EnvironmentProcessor(object): if self.upload_port: variables['upload_port'] = self.upload_port for k, v in self.options.items(): - k = k.lower() + if k in self.REMAPED_OPTIONS: + k = self.REMAPED_OPTIONS[k] if k == "targets" or (k == "upload_port" and self.upload_port): continue variables[k] = v @@ -186,7 +214,6 @@ class EnvironmentProcessor(object): if "platform" not in self.options: raise exception.UndefinedEnvPlatform(self.name) - platform = self.options['platform'] build_vars = self._get_build_variables() build_targets = self._get_build_targets() @@ -194,28 +221,32 @@ class EnvironmentProcessor(object): # install dependent libraries if "lib_install" in self.options: - _autoinstall_libs(self.cmd_ctx, self.options['lib_install']) + _autoinstall_libdeps(self.cmd_ctx, [ + int(d.strip()) for d in self.options['lib_install'].split(",") + if d.strip() + ], self.verbose) + if "lib_deps" in self.options: + _autoinstall_libdeps(self.cmd_ctx, [ + d.strip() for d in self.options['lib_deps'].split("\n") + if d.strip() + ], self.verbose) - p = PlatformFactory.newPlatform(platform) - return p.run(build_vars, build_targets, self.verbose_level) + try: + p = PlatformFactory.newPlatform(self.options['platform']) + except exception.UnknownPlatform: + self.cmd_ctx.invoke( + cmd_platform_install, platforms=[self.options['platform']]) + p = PlatformFactory.newPlatform(self.options['platform']) + + return p.run(build_vars, build_targets, self.verbose) -def _autoinstall_libs(ctx, libids_list): - require_libs = [int(l.strip()) for l in libids_list.split(",")] - installed_libs = [ - l['id'] for l in LibraryManager().get_installed().values() - ] - - not_intalled_libs = set(require_libs) - set(installed_libs) - if not require_libs or not not_intalled_libs: - return - - if (not app.get_setting("enable_prompts") or - click.confirm( - "The libraries with IDs '%s' have not been installed yet. " - "Would you like to install them now?" % - ", ".join([str(i) for i in not_intalled_libs]))): - ctx.invoke(cmd_lib_install, libid=not_intalled_libs) +def _autoinstall_libdeps(ctx, libraries, verbose=False): + storage_dir = util.get_projectlibdeps_dir() + ctx.obj = LibraryManager(storage_dir) + if verbose: + click.echo("Library Storage: " + storage_dir) + ctx.invoke(cmd_lib_install, libraries=libraries, quiet=not verbose) def _clean_pioenvs_dir(pioenvs_dir): @@ -226,14 +257,14 @@ def _clean_pioenvs_dir(pioenvs_dir): if (isdir(pioenvs_dir) and getmtime(join(util.get_project_dir(), "platformio.ini")) > getmtime(pioenvs_dir)): - rmtree(pioenvs_dir) + util.rmtree_(pioenvs_dir) # check project structure if isdir(pioenvs_dir) and isfile(structhash_file): with open(structhash_file) as f: if f.read() == proj_hash: return - rmtree(pioenvs_dir) + util.rmtree_(pioenvs_dir) if not isdir(pioenvs_dir): makedirs(pioenvs_dir) @@ -242,6 +273,39 @@ def _clean_pioenvs_dir(pioenvs_dir): f.write(proj_hash) +def print_header(label, is_error=False): + terminal_width, _ = click.get_terminal_size() + width = len(click.unstyle(label)) + half_line = "=" * ((terminal_width - width - 2) / 2) + click.echo("%s %s %s" % (half_line, label, half_line), err=is_error) + + +def check_project_defopts(config): + if not config.has_section("platformio"): + return True + known = ("home_dir", "lib_dir", "libdeps_dir", "src_dir", "env_dir", + "data_dir", "test_dir", "env_default") + unknown = set([k for k, _ in config.items("platformio")]) - set(known) + if not unknown: + return True + click.secho( + "Warning! Ignore unknown `%s` option from `[platformio]` section" % + ", ".join(unknown), + fg="yellow") + return False + + +def check_project_envs(config, environments): + if not config.sections(): + raise exception.ProjectEnvsNotAvailable() + + known = set([s[4:] for s in config.sections() if s.startswith("env:")]) + unknown = set(environments) - known + if unknown: + raise exception.UnknownEnvNames(", ".join(unknown), ", ".join(known)) + return True + + def calculate_project_hash(): structure = [__version__] for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()): diff --git a/platformio/commands/serialports.py b/platformio/commands/serialports.py index 19b69ddb..a42e59f6 100644 --- a/platformio/commands/serialports.py +++ b/platformio/commands/serialports.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -46,41 +46,72 @@ def serialports_list(json_output): if int(PYSERIAL_VERSION[0]) == 3: + @cli.command("monitor", short_help="Monitor Serial port") @click.option("--port", "-p", help="Port, a number or a device name") - @click.option("--baud", "-b", type=int, default=9600, - help="Set baud rate, default=9600") - @click.option("--parity", default="N", - type=click.Choice(["N", "E", "O", "S", "M"]), - help="Set parity, default=N") - @click.option("--rtscts", is_flag=True, - help="Enable RTS/CTS flow control, default=Off") - @click.option("--xonxoff", is_flag=True, - help="Enable software flow control, default=Off") - @click.option("--rts", default=None, type=click.Choice(["0", "1"]), - help="Set initial RTS line state") - @click.option("--dtr", default=None, type=click.Choice(["0", "1"]), - help="Set initial DTR line state") - @click.option("--echo", is_flag=True, - help="Enable local echo, default=Off") - @click.option("--encoding", default="UTF-8", - help="Set the encoding for the serial port (e.g. hexlify, " - "Latin1, UTF-8), default: UTF-8") - @click.option("--filter", "-f", multiple=True, - help="Add text transformation") - @click.option("--eol", default="CRLF", - type=click.Choice(["CR", "LF", "CRLF"]), - help="End of line mode, default=CRLF") - @click.option("--raw", is_flag=True, - help="Do not apply any encodings/transformations") - @click.option("--exit-char", type=int, default=29, - help="ASCII code of special character that is used to exit " - "the application, default=29 (DEC)") - @click.option("--menu-char", type=int, default=20, - help="ASCII code of special character that is used to " - "control miniterm (menu), default=20 (DEC)") - @click.option("--quiet", is_flag=True, - help="Diagnostics: suppress non-error messages, default=Off") + @click.option( + "--baud", + "-b", + type=int, + default=9600, + help="Set baud rate, default=9600") + @click.option( + "--parity", + default="N", + type=click.Choice(["N", "E", "O", "S", "M"]), + help="Set parity, default=N") + @click.option( + "--rtscts", + is_flag=True, + help="Enable RTS/CTS flow control, default=Off") + @click.option( + "--xonxoff", + is_flag=True, + help="Enable software flow control, default=Off") + @click.option( + "--rts", + default=None, + type=click.Choice(["0", "1"]), + help="Set initial RTS line state") + @click.option( + "--dtr", + default=None, + type=click.Choice(["0", "1"]), + help="Set initial DTR line state") + @click.option( + "--echo", is_flag=True, help="Enable local echo, default=Off") + @click.option( + "--encoding", + default="UTF-8", + help="Set the encoding for the serial port (e.g. hexlify, " + "Latin1, UTF-8), default: UTF-8") + @click.option( + "--filter", "-f", multiple=True, help="Add text transformation") + @click.option( + "--eol", + default="CRLF", + type=click.Choice(["CR", "LF", "CRLF"]), + help="End of line mode, default=CRLF") + @click.option( + "--raw", + is_flag=True, + help="Do not apply any encodings/transformations") + @click.option( + "--exit-char", + type=int, + default=29, + help="ASCII code of special character that is used to exit " + "the application, default=29 (DEC)") + @click.option( + "--menu-char", + type=int, + default=20, + help="ASCII code of special character that is used to " + "control miniterm (menu), default=20 (DEC)") + @click.option( + "--quiet", + is_flag=True, + help="Diagnostics: suppress non-error messages, default=Off") def serialports_monitor(**kwargs): if not kwargs['port']: for item in get_serialports(): @@ -107,47 +138,78 @@ if int(PYSERIAL_VERSION[0]) == 3: default_port=kwargs['port'], default_baudrate=kwargs['baud'], default_rts=kwargs['rts'], - default_dtr=kwargs['dtr'] - ) + default_dtr=kwargs['dtr']) except Exception as e: # pylint: disable=W0702 raise MinitermException(e) else: + @cli.command("monitor", short_help="Monitor Serial port") @click.option("--port", "-p", help="Port, a number or a device name") - @click.option("--baud", "-b", type=int, default=9600, - help="Set baud rate, default=9600") - @click.option("--parity", default="N", - type=click.Choice(["N", "E", "O", "S", "M"]), - help="Set parity, default=N") - @click.option("--rtscts", is_flag=True, - help="Enable RTS/CTS flow control, default=Off") - @click.option("--xonxoff", is_flag=True, - help="Enable software flow control, default=Off") - @click.option("--rts", default=None, type=click.Choice(["0", "1"]), - help="Set initial RTS line state, default=0") - @click.option("--dtr", default=None, type=click.Choice(["0", "1"]), - help="Set initial DTR line state, default=0") - @click.option("--echo", is_flag=True, - help="Enable local echo, default=Off") - @click.option("--cr", is_flag=True, - help="Do not send CR+LF, send CR only, default=Off") - @click.option("--lf", is_flag=True, - help="Do not send CR+LF, send LF only, default=Off") - @click.option("--debug", "-d", count=True, - help="""Debug received data (escape non-printable chars) + @click.option( + "--baud", + "-b", + type=int, + default=9600, + help="Set baud rate, default=9600") + @click.option( + "--parity", + default="N", + type=click.Choice(["N", "E", "O", "S", "M"]), + help="Set parity, default=N") + @click.option( + "--rtscts", + is_flag=True, + help="Enable RTS/CTS flow control, default=Off") + @click.option( + "--xonxoff", + is_flag=True, + help="Enable software flow control, default=Off") + @click.option( + "--rts", + default=None, + type=click.Choice(["0", "1"]), + help="Set initial RTS line state, default=0") + @click.option( + "--dtr", + default=None, + type=click.Choice(["0", "1"]), + help="Set initial DTR line state, default=0") + @click.option( + "--echo", is_flag=True, help="Enable local echo, default=Off") + @click.option( + "--cr", + is_flag=True, + help="Do not send CR+LF, send CR only, default=Off") + @click.option( + "--lf", + is_flag=True, + help="Do not send CR+LF, send LF only, default=Off") + @click.option( + "--debug", + "-d", + count=True, + help="""Debug received data (escape non-printable chars) # --debug can be given multiple times: # 0: just print what is received # 1: escape non-printable characters, do newlines as unusual # 2: escape non-printable characters, newlines too # 3: hex dump everything""") - @click.option("--exit-char", type=int, default=29, - help="ASCII code of special character that is used to exit " - "the application, default=29 (DEC)") - @click.option("--menu-char", type=int, default=20, - help="ASCII code of special character that is used to " - "control miniterm (menu), default=20 (DEC)") - @click.option("--quiet", is_flag=True, - help="Diagnostics: suppress non-error messages, default=Off") + @click.option( + "--exit-char", + type=int, + default=29, + help="ASCII code of special character that is used to exit " + "the application, default=29 (DEC)") + @click.option( + "--menu-char", + type=int, + default=20, + help="ASCII code of special character that is used to " + "control miniterm (menu), default=20 (DEC)") + @click.option( + "--quiet", + is_flag=True, + help="Diagnostics: suppress non-error messages, default=Off") def serialports_monitor(**kwargs): sys.argv = app.get_session_var("command_ctx").args[1:] diff --git a/platformio/commands/settings.py b/platformio/commands/settings.py index 43be3c8d..478ed527 100644 --- a/platformio/commands/settings.py +++ b/platformio/commands/settings.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,12 +29,14 @@ def settings_get(name): list_tpl = "{name:<40} {value:<35} {description}" terminal_width, _ = click.get_terminal_size() - click.echo(list_tpl.format( - name=click.style("Name", fg="cyan"), - value=(click.style("Value", fg="green") + - click.style(" [Default]", fg="yellow")), - description="Description" - )) + click.echo( + list_tpl.format( + name=click.style( + "Name", fg="cyan"), + value=(click.style( + "Value", fg="green") + click.style( + " [Default]", fg="yellow")), + description="Description")) click.echo("-" * terminal_width) for _name, _data in sorted(app.DEFAULT_SETTINGS.items()): @@ -55,11 +57,12 @@ def settings_get(name): else: _value_str += click.style(" ", fg="yellow") - click.echo(list_tpl.format( - name=click.style(_name, fg="cyan"), - value=_value_str, - description=_data['description'] - )) + click.echo( + list_tpl.format( + name=click.style( + _name, fg="cyan"), + value=_value_str, + description=_data['description'])) @cli.command("set", short_help="Set new value for the setting") diff --git a/platformio/commands/test.py b/platformio/commands/test.py new file mode 100644 index 00000000..3f9ae9c3 --- /dev/null +++ b/platformio/commands/test.py @@ -0,0 +1,215 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# pylint: disable=R0913,R0914 + +from fnmatch import fnmatch +from os import getcwd, listdir +from os.path import isdir, join +from time import sleep, time + +import click +import serial + +from platformio import exception, util +from platformio.commands.run import cli as cmd_run +from platformio.commands.run import check_project_envs, print_header +from platformio.managers.platform import PlatformFactory + + +@click.command("test", short_help="Unit Testing") +@click.option("--environment", "-e", multiple=True, metavar="") +@click.option("--skip", multiple=True, metavar="") +@click.option("--upload-port", metavar="") +@click.option( + "-d", + "--project-dir", + default=getcwd, + type=click.Path( + exists=True, + file_okay=False, + dir_okay=True, + writable=True, + resolve_path=True)) +@click.option("--verbose", "-v", is_flag=True) +@click.pass_context +def cli(ctx, environment, skip, upload_port, project_dir, verbose): + assert check_project_envs(project_dir, environment) + with util.cd(project_dir): + test_dir = util.get_projecttest_dir() + if not isdir(test_dir): + raise exception.TestDirEmpty(test_dir) + test_names = get_test_names(test_dir) + projectconf = util.load_project_config() + + click.echo("Collected %d items" % len(test_names)) + click.echo() + + start_time = time() + results = [] + for testname in test_names: + for envname in projectconf.sections(): + if not envname.startswith("env:"): + continue + envname = envname[4:] + if environment and envname not in environment: + continue + + # check skip patterns + if testname != "*" and any([fnmatch(testname, p) for p in skip]): + results.append((None, testname, envname)) + continue + + tp = TestProcessor(ctx, testname, envname, { + "project_config": projectconf, + "project_dir": project_dir, + "upload_port": upload_port, + "verbose": verbose + }) + results.append((tp.process(), testname, envname)) + + click.echo() + print_header("[%s]" % click.style("TEST SUMMARY")) + + passed = True + for result in results: + status, testname, envname = result + status_str = click.style("PASSED", fg="green") + if status is False: + passed = False + status_str = click.style("FAILED", fg="red") + elif status is None: + status_str = click.style("IGNORED", fg="yellow") + + click.echo( + "test:%s/env:%s\t%s" % (click.style( + testname, fg="yellow"), click.style( + envname, fg="cyan"), status_str), + err=status is False) + + print_header( + "[%s] Took %.2f seconds" % ((click.style( + "PASSED", fg="green", bold=True) if passed else click.style( + "FAILED", fg="red", bold=True)), time() - start_time), + is_error=not passed) + + if not passed: + raise exception.ReturnErrorCode() + + +class TestProcessor(object): + + SERIAL_TIMEOUT = 600 + SERIAL_BAUDRATE = 9600 + + def __init__(self, cmd_ctx, testname, envname, options): + self.cmd_ctx = cmd_ctx + self.cmd_ctx.meta['piotest_processor'] = True + self.test_name = testname + self.env_name = envname + self.options = options + + def process(self): + self._progress("Building... (1/3)") + self._build_or_upload(["test"]) + self._progress("Uploading... (2/3)") + self._build_or_upload(["test", "upload"]) + self._progress("Testing... (3/3)") + sleep(1.0) # wait while board is starting... + return self._run_hardware_test() + + def _progress(self, text, is_error=False): + print_header( + "[test::%s] %s" % (click.style( + self.test_name, fg="yellow", bold=True), text), + is_error=is_error) + click.echo() + + def _build_or_upload(self, target): + if self.test_name != "*": + self.cmd_ctx.meta['piotest'] = self.test_name + return self.cmd_ctx.invoke( + cmd_run, + project_dir=self.options['project_dir'], + upload_port=self.options['upload_port'], + verbose=self.options['verbose'], + environment=[self.env_name], + target=target) + + def _run_hardware_test(self): + click.echo("If you don't see any output for the first 10 secs, " + "please reset board (press reset button)") + click.echo() + ser = serial.Serial( + self.get_serial_port(), + self.SERIAL_BAUDRATE, + timeout=self.SERIAL_TIMEOUT) + passed = True + while True: + line = ser.readline().strip() + if not line: + continue + if line.endswith(":PASS"): + click.echo("%s\t%s" % (line[:-5], click.style( + "PASSED", fg="green"))) + elif ":FAIL:" in line: + passed = False + click.echo("%s\t%s" % (line, click.style("FAILED", fg="red"))) + else: + click.echo(line) + if all([l in line for l in ("Tests", "Failures", "Ignored")]): + break + ser.close() + return passed + + def get_serial_port(self): + config = self.options['project_config'] + envdata = {} + for k, v in config.items("env:" + self.env_name): + envdata[k] = v + + # if upload port is specified manually + if self.options.get("upload_port", envdata.get("upload_port")): + return self.options.get("upload_port", envdata.get("upload_port")) + + p = PlatformFactory.newPlatform(envdata['platform']) + bconfig = p.board_config(envdata['board']) + + port = None + board_hwids = [] + if "build.hwids" in bconfig: + board_hwids = bconfig.get("build.hwids") + for item in util.get_serialports(): + if "VID:PID" not in item['hwid']: + continue + port = item['port'] + for hwid in board_hwids: + hwid_str = ("%s:%s" % (hwid[0], hwid[1])).replace("0x", "") + if hwid_str in item['hwid']: + return port + if not port: + raise exception.PlatformioException( + "Please specify `upload_port` for environment or use " + "global `--upload-port` option.") + return port + + +def get_test_names(test_dir): + names = [] + for item in sorted(listdir(test_dir)): + if isdir(join(test_dir, item)): + names.append(item) + if not names: + names = ["*"] + return names diff --git a/platformio/commands/update.py b/platformio/commands/update.py index 52627a7a..422ac3d9 100644 --- a/platformio/commands/update.py +++ b/platformio/commands/update.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,14 +15,25 @@ import click from platformio.commands.lib import lib_update as cmd_lib_update -from platformio.commands.platforms import \ - platforms_update as cmd_platforms_update +from platformio.commands.platform import platform_update as cmd_platform_update +from platformio.managers.lib import LibraryManager -@click.command("update", - short_help="Update installed Platforms, Packages and Libraries") +@click.command( + "update", short_help="Update installed Platforms, Packages and Libraries") +@click.option( + "-c", + "--only-check", + is_flag=True, + help="Do not update, only check for new version") @click.pass_context -def cli(ctx): - ctx.invoke(cmd_platforms_update) +def cli(ctx, only_check): + click.echo("Platform Manager") + click.echo("================") + ctx.invoke(cmd_platform_update, only_check=only_check) + click.echo() - ctx.invoke(cmd_lib_update) + click.echo("Library Manager") + click.echo("===============") + ctx.obj = LibraryManager() + ctx.invoke(cmd_lib_update, only_check=only_check) diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index 24676bf1..93f82e6c 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,47 +13,36 @@ # limitations under the License. import os +import re import sys import click import requests -from platformio import __version__, exception, util +from platformio import VERSION, __version__, exception, util -@click.command("upgrade", - short_help="Upgrade PlatformIO to the latest version") +@click.command( + "upgrade", short_help="Upgrade PlatformIO to the latest version") def cli(): - last = get_latest_version() - if __version__ == last: + latest = get_latest_version() + if __version__ == latest: return click.secho( "You're up-to-date!\nPlatformIO %s is currently the " - "newest version available." % __version__, fg="green" - ) + "newest version available." % __version__, + fg="green") else: - click.secho("Please wait while upgrading PlatformIO ...", - fg="yellow") + click.secho("Please wait while upgrading PlatformIO ...", fg="yellow") - to_develop = False - try: - from pkg_resources import parse_version - to_develop = parse_version(last) < parse_version(__version__) - except ImportError: - pass - - cmds = ( - ["pip", "install", "--upgrade", - "https://github.com/platformio/platformio/archive/develop.zip" - if to_develop else "platformio"], - ["platformio", "--version"] - ) + to_develop = not all([c.isdigit() for c in latest if c != "."]) + cmds = (["pip", "install", "--upgrade", + "https://github.com/platformio/platformio/archive/develop.zip" + if to_develop else "platformio"], ["platformio", "--version"]) cmd = None r = None try: for cmd in cmds: - if sys.version_info < (2, 7, 0): - cmd[0] += ".__main__" cmd = [os.path.normpath(sys.executable), "-m"] + cmd r = None r = util.exec_command(cmd) @@ -68,21 +57,19 @@ def cli(): actual_version = r['out'].strip().split("version", 1)[1].strip() click.secho( "PlatformIO has been successfully upgraded to %s" % - actual_version, fg="green") + actual_version, + fg="green") click.echo("Release notes: ", nl=False) - click.secho("http://docs.platformio.org/en/stable/history.html", - fg="cyan") + click.secho( + "http://docs.platformio.org/en/stable/history.html", fg="cyan") except Exception as e: # pylint: disable=W0703 if not r: - raise exception.UpgradeError( - "\n".join([str(cmd), str(e)])) - permission_errors = ( - "permission denied", - "not permitted" - ) + raise exception.UpgradeError("\n".join([str(cmd), str(e)])) + permission_errors = ("permission denied", "not permitted") if (any([m in r['err'].lower() for m in permission_errors]) and "windows" not in util.get_systype()): - click.secho(""" + click.secho( + """ ----------------- Permission denied ----------------- @@ -91,19 +78,50 @@ You need the `sudo` permission to install Python packages. Try > sudo pip install -U platformio WARNING! Don't use `sudo` for the rest PlatformIO commands. -""", fg="yellow", err=True) +""", + fg="yellow", + err=True) raise exception.ReturnErrorCode() else: - raise exception.UpgradeError( - "\n".join([str(cmd), r['out'], r['err']])) + raise exception.UpgradeError("\n".join([str(cmd), r['out'], r[ + 'err']])) def get_latest_version(): try: - pkgdata = requests.get( - "https://pypi.python.org/pypi/platformio/json", - headers=util.get_request_defheaders() - ).json() - return pkgdata['info']['version'] + if not isinstance(VERSION[2], int): + try: + return get_develop_latest_version() + except: # pylint: disable=bare-except + pass + return get_pypi_latest_version() except: raise exception.GetLatestVersionError() + + +def get_develop_latest_version(): + version = None + r = requests.get("https://raw.githubusercontent.com/platformio/platformio" + "/develop/platformio/__init__.py", + headers=util.get_request_defheaders()) + r.raise_for_status() + for line in r.text.split("\n"): + line = line.strip() + if not line.startswith("VERSION"): + continue + match = re.match(r"VERSION\s*=\s*\(([^\)]+)\)", line) + if not match: + continue + version = match.group(1) + for c in (" ", "'", '"'): + version = version.replace(c, "") + version = ".".join(version.split(",")) + assert version + return version + + +def get_pypi_latest_version(): + r = requests.get("https://pypi.python.org/pypi/platformio/json", + headers=util.get_request_defheaders()) + r.raise_for_status() + return r.json()['info']['version'] diff --git a/platformio/downloader.py b/platformio/downloader.py index bbb90e07..e91f75db 100644 --- a/platformio/downloader.py +++ b/platformio/downloader.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -41,7 +41,8 @@ class FileDownloader(object): self._request = None # make connection - self._request = requests.get(url, stream=True, + self._request = requests.get(url, + stream=True, headers=util.get_request_defheaders()) if self._request.status_code != 200: raise FDUnrecognizedStatusCode(self._request.status_code, url) @@ -53,7 +54,7 @@ class FileDownloader(object): return self._destination def get_lmtime(self): - return self._request.headers['last-modified'] + return self._request.headers.get("last-modified") def get_size(self): if "content-length" not in self._request.headers: @@ -77,7 +78,8 @@ class FileDownloader(object): f.close() self._request.close() - self._preserve_filemtime(self.get_lmtime()) + if self.get_lmtime(): + self._preserve_filemtime(self.get_lmtime()) def verify(self, sha1=None): _dlsize = getsize(self._destination) diff --git a/platformio/exception.py b/platformio/exception.py index 07fa0248..7064b34e 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ class BoardNotDefined(PlatformioException): class UnknownBoard(PlatformioException): - MESSAGE = "Unknown board type '{0}'" + MESSAGE = "Unknown board ID '{0}'" class UnknownFramework(PlatformioException): @@ -70,14 +70,16 @@ class UnknownPackage(PlatformioException): MESSAGE = "Detected unknown package '{0}'" -class InvalidPackageVersion(PlatformioException): +class UndefinedPackageVersion(PlatformioException): - MESSAGE = "The package '{0}' with version '{1:d}' does not exist" + MESSAGE = "Could not find a version that satisfies the requirement '{0}'"\ + " for your system '{1}'" -class NonSystemPackage(PlatformioException): +class PackageInstallError(PlatformioException): - MESSAGE = "The package '{0}' is not available for your system '{1}'" + MESSAGE = "Can not install '{0}' with version requirements '{1}' "\ + "for your system '{2}'" class FDUnrecognizedStatusCode(PlatformioException): @@ -97,7 +99,7 @@ class FDSHASumMismatch(PlatformioException): "is not equal to remote '{2}'" -class NotPlatformProject(PlatformioException): +class NotPlatformIOProject(PlatformioException): MESSAGE = "Not a PlatformIO project. `platformio.ini` file has not been "\ "found in current working directory ({0}). To initialize new project "\ @@ -144,18 +146,9 @@ class APIRequestError(PlatformioException): MESSAGE = "[API] {0}" -class LibAlreadyInstalled(PlatformioException): - pass +class LibNotFound(PlatformioException): - -class LibNotInstalled(PlatformioException): - - MESSAGE = "Library #{0:d} has not been installed yet" - - -class LibInstallDependencyError(PlatformioException): - - MESSAGE = "Error has been occurred for library dependency '{0}'" + MESSAGE = "Library `{0}` has not been found in the registry" class InvalidLibConfURL(PlatformioException): @@ -185,6 +178,13 @@ class CIBuildEnvsEmpty(PlatformioException): "predefined environments using `--project-conf` option" +class TestDirEmpty(PlatformioException): + + MESSAGE = "Test directory '{0}' is empty. More details about Unit "\ + "Testing:\n http://docs.platformio.org/en/stable/platforms/"\ + "unit_testing.html" + + class UpgradeError(PlatformioException): MESSAGE = """{0} diff --git a/platformio/ide/__init__.py b/platformio/ide/__init__.py index 0c05c3b0..95899c71 100644 --- a/platformio/ide/__init__.py +++ b/platformio/ide/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 4c0a4365..ecd2f868 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -46,34 +46,24 @@ class ProjectGenerator(object): @util.memoized def get_project_env(self): data = {"env_name": "PlatformIO"} - with util.cd(self.project_dir): - config = util.get_project_config() - for section in config.sections(): - if not section.startswith("env:"): - continue - data = {"env_name": section[4:]} - for k, v in config.items(section): - data[k] = v - if self.board == data.get("board"): - break + config = util.load_project_config(self.project_dir) + for section in config.sections(): + if not section.startswith("env:"): + continue + data = {"env_name": section[4:]} + for k, v in config.items(section): + data[k] = v + if self.board == data.get("board"): + break return data @util.memoized def get_project_build_data(self): - data = { - "defines": [], - "includes": [], - "cxx_path": None - } + data = {"defines": [], "includes": [], "cxx_path": None} envdata = self.get_project_env() if "env_name" not in envdata: return data - cmd = [ - normpath(sys.executable), "-m", - "platformio" + ( - ".__main__" if sys.version_info < (2, 7, 0) else ""), - "-f" - ] + cmd = [normpath(sys.executable), "-m", "platformio", "-f"] if app.get_session_var("caller_id"): cmd.extend(["-c", app.get_session_var("caller_id")]) cmd.extend(["run", "-t", "idedata", "-e", envdata['env_name']]) @@ -81,8 +71,8 @@ class ProjectGenerator(object): result = util.exec_command(cmd) if result['returncode'] != 0 or '"includes":' not in result['out']: - raise exception.PlatformioException( - "\n".join([result['out'], result['err']])) + raise exception.PlatformioException("\n".join([result['out'], + result['err']])) output = result['out'] start_index = output.index('{"') @@ -126,8 +116,7 @@ class ProjectGenerator(object): file_name = basename(tpl_path)[:-4] self._merge_contents( join(dst_dir, file_name), - self._render_tpl(tpl_path).encode("utf8") - ) + self._render_tpl(tpl_path).encode("utf8")) def _render_tpl(self, tpl_path): content = "" @@ -162,13 +151,13 @@ class ProjectGenerator(object): "project_dir": self.project_dir, "project_src_dir": self.project_src_dir, "systype": util.get_systype(), - "platformio_path": self._fix_os_path( - util.where_is_program("platformio")), + "platformio_path": + self._fix_os_path(util.where_is_program("platformio")), "env_pathsep": os.pathsep, "env_path": self._fix_os_path(os.getenv("PATH")) }) @staticmethod def _fix_os_path(path): - return (re.sub(r"[\\]+", '\\' * 4, path) if "windows" in - util.get_systype() else path) + return (re.sub(r"[\\]+", '\\' * 4, path) + if "windows" in util.get_systype() else path) diff --git a/platformio/libmanager.py b/platformio/libmanager.py deleted file mode 100644 index 964b10d0..00000000 --- a/platformio/libmanager.py +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import re -from os import listdir, makedirs, remove, rename -from os.path import isdir, isfile, join -from shutil import rmtree -from tempfile import gettempdir - -from platformio import telemetry, util -from platformio.downloader import FileDownloader -from platformio.exception import LibAlreadyInstalled, LibNotInstalled -from platformio.unpacker import FileUnpacker - - -class LibraryManager(object): - - CONFIG_NAME = ".library.json" - - def __init__(self, lib_dir=None): - self.lib_dir = lib_dir or util.get_lib_dir() - - @staticmethod - def download(url, dest_dir): - fd = FileDownloader(url, dest_dir) - fd.start() - return fd.get_filepath() - - @staticmethod - def unpack(pkgpath, dest_dir): - fu = FileUnpacker(pkgpath, dest_dir) - return fu.start() - - def get_installed(self): - items = {} - if not isdir(self.lib_dir): - return items - for dirname in sorted(listdir(self.lib_dir)): - conf_path = join(self.lib_dir, dirname, self.CONFIG_NAME) - if not isfile(conf_path): - continue - items[dirname] = util.load_json(conf_path) - return items - - def get_latest_versions(self): - lib_ids = [str(item['id']) for item in self.get_installed().values()] - if not lib_ids: - return None - return util.get_api_result("/lib/version/" + str(",".join(lib_ids))) - - def get_outdated(self): - outdated = [] - for id_, latest_version in (self.get_latest_versions() or {}).items(): - info = self.get_info(int(id_)) - if latest_version != info['version']: - outdated.append(info['name']) - return outdated - - def get_info(self, id_): - for item in self.get_installed().values(): - if "id" in item and item['id'] == id_: - return item - raise LibNotInstalled(id_) - - def is_installed(self, id_): - try: - return int(self.get_info(id_)['id']) == id_ - except LibNotInstalled: - return False - - def install(self, id_, version=None): - if self.is_installed(id_): - raise LibAlreadyInstalled() - - dlinfo = util.get_api_result( - "/lib/download/" + str(id_), - dict(version=version) if version else None - ) - dlpath = None - tmplib_dir = join(self.lib_dir, str(id_)) - try: - dlpath = self.download(dlinfo['url'], gettempdir()) - if not isdir(tmplib_dir): - makedirs(tmplib_dir) - self.unpack(dlpath, tmplib_dir) - finally: - if dlpath: - remove(dlpath) - - info = self.get_info(id_) - rename(tmplib_dir, join(self.lib_dir, "%s_ID%d" % ( - re.sub(r"[^\da-zA-Z]+", "_", info['name']), id_))) - - telemetry.on_event( - category="LibraryManager", action="Install", - label="#%d %s" % (id_, info['name']) - ) - - return True - - def uninstall(self, id_): - for libdir, item in self.get_installed().iteritems(): - if "id" in item and item['id'] == id_: - rmtree(join(self.lib_dir, libdir)) - telemetry.on_event( - category="LibraryManager", action="Uninstall", - label="#%d %s" % (id_, item['name']) - ) - return True - raise LibNotInstalled(id_) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 4832793d..0f959a23 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,25 +12,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -import re -import struct -from os import getenv, remove -from os.path import isdir, isfile, join -from shutil import rmtree +import json +import os +from os import getenv +from os.path import isdir, join from time import time import click +import semantic_version from platformio import __version__, app, exception, telemetry, util -from platformio.commands.lib import lib_update as cmd_libraries_update -from platformio.commands.platforms import \ - platforms_install as cmd_platforms_install -from platformio.commands.platforms import \ - platforms_update as cmd_platforms_update +from platformio.commands.lib import lib_update as cmd_lib_update +from platformio.commands.platform import \ + platform_install as cmd_platform_install +from platformio.commands.platform import platform_update as cmd_platform_update from platformio.commands.upgrade import get_latest_version -from platformio.libmanager import LibraryManager -from platformio.platforms.base import PlatformFactory -from platformio.util import get_home_dir +from platformio.managers.lib import LibraryManager +from platformio.managers.platform import PlatformManager def in_silence(ctx): @@ -58,8 +56,10 @@ def on_platformio_end(ctx, result): # pylint: disable=W0613 check_internal_updates(ctx, "platforms") check_internal_updates(ctx, "libraries") except (exception.GetLatestVersionError, exception.APIRequestError): - click.secho("Failed to check for PlatformIO upgrades. " - "Please check your Internet connection.", fg="red") + click.secho( + "Failed to check for PlatformIO upgrades. " + "Please check your Internet connection.", + fg="red") def on_platformio_exception(e): @@ -69,21 +69,14 @@ def on_platformio_exception(e): class Upgrader(object): def __init__(self, from_version, to_version): - self.from_version = self.version_to_int(from_version) - self.to_version = self.version_to_int(to_version) + self.from_version = semantic_version.Version.coerce( + util.pepver_to_semver(from_version)) + self.to_version = semantic_version.Version.coerce( + util.pepver_to_semver(to_version)) - self._upgraders = ( - (self.version_to_int("0.9.0"), self._upgrade_to_0_9_0), - (self.version_to_int("1.0.0"), self._upgrade_to_1_0_0) - ) - - @staticmethod - def version_to_int(version): - match = re.match(r"(\d+)\.(\d+)\.(\d+)(\D+)?", version) - assert match is not None and len(match.groups()) is 4 - verchrs = [chr(int(match.group(i))) for i in range(1, 4)] - verchrs.append(chr(255 if match.group(4) is None else 0)) - return struct.unpack(">I", "".join(verchrs)) + self._upgraders = [ + (semantic_version.Version("3.0.0"), self._upgrade_to_3_0_0) + ] def run(self, ctx): if self.from_version > self.to_version: @@ -91,38 +84,32 @@ class Upgrader(object): result = [True] for item in self._upgraders: - if self.from_version >= item[0]: + if self.from_version >= item[0] or self.to_version < item[0]: continue result.append(item[1](ctx)) return all(result) - def _upgrade_to_0_9_0(self, ctx): # pylint: disable=R0201 - prev_platforms = [] + def _upgrade_to_3_0_0(self, ctx): # pylint: disable=R0201 + # convert custom board configuration + boards_dir = join(util.get_home_dir(), "boards") + if isdir(boards_dir): + for item in os.listdir(boards_dir): + if not item.endswith(".json"): + continue + data = util.load_json(join(boards_dir, item)) + if set(["name", "url", "vendor"]) <= set(data.keys()): + continue + os.remove(join(boards_dir, item)) + for key, value in data.items(): + with open(join(boards_dir, "%s.json" % key), "w") as f: + json.dump(value, f, sort_keys=True, indent=2) - # remove platform's folder (obsolete package structure) - for name in PlatformFactory.get_platforms(): - pdir = join(get_home_dir(), name) - if not isdir(pdir): - continue - prev_platforms.append(name) - rmtree(pdir) - - # remove unused files - for fname in (".pioupgrade", "installed.json"): - if isfile(join(get_home_dir(), fname)): - remove(join(get_home_dir(), fname)) - - if prev_platforms: - ctx.invoke(cmd_platforms_install, platforms=prev_platforms) - - return True - - def _upgrade_to_1_0_0(self, ctx): # pylint: disable=R0201 - installed_platforms = PlatformFactory.get_platforms( - installed=True).keys() + # re-install PlatformIO 2.0 development platforms + installed_platforms = app.get_state_item("installed_platforms", []) if installed_platforms: - ctx.invoke(cmd_platforms_install, platforms=installed_platforms) + ctx.invoke(cmd_platform_install, platforms=installed_platforms) + return True @@ -131,57 +118,56 @@ def after_upgrade(ctx): if last_version == __version__: return - terminal_width, _ = click.get_terminal_size() - - # promotion - click.echo("") - click.echo("*" * terminal_width) - click.echo("If you like %s, please:" % ( - click.style("PlatformIO", fg="cyan") - )) - click.echo( - "- %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/PlatformIO_Org", fg="cyan")) - ) - click.echo("- %s it on GitHub > %s" % ( - click.style("star", fg="cyan"), - click.style("https://github.com/platformio/platformio", fg="cyan") - )) - if not getenv("PLATFORMIO_IDE"): - click.echo("- %s PlatformIO IDE for IoT development > %s" % ( - click.style("try", fg="cyan"), - click.style("http://platformio.org/platformio-ide", fg="cyan") - )) - if not util.is_ci(): - click.echo("- %s to keep PlatformIO alive! > %s" % ( - click.style("donate", fg="cyan"), - click.style("http://platformio.org/donate", fg="cyan") - )) - - click.echo("*" * terminal_width) - click.echo("") - if last_version == "0.0.0": app.set_state_item("last_version", __version__) - return - - click.secho("Please wait while upgrading PlatformIO ...", - fg="yellow") - - u = Upgrader(last_version, __version__) - if u.run(ctx): - app.set_state_item("last_version", __version__) - ctx.invoke(cmd_platforms_update) - - click.secho("PlatformIO has been successfully upgraded to %s!\n" % - __version__, fg="green") - - telemetry.on_event(category="Auto", action="Upgrade", - label="%s > %s" % (last_version, __version__)) else: - raise exception.UpgradeError("Auto upgrading...") + click.secho("Please wait while upgrading PlatformIO ...", fg="yellow") + + u = Upgrader(last_version, __version__) + if u.run(ctx): + app.set_state_item("last_version", __version__) + + # patch development platforms + pm = PlatformManager() + for manifest in pm.get_installed(): + pm.update(manifest['name'], "^" + manifest['version']) + + click.secho( + "PlatformIO has been successfully upgraded to %s!\n" % + __version__, + fg="green") + + telemetry.on_event( + category="Auto", + action="Upgrade", + label="%s > %s" % (last_version, __version__)) + else: + raise exception.UpgradeError("Auto upgrading...") + click.echo("") + + # PlatformIO banner + terminal_width, _ = click.get_terminal_size() + click.echo("*" * terminal_width) + click.echo("If you like %s, please:" % (click.style( + "PlatformIO", fg="cyan"))) + click.echo("- %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/PlatformIO_Org", fg="cyan"))) + click.echo("- %s it on GitHub > %s" % (click.style( + "star", fg="cyan"), click.style( + "https://github.com/platformio/platformio", fg="cyan"))) + if not getenv("PLATFORMIO_IDE"): + click.echo("- %s PlatformIO IDE for IoT development > %s" % + (click.style( + "try", fg="cyan"), click.style( + "http://platformio.org/platformio-ide", fg="cyan"))) + if not util.is_ci(): + click.echo("- %s to keep PlatformIO alive! > %s" % (click.style( + "donate", fg="cyan"), click.style( + "http://platformio.org/donate", fg="cyan"))) + + click.echo("*" * terminal_width) click.echo("") @@ -195,30 +181,34 @@ def check_platformio_upgrade(): app.set_state_item("last_check", last_check) latest_version = get_latest_version() - if (latest_version == __version__ or - Upgrader.version_to_int(latest_version) < - Upgrader.version_to_int(__version__)): + if semantic_version.Version.coerce(util.pepver_to_semver( + latest_version)) <= semantic_version.Version.coerce( + util.pepver_to_semver(__version__)): return terminal_width, _ = click.get_terminal_size() click.echo("") click.echo("*" * terminal_width) - click.secho("There is a new version %s of PlatformIO available.\n" - "Please upgrade it via `" % latest_version, - fg="yellow", nl=False) + click.secho( + "There is a new version %s of PlatformIO available.\n" + "Please upgrade it via `" % latest_version, + fg="yellow", + nl=False) if getenv("PLATFORMIO_IDE"): - click.secho("PlatformIO IDE Menu: Upgrade PlatformIO", - fg="cyan", nl=False) + click.secho( + "PlatformIO IDE Menu: Upgrade PlatformIO", fg="cyan", nl=False) click.secho("`.", fg="yellow") + elif join("Cellar", "platformio") in util.get_source_dir(): + click.secho("brew update && brew upgrade", fg="cyan", nl=False) + click.secho("` command.", fg="yellow") else: click.secho("platformio upgrade", fg="cyan", nl=False) click.secho("` or `", fg="yellow", nl=False) click.secho("pip install -U platformio", fg="cyan", nl=False) click.secho("` command.", fg="yellow") click.secho("Changes: ", fg="yellow", nl=False) - click.secho("http://docs.platformio.org/en/stable/history.html", - fg="cyan") + click.secho("http://docs.platformio.org/en/stable/history.html", fg="cyan") click.echo("*" * terminal_width) click.echo("") @@ -232,15 +222,12 @@ def check_internal_updates(ctx, what): last_check[what + '_update'] = int(time()) app.set_state_item("last_check", last_check) + pm = PlatformManager() if what == "platforms" else LibraryManager() outdated_items = [] - if what == "platforms": - for platform in PlatformFactory.get_platforms(installed=True): - p = PlatformFactory.newPlatform(platform) - if p.is_outdated(): - outdated_items.append(platform) - elif what == "libraries": - lm = LibraryManager() - outdated_items = lm.get_outdated() + for manifest in pm.get_installed(): + if manifest['name'] not in outdated_items and \ + pm.is_outdated(manifest['name']): + outdated_items.append(manifest['name']) if not outdated_items: return @@ -249,25 +236,41 @@ def check_internal_updates(ctx, what): click.echo("") click.echo("*" * terminal_width) - click.secho("There are the new updates for %s (%s)" % - (what, ", ".join(outdated_items)), fg="yellow") + click.secho( + "There are the new updates for %s (%s)" % + (what, ", ".join(outdated_items)), + fg="yellow") if not app.get_setting("auto_update_" + what): click.secho("Please update them via ", fg="yellow", nl=False) - click.secho("`platformio %s update`" % - ("lib" if what == "libraries" else "platforms"), - fg="cyan", nl=False) + click.secho( + "`platformio %s update`" % + ("lib --global" if what == "libraries" else "platform"), + fg="cyan", + nl=False) + click.secho(" command.\n", fg="yellow") + click.secho( + "If you want to manually check for the new versions " + "without updating, please use ", + fg="yellow", + nl=False) + click.secho( + "`platformio %s update --only-check`" % + ("lib --global" if what == "libraries" else "platform"), + fg="cyan", + nl=False) click.secho(" command.", fg="yellow") else: click.secho("Please wait while updating %s ..." % what, fg="yellow") if what == "platforms": - ctx.invoke(cmd_platforms_update) + ctx.invoke(cmd_platform_update, platforms=outdated_items) elif what == "libraries": - ctx.invoke(cmd_libraries_update) + ctx.obj = pm + ctx.invoke(cmd_lib_update, libraries=outdated_items) click.echo() - telemetry.on_event(category="Auto", action="Update", - label=what.title()) + telemetry.on_event( + category="Auto", action="Update", label=what.title()) click.echo("*" * terminal_width) click.echo("") diff --git a/platformio/builder/scripts/__init__.py b/platformio/managers/__init__.py similarity index 89% rename from platformio/builder/scripts/__init__.py rename to platformio/managers/__init__.py index 0c05c3b0..95899c71 100644 --- a/platformio/builder/scripts/__init__.py +++ b/platformio/managers/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/platformio/managers/lib.py b/platformio/managers/lib.py new file mode 100644 index 00000000..a34a196b --- /dev/null +++ b/platformio/managers/lib.py @@ -0,0 +1,209 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +from os.path import join + +import click +import semantic_version + +from platformio import app, commands, exception, util +from platformio.managers.package import BasePkgManager + + +class LibraryManager(BasePkgManager): + + def __init__(self, package_dir=None): + if not package_dir: + package_dir = join(util.get_home_dir(), "lib") + BasePkgManager.__init__(self, package_dir) + + @property + def manifest_name(self): + return ".library.json" + + @staticmethod + def max_satisfying_repo_version(versions, requirements=None): + + def _cmp_dates(datestr1, datestr2): + from datetime import datetime + assert "T" in datestr1 and "T" in datestr2 + dateformat = "%Y-%m-%d %H:%M:%S" + date1 = datetime.strptime(datestr1[:-1].replace("T", " "), + dateformat) + date2 = datetime.strptime(datestr2[:-1].replace("T", " "), + dateformat) + if date1 == date2: + return 0 + return -1 if date1 < date2 else 1 + + item = None + reqspec = None + if requirements: + try: + reqspec = semantic_version.Spec(requirements) + except ValueError: + pass + for v in versions: + specver = None + try: + specver = semantic_version.Version(v['version'], partial=True) + except ValueError: + pass + + if reqspec: + if not specver or specver not in reqspec: + continue + if not item or semantic_version.Version( + item['version'], partial=True) < specver: + item = v + elif requirements: + if requirements == v['version']: + return v + else: + if not item or _cmp_dates(item['date'], v['date']) == -1: + item = v + return item + + def get_latest_repo_version(self, name, requirements): + item = self.max_satisfying_repo_version( + util.get_api_result("/lib/versions/%d" % self._get_pkg_id_by_name( + name, requirements)), requirements) + return item['version'] if item else None + + def _get_pkg_id_by_name(self, name, requirements, quiet=False): + if name.startswith("id="): + return int(name[3:]) + # try to find ID from installed packages + installed_dir = self.get_installed_dir(name, requirements) + if installed_dir: + manifest = self.load_manifest(installed_dir) + if "id" in manifest: + return int(manifest['id']) + return int(self.search_for_library({"name": name}, quiet)['id']) + + def _install_from_piorepo(self, name, requirements): + assert name.startswith("id=") + version = self.get_latest_repo_version(name, requirements) + if not version: + raise exception.UndefinedPackageVersion(requirements or "latest", + util.get_systype()) + dl_data = util.get_api_result( + "/lib/download/" + str(name[3:]), dict(version=version)) + assert dl_data + pkg_dir = None + try: + pkg_dir = self._install_from_url( + name, dl_data['url'].replace("http://", "https://"), + requirements) + except exception.APIRequestError: + pkg_dir = self._install_from_url(name, dl_data['url'], + requirements) + return pkg_dir + + def install(self, name, requirements=None, quiet=False, + trigger_event=True): + _name, _requirements, _url = self.parse_pkg_name(name, requirements) + if not _url: + _name = "id=%d" % self._get_pkg_id_by_name( + _name, _requirements, quiet=quiet) + already_installed = self.get_installed_dir(_name, _requirements, _url) + pkg_dir = BasePkgManager.install(self, _name if not _url else name, + _requirements, quiet, trigger_event) + + if already_installed: + return + + manifest = self.load_manifest(pkg_dir) + if "dependencies" not in manifest: + return pkg_dir + + if not quiet: + click.secho("Installing dependencies", fg="yellow") + + _dependencies = manifest['dependencies'] + if not isinstance(_dependencies, list): + _dependencies = [_dependencies] + for filters in _dependencies: + assert "name" in filters + if any([s in filters.get("version", "") for s in ("\\", "/")]): + self.install("{name}={version}".format(**filters)) + else: + lib_info = self.search_for_library(filters, quiet) + if filters.get("version"): + self.install( + lib_info['id'], + requirements=filters.get("version"), + quiet=quiet, + trigger_event=trigger_event) + else: + self.install( + lib_info['id'], + quiet=quiet, + trigger_event=trigger_event) + return pkg_dir + + @staticmethod + def search_for_library( # pylint: disable=too-many-branches + filters, quiet=False): + assert isinstance(filters, dict) + assert "name" in filters + if not quiet: + click.echo("Looking for %s library in registry" % click.style( + filters['name'], fg="cyan")) + query = [] + for key in filters: + if key not in ("name", "authors", "frameworks", "platforms"): + continue + values = filters[key] + if not isinstance(values, list): + values = [v.strip() for v in values.split(",") if v] + for value in values: + query.append('%s:"%s"' % (key[:-1] if key.endswith("s") else + key, value)) + + lib_info = None + result = util.get_api_result( + "/lib/search", dict(query=" ".join(query))) + if result['total'] == 1: + lib_info = result['items'][0] + elif result['total'] > 1: + click.secho( + "Conflict: More than one library has been found " + "by request %s:" % json.dumps(filters), + fg="red") + commands.lib.echo_liblist_header() + for item in result['items']: + commands.lib.echo_liblist_item(item) + + if not app.get_setting("enable_prompts"): + click.echo("Automatically chose the first available library") + lib_info = result['items'][0] + else: + deplib_id = click.prompt( + "Please choose library ID", + type=click.Choice([str(i['id']) for i in result['items']])) + for item in result['items']: + if item['id'] == int(deplib_id): + lib_info = item + break + + if not lib_info: + raise exception.LibNotFound(str(filters)) + if not quiet: + click.echo("Found: %s" % click.style( + "http://platformio.org/lib/show/{id}/{name}".format( + **lib_info), + fg="blue")) + return lib_info diff --git a/platformio/managers/package.py b/platformio/managers/package.py new file mode 100644 index 00000000..9b8cdc4f --- /dev/null +++ b/platformio/managers/package.py @@ -0,0 +1,553 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +import os +from os.path import basename, dirname, isdir, isfile, islink, join +from shutil import copyfile, copytree +from tempfile import mkdtemp + +import click +import requests +import semantic_version + +from platformio import exception, telemetry, util +from platformio.downloader import FileDownloader +from platformio.unpacker import FileUnpacker +from platformio.vcsclient import VCSClientFactory + + +class PackageRepoIterator(object): + + _MANIFEST_CACHE = {} + + def __init__(self, package, repositories): + assert isinstance(repositories, list) + self.package = package + self.repositories = iter(repositories) + + def __iter__(self): + return self + + def __next__(self): + return self.next() + + def next(self): + manifest = {} + repo = next(self.repositories) + if isinstance(repo, dict): + manifest = repo + elif repo in PackageRepoIterator._MANIFEST_CACHE: + manifest = PackageRepoIterator._MANIFEST_CACHE[repo] + else: + r = None + try: + r = requests.get(repo, headers=util.get_request_defheaders()) + r.raise_for_status() + manifest = r.json() + except: # pylint: disable=bare-except + pass + finally: + if r: + r.close() + PackageRepoIterator._MANIFEST_CACHE[repo] = manifest + + if self.package in manifest: + return manifest[self.package] + else: + return self.next() + + +class PkgRepoMixin(object): + + @staticmethod + def max_satisfying_repo_version(versions, requirements=None): + item = None + systype = util.get_systype() + reqspec = None + if requirements: + try: + reqspec = semantic_version.Spec(requirements) + except ValueError: + pass + + for v in versions: + if ("system" in v and v['system'] not in ("all", "*") and + systype not in v['system']): + continue + specver = semantic_version.Version(v['version']) + if reqspec and specver not in reqspec: + continue + if not item or semantic_version.Version(item['version']) < specver: + item = v + return item + + def get_latest_repo_version(self, name, requirements): + version = None + for versions in PackageRepoIterator(name, self.repositories): + pkgdata = self.max_satisfying_repo_version(versions, requirements) + if not pkgdata: + continue + if not version or semantic_version.compare(pkgdata['version'], + version) == 1: + version = pkgdata['version'] + return version + + +class PkgInstallerMixin(object): + + VCS_MANIFEST_NAME = ".piopkgmanager.json" + + def get_vcs_manifest_path(self, pkg_dir): + for item in os.listdir(pkg_dir): + if not isdir(join(pkg_dir, item)): + continue + if isfile(join(pkg_dir, item, self.VCS_MANIFEST_NAME)): + return join(pkg_dir, item, self.VCS_MANIFEST_NAME) + return None + + def get_manifest_path(self, pkg_dir): + if not isdir(pkg_dir): + return None + manifest_path = join(pkg_dir, self.manifest_name) + if isfile(manifest_path): + return manifest_path + return self.get_vcs_manifest_path(pkg_dir) + + def manifest_exists(self, pkg_dir): + return self.get_manifest_path(pkg_dir) is not None + + def load_manifest(self, path): + assert path + pkg_dir = path + if isdir(path): + path = self.get_manifest_path(path) + else: + pkg_dir = dirname(pkg_dir) + if path: + if isfile(path) and path.endswith(self.VCS_MANIFEST_NAME): + pkg_dir = dirname(dirname(path)) + manifest = util.load_json(path) + manifest['__pkg_dir'] = pkg_dir + return manifest + return None + + def check_pkg_structure(self, pkg_dir): + if self.manifest_exists(pkg_dir): + return True + + for root, _, _ in os.walk(pkg_dir): + if not self.manifest_exists(root): + continue + # copy contents to the root of package directory + for item in os.listdir(root): + item_path = join(root, item) + if isfile(item_path): + copyfile(item_path, join(pkg_dir, item)) + elif isdir(item_path): + copytree(item_path, join(pkg_dir, item), symlinks=True) + # remove not used contents + while True: + util.rmtree_(root) + root = dirname(root) + if root == pkg_dir: + break + break + + if self.manifest_exists(pkg_dir): + return True + + raise exception.PlatformioException( + "Could not find '%s' manifest file in the package" % + self.manifest_name) + + def _install_from_piorepo(self, name, requirements): + pkg_dir = None + pkgdata = None + versions = None + for versions in PackageRepoIterator(name, self.repositories): + pkgdata = self.max_satisfying_repo_version(versions, requirements) + if not pkgdata: + continue + try: + pkg_dir = self._install_from_url( + name, pkgdata['url'], requirements, pkgdata.get("sha1")) + break + except Exception as e: # pylint: disable=broad-except + click.secho("Warning! Package Mirror: %s" % e, fg="yellow") + click.secho("Looking for the another mirror...", fg="yellow") + + if versions is None: + raise exception.UnknownPackage(name) + elif not pkgdata: + raise exception.UndefinedPackageVersion(requirements or "latest", + util.get_systype()) + return pkg_dir + + def _install_from_url(self, name, url, requirements=None, sha1=None): + pkg_dir = None + tmp_dir = mkdtemp("-package", "installing-", self.package_dir) + + try: + if url.startswith("file://"): + url = url[7:] + if isfile(url): + self.unpack(url, tmp_dir) + else: + util.rmtree_(tmp_dir) + copytree(url, tmp_dir) + elif url.startswith(("http://", "https://")): + dlpath = self.download(url, tmp_dir, sha1) + assert isfile(dlpath) + self.unpack(dlpath, tmp_dir) + os.remove(dlpath) + else: + vcs = VCSClientFactory.newClient(tmp_dir, url) + assert vcs.export() + with open(join(vcs.storage_dir, self.VCS_MANIFEST_NAME), + "w") as fp: + json.dump({ + "name": name, + "version": vcs.get_current_revision(), + "url": url, + "requirements": requirements + }, fp) + + self.check_pkg_structure(tmp_dir) + pkg_dir = self._install_from_tmp_dir(tmp_dir, requirements) + finally: + if isdir(tmp_dir): + util.rmtree_(tmp_dir) + return pkg_dir + + def _install_from_tmp_dir(self, tmp_dir, requirements=None): + tmpmanifest = self.load_manifest(tmp_dir) + assert set(["name", "version"]) <= set(tmpmanifest.keys()) + name = tmpmanifest['name'] + pkg_dir = join(self.package_dir, name) + if "id" in tmpmanifest: + name += "_ID%d" % tmpmanifest['id'] + pkg_dir = join(self.package_dir, name) + + # package should satisfy requirements + if requirements: + mismatch_error = ( + "Package version %s doesn't satisfy requirements %s" % ( + tmpmanifest['version'], requirements)) + try: + reqspec = semantic_version.Spec(requirements) + tmpmanver = semantic_version.Version( + tmpmanifest['version'], partial=True) + assert tmpmanver in reqspec, mismatch_error + + if self.manifest_exists(pkg_dir): + curmanifest = self.load_manifest(pkg_dir) + curmanver = semantic_version.Version( + curmanifest['version'], partial=True) + # if current package version < new package, backup it + if tmpmanver > curmanver: + os.rename(pkg_dir, join(self.package_dir, "%s@%s" % ( + name, curmanifest['version']))) + elif tmpmanver < curmanver: + pkg_dir = join(self.package_dir, "%s@%s" % + (name, tmpmanifest['version'])) + except ValueError: + assert tmpmanifest['version'] == requirements, mismatch_error + + # remove previous/not-satisfied package + if isdir(pkg_dir): + util.rmtree_(pkg_dir) + os.rename(tmp_dir, pkg_dir) + assert isdir(pkg_dir) + return pkg_dir + + +class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): + + _INSTALLED_CACHE = {} + + def __init__(self, package_dir, repositories=None): + self.repositories = repositories + self.package_dir = package_dir + if not isdir(self.package_dir): + os.makedirs(self.package_dir) + assert isdir(self.package_dir) + + @property + def manifest_name(self): + raise NotImplementedError() + + @staticmethod + def download(url, dest_dir, sha1=None): + fd = FileDownloader(url, dest_dir) + fd.start() + if sha1: + fd.verify(sha1) + return fd.get_filepath() + + @staticmethod + def unpack(source_path, dest_dir): + fu = FileUnpacker(source_path, dest_dir) + return fu.start() + + def reset_cache(self): + if self.package_dir in BasePkgManager._INSTALLED_CACHE: + del BasePkgManager._INSTALLED_CACHE[self.package_dir] + + def print_message(self, message, nl=True): + click.echo("%s: %s" % (self.__class__.__name__, message), nl=nl) + + @staticmethod + def parse_pkg_name( # pylint: disable=too-many-branches + text, requirements=None): + text = str(text) + if not requirements and "@" in text and not text.startswith("git@"): + text, requirements = text.rsplit("@", 1) + if text.isdigit(): + text = "id=" + text + + url_marker = "://" + name, url = (None, text) + if "=" in text and not text.startswith("id="): + name, url = text.split("=", 1) + + # Handle GitHub URL (https://github.com/user/package) + if url.startswith("https://github.com/") and \ + not url.endswith((".zip", ".tar.gz")): + url = "git+" + url + # Handle Developer Mbed URL + # (https://developer.mbed.org/users/user/code/package/) + if url.startswith("https://developer.mbed.org"): + url = "hg+" + url + + # git@github.com:user/package.git + if url.startswith("git@"): + url_marker = "git@" + + if any([s in url for s in ("\\", "/")]) and url_marker not in url: + if isfile(url) or isdir(url): + url = "file://" + url + elif url.count("/") == 1 and not url.startswith("git@"): + url = "git+https://github.com/" + url + if url_marker in url and not name: + _url = url.split("#", 1)[0] if "#" in url else url + if _url.endswith(("\\", "/")): + _url = _url[:-1] + name = basename(_url) + if "." in name and not name.startswith("."): + name = name.split(".", 1)[0] + + if url_marker not in url: + url = None + return (name or text, requirements, url) + + def get_installed(self): + if self.package_dir in BasePkgManager._INSTALLED_CACHE: + return BasePkgManager._INSTALLED_CACHE[self.package_dir] + items = [] + for p in sorted(os.listdir(self.package_dir)): + manifest = self.load_manifest(join(self.package_dir, p)) + if not manifest: + continue + assert set(["name", "version"]) <= set(manifest.keys()) + items.append(manifest) + BasePkgManager._INSTALLED_CACHE[self.package_dir] = items + return items + + def get_installed_dir(self, name, requirements=None, url=None): + pkg_id = int(name[3:]) if name.startswith("id=") else 0 + best = None + reqspec = None + if requirements: + try: + reqspec = semantic_version.Spec(requirements) + except ValueError: + pass + + for manifest in self.get_installed(): + if pkg_id and manifest.get("id") != pkg_id: + continue + elif not pkg_id and manifest['name'] != name: + continue + elif not reqspec and requirements: + if requirements == manifest['version']: + best = manifest + break + continue + try: + if reqspec and not reqspec.match( + semantic_version.Version( + manifest['version'], partial=True)): + continue + elif not best or (semantic_version.Version( + manifest['version'], partial=True) > + semantic_version.Version( + best['version'], partial=True)): + best = manifest + except ValueError: + pass + if best: + # check that URL is the same in installed package (VCS) + if url and best.get("url") != url: + return None + return best.get("__pkg_dir") + return None + + def is_outdated(self, name, requirements=None): + installed_dir = self.get_installed_dir(name, requirements) + if not installed_dir: + click.secho( + "%s @ %s is not installed" % (name, requirements or "*"), + fg="yellow") + return + if self.get_vcs_manifest_path(installed_dir): + return False + manifest = self.load_manifest(installed_dir) + return manifest['version'] != self.get_latest_repo_version( + name, requirements) + + def install(self, name, requirements=None, quiet=False, + trigger_event=True): + name, requirements, url = self.parse_pkg_name(name, requirements) + installed_dir = self.get_installed_dir(name, requirements, url) + + if not installed_dir or not quiet: + msg = "Installing " + click.style(name, fg="cyan") + if requirements: + msg += " @ " + requirements + self.print_message(msg) + if installed_dir: + if not quiet: + click.secho( + "{name} @ {version} is already installed".format( + **self.load_manifest(installed_dir)), + fg="yellow") + return installed_dir + + if url: + pkg_dir = self._install_from_url(name, url, requirements) + else: + pkg_dir = self._install_from_piorepo(name, requirements) + if not pkg_dir or not self.manifest_exists(pkg_dir): + raise exception.PackageInstallError(name, requirements or "*", + util.get_systype()) + + self.reset_cache() + manifest = self.load_manifest(pkg_dir) + + if trigger_event: + telemetry.on_event( + category=self.__class__.__name__, + action="Install", + label=manifest['name']) + + click.secho( + "{name} @ {version} has been successfully installed!".format( + **manifest), + fg="green") + + return pkg_dir + + def uninstall(self, name, requirements=None, trigger_event=True): + name, requirements, url = self.parse_pkg_name(name, requirements) + installed_dir = self.get_installed_dir(name, requirements, url) + if not installed_dir: + click.secho( + "%s @ %s is not installed" % (name, requirements or "*"), + fg="yellow") + return + + manifest = self.load_manifest(installed_dir) + click.echo( + "Uninstalling %s @ %s: \t" % (click.style( + manifest['name'], fg="cyan"), manifest['version']), + nl=False) + + if isdir(installed_dir): + if islink(installed_dir): + os.unlink(installed_dir) + else: + util.rmtree_(installed_dir) + + click.echo("[%s]" % click.style("OK", fg="green")) + + self.reset_cache() + if trigger_event: + telemetry.on_event( + category=self.__class__.__name__, + action="Uninstall", + label=manifest['name']) + return True + + def update(self, name, requirements=None, only_check=False): + name, requirements, url = self.parse_pkg_name(name, requirements) + installed_dir = self.get_installed_dir(name, requirements, url) + if not installed_dir: + click.secho( + "%s @ %s is not installed" % (name, requirements or "*"), + fg="yellow") + return + + is_vcs_pkg = False + if self.get_vcs_manifest_path(installed_dir): + is_vcs_pkg = True + manifest_path = self.get_vcs_manifest_path(installed_dir) + else: + manifest_path = self.get_manifest_path(installed_dir) + + manifest = self.load_manifest(manifest_path) + click.echo( + "%s %s @ %s: \t" % ("Checking" + if only_check else "Updating", click.style( + name, fg="cyan"), manifest['version']), + nl=False) + if is_vcs_pkg: + if only_check: + click.echo("[%s]" % (click.style("Skip", fg="yellow"))) + return + click.echo("[%s]" % (click.style("VCS", fg="yellow"))) + vcs = VCSClientFactory.newClient(installed_dir, manifest['url']) + if not vcs.can_be_updated: + click.secho( + "Skip update because repository is fixed " + "to %s revision" % manifest['version'], + fg="yellow") + return + assert vcs.update() + with open(manifest_path, "w") as fp: + manifest['version'] = vcs.get_current_revision() + json.dump(manifest, fp) + else: + latest_version = self.get_latest_repo_version(name, requirements) + if manifest['version'] == latest_version: + click.echo("[%s]" % (click.style("Up-to-date", fg="green"))) + return + click.echo("[%s]" % (click.style("Out-of-date", fg="red"))) + if only_check: + return + self.uninstall(name, manifest['version'], trigger_event=False) + self.install(name, latest_version, trigger_event=False) + + telemetry.on_event( + category=self.__class__.__name__, + action="Update", + label=manifest['name']) + return True + + +class PackageManager(BasePkgManager): + + @property + def manifest_name(self): + return "package.json" diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py new file mode 100644 index 00000000..aae99081 --- /dev/null +++ b/platformio/managers/platform.py @@ -0,0 +1,532 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import base64 +import os +import re +import sys +from imp import load_source +from multiprocessing import cpu_count +from os.path import basename, dirname, isdir, isfile, join + +import click +import semantic_version + +from platformio import app, exception, util +from platformio.managers.package import BasePkgManager, PackageManager + + +class PlatformManager(BasePkgManager): + + def __init__(self, package_dir=None, repositories=None): + if not repositories: + repositories = [ + "https://dl.platformio.org/platforms/manifest.json" + ] + BasePkgManager.__init__(self, package_dir or + join(util.get_home_dir(), "platforms"), + repositories) + + @property + def manifest_name(self): + return "platform.json" + + def install(self, # pylint: disable=too-many-arguments,arguments-differ + name, requirements=None, quiet=False, + trigger_event=True, with_packages=None, + without_packages=None, skip_default_package=False): + platform_dir = BasePkgManager.install(self, name, requirements) + p = PlatformFactory.newPlatform(self.get_manifest_path(platform_dir)) + p.install_packages(with_packages, without_packages, + skip_default_package) + self.cleanup_packages(p.packages.keys()) + return True + + def uninstall(self, name, requirements=None, trigger_event=True): + name, requirements, _ = self.parse_pkg_name(name, requirements) + p = PlatformFactory.newPlatform(name, requirements) + BasePkgManager.uninstall(self, name, requirements) + # trigger event is disabled when upgrading operation + # don't cleanup packages, "install" will do that + if trigger_event: + self.cleanup_packages(p.packages.keys()) + return True + + def update(self, # pylint: disable=arguments-differ + name, requirements=None, only_packages=False, only_check=False): + name, requirements, _ = self.parse_pkg_name(name, requirements) + if not only_packages: + BasePkgManager.update(self, name, requirements, only_check) + p = PlatformFactory.newPlatform(name, requirements) + p.update_packages(only_check) + return True + + def is_outdated(self, name, requirements=None): + if BasePkgManager.is_outdated(self, name, requirements): + return True + p = PlatformFactory.newPlatform(name, requirements) + return p.are_outdated_packages() + + def cleanup_packages(self, names): + self.reset_cache() + deppkgs = {} + for manifest in PlatformManager().get_installed(): + p = PlatformFactory.newPlatform(manifest['name'], + manifest['version']) + for pkgname, pkgmanifest in p.get_installed_packages().items(): + if pkgname not in deppkgs: + deppkgs[pkgname] = set() + deppkgs[pkgname].add(pkgmanifest['version']) + + pm = PackageManager(join(util.get_home_dir(), "packages")) + for manifest in pm.get_installed(): + if manifest['name'] not in names: + continue + if (manifest['name'] not in deppkgs or + manifest['version'] not in deppkgs[manifest['name']]): + pm.uninstall( + manifest['name'], manifest['version'], trigger_event=False) + + self.reset_cache() + return True + + def get_installed_boards(self): + boards = [] + for manifest in self.get_installed(): + p = PlatformFactory.newPlatform( + self.get_manifest_path(manifest['__pkg_dir'])) + for config in p.get_boards().values(): + boards.append(config.get_brief_data()) + return boards + + @staticmethod + @util.memoized + def get_registered_boards(): + boards = util.get_api_result("/boards") + for item in boards: + # @TODO remove type from API + item['id'] = item['type'] + del item['type'] + return boards + + +class PlatformFactory(object): + + @staticmethod + def get_clsname(name): + return "%s%sPlatform" % (name.upper()[0], name.lower()[1:]) + + @staticmethod + def load_module(name, path): + module = None + try: + module = load_source("platformio.managers.platform.%s" % name, + path) + except ImportError: + raise exception.UnknownPlatform(name) + return module + + @classmethod + def newPlatform(cls, name, requirements=None): + platform_dir = None + if name.endswith("platform.json") and isfile(name): + platform_dir = dirname(name) + name = util.load_json(name)['name'] + else: + if not requirements and "@" in name: + name, requirements = name.rsplit("@", 1) + platform_dir = PlatformManager().get_installed_dir(name, + requirements) + + if not platform_dir: + raise exception.UnknownPlatform(name if not requirements else + "%s@%s" % (name, requirements)) + + platform_cls = None + if isfile(join(platform_dir, "platform.py")): + platform_cls = getattr( + cls.load_module(name, join(platform_dir, "platform.py")), + cls.get_clsname(name)) + else: + platform_cls = type( + str(cls.get_clsname(name)), (PlatformBase, ), {}) + + _instance = platform_cls(join(platform_dir, "platform.json")) + assert isinstance(_instance, PlatformBase) + return _instance + + +class PlatformPackagesMixin(object): + + def get_installed_packages(self): + items = {} + installed = self.pm.get_installed() + for name, opts in self.packages.items(): + manifest = None + reqspec = None + try: + reqspec = semantic_version.Spec(opts['version']) + except ValueError: + pass + + for p in installed: + if p['name'] != name: + continue + if reqspec and not reqspec.match( + semantic_version.Version(p['version'])): + continue + elif (not manifest or semantic_version.compare( + p['version'], manifest['version']) == 1): + manifest = p + if manifest: + items[name] = manifest + return items + + def install_packages(self, + with_packages=None, + without_packages=None, + skip_default_package=False, + quiet=False): + with_packages = set(self.pkg_types_to_names(with_packages or [])) + without_packages = set(self.pkg_types_to_names(without_packages or [])) + + upkgs = with_packages | without_packages + ppkgs = set(self.packages.keys()) + if not upkgs.issubset(ppkgs): + raise exception.UnknownPackage(", ".join(upkgs - ppkgs)) + + for name, opts in self.packages.items(): + if name in without_packages: + continue + elif (name in with_packages or + not (skip_default_package or opts.get("optional", False))): + if any([s in opts.get("version", "") for s in ("\\", "/")]): + self.pm.install( + "%s=%s" % (name, opts['version']), quiet=quiet) + else: + self.pm.install(name, opts.get("version"), quiet=quiet) + + return True + + def update_packages(self, only_check=False): + for name in self.get_installed_packages(): + self.pm.update(name, self.packages[name]['version'], only_check) + + def are_outdated_packages(self): + for name, opts in self.get_installed_packages().items(): + if (opts['version'] != self.pm.get_latest_repo_version( + name, self.packages[name].get("version"))): + return True + return False + + +class PlatformRunMixin(object): + + LINE_ERROR_RE = re.compile(r"(\s+error|error[:\s]+)", re.I) + + def run(self, variables, targets, verbose): + assert isinstance(variables, dict) + assert isinstance(targets, list) + + self.configure_default_packages(variables, targets) + self.install_packages(quiet=True) + + self._verbose = verbose or app.get_setting("force_verbose") + + if "clean" in targets: + targets = ["-c", "."] + + variables['platform_manifest'] = self.manifest_path + + if "build_script" not in variables: + variables['build_script'] = self.get_build_script() + if not isfile(variables['build_script']): + raise exception.BuildScriptNotFound(variables['build_script']) + + result = self._run_scons(variables, targets) + assert "returncode" in result + + return result + + def _run_scons(self, variables, targets): + # pass current PYTHONPATH to SCons + if "PYTHONPATH" in os.environ: + _PYTHONPATH = os.environ.get("PYTHONPATH").split(os.pathsep) + else: + _PYTHONPATH = [] + for p in os.sys.path: + if p not in _PYTHONPATH: + _PYTHONPATH.append(p) + os.environ['PYTHONPATH'] = os.pathsep.join(_PYTHONPATH) + + cmd = [ + os.path.normpath(sys.executable), + join(self.get_package_dir("tool-scons"), "script", "scons"), "-Q", + "-j %d" % self.get_job_nums(), "--warn=no-no-parallel-support", + "-f", join(util.get_source_dir(), "builder", "main.py") + ] + if not self._verbose and "-c" not in targets: + cmd.append("--silent") + cmd += targets + + # encode and append variables + for key, value in variables.items(): + cmd.append("%s=%s" % (key.upper(), base64.b64encode(value))) + + result = util.exec_command( + cmd, + stdout=util.AsyncPipe(self.on_run_out), + stderr=util.AsyncPipe(self.on_run_err)) + return result + + def on_run_out(self, line): + self._echo_line(line, level=1) + + def on_run_err(self, line): + is_error = self.LINE_ERROR_RE.search(line) is not None + self._echo_line(line, level=3 if is_error else 2) + + @staticmethod + def _echo_line(line, level): + assert 1 <= level <= 3 + fg = (None, "yellow", "red")[level - 1] + if level == 1 and "is up to date" in line: + fg = "green" + click.secho(line, fg=fg, err=level > 1) + + @staticmethod + def get_job_nums(): + try: + return cpu_count() + except NotImplementedError: + return 1 + + +class PlatformBase(PlatformPackagesMixin, PlatformRunMixin): + + _BOARDS_CACHE = {} + + def __init__(self, manifest_path): + self._BOARDS_CACHE = {} + self.manifest_path = manifest_path + self._manifest = util.load_json(manifest_path) + + self.pm = PackageManager( + join(util.get_home_dir(), "packages"), + self._manifest.get("packageRepositories")) + + self._verbose = False + + @property + def name(self): + return self._manifest['name'] + + @property + def title(self): + return self._manifest['title'] + + @property + def description(self): + return self._manifest['description'] + + @property + def version(self): + return self._manifest['version'] + + @property + def homepage(self): + return self._manifest.get("homepage") + + @property + def license(self): + return self._manifest.get("license") + + @property + def frameworks(self): + return self._manifest.get("frameworks") + + @property + def manifest(self): + return self._manifest + + @property + def packages(self): + packages = self._manifest.get("packages", {}) + if "tool-scons" not in packages: + packages['tool-scons'] = { + "version": self._manifest.get("engines", {}).get( + "scons", ">=2.3.0,<2.6.0"), + "optional": False + } + return packages + + def get_dir(self): + return dirname(self.manifest_path) + + def get_build_script(self): + main_script = join(self.get_dir(), "builder", "main.py") + if isfile(main_script): + return main_script + raise NotImplementedError() + + def is_embedded(self): + for opts in self.packages.values(): + if opts.get("type") == "uploader": + return True + return False + + def get_boards(self, id_=None): + + def _append_board(board_id, manifest_path): + config = PlatformBoardConfig(manifest_path) + if "platform" in config and config.get("platform") != self.name: + return + elif ("platforms" in config and + self.name not in config.get("platforms")): + return + config.manifest['platform'] = self.name + self._BOARDS_CACHE[board_id] = config + + bdirs = (join(util.get_home_dir(), "boards"), + join(self.get_dir(), "boards")) + if id_ is None: + for boards_dir in bdirs: + if not isdir(boards_dir): + continue + for item in sorted(os.listdir(boards_dir)): + _id = item[:-5] + if not item.endswith(".json") or _id in self._BOARDS_CACHE: + continue + _append_board(_id, join(boards_dir, item)) + else: + if id_ not in self._BOARDS_CACHE: + for boards_dir in bdirs: + if not isdir(boards_dir): + continue + manifest_path = join(boards_dir, "%s.json" % id_) + if not isfile(manifest_path): + continue + _append_board(id_, manifest_path) + if id_ not in self._BOARDS_CACHE: + raise exception.UnknownBoard(id_) + return self._BOARDS_CACHE[id_] if id_ else self._BOARDS_CACHE + + def board_config(self, id_): + return self.get_boards(id_) + + def get_package_dir(self, name): + packages = self.get_installed_packages() + if name not in packages: + return None + return packages[name]['__pkg_dir'] + + def get_package_version(self, name): + packages = self.get_installed_packages() + if name not in packages: + return None + return packages[name]['version'] + + def get_package_type(self, name): + return self.packages[name].get("type") + + def pkg_types_to_names(self, types): + names = [] + for type_ in types: + name = type_ + # lookup by package types + for _name, _opts in self.packages.items(): + if _opts.get("type") == type_: + name = None + names.append(_name) + # if type is the right name + if name: + names.append(name) + return names + + def configure_default_packages(self, variables, targets): + # enbale used frameworks + for framework in variables.get("pioframework", "").split(","): + if not self.frameworks: + continue + framework = framework.lower().strip() + if not framework or framework not in self.frameworks: + continue + _pkg_name = self.frameworks[framework]['package'] + self.packages[_pkg_name]['optional'] = False + + # enable upload tools for upload targets + if any(["upload" in t for t in targets] + ["program" in targets]): + for _name, _opts in self.packages.iteritems(): + if _opts.get("type") == "uploader": + self.packages[_name]['optional'] = False + elif "uploadlazy" in targets: + # skip all packages, allow only upload tools + self.packages[_name]['optional'] = True + + if "test" in targets and "tool-unity" not in self.packages: + self.packages['tool-unity'] = { + "version": "~1.20302.0", + "optional": False + } + + +class PlatformBoardConfig(object): + + def __init__(self, manifest_path): + self._id = basename(manifest_path)[:-5] + assert isfile(manifest_path) + self.manifest_path = manifest_path + self._manifest = util.load_json(manifest_path) + assert set(["name", "url", "vendor"]) <= set(self._manifest.keys()) + + def get(self, path, default=None): + try: + value = self._manifest + for k in path.split("."): + value = value[k] + return value + except KeyError: + if default is not None: + return default + else: + raise KeyError("Invalid board option '%s'" % path) + + def __contains__(self, key): + try: + self.get(key) + return True + except KeyError: + return False + + @property + def id_(self): + return self._id + + @property + def manifest(self): + return self._manifest + + def get_brief_data(self): + return { + "id": self.id_, + "name": self._manifest['name'], + "platform": self._manifest.get("platform"), + "mcu": self._manifest.get("build", {}).get("mcu", "").upper(), + "fcpu": int(self._manifest.get("build", {}).get("f_cpu", "")[:-1]), + "ram": self._manifest.get("upload", {}).get("maximum_ram_size", 0), + "rom": self._manifest.get("upload", {}).get("maximum_size", 0), + "frameworks": self._manifest.get("frameworks"), + "vendor": self._manifest['vendor'], + "url": self._manifest['url'] + } diff --git a/platformio/pkgmanager.py b/platformio/pkgmanager.py deleted file mode 100644 index 33f74bb7..00000000 --- a/platformio/pkgmanager.py +++ /dev/null @@ -1,172 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from os import makedirs, remove -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 -from platformio.downloader import FileDownloader -from platformio.unpacker import FileUnpacker - - -class PackageManager(object): - - def __init__(self): - self._package_dir = join(util.get_home_dir(), "packages") - if not isdir(self._package_dir): - makedirs(self._package_dir) - assert isdir(self._package_dir) - - @classmethod - @util.memoized - def get_manifest(cls): - return util.get_api_result("/packages/manifest") - - @staticmethod - def download(url, dest_dir, sha1=None): - fd = FileDownloader(url, dest_dir) - fd.start() - fd.verify(sha1) - return fd.get_filepath() - - @staticmethod - def unpack(pkgpath, dest_dir): - fu = FileUnpacker(pkgpath, dest_dir) - return fu.start() - - @staticmethod - def get_installed(): - return get_state_item("installed_packages", {}) - - def get_outdated(self): - outdated = [] - for name, data in self.get_installed().items(): - if data['version'] != self.get_info(name)['version']: - outdated.append(name) - return outdated - - def is_installed(self, name): - return name in self.get_installed() - - def get_info(self, name, version=None): - manifest = self.get_manifest() - if name not in manifest: - raise exception.UnknownPackage(name) - - # check system platform - systype = util.get_systype() - builds = ([b for b in manifest[name] if b['system'] == "all" or systype - in b['system']]) - if not builds: - raise exception.NonSystemPackage(name, systype) - - if version: - for b in builds: - if b['version'] == version: - return b - raise exception.InvalidPackageVersion(name, version) - else: - return sorted(builds, key=lambda s: s['version'])[-1] - - def install(self, name): - click.echo("Installing %s package:" % click.style(name, fg="cyan")) - - if self.is_installed(name): - click.secho("Already installed", fg="yellow") - return False - - info = self.get_info(name) - pkg_dir = join(self._package_dir, name) - if not isdir(pkg_dir): - makedirs(pkg_dir) - - dlpath = None - try: - dlpath = self.download(info['url'], pkg_dir, info['sha1']) - except (requests.exceptions.ConnectionError, - requests.exceptions.ChunkedEncodingError, - requests.exceptions.SSLError, - exception.FDUnrecognizedStatusCode, StopIteration): - if not info['url'].startswith("http://dl.platformio.org"): - 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 - remove(dlpath) - - telemetry.on_event( - category="PackageManager", action="Install", label=name) - - def uninstall(self, name): - click.echo("Uninstalling %s package: \t" % - click.style(name, fg="cyan"), nl=False) - - if not self.is_installed(name): - click.secho("Not installed", fg="yellow") - return False - - if isdir(join(self._package_dir, name)): - rmtree(join(self._package_dir, name)) - self._unregister(name) - click.echo("[%s]" % click.style("OK", fg="green")) - - # report usage - telemetry.on_event( - category="PackageManager", action="Uninstall", label=name) - - def update(self, name): - click.echo("Updating %s package:" % click.style(name, fg="yellow")) - - installed = self.get_installed() - current_version = installed[name]['version'] - latest_version = self.get_info(name)['version'] - - click.echo("Versions: Current=%d, Latest=%d \t " % - (current_version, latest_version), nl=False) - - if current_version == latest_version: - click.echo("[%s]" % (click.style("Up-to-date", fg="green"))) - return True - else: - click.echo("[%s]" % (click.style("Out-of-date", fg="red"))) - - self.uninstall(name) - self.install(name) - - telemetry.on_event( - category="PackageManager", action="Update", label=name) - - def _register(self, name, version): - data = self.get_installed() - data[name] = { - "version": version, - "time": int(time()) - } - set_state_item("installed_packages", data) - - def _unregister(self, name): - data = self.get_installed() - del data[name] - set_state_item("installed_packages", data) diff --git a/platformio/platforms/atmelavr.py b/platformio/platforms/atmelavr.py deleted file mode 100644 index 4469b652..00000000 --- a/platformio/platforms/atmelavr.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform -from platformio.util import get_boards - - -class AtmelavrPlatform(BasePlatform): - - """ - Atmel AVR 8- and 32-bit MCUs deliver a unique combination of - performance, power efficiency and design flexibility. Optimized to - speed time to market-and easily adapt to new ones-they are based on - the industrys most code-efficient architecture for C and assembly - programming. - - http://www.atmel.com/products/microcontrollers/avr/default.aspx - """ - - PACKAGES = { - - "toolchain-atmelavr": { - "alias": "toolchain", - "default": True - }, - - "tool-avrdude": { - }, - - "tool-micronucleus": { - }, - - "framework-arduinoavr": { - "alias": "framework" - }, - - "framework-simba": { - "alias": "framework" - } - } - - def get_name(self): - return "Atmel AVR" - - def configure_default_packages(self, envoptions, targets): - if envoptions.get("board"): - board = get_boards(envoptions.get("board")) - if "digispark" in board['build']['core']: - self.PACKAGES['tool-micronucleus']['alias'] = "uploader" - else: - self.PACKAGES['tool-avrdude']['alias'] = "uploader" - - return BasePlatform.configure_default_packages( - self, envoptions, targets) - - def on_run_err(self, line): # pylint: disable=R0201 - # fix STDERR "flash written" for avrdude - if "avrdude" in line: - self.on_run_out(line) - else: - BasePlatform.on_run_err(self, line) diff --git a/platformio/platforms/atmelsam.py b/platformio/platforms/atmelsam.py deleted file mode 100644 index e12f02ba..00000000 --- a/platformio/platforms/atmelsam.py +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform -from platformio.util import get_boards - - -class AtmelsamPlatform(BasePlatform): - - """ - Atmel | SMART offers Flash- based ARM products based on the ARM - Cortex-M0+, Cortex-M3 and Cortex-M4 architectures, ranging from 8KB - to 2MB of Flash including a rich peripheral and feature mix. - - http://www.atmel.com/products/microcontrollers/arm/default.aspx - """ - - PACKAGES = { - - "toolchain-gccarmnoneeabi": { - "alias": "toolchain", - "default": True - }, - - "ldscripts": { - "default": True - }, - - "framework-arduinosam": { - "alias": "framework" - }, - - "framework-mbed": { - "alias": "framework" - }, - - "framework-simba": { - "alias": "framework" - }, - - "tool-bossac": { - }, - - "tool-openocd": { - }, - - "tool-avrdude": { - } - } - - def get_name(self): - return "Atmel SAM" - - def configure_default_packages(self, envoptions, targets): - if envoptions.get("board"): - board = get_boards(envoptions.get("board")) - upload_protocol = board.get("upload", {}).get("protocol", None) - upload_tool = None - if upload_protocol == "openocd": - upload_tool = "tool-openocd" - elif upload_protocol == "sam-ba": - upload_tool = "tool-bossac" - elif upload_protocol == "stk500v2": - upload_tool = "tool-avrdude" - - if upload_tool: - self.PACKAGES[upload_tool]['alias'] = "uploader" - - return BasePlatform.configure_default_packages( - self, envoptions, targets) diff --git a/platformio/platforms/base.py b/platformio/platforms/base.py deleted file mode 100644 index ba97cbe6..00000000 --- a/platformio/platforms/base.py +++ /dev/null @@ -1,547 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import base64 -import os -import re -import sys -from imp import load_source -from multiprocessing import cpu_count -from os.path import isdir, isfile, join - -import click - -from platformio import app, exception, util -from platformio.app import get_state_item, set_state_item -from platformio.pkgmanager import PackageManager - -PLATFORM_PACKAGES = { - - "framework-arduinoavr": [ - ("Arduino Wiring-based Framework (AVR Core, 1.6)", - "http://arduino.cc/en/Reference/HomePage") - ], - "framework-arduinosam": [ - ("Arduino Wiring-based Framework (SAM Core, 1.6)", - "http://arduino.cc/en/Reference/HomePage") - ], - "framework-arduinoteensy": [ - ("Arduino Wiring-based Framework", - "http://arduino.cc/en/Reference/HomePage") - ], - "framework-arduinomsp430": [ - ("Arduino Wiring-based Framework (MSP430 Core)", - "http://arduino.cc/en/Reference/HomePage") - ], - "framework-arduinoespressif": [ - ("Arduino Wiring-based Framework (ESP8266 Core)", - "https://github.com/esp8266/Arduino") - ], - "framework-arduinomicrochippic32": [ - ("Arduino Wiring-based Framework (PIC32 Core)", - "https://github.com/chipKIT32/chipKIT-core") - ], - "framework-arduinointel": [ - ("Arduino Wiring-based Framework (Intel ARC Core)", - "https://github.com/01org/corelibs-arduino101") - ], - "framework-arduinonordicnrf51": [ - ("Arduino Wiring-based Framework (RFduino Core)", - "https://github.com/RFduino/RFduino") - ], - "framework-energiamsp430": [ - ("Energia Wiring-based Framework (MSP430 Core)", - "http://energia.nu/reference/") - ], - "framework-energiativa": [ - ("Energia Wiring-based Framework (LM4F Core)", - "http://energia.nu/reference/") - ], - "framework-cmsis": [ - ("Vendor-independent hardware abstraction layer for the Cortex-M " - "processor series", - "http://www.arm.com/products/processors/" - "cortex-m/cortex-microcontroller-software-interface-standard.php") - ], - "framework-spl": [ - ("Standard Peripheral Library for STM32 MCUs", - "http://www.st.com" - "/web/catalog/tools/FM147/CL1794/SC961/SS1743/PF257890") - ], - "framework-libopencm3": [ - ("libOpenCM3 Framework", "http://www.libopencm3.org/") - ], - "framework-mbed": [ - ("mbed Framework", "http://mbed.org") - ], - "framework-wiringpi": [ - ("GPIO Interface library for the Raspberry Pi", "http://wiringpi.com") - ], - "framework-simba": [ - ("Simba Framework", "https://github.com/eerimoq/simba") - ], - "sdk-esp8266": [ - ("ESP8266 SDK", "http://bbs.espressif.com") - ], - "ldscripts": [ - ("Linker Scripts", - "https://sourceware.org/binutils/docs/ld/Scripts.html") - ], - "toolchain-atmelavr": [ - ("avr-gcc", "https://gcc.gnu.org/wiki/avr-gcc"), - ("GDB", "http://www.gnu.org/software/gdb/"), - ("AVaRICE", "http://avarice.sourceforge.net/"), - ("SimulAVR", "http://www.nongnu.org/simulavr/") - ], - "toolchain-gccarmnoneeabi": [ - ("gcc-arm-embedded", "https://launchpad.net/gcc-arm-embedded"), - ("GDB", "http://www.gnu.org/software/gdb/") - ], - "toolchain-gccarmlinuxgnueabi": [ - ("GCC for Linux ARM GNU EABI", "https://gcc.gnu.org"), - ("GDB", "http://www.gnu.org/software/gdb/") - ], - "toolchain-gccmingw32": [ - ("MinGW", "http://www.mingw.org") - ], - "toolchain-gcclinux32": [ - ("GCC for Linux i686", "https://gcc.gnu.org") - ], - "toolchain-gcclinux64": [ - ("GCC for Linux x86_64", "https://gcc.gnu.org") - ], - "toolchain-xtensa": [ - ("xtensa-gcc", "https://github.com/jcmvbkbc/gcc-xtensa"), - ("GDB", "http://www.gnu.org/software/gdb/") - ], - "toolchain-timsp430": [ - ("msp-gcc", "http://sourceforge.net/projects/mspgcc/"), - ("GDB", "http://www.gnu.org/software/gdb/") - ], - "toolchain-icestorm": [ - ("GCC for FPGA IceStorm", "http://www.clifford.at/icestorm/") - ], - "toolchain-microchippic32": [ - ("GCC for Microchip PIC32", "https://github.com/chipKIT32/chipKIT-cxx") - ], - "toolchain-intelarc32": [ - ("GCC for Intel ARC", - "https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain") - ], - "tool-scons": [ - ("SCons software construction tool", "http://www.scons.org") - ], - "tool-avrdude": [ - ("AVRDUDE", "http://www.nongnu.org/avrdude/") - ], - "tool-micronucleus": [ - ("Micronucleus", "https://github.com/micronucleus/micronucleus") - ], - "tool-bossac": [ - ("BOSSA CLI", "https://sourceforge.net/projects/b-o-s-s-a/") - ], - "tool-openocd": [ - ("OpenOCD", "http://openocd.org") - ], - "tool-stlink": [ - ("ST-Link", "https://github.com/texane/stlink") - ], - "tool-teensy": [ - ("Teensy Loader", "https://www.pjrc.com/teensy/loader.html") - ], - "tool-lm4flash": [ - ("Flash Programmer", "http://www.ti.com/tool/lmflashprogrammer") - ], - "tool-mspdebug": [ - ("MSPDebug", "http://mspdebug.sourceforge.net/") - ], - "tool-esptool": [ - ("esptool-ck", "https://github.com/igrr/esptool-ck") - ], - "tool-rfdloader": [ - ("rfdloader", "https://github.com/RFduino/RFduino") - ], - "tool-mkspiffs": [ - ("Tool to build and unpack SPIFFS images", - "https://github.com/igrr/mkspiffs") - ], - "tool-pic32prog": [ - ("pic32prog", "https://github.com/sergev/pic32prog") - ], - "tool-arduino101load": [ - ("Genuino101 uploader", "https://github.com/01org/intel-arduino-tools") - ], - "tool-sreccat": [ - ("Merging tool", "https://github.com/marcows/SRecord") - ] -} - - -def get_packages(): - return PLATFORM_PACKAGES - - -class PlatformFactory(object): - - @staticmethod - def get_clsname(type_): - return "%s%sPlatform" % (type_.upper()[0], type_.lower()[1:]) - - @staticmethod - def load_module(type_, path): - module = None - try: - module = load_source( - "platformio.platforms.%s" % type_, path) - except ImportError: - raise exception.UnknownPlatform(type_) - return module - - @classmethod - @util.memoized - def _lookup_platforms(cls): - platforms = {} - for d in (util.get_home_dir(), util.get_source_dir()): - pdir = join(d, "platforms") - if not isdir(pdir): - continue - for p in sorted(os.listdir(pdir)): - if (p in ("__init__.py", "base.py") or not - p.endswith(".py")): - continue - type_ = p[:-3] - path = join(pdir, p) - try: - isplatform = hasattr( - cls.load_module(type_, path), - cls.get_clsname(type_) - ) - if isplatform: - platforms[type_] = path - except exception.UnknownPlatform: - pass - return platforms - - @classmethod - def get_platforms(cls, installed=False): - platforms = cls._lookup_platforms() - - if not installed: - return platforms - - installed_platforms = {} - for type_ in get_state_item("installed_platforms", []): - if type_ in platforms: - installed_platforms[type_] = platforms[type_] - return installed_platforms - - @classmethod - def newPlatform(cls, type_): - platforms = cls.get_platforms() - if type_ not in platforms: - raise exception.UnknownPlatform(type_) - - _instance = getattr( - cls.load_module(type_, platforms[type_]), - cls.get_clsname(type_) - )() - assert isinstance(_instance, BasePlatform) - return _instance - - -class BasePlatform(object): - - PACKAGES = {} - LINE_ERROR_RE = re.compile(r"(\s+error|error[:\s]+)", re.I) - - def __init__(self): - self._found_error = False - self._last_echo_line = None - - # 1 = errors - # 2 = 1 + warnings - # 3 = 2 + others - self._verbose_level = 3 - - def get_type(self): - return self.__class__.__name__[:-8].lower() - - def get_name(self): - return self.get_type().title() - - def get_build_script(self): - builtin = join(util.get_source_dir(), "builder", "scripts", "%s.py" % - self.get_type()) - if isfile(builtin): - return builtin - raise NotImplementedError() - - def get_description(self): - if self.__doc__: - doclines = [l.strip() for l in self.__doc__.splitlines() if - l.strip()] - return " ".join(doclines[:-1]).strip() - else: - raise NotImplementedError() - - def get_vendor_url(self): - if self.__doc__ and "http" in self.__doc__: - return self.__doc__[self.__doc__.index("http"):].strip() - else: - raise NotImplementedError() - - def is_embedded(self): - for name, opts in self.get_packages().items(): - if name == "framework-mbed" or opts.get("alias") == "uploader": - return True - return False - - def get_packages(self): - return self.PACKAGES - - def get_package_alias(self, pkgname): - return self.PACKAGES[pkgname].get("alias") - - def pkg_aliases_to_names(self, aliases): - names = [] - for alias in aliases: - name = alias - # lookup by package aliases - for _name, _opts in self.get_packages().items(): - if _opts.get("alias") == alias: - name = None - names.append(_name) - # if alias is the right name - if name: - names.append(name) - return names - - def get_default_packages(self): - return [k for k, v in self.get_packages().items() - if v.get("default", False)] - - def get_installed_packages(self): - pm = PackageManager() - return [n for n in self.get_packages() if pm.is_installed(n)] - - def install(self, with_packages=None, without_packages=None, - skip_default_packages=False): - with_packages = set( - self.pkg_aliases_to_names(with_packages or [])) - without_packages = set( - self.pkg_aliases_to_names(without_packages or [])) - - upkgs = with_packages | without_packages - ppkgs = set(self.get_packages().keys()) - if not upkgs.issubset(ppkgs): - raise exception.UnknownPackage(", ".join(upkgs - ppkgs)) - - requirements = [] - for name, opts in self.get_packages().items(): - if name in without_packages: - continue - elif (name in with_packages or (not skip_default_packages and - opts.get("default"))): - requirements.append(name) - - pm = PackageManager() - for name in requirements: - pm.install(name) - - # register installed platform - data = get_state_item("installed_platforms", []) - if self.get_type() not in data: - data.append(self.get_type()) - set_state_item("installed_platforms", data) - - return len(requirements) - - def uninstall(self): - platform = self.get_type() - installed_platforms = PlatformFactory.get_platforms( - installed=True).keys() - - if platform not in installed_platforms: - raise exception.PlatformNotInstalledYet(platform) - - deppkgs = set() - for item in installed_platforms: - if item == platform: - continue - p = PlatformFactory.newPlatform(item) - deppkgs = deppkgs.union(set(p.get_packages().keys())) - - pm = PackageManager() - for name in self.get_packages(): - if not pm.is_installed(name) or name in deppkgs: - continue - pm.uninstall(name) - - # unregister installed platform - installed_platforms.remove(platform) - set_state_item("installed_platforms", installed_platforms) - - return True - - def update(self): - pm = PackageManager() - for name in self.get_installed_packages(): - pm.update(name) - - def is_outdated(self): - pm = PackageManager() - obsolated = pm.get_outdated() - return not set(self.get_packages().keys()).isdisjoint(set(obsolated)) - - def configure_default_packages(self, variables, targets): - # enbale used frameworks - for pkg_name in self.pkg_aliases_to_names(["framework"]): - for framework in variables.get("framework", "").split(","): - framework = framework.lower().strip() - if not framework: - continue - if framework in pkg_name: - self.PACKAGES[pkg_name]['default'] = True - - # append SCons tool - self.PACKAGES['tool-scons'] = {"default": True} - - # enable upload tools for upload targets - if any(["upload" in t for t in targets] + ["program" in targets]): - for _name, _opts in self.PACKAGES.iteritems(): - if _opts.get("alias") == "uploader": - self.PACKAGES[_name]['default'] = True - elif "uploadlazy" in targets: - # skip all packages, allow only upload tools - self.PACKAGES[_name]['default'] = False - - def _install_default_packages(self): - installed_platforms = PlatformFactory.get_platforms( - installed=True).keys() - - if (self.get_type() in installed_platforms and - set(self.get_default_packages()) <= - set(self.get_installed_packages())): - return True - - if (not app.get_setting("enable_prompts") or - self.get_type() in installed_platforms or - click.confirm( - "The platform '%s' has not been installed yet. " - "Would you like to install it now?" % self.get_type())): - return self.install() - else: - raise exception.PlatformNotInstalledYet(self.get_type()) - - def run(self, variables, targets, verbose): - assert isinstance(variables, dict) - assert isinstance(targets, list) - - self.configure_default_packages(variables, targets) - self._install_default_packages() - - self._verbose_level = int(verbose) - - if "clean" in targets: - targets.remove("clean") - targets.append("-c") - - if "build_script" not in variables: - variables['build_script'] = self.get_build_script() - if not isfile(variables['build_script']): - raise exception.BuildScriptNotFound(variables['build_script']) - - # append aliases of the installed packages - installed_packages = PackageManager.get_installed() - for name, options in self.get_packages().items(): - if "alias" not in options or name not in installed_packages: - continue - variables['piopackage_%s' % options['alias']] = name - - self._found_error = False - result = self._run_scons(variables, targets) - assert "returncode" in result - # if self._found_error: - # result['returncode'] = 1 - - if self._last_echo_line == ".": - click.echo("") - - return result - - def _run_scons(self, variables, targets): - # pass current PYTHONPATH to SCons - if "PYTHONPATH" in os.environ: - _PYTHONPATH = os.environ.get("PYTHONPATH").split(os.pathsep) - else: - _PYTHONPATH = [] - for p in os.sys.path: - if p not in _PYTHONPATH: - _PYTHONPATH.append(p) - os.environ['PYTHONPATH'] = os.pathsep.join(_PYTHONPATH) - - cmd = [ - os.path.normpath(sys.executable), - join(util.get_home_dir(), "packages", "tool-scons", - "script", "scons"), - "-Q", - "-j %d" % self.get_job_nums(), - "--warn=no-no-parallel-support", - "-f", join(util.get_source_dir(), "builder", "main.py") - ] + targets - - # encode and append variables - for key, value in variables.items(): - cmd.append("%s=%s" % (key.upper(), base64.b64encode(value))) - - result = util.exec_command( - cmd, - stdout=util.AsyncPipe(self.on_run_out), - stderr=util.AsyncPipe(self.on_run_err) - ) - return result - - def on_run_out(self, line): - self._echo_line(line, level=3) - - def on_run_err(self, line): - is_error = self.LINE_ERROR_RE.search(line) is not None - if is_error: - self._found_error = True - self._echo_line(line, level=1 if is_error else 2) - - def _echo_line(self, line, level): - assert 1 <= level <= 3 - - fg = ("red", "yellow", None)[level - 1] - if level == 3 and "is up to date" in line: - fg = "green" - - if level > self._verbose_level: - click.secho(".", fg=fg, err=level < 3, nl=False) - self._last_echo_line = "." - return - - if self._last_echo_line == ".": - click.echo("") - self._last_echo_line = line - - click.secho(line, fg=fg, err=level < 3) - - @staticmethod - def get_job_nums(): - try: - return cpu_count() - except NotImplementedError: - return 1 diff --git a/platformio/platforms/espressif.py b/platformio/platforms/espressif.py deleted file mode 100644 index 97d95c10..00000000 --- a/platformio/platforms/espressif.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class EspressifPlatform(BasePlatform): - - """ - Espressif Systems is a privately held fabless semiconductor company. - They provide wireless communications and Wi-Fi chips which are widely - used in mobile devices and the Internet of Things applications. - - https://espressif.com/ - """ - - PACKAGES = { - - "toolchain-xtensa": { - "alias": "toolchain", - "default": True - }, - - "ldscripts": { - "default": True - }, - - "tool-esptool": { - "alias": "uploader", - "default": True - }, - - "tool-mkspiffs": { - "alias": "uploader" - }, - - "sdk-esp8266": { - }, - - "framework-arduinoespressif": { - "alias": "framework" - }, - - "framework-simba": { - "alias": "framework" - } - } - - def get_name(self): - return "Espressif" - - def configure_default_packages(self, envoptions, targets): - if not envoptions.get("framework"): - self.PACKAGES['sdk-esp8266']['default'] = True - - return BasePlatform.configure_default_packages( - self, envoptions, targets) diff --git a/platformio/platforms/freescalekinetis.py b/platformio/platforms/freescalekinetis.py deleted file mode 100644 index 47e387d0..00000000 --- a/platformio/platforms/freescalekinetis.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class FreescalekinetisPlatform(BasePlatform): - - """ - Freescale Kinetis Microcontrollers is family of multiple hardware- and - software-compatible ARM Cortex-M0+, Cortex-M4 and Cortex-M7-based MCU - series. Kinetis MCUs offer exceptional low-power performance, - scalability and feature integration. - - http://www.freescale.com/webapp/sps/site/homepage.jsp?code=KINETIS - """ - - PACKAGES = { - - "toolchain-gccarmnoneeabi": { - "alias": "toolchain", - "default": True - }, - - "framework-mbed": { - "alias": "framework" - } - } - - def get_name(self): - return "Freescale Kinetis" diff --git a/platformio/platforms/intel_arc32.py b/platformio/platforms/intel_arc32.py deleted file mode 100644 index a0aa7535..00000000 --- a/platformio/platforms/intel_arc32.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class Intel_arc32Platform(BasePlatform): - - """ - ARC embedded processors are a family of 32-bit CPUs that are widely used - in SoC devices for storage, home, mobile, automotive, and Internet of - Things applications. - - http://www.intel.com/content/www/us/en/wearables/wearable-soc.html - """ - - PACKAGES = { - - "toolchain-intelarc32": { - "alias": "toolchain", - "default": True - }, - - "framework-arduinointel": { - "alias": "framework" - }, - - "tool-arduino101load": { - "alias": "uploader" - }, - } - - def get_name(self): - return "Intel ARC32" diff --git a/platformio/platforms/lattice_ice40.py b/platformio/platforms/lattice_ice40.py deleted file mode 100755 index 35d41ed8..00000000 --- a/platformio/platforms/lattice_ice40.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class Lattice_ice40Platform(BasePlatform): - - """ - The iCE40 family of ultra-low power, non-volatile FPGAs has five devices - with densities ranging from 384 to 7680 Look-Up Tables (LUTs). In addition - to LUT-based,low-cost programmable logic, these devices feature Embedded - Block RAM (EBR), Non-volatile Configuration Memory (NVCM) and Phase Locked - Loops (PLLs). These features allow the devices to be used in low-cost, - high-volume consumer and system applications. - - http://www.latticesemi.com/Products/FPGAandCPLD/iCE40.aspx - """ - - PACKAGES = { - - "toolchain-icestorm": { - "alias": "toolchain", - "default": True - } - } - - def get_name(self): - return "Lattice iCE40" - - def is_embedded(self): - return True diff --git a/platformio/platforms/linux_arm.py b/platformio/platforms/linux_arm.py deleted file mode 100644 index 79c03ad5..00000000 --- a/platformio/platforms/linux_arm.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio import exception, util -from platformio.platforms.base import BasePlatform - - -class Linux_armPlatform(BasePlatform): - - """ - Linux ARM is a Unix-like and mostly POSIX-compliant computer - operating system (OS) assembled under the model of free and open-source - software development and distribution. - - Using host OS (Mac OS X, Linux ARM) you can build native application - for Linux ARM platform. - - http://platformio.org/platforms/linux_arm - """ - - PACKAGES = { - - "toolchain-gccarmlinuxgnueabi": { - "alias": "toolchain", - "default": True - }, - - "framework-wiringpi": { - "alias": "framework" - } - } - - def __init__(self): - if "linux_arm" in util.get_systype(): - del self.PACKAGES['toolchain-gccarmlinuxgnueabi'] - BasePlatform.__init__(self) - - def configure_default_packages(self, envoptions, targets): - if (envoptions.get("framework") == "wiringpi" and - "linux_arm" not in util.get_systype()): - raise exception.PlatformioException( - "PlatformIO does not support temporary cross-compilation " - "for WiringPi framework. Please run PlatformIO directly on " - "Raspberry Pi" - ) - - return BasePlatform.configure_default_packages( - self, envoptions, targets) diff --git a/platformio/platforms/linux_i686.py b/platformio/platforms/linux_i686.py deleted file mode 100644 index 11f1ac01..00000000 --- a/platformio/platforms/linux_i686.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform -from platformio.util import get_systype - - -class Linux_i686Platform(BasePlatform): - - """ - Linux i686 (32-bit) is a Unix-like and mostly POSIX-compliant - computer operating system (OS) assembled under the model of free and - open-source software development and distribution. - - Using host OS (Mac OS X or Linux 32-bit) you can build native - application for Linux i686 platform. - - http://platformio.org/platforms/linux_i686 - """ - - PACKAGES = { - - "toolchain-gcclinux32": { - "alias": "toolchain", - "default": True - } - } - - def __init__(self): - if get_systype() == "linux_i686": - del self.PACKAGES['toolchain-gcclinux32'] - BasePlatform.__init__(self) diff --git a/platformio/platforms/linux_x86_64.py b/platformio/platforms/linux_x86_64.py deleted file mode 100644 index c3bf330e..00000000 --- a/platformio/platforms/linux_x86_64.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform -from platformio.util import get_systype - - -class Linux_x86_64Platform(BasePlatform): - - """ - Linux x86_64 (64-bit) is a Unix-like and mostly POSIX-compliant - computer operating system (OS) assembled under the model of free and - open-source software development and distribution. - - Using host OS (Mac OS X or Linux 64-bit) you can build native - application for Linux x86_64 platform. - - http://platformio.org/platforms/linux_i686 - """ - - PACKAGES = { - - "toolchain-gcclinux64": { - "alias": "toolchain", - "default": True - } - } - - def __init__(self): - if get_systype() == "linux_x86_64": - del self.PACKAGES['toolchain-gcclinux64'] - BasePlatform.__init__(self) diff --git a/platformio/platforms/microchippic32.py b/platformio/platforms/microchippic32.py deleted file mode 100644 index 22888125..00000000 --- a/platformio/platforms/microchippic32.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class Microchippic32Platform(BasePlatform): - - """ - Microchip's 32-bit portfolio with the MIPS microAptiv or M4K core offer - high performance microcontrollers, and all the tools needed to develop - your embedded projects. PIC32 MCUs gives your application the processing - power, memory and peripherals your design needs! - - http://www.microchip.com/design-centers/32-bit - """ - - PACKAGES = { - - "toolchain-microchippic32": { - "alias": "toolchain", - "default": True - }, - - "framework-arduinomicrochippic32": { - "alias": "framework" - }, - - "tool-pic32prog": { - "alias": "uploader" - } - } - - def get_name(self): - return "Microchip PIC32" diff --git a/platformio/platforms/native.py b/platformio/platforms/native.py deleted file mode 100644 index 9c4ed8bb..00000000 --- a/platformio/platforms/native.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class NativePlatform(BasePlatform): - - """ - Native development platform is intended to be used for desktop OS. - This platform uses built-in toolchains (preferable based on GCC), - frameworks, libs from particular OS where it will be run. - - http://platformio.org/platforms/native - """ - - PACKAGES = { - } diff --git a/platformio/platforms/nordicnrf51.py b/platformio/platforms/nordicnrf51.py deleted file mode 100644 index 32a0d054..00000000 --- a/platformio/platforms/nordicnrf51.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class Nordicnrf51Platform(BasePlatform): - - """ - The Nordic nRF51 Series is a family of highly flexible, - multi-protocol, system-on-chip (SoC) devices for ultra-low power - wireless applications. nRF51 Series devices support a range of - protocol stacks including Bluetooth Smart (previously called - Bluetooth low energy), ANT and proprietary 2.4GHz protocols such as - Gazell. - - https://www.nordicsemi.com/eng/Products/nRF51-Series-SoC - """ - - PACKAGES = { - - "toolchain-gccarmnoneeabi": { - "alias": "toolchain", - "default": True - }, - - "framework-mbed": { - "alias": "framework" - }, - - "framework-arduinonordicnrf51": { - "alias": "framework" - }, - - "tool-sreccat": { - "default": True - }, - - "tool-rfdloader": { - } - } - - def get_name(self): - return "Nordic nRF51" - - def configure_default_packages(self, envoptions, targets): - if envoptions.get("board") == "rfduino": - self.PACKAGES['tool-rfdloader']['alias'] = "uploader" - - return BasePlatform.configure_default_packages( - self, envoptions, targets) diff --git a/platformio/platforms/nxplpc.py b/platformio/platforms/nxplpc.py deleted file mode 100644 index d359b117..00000000 --- a/platformio/platforms/nxplpc.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class NxplpcPlatform(BasePlatform): - - """ - 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. - - http://www.nxp.com/products/microcontrollers/ - """ - - PACKAGES = { - - "toolchain-gccarmnoneeabi": { - "alias": "toolchain", - "default": True - }, - - "framework-mbed": { - "alias": "framework" - } - } - - def get_name(self): - return "NXP LPC" diff --git a/platformio/platforms/siliconlabsefm32.py b/platformio/platforms/siliconlabsefm32.py deleted file mode 100644 index 8aa642ea..00000000 --- a/platformio/platforms/siliconlabsefm32.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -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": { - "alias": "framework" - } - } - - def get_name(self): - return "Silicon Labs EFM32" diff --git a/platformio/platforms/ststm32.py b/platformio/platforms/ststm32.py deleted file mode 100644 index 10203ec4..00000000 --- a/platformio/platforms/ststm32.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class Ststm32Platform(BasePlatform): - - """ - 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. - - http://www.st.com/web/en/catalog/mmc/FM141/SC1169?sc=stm32 - """ - - PACKAGES = { - - "toolchain-gccarmnoneeabi": { - "alias": "toolchain", - "default": True - }, - - "ldscripts": { - "default": True - }, - - "tool-stlink": { - "alias": "uploader" - }, - - "framework-cmsis": { - "alias": "framework" - }, - - "framework-spl": { - "alias": "framework" - }, - - "framework-libopencm3": { - "alias": "framework" - }, - - "framework-mbed": { - "alias": "framework" - } - } - - def get_name(self): - return "ST STM32" - - def configure_default_packages(self, envoptions, targets): - if envoptions.get("framework") == "cmsis": - self.PACKAGES['framework-mbed']['default'] = True - - return BasePlatform.configure_default_packages( - self, envoptions, targets) diff --git a/platformio/platforms/teensy.py b/platformio/platforms/teensy.py deleted file mode 100644 index 45e62562..00000000 --- a/platformio/platforms/teensy.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform -from platformio.util import get_boards - - -class TeensyPlatform(BasePlatform): - - """ - Teensy is a complete USB-based microcontroller development system, in - a very small footprint, capable of implementing many types of projects. - All programming is done via the USB port. No special programmer is - needed, only a standard USB cable and a PC or Macintosh with a USB port. - - https://www.pjrc.com/teensy - """ - - PACKAGES = { - - "toolchain-atmelavr": { - }, - - "toolchain-gccarmnoneeabi": { - }, - - "ldscripts": { - "default": True - }, - - "framework-arduinoteensy": { - "alias": "framework" - }, - - "framework-mbed": { - "alias": "framework" - }, - - "tool-teensy": { - "alias": "uploader" - } - } - - def get_name(self): - return "Teensy" - - def configure_default_packages(self, envoptions, targets): - if envoptions.get("board"): - board = get_boards(envoptions.get("board")) - if board['build']['core'] == "teensy": - name = "toolchain-atmelavr" - else: - name = "toolchain-gccarmnoneeabi" - self.PACKAGES[name]['alias'] = "toolchain" - self.PACKAGES[name]['default'] = True - - return BasePlatform.configure_default_packages( - self, envoptions, targets) diff --git a/platformio/platforms/timsp430.py b/platformio/platforms/timsp430.py deleted file mode 100644 index e3ce6ee4..00000000 --- a/platformio/platforms/timsp430.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class Timsp430Platform(BasePlatform): - - """ - MSP430 microcontrollers (MCUs) from Texas Instruments (TI) - are 16-bit, RISC-based, mixed-signal processors designed for ultra-low - power. These MCUs offer the lowest power consumption and the perfect - mix of integrated peripherals for thousands of applications. - - http://www.ti.com/lsds/ti/microcontrollers_16-bit_32-bit/msp/overview.page - """ - - PACKAGES = { - - "toolchain-timsp430": { - "alias": "toolchain", - "default": True - }, - - "tool-mspdebug": { - "alias": "uploader" - }, - - "framework-energiamsp430": { - "alias": "framework" - }, - - "framework-arduinomsp430": { - "alias": "framework" - } - } - - def get_name(self): - return "TI MSP430" diff --git a/platformio/platforms/titiva.py b/platformio/platforms/titiva.py deleted file mode 100644 index fbe4981e..00000000 --- a/platformio/platforms/titiva.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class TitivaPlatform(BasePlatform): - - """ - Texas Instruments TM4C12x MCUs offer the industrys most popular - ARM Cortex-M4 core with scalable memory and package options, unparalleled - connectivity peripherals, advanced application functions, industry-leading - analog integration, and extensive software solutions. - - http://www.ti.com/lsds/ti/microcontrollers_16-bit_32-bit/c2000_performance/control_automation/tm4c12x/overview.page - """ - - PACKAGES = { - - "toolchain-gccarmnoneeabi": { - "alias": "toolchain", - "default": True - }, - - "ldscripts": { - "default": True - }, - - "tool-lm4flash": { - "alias": "uploader" - }, - - "framework-energiativa": { - "alias": "framework" - }, - - "framework-libopencm3": { - "alias": "framework" - } - } - - def get_name(self): - return "TI TIVA" diff --git a/platformio/platforms/windows_x86.py b/platformio/platforms/windows_x86.py deleted file mode 100644 index bf52cc1c..00000000 --- a/platformio/platforms/windows_x86.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.platforms.base import BasePlatform - - -class Windows_x86Platform(BasePlatform): - - """ - Windows x86 (32-bit) is a metafamily of graphical operating systems - developed and marketed by Microsoft. - Using host OS (Windows, Linux 32/64 or Mac OS X) you can build native - application for Windows x86 platform. - - http://platformio.org/platforms/windows_x86 - """ - - PACKAGES = { - - "toolchain-gccmingw32": { - "alias": "toolchain", - "default": True - } - } diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 48ca79ab..964cc707 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -210,8 +210,7 @@ class MPDataPusher(object): "https://ssl.google-analytics.com/collect", data=data, headers=util.get_request_defheaders(), - timeout=1 - ) + timeout=1) r.raise_for_status() return True except: # pylint: disable=W0702 @@ -233,11 +232,7 @@ def on_command(): def measure_ci(): - event = { - "category": "CI", - "action": "NoName", - "label": None - } + event = {"category": "CI", "action": "NoName", "label": None} envmap = { "APPVEYOR": {"label": getenv("APPVEYOR_REPO_NAME")}, @@ -258,11 +253,7 @@ def measure_ci(): def measure_caller(calller_id): calller_id = str(calller_id)[:20].lower() - event = { - "category": "Caller", - "action": "Misc", - "label": calller_id - } + event = {"category": "Caller", "action": "Misc", "label": calller_id} if calller_id in (["atom", "vim"] + ProjectGenerator.get_supported_ides()): event['action'] = "IDE" on_event(**event) diff --git a/platformio/unpacker.py b/platformio/unpacker.py index ab8955cd..67ca78a7 100644 --- a/platformio/unpacker.py +++ b/platformio/unpacker.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -64,8 +64,7 @@ class ZIPArchive(ArchiveBase): def preserve_mtime(item, dest_dir): util.change_filemtime( join(dest_dir, item.filename), - mktime(list(item.date_time) + [0] * 3) - ) + mktime(list(item.date_time) + [0] * 3)) def get_items(self): return self._afo.infolist() @@ -97,8 +96,8 @@ class FileUnpacker(object): for item in self._unpacker.get_items(): self._unpacker.extract_item(item, self._dest_dir) else: - with click.progressbar(self._unpacker.get_items(), - label="Unpacking") as pb: + items = self._unpacker.get_items() + with click.progressbar(items, label="Unpacking") as pb: for item in pb: self._unpacker.extract_item(item, self._dest_dir) return True diff --git a/platformio/util.py b/platformio/util.py index f5e96b20..cd87103c 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,12 +17,14 @@ import functools import json import os import re +import stat import subprocess import sys from glob import glob from os.path import (abspath, basename, dirname, expanduser, isdir, isfile, join, splitdrive) from platform import system, uname +from shutil import rmtree from threading import Thread from platformio import __apiip__, __apiurl__, __version__, exception @@ -81,7 +83,6 @@ class cd(object): class memoized(object): - ''' Decorator. Caches a function's return value each time it is called. If called later with the same arguments, the cached value is returned @@ -122,6 +123,7 @@ def singleton(cls): if cls not in _instances: _instances[cls] = cls(*args, **kwargs) return _instances[cls] + return get_instance @@ -149,23 +151,21 @@ def _get_projconf_option_dir(name, default=None): return os.getenv(_env_name) try: - config = get_project_config() + config = load_project_config() if (config.has_section("platformio") and config.has_option("platformio", name)): option_dir = config.get("platformio", name) if option_dir.startswith("~"): option_dir = expanduser(option_dir) return abspath(option_dir) - except exception.NotPlatformProject: + except exception.NotPlatformIOProject: pass return default def get_home_dir(): - home_dir = _get_projconf_option_dir( - "home_dir", - join(expanduser("~"), ".platformio") - ) + home_dir = _get_projconf_option_dir("home_dir", + join(expanduser("~"), ".platformio")) if "windows" in get_systype(): try: @@ -180,13 +180,6 @@ def get_home_dir(): return home_dir -def get_lib_dir(): - return _get_projconf_option_dir( - "lib_dir", - join(get_home_dir(), "lib") - ) - - def get_source_dir(): curpath = abspath(__file__) if not isfile(curpath): @@ -201,22 +194,33 @@ def get_project_dir(): return os.getcwd() -def get_projectsrc_dir(): - return _get_projconf_option_dir( - "src_dir", - join(get_project_dir(), "src") - ) +def is_platformio_project(project_dir=None): + if not project_dir: + project_dir = get_project_dir() + return isfile(join(project_dir, "platformio.ini")) def get_projectlib_dir(): - return join(get_project_dir(), "lib") + return _get_projconf_option_dir("lib_dir", join(get_project_dir(), "lib")) -def get_pioenvs_dir(): - path = _get_projconf_option_dir( - "envs_dir", - join(get_project_dir(), ".pioenvs") - ) +def get_projectlibdeps_dir(): + return _get_projconf_option_dir("libdeps_dir", + join(get_project_dir(), ".piolibdeps")) + + +def get_projectsrc_dir(): + return _get_projconf_option_dir("src_dir", join(get_project_dir(), "src")) + + +def get_projecttest_dir(): + return _get_projconf_option_dir("test_dir", join(get_project_dir(), + "test")) + + +def get_projectpioenvs_dir(): + path = _get_projconf_option_dir("envs_dir", + join(get_project_dir(), ".pioenvs")) if not isdir(path): os.makedirs(path) dontmod_path = join(path, "do-not-modify-files-here.url") @@ -230,19 +234,17 @@ URL=http://docs.platformio.org/en/stable/projectconf.html#envs-dir def get_projectdata_dir(): - return _get_projconf_option_dir( - "data_dir", - join(get_project_dir(), "data") - ) + return _get_projconf_option_dir("data_dir", + join(get_project_dir(), "data")) -def get_project_config(ini_path=None): - if not ini_path: - ini_path = join(get_project_dir(), "platformio.ini") - if not isfile(ini_path): - raise exception.NotPlatformProject(get_project_dir()) +def load_project_config(project_dir=None): + if not project_dir: + project_dir = get_project_dir() + if not is_platformio_project(project_dir): + raise exception.NotPlatformIOProject(project_dir) cp = ConfigParser() - cp.read(ini_path) + cp.read(join(project_dir, "platformio.ini")) return cp @@ -255,17 +257,12 @@ def is_ci(): def exec_command(*args, **kwargs): - result = { - "out": None, - "err": None, - "returncode": None - } + result = {"out": None, "err": None, "returncode": None} default = dict( stdout=subprocess.PIPE, stderr=subprocess.PIPE, - shell=system() == "Windows" - ) + shell=system() == "Windows") default.update(kwargs) kwargs = default @@ -340,9 +337,14 @@ def get_logicaldisks(): def get_request_defheaders(): import requests - return {"User-Agent": "PlatformIO/%s CI/%d %s" % ( - __version__, int(is_ci()), requests.utils.default_user_agent() - )} + data = (__version__, int(is_ci()), requests.utils.default_user_agent()) + return {"User-Agent": "PlatformIO/%s CI/%d %s" % data} + + +@memoized +def _api_request_session(): + import requests + return requests.Session() def get_api_result(path, params=None, data=None, skipdns=False): @@ -354,16 +356,18 @@ def get_api_result(path, params=None, data=None, skipdns=False): url = __apiurl__ if skipdns: url = "http://%s" % __apiip__ - headers['host'] = __apiurl__[__apiurl__.index("://")+3:] + headers['host'] = __apiurl__[__apiurl__.index("://") + 3:] try: if data: - r = requests.post( + r = _api_request_session().post( url + path, params=params, data=data, headers=headers) else: - r = requests.get(url + path, params=params, headers=headers) - r.raise_for_status() + r = _api_request_session().get(url + path, + params=params, + headers=headers) result = r.json() + r.raise_for_status() except requests.exceptions.HTTPError as e: if result and "errors" in result: raise exception.APIRequestError(result['errors'][0]['title']) @@ -378,45 +382,19 @@ def get_api_result(path, params=None, data=None, skipdns=False): "Could not connect to PlatformIO Registry Service. " "Please try later.") except ValueError: - raise exception.APIRequestError( - "Invalid response: %s" % r.text.encode("utf-8")) + raise exception.APIRequestError("Invalid response: %s" % + r.text.encode("utf-8")) finally: if r: r.close() return result -@memoized -def _lookup_boards(): - 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 sorted(os.listdir(bdir)): - if not json_file.endswith(".json"): - continue - boards.update(load_json(join(bdir, json_file))) - return boards - - -def get_boards(type_=None): - boards = _lookup_boards() - - if type_ is None: - return boards - else: - if type_ not in boards: - raise exception.UnknownBoard(type_) - return boards[type_] - - @memoized def _lookup_frameworks(): frameworks = {} - frameworks_path = join( - get_source_dir(), "builder", "scripts", "frameworks") + frameworks_path = join(get_source_dir(), "builder", "scripts", + "frameworks") frameworks_list = [f[:-3] for f in os.listdir(frameworks_path) if not f.startswith("__") and f.endswith(".py")] @@ -426,8 +404,8 @@ def _lookup_frameworks(): fcontent = f.read() assert '"""' in fcontent _doc_start = fcontent.index('"""') + 3 - fdoc = fcontent[ - _doc_start:fcontent.index('"""', _doc_start)].strip() + fdoc = fcontent[_doc_start:fcontent.index('"""', + _doc_start)].strip() doclines = [l.strip() for l in fdoc.splitlines() if l.strip()] frameworks[_type] = { "name": doclines[0], @@ -460,8 +438,7 @@ def where_is_program(program, envpath=None): try: result = exec_command( ["where" if "windows" in get_systype() else "which", program], - env=env - ) + env=env) if result['returncode'] == 0 and isfile(result['out'].strip()): return result['out'].strip() except OSError: @@ -475,3 +452,16 @@ def where_is_program(program, envpath=None): return join(bin_dir, "%s.exe" % program) return program + + +def pepver_to_semver(pepver): + return re.sub(r"(\.\d+)\.?(dev|a|b|rc|post)", r"\1-\2", pepver, 1) + + +def rmtree_(path): + + def _onerror(_, name, __): + os.chmod(name, stat.S_IWRITE) + os.remove(name) + + return rmtree(path, onerror=_onerror) diff --git a/platformio/vcsclient.py b/platformio/vcsclient.py new file mode 100644 index 00000000..0d3af892 --- /dev/null +++ b/platformio/vcsclient.py @@ -0,0 +1,181 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import re +from os.path import join +from subprocess import check_call +from sys import modules +from urlparse import urlparse + +from platformio import util +from platformio.exception import PlatformioException + + +class VCSClientFactory(object): + + @staticmethod + def newClient(src_dir, remote_url): + result = urlparse(remote_url) + type_ = result.scheme + if "+" in result.scheme: + type_, _ = result.scheme.split("+", 1) + remote_url = remote_url[len(type_) + 1:] + if result.fragment: + remote_url = remote_url.rsplit("#", 1)[0] + obj = getattr(modules[__name__], "%sClient" % type_.title())( + src_dir, remote_url, result.fragment) + assert isinstance(obj, VCSClientBase) + return obj + + +class VCSClientBase(object): + + command = None + + def __init__(self, src_dir, remote_url=None, tag=None): + self.src_dir = src_dir + self.remote_url = remote_url + self.tag = tag + self.check_client() + + def check_client(self): + try: + assert self.command + assert self.run_cmd(["--version"]) + except (AssertionError, OSError): + raise PlatformioException( + "VCS: `%s` client is not installed in your system" % + self.command) + return True + + @property + def storage_dir(self): + return join(self.src_dir, "." + self.command) + + def export(self): + raise NotImplementedError + + def update(self): + raise NotImplementedError + + @property + def can_be_updated(self): + return not self.tag + + def get_current_revision(self): + raise NotImplementedError + + def run_cmd(self, args, **kwargs): + args = [self.command] + args + if "cwd" not in kwargs: + kwargs['cwd'] = self.src_dir + return check_call(args, **kwargs) == 0 + + def get_cmd_output(self, args, **kwargs): + args = [self.command] + args + if "cwd" not in kwargs: + kwargs['cwd'] = self.src_dir + result = util.exec_command(args, **kwargs) + if result['returncode'] == 0: + return result['out'].strip() + raise PlatformioException( + "VCS: Could not receive an output from `%s` command (%s)" % ( + args, result)) + + +class GitClient(VCSClientBase): + + command = "git" + + def get_branches(self): + output = self.get_cmd_output(["branch"]) + output = output.replace("*", "") # fix active branch + return [b.strip() for b in output.split("\n")] + + def get_tags(self): + output = self.get_cmd_output(["tag", "-l"]) + return [t.strip() for t in output.split("\n")] + + @staticmethod + def is_commit_id(text): + return text and re.match(r"[0-9a-f]{7,}$", text) is not None + + @property + def can_be_updated(self): + return not self.tag or not self.is_commit_id(self.tag) + + def export(self): + is_commit = self.is_commit_id(self.tag) + args = ["clone", "--recursive"] + if not self.tag or not is_commit: + args += ["--depth", "1"] + if self.tag: + args += ["--branch", self.tag] + args += [self.remote_url, self.src_dir] + assert self.run_cmd(args) + if is_commit: + return self.run_cmd(["reset", "--hard", self.tag]) + return True + + def update(self): + args = ["pull"] + return self.run_cmd(args) + + def get_current_revision(self): + return self.get_cmd_output(["rev-parse", "--short", "HEAD"]) + + +class HgClient(VCSClientBase): + + command = "hg" + + def export(self): + args = ["clone"] + if self.tag: + args.extend(["--updaterev", self.tag]) + args.extend([self.remote_url, self.src_dir]) + return self.run_cmd(args) + + def update(self): + args = ["pull", "--update"] + return self.run_cmd(args) + + def get_current_revision(self): + return self.get_cmd_output(["identify", "--id"]) + + +class SvnClient(VCSClientBase): + + command = "svn" + + def export(self): + args = ["checkout"] + if self.tag: + args.extend(["--revision", self.tag]) + args.extend([self.remote_url, self.src_dir]) + return self.run_cmd(args) + + def update(self): + + args = ["update"] + return self.run_cmd(args) + + def get_current_revision(self): + output = self.get_cmd_output(["info", "--non-interactive", + "--trust-server-cert", "-r", "HEAD"]) + for line in output.split("\n"): + line = line.strip() + if line.startswith("Revision:"): + return line.split(":", 1)[1].strip() + raise PlatformioException("Could not detect current SVN revision") diff --git a/scripts/99-platformio-udev.rules b/scripts/99-platformio-udev.rules index ac52af74..3156ef0e 100644 --- a/scripts/99-platformio-udev.rules +++ b/scripts/99-platformio-udev.rules @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/docspregen.py b/scripts/docspregen.py index 90fb3455..8b42e242 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -1,4 +1,4 @@ -# Copyright 2014-present Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -134,7 +134,7 @@ def generate_platform(name): print "Processing platform: %s" % name lines = [] - lines.append(""".. Copyright 2014-present Ivan Kravets + lines.append(""".. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -241,7 +241,7 @@ def generate_framework(type_, data): print "Processing framework: %s" % type_ lines = [] - lines.append(""".. Copyright 2014-present Ivan Kravets + lines.append(""".. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -367,7 +367,7 @@ Packages def update_embedded_boards(): lines = [] - lines.append(""".. Copyright 2014-present Ivan Kravets + lines.append(""".. Copyright 2014-present PlatformIO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/scripts/fixsymlink.py b/scripts/fixsymlink.py index d7d97f37..44a628fd 100644 --- a/scripts/fixsymlink.py +++ b/scripts/fixsymlink.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/get-platformio.py b/scripts/get-platformio.py index 75453e56..c67debfe 100644 --- a/scripts/get-platformio.py +++ b/scripts/get-platformio.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/mbed_to_package.py b/scripts/mbed_to_package.py index fcf5581c..6effd7ea 100644 --- a/scripts/mbed_to_package.py +++ b/scripts/mbed_to_package.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/setup.py b/setup.py index 83d9acb9..29a759d9 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys - from setuptools import find_packages, setup from platformio import (__author__, __description__, __email__, __license__, @@ -21,16 +19,14 @@ from platformio import (__author__, __description__, __email__, __license__, install_requires = [ "bottle<0.13", - "click>=3.2,<6", + "click>=5,<6", "lockfile>=0.9.1,<0.13", "requests>=2.4.0,<3", + "semantic_version>=2.5.0", "colorama", "pyserial<4" ] -if sys.version_info < (2, 7, 0): - install_requires[-1] = "pyserial<3" - setup( name=__title__, version=__version__, @@ -45,7 +41,6 @@ setup( package_data={ "platformio": [ "projectconftpl.ini", - "boards/*.json", "ide/tpls/*/.*.tpl", "ide/tpls/*/*.tpl", "ide/tpls/*/*/*.tpl", diff --git a/tests/commands/test_boards.py b/tests/commands/test_boards.py index f137096c..71f4ebd8 100644 --- a/tests/commands/test_boards.py +++ b/tests/commands/test_boards.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,18 +14,16 @@ import json -from platformio import util from platformio.commands.boards import cli as cmd_boards -from platformio.commands.platforms import \ - platforms_search as cmd_platforms_search +from platformio.commands.platform import platform_search as cmd_platform_search def test_board_json_output(platformio_setup, clirunner, validate_cliresult): - result = clirunner.invoke(cmd_boards, ["cortex", "--json-output"]) + result = clirunner.invoke(cmd_boards, ["mbed", "--json-output"]) validate_cliresult(result) boards = json.loads(result.output) - assert isinstance(boards, dict) - assert "teensy30" in boards + assert isinstance(boards, list) + assert any(["mbed" in b['frameworks'] for b in boards]) def test_board_raw_output(platformio_setup, clirunner, validate_cliresult): @@ -36,16 +34,20 @@ def test_board_raw_output(platformio_setup, clirunner, validate_cliresult): def test_board_options(platformio_setup, clirunner, validate_cliresult): required_opts = set( - ["build", "platform", "upload", "name"]) + ["fcpu", "frameworks", "id", "mcu", "name", "platform"]) # fetch available platforms - result = clirunner.invoke(cmd_platforms_search, ["--json-output"]) + result = clirunner.invoke(cmd_platform_search, ["--json-output"]) validate_cliresult(result) search_result = json.loads(result.output) assert isinstance(search_result, list) assert len(search_result) - platforms = [item['type'] for item in search_result] + platforms = [item['name'] for item in search_result] - for _, opts in util.get_boards().iteritems(): - assert required_opts.issubset(set(opts)) - assert opts['platform'] in platforms + result = clirunner.invoke(cmd_boards, ["mbed", "--json-output"]) + validate_cliresult(result) + boards = json.loads(result.output) + + for board in boards: + assert required_opts.issubset(set(board)) + assert board['platform'] in platforms diff --git a/tests/commands/test_init.py b/tests/commands/test_init.py index 5e136f47..9c8c1189 100644 --- a/tests/commands/test_init.py +++ b/tests/commands/test_init.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,11 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -from os import makedirs, getcwd +import json +from os import getcwd, makedirs from os.path import getsize, isdir, isfile, join -from platformio.commands.init import cli from platformio import util +from platformio.commands.boards import cli as cmd_boards +from platformio.commands.init import cli def validate_pioproject(pioproject_dir): @@ -56,11 +58,14 @@ def test_init_special_board(platformio_setup, clirunner, validate_cliresult): validate_cliresult(result) validate_pioproject(getcwd()) - uno = util.get_boards("uno") - config = util.get_project_config() + result = clirunner.invoke(cmd_boards, ["Arduino Uno", "--json-output"]) + validate_cliresult(result) + boards = json.loads(result.output) + + config = util.load_project_config() expected_result = [ - ("platform", str(uno['platform'])), - ("framework", str(uno['frameworks'][0])), + ("platform", str(boards[0]['platform'])), + ("framework", str(boards[0]['frameworks'][0])), ("board", "uno") ] @@ -76,7 +81,7 @@ def test_init_enable_auto_uploading(platformio_setup, clirunner, ["-b", "uno", "--enable-auto-uploading"]) validate_cliresult(result) validate_pioproject(getcwd()) - config = util.get_project_config() + config = util.load_project_config() expected_result = [ ("platform", "atmelavr"), ("framework", "arduino"), @@ -91,5 +96,5 @@ def test_init_enable_auto_uploading(platformio_setup, clirunner, def test_init_incorrect_board(clirunner): result = clirunner.invoke(cli, ["-b", "missed_board"]) assert result.exit_code == 2 - assert 'Error: Invalid value for "--board" / "-b"' in result.output + assert 'Error: Invalid value for "-b" / "--board' in result.output assert isinstance(result.exception, SystemExit) diff --git a/tests/commands/test_lib.py b/tests/commands/test_lib.py index e749a68c..994417a4 100644 --- a/tests/commands/test_lib.py +++ b/tests/commands/test_lib.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,25 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -from os import listdir -from os.path import isdir, isfile, join - import re from platformio.commands.lib import cli -from platformio import util -def validate_libfolder(): - libs_path = util.get_lib_dir() - installed_libs = listdir(libs_path) - for lib in installed_libs: - assert isdir(join(libs_path, lib)) - assert isfile(join(libs_path, lib, ".library.json")) and isfile( - join(libs_path, lib, "library.json")) - - -def test_lib_search(clirunner, validate_cliresult): +def test_search(clirunner, validate_cliresult): result = clirunner.invoke(cli, ["search", "DHT22"]) validate_cliresult(result) match = re.search(r"Found\s+(\d+)\slibraries:", result.output) @@ -42,34 +29,70 @@ def test_lib_search(clirunner, validate_cliresult): assert int(match.group(1)) == 1 -def test_lib_install(clirunner, validate_cliresult): - result = clirunner.invoke(cli, ["install", "58", "115"]) +def test_global_install_registry(clirunner, validate_cliresult, + isolated_pio_home): + result = clirunner.invoke( + cli, ["-g", "install", "58", "OneWire", "Json@5.4.0", "Json@>5.4"]) validate_cliresult(result) - validate_libfolder() + items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()] + items2 = ["DHT22_ID58", "Json_ID64", "Json_ID64@5.4.0", "OneWire_ID1"] + assert set(items1) == set(items2) -def test_lib_list(clirunner, validate_cliresult): - result = clirunner.invoke(cli, ["list"]) +def test_global_install_repository(clirunner, validate_cliresult, + isolated_pio_home): + result = clirunner.invoke( + cli, ["-g", "install", "https://github.com/gioblu/PJON.git#3.0", + "https://developer.mbed.org/users/simon/code/TextLCD/", + "http://dl.platformio.org/libraries/archives/3/3756.tar.gz", + "knolleary/pubsubclient"]) validate_cliresult(result) - assert "58" in result.output and "115" in result.output + items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()] + items2 = ["PJON", "TextLCD", "ESPAsyncTCP", "PubSubClient"] + assert set(items2) & set(items1) -def test_lib_show(clirunner, validate_cliresult): - result = clirunner.invoke(cli, ["show", "115"]) +def test_global_lib_list(clirunner, validate_cliresult, isolated_pio_home): + result = clirunner.invoke(cli, ["-g", "list"]) validate_cliresult(result) - assert "arduino" in result.output and "atmelavr" in result.output + assert all([n in result.output for n in ("OneWire", "DHT22", "64")]) - result = clirunner.invoke(cli, ["show", "58"]) + result = clirunner.invoke(cli, ["-g", "list", "--json-output"]) validate_cliresult(result) - assert "energia" in result.output and "timsp430" in result.output + assert all( + [n in result.output + for n in ("PJON", + "https://developer.mbed.org/users/simon/code/TextLCD/")]) -def test_lib_update(clirunner, validate_cliresult): - result = clirunner.invoke(cli, ["update"]) +def test_global_lib_show(clirunner, validate_cliresult, isolated_pio_home): + result = clirunner.invoke(cli, ["-g", "show", "64@5.4.0"]) validate_cliresult(result) - assert "58" in result.output and "115" in result.output + assert all( + [s in result.output for s in ("Json", "arduino", "atmelavr", "5.4.0")]) - -def test_lib_uninstall(clirunner, validate_cliresult): - result = clirunner.invoke(cli, ["uninstall", "58", "115"]) + result = clirunner.invoke(cli, ["-g", "show", "Json@>5.4.0"]) validate_cliresult(result) + assert all([s in result.output for s in ("Json", "arduino", "atmelavr")]) + assert "5.4.0" not in result.output + + result = clirunner.invoke(cli, ["-g", "show", "1"]) + validate_cliresult(result) + assert "OneWire" in result.output + + +def test_global_lib_update(clirunner, validate_cliresult, isolated_pio_home): + result = clirunner.invoke(cli, ["-g", "update"]) + validate_cliresult(result) + assert all([s in result.output for s in ("[Up-to-date]", "[VCS]")]) + + +def test_global_lib_uninstall(clirunner, validate_cliresult, + isolated_pio_home): + result = clirunner.invoke( + cli, ["-g", "uninstall", "1", "Json@!=5.4.0", "TextLCD"]) + validate_cliresult(result) + items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()] + items2 = ["DHT22_ID58", "Json_ID64@5.4.0", "ESPAsyncTCP_ID305", + "pubsubclient", "PJON"] + assert set(items1) == set(items2) diff --git a/tests/commands/test_platform.py b/tests/commands/test_platform.py new file mode 100644 index 00000000..ec618a90 --- /dev/null +++ b/tests/commands/test_platform.py @@ -0,0 +1,126 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +import os +from os.path import join + +from platformio import exception, util +from platformio.commands import platform as cli_platform + + +def test_list_json_output(clirunner, validate_cliresult): + result = clirunner.invoke(cli_platform.platform_list, ["--json-output"]) + validate_cliresult(result) + list_result = json.loads(result.output) + assert isinstance(list_result, list) + assert len(list_result) + platforms = [item['name'] for item in list_result] + assert "titiva" in platforms + + +def test_list_raw_output(clirunner, validate_cliresult): + result = clirunner.invoke(cli_platform.platform_list) + validate_cliresult(result) + assert "teensy" in result.output + + +def test_search_json_output(clirunner, validate_cliresult): + result = clirunner.invoke(cli_platform.platform_search, + ["arduino", "--json-output"]) + validate_cliresult(result) + search_result = json.loads(result.output) + assert isinstance(search_result, list) + assert len(search_result) + platforms = [item['name'] for item in search_result] + assert "atmelsam" in platforms + + +def test_search_raw_output(clirunner, validate_cliresult): + result = clirunner.invoke(cli_platform.platform_search, ["arduino"]) + validate_cliresult(result) + assert "teensy" in result.output + + +def test_install_uknown_from_registry(clirunner, validate_cliresult): + result = clirunner.invoke(cli_platform.platform_install, + ["uknown-platform"]) + assert result.exit_code == -1 + assert isinstance(result.exception, exception.UnknownPackage) + + +def test_install_uknown_version(clirunner, validate_cliresult): + result = clirunner.invoke(cli_platform.platform_install, + ["atmelavr@99.99.99"]) + assert result.exit_code == -1 + assert isinstance(result.exception, exception.UndefinedPackageVersion) + + +def test_complex(clirunner, validate_cliresult): + items = [ + "teensy", + "https://github.com/platformio/platform-teensy/archive/develop.zip", + "https://github.com/platformio/platform-teensy.git", + "platformio/platform-teensy", + ] + for item in items: + with clirunner.isolated_filesystem(): + os.environ["PLATFORMIO_HOME_DIR"] = os.getcwd() + try: + result = clirunner.invoke(cli_platform.platform_install, + [item]) + validate_cliresult(result) + assert all([ + s in result.output + for s in ("teensy", "Downloading", "Unpacking", + "tool-scons") + ]) + + # show platform information + result = clirunner.invoke(cli_platform.platform_show, + ["teensy"]) + validate_cliresult(result) + assert "teensy" in result.output + + # list platforms + result = clirunner.invoke(cli_platform.platform_list, + ["--json-output"]) + validate_cliresult(result) + list_result = json.loads(result.output) + assert isinstance(list_result, list) + assert len(list_result) == 1 + assert list_result[0]["name"] == "teensy" + assert list_result[0]["packages"] == ["tool-scons"] + + # try to install again + result = clirunner.invoke(cli_platform.platform_install, + ["teensy"]) + validate_cliresult(result) + assert "is already installed" in result.output + + # try to update + result = clirunner.invoke(cli_platform.platform_update) + validate_cliresult(result) + assert "teensy" in result.output + assert "Up-to-date" in result.output + + # try to uninstall + result = clirunner.invoke(cli_platform.platform_uninstall, + ["teensy"]) + validate_cliresult(result) + for folder in ("platforms", "packages"): + assert len(os.listdir(join(util.get_home_dir(), + folder))) == 0 + finally: + del os.environ["PLATFORMIO_HOME_DIR"] diff --git a/tests/commands/test_platforms.py b/tests/commands/test_platforms.py deleted file mode 100644 index 0d0251d1..00000000 --- a/tests/commands/test_platforms.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2014-2016 Ivan Kravets -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import json - -from platformio.commands.platforms import \ - platforms_list as cmd_platforms_list -from platformio.commands.platforms import \ - platforms_search as cmd_platforms_search - - -def test_list_json_output(clirunner, validate_cliresult): - result = clirunner.invoke(cmd_platforms_list, ["--json-output"]) - validate_cliresult(result) - list_result = json.loads(result.output) - assert isinstance(list_result, list) - assert len(list_result) - platforms = [item['name'] for item in list_result] - assert "titiva" in platforms - - -def test_list_raw_output(clirunner, validate_cliresult): - result = clirunner.invoke(cmd_platforms_list) - validate_cliresult(result) - assert "teensy" in result.output - - -def test_search_json_output(clirunner, validate_cliresult): - result = clirunner.invoke(cmd_platforms_search, - ["arduino", "--json-output"]) - validate_cliresult(result) - search_result = json.loads(result.output) - assert isinstance(search_result, list) - assert len(search_result) - platforms = [item['type'] for item in search_result] - assert "atmelsam" in platforms - - -def test_search_raw_output(clirunner, validate_cliresult): - result = clirunner.invoke(cmd_platforms_search, ["arduino"]) - validate_cliresult(result) - assert "teensy" in result.output diff --git a/tests/commands/test_settings.py b/tests/commands/test_settings.py index d74c3ad8..bec21889 100644 --- a/tests/commands/test_settings.py +++ b/tests/commands/test_settings.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from platformio.commands.settings import cli from platformio import app +from platformio.commands.settings import cli def test_settings_check(clirunner, validate_cliresult): diff --git a/tests/commands/test_update.py b/tests/commands/test_update.py new file mode 100644 index 00000000..27eb8c9d --- /dev/null +++ b/tests/commands/test_update.py @@ -0,0 +1,29 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from platformio.commands.update import cli as cmd_update + + +def test_update(platformio_setup, clirunner, validate_cliresult): + matches = ( + "Platform Manager", + "Up-to-date", + "Library Manager" + ) + result = clirunner.invoke(cmd_update, ["--only-check"]) + validate_cliresult(result) + assert all([m in result.output for m in matches]) + result = clirunner.invoke(cmd_update) + validate_cliresult(result) + assert all([m in result.output for m in matches]) diff --git a/tests/conftest.py b/tests/conftest.py index f4cdc110..8483d8b9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,29 +12,28 @@ # See the License for the specific language governing permissions and # limitations under the License. -from os import environ - -from click.testing import CliRunner +import os import pytest +from click.testing import CliRunner @pytest.fixture(scope="session") def platformio_setup(request): pioenvvars = ("ENABLE_PROMPTS", "ENABLE_TELEMETRY") for v in pioenvvars: - environ["PLATFORMIO_SETTING_%s" % v] = "No" + os.environ["PLATFORMIO_SETTING_%s" % v] = "No" def platformio_teardown(): for v in pioenvvars: _name = "PLATFORMIO_SETTING_%s" % v - if _name in environ: - del environ[_name] + if _name in os.environ: + del os.environ[_name] request.addfinalizer(platformio_teardown) -@pytest.fixture(scope="session") +@pytest.fixture(scope="module") def clirunner(): return CliRunner() @@ -46,3 +45,15 @@ def validate_cliresult(): assert not result.exception assert "error" not in result.output.lower() return decorator + + +@pytest.fixture(scope="module") +def isolated_pio_home(request, tmpdir_factory): + home_dir = tmpdir_factory.mktemp(".platformio") + os.environ['PLATFORMIO_HOME_DIR'] = str(home_dir) + + def fin(): + del os.environ['PLATFORMIO_HOME_DIR'] + + request.addfinalizer(fin) + return home_dir diff --git a/tests/test_examples.py b/tests/test_examples.py index f953feab..bfe428d9 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,11 +15,10 @@ from glob import glob from os import listdir, walk from os.path import dirname, getsize, isdir, isfile, join, normpath -from shutil import rmtree import pytest -from platformio.util import exec_command +from platformio import util def pytest_generate_tests(metafunc): @@ -38,9 +37,9 @@ def pytest_generate_tests(metafunc): @pytest.mark.examples def test_run(platformio_setup, pioproject_dir): if isdir(join(pioproject_dir, ".pioenvs")): - rmtree(join(pioproject_dir, ".pioenvs")) + util.rmtree_(join(pioproject_dir, ".pioenvs")) - result = exec_command( + result = util.exec_command( ["platformio", "--force", "run", "--project-dir", pioproject_dir] ) if result['returncode'] != 0: diff --git a/tests/test_managers.py b/tests/test_managers.py new file mode 100644 index 00000000..f41c31a1 --- /dev/null +++ b/tests/test_managers.py @@ -0,0 +1,66 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from platformio import util +from platformio.managers.package import BasePkgManager + + +def test_pkg_name_parser(): + items = [ + ["PkgName", ("PkgName", None, None)], + [("PkgName", "!=1.2.3,<2.0"), ("PkgName", "!=1.2.3,<2.0", None)], + ["PkgName@1.2.3", ("PkgName", "1.2.3", None)], + [("PkgName@1.2.3", "1.2.5"), ("PkgName@1.2.3", "1.2.5", None)], + ["id:13", ("id:13", None, None)], + ["id:13@~1.2.3", ("id:13", "~1.2.3", None)], + [util.get_home_dir(), + (".platformio", None, "file://" + util.get_home_dir())], + ["LocalName=" + util.get_home_dir(), + ("LocalName", None, "file://" + util.get_home_dir())], + ["https://github.com/user/package.git", + ("package", None, "git+https://github.com/user/package.git")], + ["https://github.com/user/package/archive/branch.zip", + ("branch", None, + "https://github.com/user/package/archive/branch.zip")], + ["https://github.com/user/package/archive/branch.tar.gz", + ("branch", None, + "https://github.com/user/package/archive/branch.tar.gz")], + ["https://developer.mbed.org/users/user/code/package/", + ("package", None, + "hg+https://developer.mbed.org/users/user/code/package/")], + ["https://github.com/user/package#v1.2.3", + ("package", None, "git+https://github.com/user/package#v1.2.3")], + ["https://github.com/user/package.git#branch", + ("package", None, "git+https://github.com/user/package.git#branch")], + ["PkgName=https://github.com/user/package.git#a13d344fg56", + ("PkgName", None, + "git+https://github.com/user/package.git#a13d344fg56")], + ["PkgName=user/package", + ("PkgName", None, "git+https://github.com/user/package")], + ["PkgName=user/package#master", + ("PkgName", None, "git+https://github.com/user/package#master")], + ["git+https://github.com/user/package", + ("package", None, "git+https://github.com/user/package")], + ["hg+https://example.com/user/package", + ("package", None, "hg+https://example.com/user/package")], + ["git@github.com:user/package.git", + ("package", None, "git@github.com:user/package.git")], + ["git@github.com:user/package.git#v1.2.0", + ("package", None, "git@github.com:user/package.git#v1.2.0")] + ] + for params, result in items: + if isinstance(params, tuple): + assert BasePkgManager.parse_pkg_name(*params) == result + else: + assert BasePkgManager.parse_pkg_name(params) == result diff --git a/tests/test_pkgmanifest.py b/tests/test_pkgmanifest.py index 62b1b9d6..476666a0 100644 --- a/tests/test_pkgmanifest.py +++ b/tests/test_pkgmanifest.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tox.ini b/tox.ini index 7b32c481..172bb4c5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Ivan Kravets +# Copyright 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -55,7 +55,17 @@ basepython = py27: python2.7 usedevelop = True passenv = * -deps = pytest +deps = + pytest commands = {envpython} --version py.test -v --basetemp="{envtmpdir}" tests + +[testenv:coverage] +passenv = * +basepython = python2.7 +deps = + pytest + pytest-cov +commands = + py.test --cov=platformio --cov-report term --cov-report xml --ignore=tests/test_examples.py --ignore=tests/test_pkgmanifest.py -v tests