Merge branch 'release/v2.7.0'

This commit is contained in:
Ivan Kravets
2015-12-30 20:25:12 +02:00
87 changed files with 1563 additions and 455 deletions

1
.gitignore vendored
View File

@ -2,6 +2,5 @@
*.pyc
.pioenvs
.tox
.sconsign.dblite
docs/_build
dist

View File

@ -4,6 +4,30 @@ Release History
PlatformIO 2.0
--------------
2.7.0 (2015-12-30)
~~~~~~~~~~~~~~~~~~
**Happy New Year!**
* Moved SCons to PlatformIO packages. PlatformIO does not require SCons to be
installed in your system. Significantly simplified installation process of
PlatformIO. ``pip install platformio`` rocks!
* Implemented uploading files to file system of ESP8266 SPIFFS (including OTA)
(`issue #382 <https://github.com/platformio/platformio/issues/382>`_)
* Added support for the new Adafruit boards Bluefruit Micro and Feather
(`issue #403 <https://github.com/platformio/platformio/issues/403>`_)
* Added support for RFDuino
(`issue #319 <https://github.com/platformio/platformio/issues/319>`_)
* Project generator for `Emacs <http://docs.platformio.org/en/latest/ide/emacs.html>`__
text editor
(`pull #404 <https://github.com/platformio/platformio/pull/404>`_)
* Updated Arduino framework for Atmel AVR development platform to 1.6.7
* Documented `firmware uploading for Atmel AVR development platform using
Programmers <http://docs.platformio.org/en/latest/platforms/atmelavr.html#upload-using-programmer>`_:
AVR ISP, AVRISP mkII, USBtinyISP, USBasp, Parallel Programmer and Arduino as ISP
* Fixed issue with current Python interpreter for Python-based tools
(`pull #417 <https://github.com/platformio/platformio/pull/417>`_)
2.6.3 (2015-12-21)
~~~~~~~~~~~~~~~~~~

View File

@ -28,6 +28,9 @@ PlatformIO
.. image:: https://badges.gitter.im/Join%20Chat.svg
:alt: Join the chat at https://gitter.im/platformio/platformio
:target: https://gitter.im/platformio/platformio
.. image:: https://img.shields.io/PlatformIO/donate.png?color=yellow
:alt: Support PlatformIO Team
:target: https://www.bountysource.com/teams/platformio
`Home & Demo <http://platformio.org>`_ |
`Project Examples <https://github.com/platformio/platformio/tree/develop/examples>`_ |
@ -93,7 +96,7 @@ settings for most popular `Embedded Boards <http://platformio.org/#!/boards>`_.
* Colourful `command-line output <https://raw.githubusercontent.com/platformio/platformio/develop/examples/platformio-examples.png>`_
* `IDE Integration <http://docs.platformio.org/en/latest/ide.html>`_ with
*Arduino, Eclipse, Energia, Qt Creator, Sublime Text, Vim, Visual Studio*
*Arduino, Eclipse, Emacs, Energia, Qt Creator, Sublime Text, Vim, Visual Studio*
* Cloud compiling and `Continuous Integration <http://docs.platformio.org/en/latest/ci/index.html>`_
with *AppVeyor, Circle CI, Drone, Shippable, Travis CI*
* Built-in `Serial Port Monitor <http://docs.platformio.org/en/latest/userguide/cmd_serialports.html#platformio-serialports-monitor>`_ and configurable

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -23,6 +23,10 @@ Here are recent articles about PlatformIO:
2015
^^^^
* Dec 22, 2015 - **Jan Penninkhof** - `Over-the-Air ESP8266 programming using PlatformIO <http://www.penninkhof.com/2015/12/1610-over-the-air-esp8266-programming-using-platformio/>`_
* Dec 15, 2015 - **stastaka** - `PlatformIOでカスタムボードを使う (Use a custom board for PlatformIO, Japanese) <http://qiita.com/stastaka/items/a6a50dbbb2933bd78bdd>`_
* Dec 08, 2015 - **Piotr Król** - `Using PlatformIO with TI MSP430 LunchPads <http://blog.3mdeb.com/2015/12/08/using-platformio-with-ti-msp430-lunchpads/>`_
* Dec 01, 2015 - **Michał Seroczyński** - `Push Notification from Arduino Yún with motion sensor <http://www.ches.pl/push-from-yun-1/>`_
* Dec 01, 2015 - **JetBrains CLion Blog** - `C++ Annotated: Fall 2015. Arduino Support in CLion using PlatformIO <http://blog.jetbrains.com/clion/2015/12/cpp-annotated-fall-2015/>`_
* Dec 01, 2015 - **Tateno Yuichi** - `ESP8266 を CUI で開発する (Develop a ESP8266 in CUI, Japanese) <http://jaywiggins.com/platformio/arduino/avr/es8266/2015/09/30/platformio-investigation/>`_
* Nov 29, 2015 - **Keith Hughes** - `Using PlatformIO for Embedded Projects <http://smartspacestuff.blogspot.com/2015/11/using-platformio-for-embedded-projects.html>`_
@ -31,6 +35,7 @@ Here are recent articles about PlatformIO:
* Nov 06, 2015 - **nocd5** - `PlatformIOでmbedをオフラインビルドしSTM32 Nucleoボードでmrubyを使う (Use mruby in the offline build for STM32 Nucleo board with mbed and PlatformIO, Japanese) <http://qiita.com/nocd5/items/d5fda776240f7e7c17eb>`_
* Oct 21, 2015 - **Vittorio Zaccaria** - `Using a cheap STM32 Nucleo to teach remote sensor monitoring <http://www.vittoriozaccaria.net/blog/2015/10/21/using-a-cheap-stm32-nucleo-to-teach-remote-sensor-monitoring.html>`_
* Oct 18, 2015 - **Nico Coetzee** - `First Arduino I2C Experience with PlatformIO <https://electronicventurer.wordpress.com/2015/10/18/first-arduino-i2c-experience/>`_
* Oct 10, 2015 - **Floyd Hilton** - `Programming Arduino with Atom <http://floydhilton.com/software/career/2015/10/10/Arduino_with_Atom.html>`_
* Oct 01, 2015 - **Mistan** - `Compile and Upload Arduino Sketch with PlatformIO for Raspberry Pi Running Arch Linux <http://tech.memoryimprintstudio.com/code-building-for-arduino-with-platformio-for-raspberry-pi-with-arch-linux/>`_
* Sep 30, 2015 - **Jay Wiggins** - `PlatformIO Investigation <http://jaywiggins.com/platformio/arduino/avr/es8266/2015/09/30/platformio-investigation/>`_
* Sep 01, 2015 - **Thomas P. Weldon, Ph.D.** - `Improvised MBED FRDM-K64F Eclipse/PlatformIO Setup and Software Installation <http://thomasweldon.com/tpw/courses/embeddsp/p00pcFrdmK64_eclipsePlatformioSetup.html>`_

View File

@ -50,7 +50,7 @@ Please fill all fields for your project in the Drone control panel:
.. code-block:: bash
python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
pip install -U platformio
platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
.. image:: ../_static/droneci-platformio-integration-1.png
@ -75,7 +75,7 @@ Examples
.. code-block:: bash
python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
pip install -U platformio
wget https://github.com/xxxajk/spi4teensy3/archive/master.zip -O /tmp/spi4teensy3.zip
unzip /tmp/spi4teensy3.zip -d /tmp
platformio ci --lib="." --lib="/tmp/spi4teensy3-master" --board=uno --board=teensy31 --board=due

View File

@ -55,7 +55,7 @@ GitHub repository.
- PLATFORMIO_CI_SRC=path/to/source/directory
install:
- python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
- pip install -U platformio
script:
- platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
@ -81,7 +81,7 @@ Examples
- PLATFORMIO_CI_SRC=examples/pl2303/pl2303_gps/pl2303_gps.ino
install:
- python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
- pip install -U platformio
- wget https://github.com/xxxajk/spi4teensy3/archive/master.zip -O /tmp/spi4teensy3.zip
- unzip /tmp/spi4teensy3.zip -d /tmp

View File

@ -64,3 +64,15 @@ Used in demo
7. :ref:`platformio lib install 124 --version "1.40" <cmd_lib_install>` command
8. :ref:`platformio lib show 124 <cmd_lib_show>` command
9. :ref:`cmd_lib_update` command.
Over-the-Air update for ESP8266
-------------------------------
.. image:: _static/platformio-demo-ota-esp8266.jpg
:target: https://www.youtube.com/watch?v=lXchL3hpDO4
Used in demo
~~~~~~~~~~~~
1. :ref:`cmd_run` command
2. :ref:`platformio run -t upload <cmd_run>` command.

View File

@ -55,6 +55,10 @@ Allows to override :ref:`projectconf` option :ref:`projectconf_pio_src_dir`.
Allows to override :ref:`projectconf` option :ref:`projectconf_pio_envs_dir`.
.. envvar:: PLATFORMIO_DATA_DIR
Allows to override :ref:`projectconf` option :ref:`projectconf_pio_data_dir`.
Builder
-------

View File

@ -103,52 +103,6 @@ Troubleshooting
Installation
~~~~~~~~~~~~
``SCons`` is not installed in your system
'''''''''''''''''''''''''''''''''''''''''
PlatformIO depends on awesome and irreplaceable software construction tool
named `SCons <http://www.scons.org>`_. PlatformIO Code Builder uses it to build
single source code for the multiple embedded platforms.
When you install PlatformIO it tries to find ``scons`` program in your OS. If
SCons is installed in your system, then PlatformIO will use it. Otherwise,
PlatformIO tries to install it automatically using ``pip install scons``. So, if
you are here, then it means that PlatformIO could not install it for you.
Let fix it manually.
1. Need to cleanup all previous SCons installations using `pip <https://pip.pypa.io>`_
.. code-block:: bash
[sudo] pip uninstall scons
2. Try to install it manually
.. code-block:: bash
[sudo] pip install scons
# If you have errors:
# * error: option --single-version-externally-managed not recognized
# * OSError: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/man'
[sudo] pip install --egg scons --install-option="--no-install-man"
3. If it didn't help you, try system OS package manager
* **Mac OS X** using `brew <http://brew.sh>`_ run ``brew install scons``
* **Linux** using ``apt`` run ``[sudo] apt-get install scons``
To identify that SCons is installed in your system run ``scons -v``.
.. _faq_troubleshooting_sconssingverextmanaged:
PIP & SCons Error: option --single-version-externally-managed not recognized
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Answered in `issue #279 <https://github.com/platformio/platformio/issues/279>`_.
[Errno 1] Operation not permitted
'''''''''''''''''''''''''''''''''
@ -180,8 +134,8 @@ For example, ``which platformio`` is equal to ``/usr/local/bin/platformio``,
then `PATH (wiki) <https://en.wikipedia.org/wiki/PATH_(variable)>`_
should contain ``/usr/local/bin`` directory.
**Unix Users**: You can make "symlinks" from ``platformio`` and ``scons``
programs to the ``bin`` directory which is included in ``$PATH``. For example,
**Unix Users**: You can make "symlinks" from ``platformio`` program to the
``bin`` directory which is included in ``$PATH``. For example,
see `issue #272 <https://github.com/platformio/platformio/issues/272#issuecomment-133626112>`_.
Windows UnicodeDecodeError: 'ascii' codec can't decode byte

View File

@ -36,6 +36,9 @@ Platforms
* - :ref:`platform_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.
* - :ref:`platform_nordicnrf51`
- 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.
* - :ref:`platform_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 "Mini-B" USB cable and a PC or Macintosh with a USB port.
@ -63,6 +66,20 @@ Adafruit
- Flash
- RAM
* - ``bluefruitmicro``
- `Adafruit Bluefruit Micro <https://www.adafruit.com/products/2661>`_
- ATMEGA32U4
- 8 MHz
- 32 Kb
- 2.5 Kb
* - ``feather32u4``
- `Adafruit Feather <https://learn.adafruit.com/adafruit-feather-32u4-bluefruit-le/>`_
- ATMEGA32U4
- 8 MHz
- 32 Kb
- 2.5 Kb
* - ``flora8``
- `Adafruit Flora <http://www.adafruit.com/product/659>`_
- ATMEGA32U4
@ -84,6 +101,13 @@ Adafruit
- 4096 Kb
- 80 Kb
* - ``metro``
- `Adafruit Metro <https://www.adafruit.com/products/2466>`_
- ATMEGA328P
- 16 MHz
- 32 Kb
- 2 Kb
* - ``protrinket3``
- `Adafruit Pro Trinket 3V/12MHz (USB) <http://www.adafruit.com/products/2010>`_
- ATMEGA328P
@ -762,6 +786,26 @@ Quirkbot
- 32 Kb
- 2.5 Kb
RFduino
~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``rfduino``
- `RFduino <http://www.rfduino.com/product/rfd22102-rfduino-dip/index.html>`_
- NRF51822
- 16 MHz
- 128 Kb
- 8 Kb
RedBearLab
~~~~~~~~~~

View File

@ -112,3 +112,5 @@ ST
- 84 MHz
- 512 Kb
- 96 Kb
.. include:: cmsis_extra.rst

View File

@ -0,0 +1,18 @@
.. Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
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.
Examples
--------
All project examples are located in PlatformIO repository
`Examples for CMSIS framework <https://github.com/platformio/platformio/tree/develop/examples/stm32>`_.
* `Blink <https://github.com/platformio/platformio/tree/develop/examples/stm32/stm32-cmsis-blink>`_

View File

@ -115,3 +115,5 @@ TI
- 120 MHz
- 1024 Kb
- 256 Kb
.. include:: libopencm3_extra.rst

View File

@ -0,0 +1,18 @@
.. Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
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.
Examples
--------
All project examples are located in PlatformIO repository
`Examples for libOpenCM3 framework <https://github.com/platformio/platformio/tree/develop/examples/stm32>`_.
* `Blink <https://github.com/platformio/platformio/tree/develop/examples/stm32/stm32-opencm3-blink>`_

View File

@ -741,3 +741,5 @@ u-blox
- 96 MHz
- 512 Kb
- 32 Kb
.. include:: mbed_extra.rst

View File

@ -0,0 +1,32 @@
.. Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
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.
Articles
--------
* Dec 15, 2015 - **stastaka** - `PlatformIOでカスタムボードを使う (Use a custom board for PlatformIO, Japanese) <http://qiita.com/stastaka/items/a6a50dbbb2933bd78bdd>`_
* Nov 06, 2015 - **nocd5** - `PlatformIOでmbedをオフラインビルドしSTM32 Nucleoボードでmrubyを使う (Use mruby in the offline build for STM32 Nucleo board with mbed and PlatformIO, Japanese) <http://qiita.com/nocd5/items/d5fda776240f7e7c17eb>`_
* Oct 21, 2015 - **Vittorio Zaccaria** - `Using a cheap STM32 Nucleo to teach remote sensor monitoring <http://www.vittoriozaccaria.net/blog/2015/10/21/using-a-cheap-stm32-nucleo-to-teach-remote-sensor-monitoring.html>`_
* Sep 01, 2015 - **Thomas P. Weldon, Ph.D.** - `Improvised MBED FRDM-K64F Eclipse/PlatformIO Setup and Software Installation <http://thomasweldon.com/tpw/courses/embeddsp/p00pcFrdmK64_eclipsePlatformioSetup.html>`_
See more :ref:`articles`.
Examples
--------
All project examples are located in PlatformIO repository
`Examples for MBED framework <https://github.com/platformio/platformio/tree/develop/examples/mbed>`_.
* `Blink <https://github.com/platformio/platformio/tree/develop/examples/mbed/mbed-blink>`_
* `DSP <https://github.com/platformio/platformio/tree/develop/examples/mbed/mbed-dsp>`_
* `HTTP Client <https://github.com/platformio/platformio/tree/develop/examples/mbed/mbed-http-client>`_
* `RTOS <https://github.com/platformio/platformio/tree/develop/examples/mbed/mbed-rtos>`_
* `Serial <https://github.com/platformio/platformio/tree/develop/examples/mbed/mbed-serial>`_

View File

@ -105,3 +105,5 @@ ST
- 32 MHz
- 128 Kb
- 16 Kb
.. include:: spl_extra.rst

View File

@ -0,0 +1,18 @@
.. Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
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.
Examples
--------
All project examples are located in PlatformIO repository
`Examples for SPL framework <https://github.com/platformio/platformio/tree/develop/examples/stm32>`_.
* `Blink <https://github.com/platformio/platformio/tree/develop/examples/stm32/stm32-spl-blink>`_

View File

@ -71,3 +71,5 @@ Raspberry Pi
- 1000 MHz
- 524288 Kb
- 524288 Kb
.. include:: wiringpi_extra.rst

View File

@ -0,0 +1,19 @@
.. Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
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.
Examples
--------
All project examples are located in PlatformIO repository
`Examples for WiringPi framework <https://github.com/platformio/platformio/tree/develop/examples/raspberrypi>`_.
* `Blink <https://github.com/platformio/platformio/tree/develop/examples/raspberrypi/wiringpi-blink>`_
* `Serial <https://github.com/platformio/platformio/tree/develop/examples/raspberrypi/wiringpi-serial>`_

View File

@ -21,6 +21,7 @@ IDE Integration
ide/atom
ide/clion
ide/eclipse
ide/emacs
ide/energia
ide/qtcreator
ide/sublimetext

View File

@ -37,9 +37,9 @@ please install `platomformio <https://atom.io/packages/platomformio>`_ package.
Articles / Manuals
------------------
* `Arduino Development in Atom Editor <http://viget.com/extend/arduino-development-in-atom-editor>`_
* Jul 20, 2015 - **Eli Fatsi** - `Arduino Development in Atom Editor <http://viget.com/extend/arduino-development-in-atom-editor>`_
See a full list with :ref:`articles`.
See more :ref:`articles`.
Screenshot
----------

View File

@ -33,17 +33,16 @@ page for more detailed information.
Integration
-----------
Project Generator
^^^^^^^^^^^^^^^^^
Since PlatformIO 2.0 you can generate CLion compatible project using
:option:`platformio init --ide` command. Please choose board type using
:ref:`cmd_boards` command and run:
Choose board ``type`` using :ref:`cmd_boards` or `Embedded Boards Explorer <http://platformio.org/#!/boards>`_
command and generate project via :option:`platformio init --ide` command:
.. code-block:: shell
platformio init --ide clion --board %TYPE%
# For example, generate project for Arduino UNO
platformio init --ide clion --board uno
Then:
1. Import this project via ``Menu: File > Import Project``
@ -82,10 +81,11 @@ the screenshot below):
Articles / Manuals
------------------
* `Using PlatformIO to get started with Arduino in CLion IDE <http://www.ches.pl/using-platformio-get-started-arduino-clion-ide/>`_
* `Programar con Arduino "The good way" (Programming with Arduino "The good way", Spanish) <http://congdegnu.es/2015/11/09/programar-con-arduino-the-good-way/>`_
* Dec 01, 2015 - **JetBrains CLion Blog** - `C++ Annotated: Fall 2015. Arduino Support in CLion using PlatformIO <http://blog.jetbrains.com/clion/2015/12/cpp-annotated-fall-2015/>`_
* Nov 22, 2015 - **Michał Seroczyński** - `Using PlatformIO to get started with Arduino in CLion IDE <http://www.ches.pl/using-platformio-get-started-arduino-clion-ide/>`_
* Nov 09, 2015 - **ÁLvaro García Gómez** - `Programar con Arduino "The good way" (Programming with Arduino "The good way", Spanish) <http://congdegnu.es/2015/11/09/programar-con-arduino-the-good-way/>`_
See a full list with :ref:`articles`.
See more :ref:`articles`.
Screenshot
----------

View File

@ -37,14 +37,16 @@ page for more detailed information.
Integration
-----------
Since PlatformIO 2.0 you can generate Eclipse compatible project using
:option:`platformio init --ide` command. Please choose board type using
:ref:`cmd_boards` command and run:
Choose board ``type`` using :ref:`cmd_boards` or `Embedded Boards Explorer <http://platformio.org/#!/boards>`_
command and generate project via :option:`platformio init --ide` command:
.. code-block:: shell
platformio init --ide eclipse --board %TYPE%
# For example, generate project for Arduino UNO
platformio init --ide eclipse --board uno
Then:
1. Import this project via
@ -61,9 +63,9 @@ Then:
Articles / Manuals
------------------
* `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO <http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio>`_
* `Improvised MBED FRDM-K64F Eclipse/PlatformIO Setup and Software Installation <http://thomasweldon.com/tpw/courses/embeddsp/p00pcFrdmK64_eclipsePlatformioSetup.html>`_
* `Learning Arduino GitHub Repository <http://www.trojanc.co.za/2015/07/11/learning-arduino-github-repository/>`_
* Sep 01, 2015 - **Thomas P. Weldon, Ph.D.** - `Improvised MBED FRDM-K64F Eclipse/PlatformIO Setup and Software Installation <http://thomasweldon.com/tpw/courses/embeddsp/p00pcFrdmK64_eclipsePlatformioSetup.html>`_
* Jul 11, 2015 - **TrojanC** - `Learning Arduino GitHub Repository <http://www.trojanc.co.za/2015/07/11/learning-arduino-github-repository/>`_
* June 20, 2014 - **Ivan Kravets, Ph.D.** - `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO <http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio>`_
See a full list with :ref:`articles`.

77
docs/ide/emacs.rst Normal file
View File

@ -0,0 +1,77 @@
.. Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
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.
.. _ide_emacs:
Emacs
=====
GNU Emacs is an extensible, customizable text editor - and more. At its core is
an interpreter for Emacs Lisp, a dialect of the
`Lisp programming language <http://en.wikipedia.org/wiki/Lisp_programming_language>`_
with extensions to support text editing.
This software can be used with:
* all available :ref:`platforms`
* all available :ref:`frameworks`
Refer to the `Emacs Documentation <https://www.gnu.org/software/emacs/#Manuals>`_
page for more detailed information.
.. contents::
Integration
-----------
PlatformIO-Mode
^^^^^^^^^^^^^^^
An Emacs minor mode has been written to facilitate building and uploading from within Emacs.
It can be installed from the MELPA repository using ``M-x package-install``.
See the MELPA `Getting Started <https://melpa.org/#/getting-started>`_ page for more information.
Setup instructions for the minor mode can be found at the `Github page <https://github.com/ZachMassia/platformio-mode>`_.
Code completion can optionally be provided by installing `irony-mode <https://github.com/Sarcasm/irony-mode>`_
Project Generator
^^^^^^^^^^^^^^^^^
Choose board ``type`` using :ref:`cmd_boards` or `Embedded Boards Explorer <http://platformio.org/#!/boards>`_
command and generate project via :option:`platformio init --ide` command:
.. code-block:: shell
platformio init --ide emacs --board %TYPE%
cmake .
There are 4 predefined targets for building.
* ``platformio_build`` - Build project without auto-uploading. (``C-c i b``)
* ``platformio_upload`` - Build and upload (if no errors). (``C-c i u``)
* ``platformio_clean`` - Clean compiled objects. (``C-c i c``)
* ``platformio_update`` - Update installed platforms and libraries. (``C-c i d``)
.. warning::
The libraries which are added, installed or used in the project
after generating process wont be reflected in IDE. To fix it you
need to reinitialize project using :ref:`cmd_init` (repeat it).
Screenshot
----------
.. image:: ../_static/ide-platformio-emacs.png
:target: http://docs.platformio.org/en/latest/_static/ide-platformio-emacs.png

View File

@ -37,14 +37,16 @@ Integration
Project Generator
^^^^^^^^^^^^^^^^^
Since PlatformIO 2.0 you can generate Qt Creator compatible project using
:option:`platformio init --ide` command. Please choose board type using
:ref:`cmd_boards` command and run:
Choose board ``type`` using :ref:`cmd_boards` or `Embedded Boards Explorer <http://platformio.org/#!/boards>`_
command and generate project via :option:`platformio init --ide` command:
.. code-block:: shell
platformio init --ide qtcreator --board %TYPE%
# For example, generate project for Arduino UNO
platformio init --ide qtcreator --board uno
Then:
1. Import project via ``File > Open File or Project`` and select

View File

@ -32,14 +32,16 @@ Integration
Project Generator
^^^^^^^^^^^^^^^^^
Since PlatformIO 2.0 you can generate Sublime Text compatible project using
:option:`platformio init --ide` command. Please choose board type using
:ref:`cmd_boards` command and run:
Choose board ``type`` using :ref:`cmd_boards` or `Embedded Boards Explorer <http://platformio.org/#!/boards>`_
command and generate project via :option:`platformio init --ide` command:
.. code-block:: shell
platformio init --ide sublimetext --board %TYPE%
# For example, generate project for Arduino UNO
platformio init --ide sublimetext --board uno
Then:
1. Import project via ``Menu: Project > Open Project...`` and select

View File

@ -37,13 +37,15 @@ Integration
Project Generator
^^^^^^^^^^^^^^^^^
Since PlatformIO 2.0 you can generate Visual Studio compatible project using
:option:`platformio init --ide` command. Please choose board type using
:ref:`cmd_boards` command and run:
Choose board ``type`` using :ref:`cmd_boards` or `Embedded Boards Explorer <http://platformio.org/#!/boards>`_
command and generate project via :option:`platformio init --ide` command:
.. code-block:: shell
platformio init --ide visualstudio --board %TYPE%
platformio init --ide sublimetext --board %TYPE%
# For example, generate project for Arduino UNO
platformio init --ide visualstudio --board uno
Then:

View File

@ -28,7 +28,7 @@ integration. Arduino and MBED compatible. Ready for Cloud compiling.**
*Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC,
Silicon Labs EFM32, ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed,
libOpenCM3, etc.**
libOpenCM3, etc.*
* `Website <http://platformio.org>`_
* `Web 2.0 Library Search <http://platformio.org/#!/lib>`_ |
@ -46,12 +46,12 @@ Embedded Development. *Easier Than Ever.*
-----------------------------------------
* Colourful command-line output
* :ref:`IDE Integration <ide>` with *Arduino, Eclipse, Energia, Qt Creator,
* :ref:`IDE Integration <ide>` with *Arduino, Eclipse, Emacs, Energia, Qt Creator,
Sublime Text, Vim, Visual Studio*
* Cloud compiling and :ref:`ci` with *AppVeyor, Circle CI, Drone, Shippable, Travis CI*
* Built-in :ref:`Serial Port Monitor <cmd_serialports_monitor>` and
configurable build :ref:`-flags/-options <projectconf_build_flags>`
* Pre-built tool chains, :ref:`frameworks` for the
* Pre-built toolchains, :ref:`frameworks` for the
:ref:`Development Platforms <platforms>`
Smart Code Builder. *Fast and Reliable.*

View File

@ -25,28 +25,27 @@ computers (`Raspberry Pi <http://www.raspberrypi.org>`_,
System requirements
-------------------
* **Operating systems:**
* Mac OS X
* Linux, +ARM
* Windows
* Python 2.6.x or Python 2.7.x(recommended)
:Operating System: Mac OS X, Linux (+ARM) or Windows
:Python Interpreter:
All commands below should be executed in
`Command-line <http://en.wikipedia.org/wiki/Command-line_interface>`_
application (Terminal):
Python 2.6 or 2.7. Python 2.7 is recommended
* Mac OS X / Linux *Terminal* application
* Windows ``cmd.exe`` application.
.. attention::
**Windows Users**: Please `Download the latest Python 2.7.x
<https://www.python.org/downloads/>`_ and install it.
**DON'T FORGET** to select ``Add python.exe to Path`` feature on the
"Customize" stage, otherwise ``pip`` command will not be available.
:Terminal Application:
All commands below should be executed in
`Command-line <http://en.wikipedia.org/wiki/Command-line_interface>`_
application (Terminal). For Mac OS X and Linux OS - *Terminal* application,
for Windows OS ``cmd.exe`` application.
Installation Methods
--------------------
.. warning::
**Windows OS**: Please `Download the latest Python 2.7.x
<https://www.python.org/downloads/>`_ and install it.
**DON'T FORGET** to select ``Add python.exe to Path`` feature on the
"Customize" stage.
Please *choose ONE of* the following methods:
a) Python Package Manager
@ -57,19 +56,20 @@ The latest stable version of PlatformIO may be installed or upgraded via
.. code-block:: bash
# update package installer
pip install -U pip setuptools
# install or upgrade PlatformIO
pip install -U platformio
Note that you may run into permissions issues running these commands. You have
a few options here:
* Run with ``sudo`` to install PlatformIO and dependencies globally
* Specify the `pip install --user <https://pip.pypa.io/en/stable/user_guide.html#user-installs>`_
option to install local to your user
* Run the command in a `virtualenv <https://virtualenv.pypa.io>`_ local to a
specific project working set.
If ``pip`` command is not available or you have problems with it try
:ref:`installation_installer_script`.
.. _installation_installer_script:
b) Installer Script
@ -130,10 +130,6 @@ c) Full Guide
.. code-block:: bash
# update package installer
pip install -U pip setuptools
# install or upgrade PlatformIO
pip install -U platformio
If your computer does not recognize ``pip`` command, try to install it first
@ -152,8 +148,8 @@ Install the latest PlatformIO from the ``develop`` branch:
.. code-block:: bash
# update package installer
pip install -U pip setuptools
# uninstall existing version
pip uninstall platformio
# install the latest development version of PlatformIO
pip install -U https://github.com/platformio/platformio/archive/develop.zip

View File

@ -25,7 +25,7 @@ to keep project in own structure and define:
PlatformIO Library Crawler uses ``library.json`` manifest to extract
source code from developer's location and keeps cleaned library in own
Libraries Storage.
Library Storage.
A data in ``library.json`` should be represented
in `JSON-style <http://en.wikipedia.org/wiki/JSON>`_ via
@ -183,6 +183,16 @@ A version of the current library source code.
:ref:`libjson_repository` field. In this case
|PIOAPICR| will use the *CVS*-revision from the latest commit.
Example with fixed release/tag on GitHub:
.. code-block:: javascript
"version": "1.0.0",
"downloadUrl": "https://github.com/foo/bar/archive/v1.0.0.tar.gz",
"include": "bar-1.0.0"
See more ``library.json`` :ref:`library_creating_examples`.
.. _libjson_url:
@ -244,6 +254,7 @@ Pattern Meaning
* - ``[!seq]``
- matches any character not in seq
See more ``library.json`` :ref:`library_creating_examples`.
.. _libjson_exclude:
@ -329,6 +340,8 @@ Example:
]
See more ``library.json`` :ref:`library_creating_examples`.
.. _libjson_examples:
``examples``

View File

@ -146,3 +146,12 @@ The registration requirements:
Now, you can :ref:`register <cmd_lib_register>` your library and allow others
to :ref:`install <cmd_lib_install>` it.
.. _library_creating_examples:
Examples
--------
* `GitHub + fixed release <http://platformio.org/#!/lib/show/552/ACNoblex>`_
* `Dependencies by author and framework <http://platformio.org/#!/lib/show/3/PID-AutoTune>`_
* `Multiple libraries in the one repository <https://github.com/jrowberg/i2cdevlib/tree/master/Arduino>`_

View File

@ -82,6 +82,20 @@ Adafruit
- Flash
- RAM
* - ``bluefruitmicro``
- `Adafruit Bluefruit Micro <https://www.adafruit.com/products/2661>`_
- ATMEGA32U4
- 8 MHz
- 32 Kb
- 2.5 Kb
* - ``feather32u4``
- `Adafruit Feather <https://learn.adafruit.com/adafruit-feather-32u4-bluefruit-le/>`_
- ATMEGA32U4
- 8 MHz
- 32 Kb
- 2.5 Kb
* - ``flora8``
- `Adafruit Flora <http://www.adafruit.com/product/659>`_
- ATMEGA32U4
@ -96,6 +110,13 @@ Adafruit
- 8 Kb
- 0.5 Kb
* - ``metro``
- `Adafruit Metro <https://www.adafruit.com/products/2466>`_
- ATMEGA328P
- 16 MHz
- 32 Kb
- 2 Kb
* - ``protrinket3``
- `Adafruit Pro Trinket 3V/12MHz (USB) <http://www.adafruit.com/products/2010>`_
- ATMEGA328P
@ -903,3 +924,5 @@ ubIQio
- 16 MHz
- 32 Kb
- 2 Kb
.. include:: atmelavr_extra.rst

View File

@ -0,0 +1,115 @@
.. Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
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.
.. _atmelavr_upload_via_programmer:
Upload using Programmer
-----------------------
To upload firmware using programmer you need to use ``program`` target instead
``upload`` for :option:`platformio run --target` command. For example,
``platformio run -t program``.
Configuration for the programmers:
* AVR ISP
.. code-block:: ini
[env:myenv]
platform = atmelavr
framework = arduino
upload_protocol = stk500v1
upload_flags = -P$UPLOAD_PORT
# edit this line with valid upload port
upload_port = SERIAL_PORT_HERE
* AVRISP mkII
.. code-block:: ini
[env:myenv]
platform = atmelavr
framework = arduino
upload_protocol = stk500v2
upload_flags = -Pusb
* USBtinyISP
.. code-block:: ini
[env:myenv]
platform = atmelavr
framework = arduino
upload_protocol = usbtiny
* USBasp
.. code-block:: ini
[env:myenv]
platform = atmelavr
framework = arduino
upload_protocol = usbasp
upload_flags = -Pusb
* Parallel Programmer
.. code-block:: ini
[env:myenv]
platform = atmelavr
framework = arduino
upload_protocol = dapa
upload_flags = -F
* Arduino as ISP
.. code-block:: ini
[env:myenv]
platform = atmelavr
framework = arduino
upload_protocol = stk500v1
upload_flags = -P$UPLOAD_PORT -b$UPLOAD_SPEED
# edit these lines
upload_port = SERIAL_PORT_HERE
upload_speed = 19200
Articles
--------
* Dec 01, 2015 - **Michał Seroczyński** - `Push Notification from Arduino Yún with motion sensor <http://www.ches.pl/push-from-yun-1/>`_
* Nov 29, 2015 - **Keith Hughes** - `Using PlatformIO for Embedded Projects <http://smartspacestuff.blogspot.com/2015/11/using-platformio-for-embedded-projects.html>`_
* Nov 22, 2015 - **Michał Seroczyński** - `Using PlatformIO to get started with Arduino in CLion IDE <http://www.ches.pl/using-platformio-get-started-arduino-clion-ide/>`_
* Nov 09, 2015 - **ÁLvaro García Gómez** - `Programar con Arduino "The good way" (Programming with Arduino "The good way", Spanish) <http://congdegnu.es/2015/11/09/programar-con-arduino-the-good-way/>`_
* Oct 18, 2015 - **Nico Coetzee** - `First Arduino I2C Experience with PlatformIO <https://electronicventurer.wordpress.com/2015/10/18/first-arduino-i2c-experience/>`_
* Oct 10, 2015 - **Floyd Hilton** - `Programming Arduino with Atom <http://floydhilton.com/software/career/2015/10/10/Arduino_with_Atom.html>`_
* June 20, 2014 - **Ivan Kravets, Ph.D.** - `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO <http://www.ikravets.com/computer-life/programming/2014/06/20/building-and-debugging-atmel-avr-arduino-based-project-using-eclipse-ideplatformio>`_
See more :ref:`articles`.
Examples
--------
All project examples are located in PlatformIO repository
`Examples for Atmel AVR platform <https://github.com/platformio/platformio/tree/develop/examples/atmelavr-and-arduino>`_.
* `Wiring Blink <https://github.com/platformio/platformio/tree/develop/examples/wiring-blink>`_
* `Arduino with external libraries <https://github.com/platformio/platformio/tree/develop/examples/atmelavr-and-arduino/arduino-external-libs>`_
* `Arduino with internal libraries <https://github.com/platformio/platformio/tree/develop/examples/atmelavr-and-arduino/arduino-internal-libs>`_
* `Project uses source file name for "src" directory (Arduino project structure) <https://github.com/platformio/platformio/tree/develop/examples/atmelavr-and-arduino/arduino-own-src_dir>`_
* `Atmel AVR Native blink <https://github.com/platformio/platformio/tree/develop/examples/atmelavr-and-arduino/atmelavr-native-blink>`_
* `Digitstump Mouse <https://github.com/platformio/platformio/tree/develop/examples/atmelavr-and-arduino/digitstump-mouse>`_
* `Engduino magnetometer <https://github.com/platformio/platformio/tree/develop/examples/atmelavr-and-arduino/engduino-magnetometer>`_
* `PanStamp blink <https://github.com/platformio/platformio/tree/develop/examples/atmelavr-and-arduino/panstamp-blink>`_

View File

@ -19,10 +19,10 @@ for the different development platforms via single command :ref:`cmd_run`
without any dependent software or requirements.
For this purpose *PlatformIO* uses own pre-configured platforms data:
build scripts, tool chains, the settings for the most popular embedded
build scripts, toolchains, the settings for the most popular embedded
boards and etc. These data are pre-built and packaged to the different
``packages``. It allows *PlatformIO* to have multiple development platforms
which can use the same packages(tool chains, frameworks), but have
which can use the same packages(toolchains, frameworks), but have
different/own build scripts, uploader and etc.
.. note::
@ -62,6 +62,9 @@ Packages
* - ``framework-arduinomsp430``
- `Arduino Wiring-based Framework (MSP430 Core) <http://arduino.cc/en/Reference/HomePage>`_
* - ``framework-arduinonordicnrf51``
- `Arduino Wiring-based Framework (RFduino Core) <https://github.com/RFduino/RFduino>`_
* - ``framework-arduinosam``
- `Arduino Wiring-based Framework (SAM Core, 1.6) <http://arduino.cc/en/Reference/HomePage>`_
@ -110,9 +113,18 @@ Packages
* - ``tool-micronucleus``
- `Micronucleus <https://github.com/micronucleus/micronucleus>`_
* - ``tool-mkspiffs``
- `Tool to build and unpack SPIFFS images <https://github.com/igrr/mkspiffs>`_
* - ``tool-mspdebug``
- `MSPDebug <http://mspdebug.sourceforge.net/>`_
* - ``tool-rfdloader``
- `rfdloader <https://github.com/RFduino/RFduino>`_
* - ``tool-scons``
- `SCons software construction tool <http://www.scons.org>`_
* - ``tool-stlink``
- `ST-Link <https://github.com/texane/stlink>`_

View File

@ -28,21 +28,24 @@ Packages
* - Name
- Contents
* - ``toolchain-xtensa``
- `xtensa-gcc <https://github.com/jcmvbkbc/gcc-xtensa>`_, `GDB <http://www.gnu.org/software/gdb/>`_
* - ``tool-esptool``
- `esptool-ck <https://github.com/igrr/esptool-ck>`_
* - ``tool-mkspiffs``
- `Tool to build and unpack SPIFFS images <https://github.com/igrr/mkspiffs>`_
* - ``framework-arduinoespressif``
- `Arduino Wiring-based Framework (ESP8266 Core) <https://github.com/esp8266/Arduino>`_
* - ``ldscripts``
- `Linker Scripts <https://sourceware.org/binutils/docs/ld/Scripts.html>`_
* - ``sdk-esp8266``
- `ESP8266 SDK <http://bbs.espressif.com>`_
* - ``tool-esptool``
- `esptool-ck <https://github.com/igrr/esptool-ck>`_
* - ``framework-arduinoespressif``
- `Arduino Wiring-based Framework (ESP8266 Core) <https://github.com/esp8266/Arduino>`_
* - ``toolchain-xtensa``
- `xtensa-gcc <https://github.com/jcmvbkbc/gcc-xtensa>`_, `GDB <http://www.gnu.org/software/gdb/>`_
.. warning::
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).

View File

@ -9,8 +9,76 @@
See the License for the specific language governing permissions and
limitations under the License.
OTA update
----------
Custom CPU Frequency or Upload Speed
------------------------------------
See :ref:`projectconf_board_f_cpu` and :ref:`projectconf_upload_speed` options
from :ref:`projectconf`
.. code-block:: ini
[env:myenv]
# set frequency to 40MHz
board_f_cpu = 40000000L
upload_speed = 9600
.. _platform_espressif_customflash:
Custom Flash Size
-----------------
.. warning::
Please make sure to read `ESP8266 Flash layout <https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md#flash-layout>`_
information first.
The list with preconfigured LD scripts is located in public repository
`platformio-pkg-ldscripts <https://github.com/platformio/platformio-pkg-ldscripts>`_.
* ``esp8266.flash.512k0.ld`` 512K (no SPIFFS)
* ``esp8266.flash.512k64.ld`` 512K (64K SPIFFS)
* ``esp8266.flash.1m64.ld`` 1M (64K SPIFFS)
* ``esp8266.flash.1m128.ld`` 1M (128K SPIFFS)
* ``esp8266.flash.1m256.ld`` 1M (256K SPIFFS)
* ``esp8266.flash.1m512.ld`` 1M (512K SPIFFS)
* ``esp8266.flash.2m.ld`` 2M (1M SPIFFS)
* ``esp8266.flash.4m1m.ld`` 4M (1M SPIFFS)
* ``esp8266.flash.4m.ld`` 4M (3M SPIFFS)
To override default LD script please use :ref:`projectconf_build_flags` from
:ref:`projectconf`.
.. code-block:: ini
[env:myenv]
build_flags = -Wl,-Tesp8266.flash.4m.ld
.. _platform_espressif_uploadfs:
Uploading files to file system SPIFFS
-------------------------------------
.. warning::
Please make sure to read `ESP8266 Flash layout <https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md#flash-layout>`_
information first.
1. Create :ref:`projectconf_pio_data_dir` and put files here
2. Run target ``uploadfs`` via :option:`platformio run --target` command.
To upload SPIFFS image using OTA update please specify ``upload_port`` /
``--upload-port`` as IP address or DNS name (``*.local``). For the details
please follow to :ref:`platform_espressif_ota`.
By default, will be used default LD Script for the board where is specified
SPIFFS offsets (start, end, page, block). You can override it using
:ref:`platform_espressif_customflash`.
Active discussion is located in `issue #382 <https://github.com/platformio/platformio/issues/382>`_.
.. _platform_espressif_ota:
Over-the-Air (OTA) update
-------------------------
Firstly, please read `What is OTA? How to use it? <https://github.com/esp8266/Arduino/blob/master/doc/ota_updates/ota_updates.md>`_
@ -20,7 +88,7 @@ There are 2 options:
.. code-block:: bash
platformio run --target upload --upload-port IP_ADDRESS_HERE
platformio run --target upload --upload-port IP_ADDRESS_HERE or DNS_NAME.local
* Specify ``upload_port`` option in :ref:`projectconf`
@ -28,7 +96,12 @@ There are 2 options:
[env:myenv]
...
upload_port = IP_ADDRESS_HERE
upload_port = IP_ADDRESS_HERE or DNS_NAME.local
For example,
* ``platformio run -t upload --upload-port 192.168.0.255``
* ``platformio run -t upload --upload-port myesp8266.local``
Authentication and upload options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -81,46 +154,19 @@ For the full list with available options please run
-d, --debug Show debug output. And override loglevel with debug.
-r, --progress Show progress output. Does not work for ArduinoIDE
Custom CPU Frequency and Upload Speed
-------------------------------------
Demo
~~~~
See :ref:`projectconf_board_f_cpu` and :ref:`projectconf_upload_speed` options
from :ref:`projectconf`
.. image:: ../_static/platformio-demo-ota-esp8266.jpg
:target: https://www.youtube.com/watch?v=lXchL3hpDO4
.. code-block:: ini
Articles
--------
[env:myenv]
# set frequency to 40MHz
board_f_cpu = 40000000L
* Dec 22, 2015 - **Jan Penninkhof** - `Over-the-Air ESP8266 programming using PlatformIO <http://www.penninkhof.com/2015/12/1610-over-the-air-esp8266-programming-using-platformio/>`_
* Dec 01, 2015 - **Tateno Yuichi** - `ESP8266 を CUI で開発する (Develop a ESP8266 in CUI, Japanese) <http://jaywiggins.com/platformio/arduino/avr/es8266/2015/09/30/platformio-investigation/>`_
upload_speed = 9600
Custom Flash Size
-----------------
The list with preconfigured LD scripts is located in public repository
`platformio-pkg-ldscripts <https://github.com/platformio/platformio-pkg-ldscripts>`_.
* ``esp8266.flash.512k0.ld`` 512K (no SPIFFS)
* ``esp8266.flash.512k64.ld`` 512K (64K SPIFFS)
* ``esp8266.flash.1m64.ld`` 1M (64K SPIFFS)
* ``esp8266.flash.1m128.ld`` 1M (128K SPIFFS)
* ``esp8266.flash.1m256.ld`` 1M (256K SPIFFS)
* ``esp8266.flash.1m512.ld`` 1M (512K SPIFFS)
* ``esp8266.flash.2m.ld`` 2M (1M SPIFFS)
* ``esp8266.flash.4m1.ld`` 4M (1M SPIFFS)
* ``esp8266.flash.4m.ld`` 4M (3M SPIFFS)
* ``esp8266.flash.8m.ld`` 8M (7M SPIFFS)
* ``esp8266.flash.16m.ld`` 16M (15M SPIFFS)
To override default LD script please use :ref:`projectconf_build_flags` from
:ref:`projectconf`.
.. code-block:: ini
[env:myenv]
build_flags = -Wl,-Tesp8266.flash.4m.ld
See more :ref:`articles`.
Examples
--------

View File

@ -13,7 +13,7 @@
Platform ``native``
===================
Native development platform is intended to be used for desktop OS. This platform uses built-in tool chains (preferable based on GCC), frameworks, libs from particular OS where it will be run.
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.
For more detailed information please visit `vendor site <http://platformio.org/#!/platforms/native>`_.

View File

@ -31,9 +31,15 @@ Packages
* - ``framework-mbed``
- `mbed Framework <http://mbed.org>`_
* - ``tool-rfdloader``
- `rfdloader <https://github.com/RFduino/RFduino>`_
* - ``toolchain-gccarmnoneeabi``
- `gcc-arm-embedded <https://launchpad.net/gcc-arm-embedded>`_, `GDB <http://www.gnu.org/software/gdb/>`_
* - ``framework-arduinonordicnrf51``
- `Arduino Wiring-based Framework (RFduino Core) <https://github.com/RFduino/RFduino>`_
.. warning::
**Linux Users:** Don't forget to install "udev" rules file
`99-platformio-udev.rules <https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules>`_ (an instruction is located in the file).
@ -51,6 +57,9 @@ Frameworks
* - Name
- Description
* - :ref:`framework_arduino`
- Arduino 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.
* - :ref:`framework_mbed`
- The mbed framework The mbed SDK has been designed to provide enough hardware abstraction to be intuitive and concise, yet powerful enough to build complex projects. It is built on the low-level ARM CMSIS APIs, allowing you to code down to the metal if needed. In addition to RTOS, USB and Networking libraries, a cookbook of hundreds of reusable peripheral and module libraries have been built on top of the SDK by the mbed Developer Community.
@ -137,6 +146,26 @@ Nordic
- 128 Kb
- 16 Kb
RFduino
~~~~~~~
.. list-table::
:header-rows: 1
* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM
* - ``rfduino``
- `RFduino <http://www.rfduino.com/product/rfd22102-rfduino-dip/index.html>`_
- NRF51822
- 16 MHz
- 128 Kb
- 8 Kb
RedBearLab
~~~~~~~~~~
@ -203,3 +232,5 @@ Switch Science
- 16 MHz
- 256 Kb
- 16 Kb
.. include:: nordicnrf51_extra.rst

View File

@ -0,0 +1,18 @@
.. Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
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.
Examples
--------
All project examples are located in PlatformIO repository
`Examples for Nordic nRF51 platform <https://github.com/platformio/platformio/tree/develop/examples/nordicnrf51>`_.
* `RFduino iBeacon <https://github.com/platformio/platformio/tree/develop/examples/nordicnrf51/rfduino-ibeacon>`_

View File

@ -329,3 +329,5 @@ ST
- 80 MHz
- 1024 Kb
- 128 Kb
.. include:: ststm32_extra.rst

View File

@ -0,0 +1,29 @@
.. Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
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.
Articles
--------
* Nov 06, 2015 - **nocd5** - `PlatformIOでmbedをオフラインビルドしSTM32 Nucleoボードでmrubyを使う (Use mruby in the offline build for STM32 Nucleo board with mbed and PlatformIO, Japanese) <http://qiita.com/nocd5/items/d5fda776240f7e7c17eb>`_
* Oct 21, 2015 - **Vittorio Zaccaria** - `Using a cheap STM32 Nucleo to teach remote sensor monitoring <http://www.vittoriozaccaria.net/blog/2015/10/21/using-a-cheap-stm32-nucleo-to-teach-remote-sensor-monitoring.html>`_
* Aug 08, 2015 - **Josh Glendenning** - `Armstrap Eagle and PlatformIO <http://isobit.io/2015/08/08/armstrap.html>`_
See more :ref:`articles`.
Examples
--------
All project examples are located in PlatformIO repository
`Examples for ST STM32 platform <https://github.com/platformio/platformio/tree/develop/examples/stm32>`_.
* `CMSIS Blink <https://github.com/platformio/platformio/tree/develop/examples/stm32/stm32-cmsis-blink>`_
* `libOpenCM3 Blink <https://github.com/platformio/platformio/tree/develop/examples/stm32/stm32-opencm3-blink>`_
* `SPL Blink <https://github.com/platformio/platformio/tree/develop/examples/stm32/stm32-spl-blink>`_

View File

@ -153,3 +153,5 @@ TI
- 16 MHz
- 16 Kb
- 0.5 Kb
.. include:: timsp430_extra.rst

View File

@ -0,0 +1,28 @@
.. Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
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.
Articles
--------
* Dec 08, 2015 - **Piotr Król** - `Using PlatformIO with TI MSP430 LunchPads <http://blog.3mdeb.com/2015/12/08/using-platformio-with-ti-msp430-lunchpads/>`_
See more :ref:`articles`.
Examples
--------
All project examples are located in PlatformIO repository
`Examples for TI MSP430 platform <https://github.com/platformio/platformio/tree/develop/examples/timsp430>`_.
* `PanStamp blink <https://github.com/platformio/platformio/tree/develop/examples/timsp430/panstamp-blink>`_
* `Energia blink <https://github.com/platformio/platformio/tree/develop/examples/timsp430/timsp430-energia-blink>`_
* `Native blink <https://github.com/platformio/platformio/tree/develop/examples/timsp430/timsp430-native-blink>`_
* `Wiring Blink <https://github.com/platformio/platformio/tree/develop/examples/wiring-blink>`_

View File

@ -44,7 +44,7 @@ Options
``home_dir``
^^^^^^^^^^^^
Is used to store platform tool chains, frameworks, external libraries,
Is used to store platform toolchains, frameworks, external libraries,
service data and etc.
A default value is User's home directory:
@ -115,6 +115,18 @@ This option can be overridden by global environment variable
are defined in :ref:`projectconf`, then **TRY TO DELETE** this folder. In
this situation you will remove all cached files without any risk.
.. _projectconf_pio_data_dir:
``data_dir``
^^^^^^^^^^^^
Data directory to store contents and :ref:`platform_espressif_uploadfs`.
A default value is ``%project_dir%/data``.
This option can be overridden by global environment variable
:envvar:`PLATFORMIO_DATA_DIR`.
[env:NAME]
----------
@ -398,7 +410,7 @@ Example:
^^^^^^^^^^^^^^^^
Control cyclic (recursive) behaviour for ``Library Dependency Finder (LDF)``.
By default, this option is turned OFF (``lib_dfcyclic=False``) and means, that
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`.
@ -453,7 +465,7 @@ Example, specify own upload command for :ref:`platform_atmelavr`:
* see built-in examples of `PlatformIO build scripts <https://github.com/platformio/platformio/tree/develop/platformio/builder/scripts>`_.
* take a look on the multiple snippets/answers for the user questions:
* take a look at the multiple snippets/answers for the user questions:
`#365 <https://github.com/platformio/platformio/issues/365#issuecomment-163695011>`_,
`#351 <https://github.com/platformio/platformio/issues/351#issuecomment-161789165>`_,
`#236 <https://github.com/platformio/platformio/issues/236#issuecomment-112038284>`_,
@ -463,8 +475,9 @@ Example, specify own upload command for :ref:`platform_atmelavr`:
^^^^^^^^^^^
A list with targets which will be processed by :ref:`cmd_run` command by
default. You can enter more than one target separated with "space". Which
targets are supported is described in :option:`platformio run --target`.
default. You can enter more than one target separated with "space".
The list with available targets is located in :option:`platformio run --target`.
**Tip!** You can use these targets like an option to
:option:`platformio run --target` command. For example:
@ -532,9 +545,11 @@ Examples
platform = atmelavr
framework = arduino
board = pro8MHzatmega328
upload_protocol = usbasp -B5
upload_protocol = usbasp
upload_flags = -Pusb -B5
Then upload firmware using :option:`platformio run --target program`
Then upload firmware using :option:`platformio run --target program`. To use
other programmers see :ref:`atmelavr_upload_via_programmer`.
4. :ref:`platform_ststm32`: Upload firmware using GDB script ``upload.gdb``,

View File

@ -14,7 +14,7 @@
Quickstart
==========
.. note::
.. hint::
Please read `Get Started <http://platformio.org/#!/get-started>`_
article from the official WebSite.

View File

@ -73,7 +73,7 @@ Initialise PlatformIO project for the specified IDE which can be imported later
via "Import Project" functionality.
A list with supported IDE is available within ``platformio init --help`` command.
Also, please look into :ref:`ide` page.
Also, please take a look at :ref:`ide` page.
.. option::
--enable-auto-uploading

View File

@ -53,6 +53,7 @@ Pre-built targets:
* ``program`` firmware "auto-uploading" for embedded platforms using external
programmer (available only for :ref:`platform_atmelavr`)
* ``uploadlazy`` upload existing firmware without project rebuilding
* ``uploadfs`` :ref:`platform_espressif_uploadfs`
* ``envdump`` dump current build environment
* ``size`` print the size of the sections in a firmware/program

View File

@ -191,7 +191,10 @@ Do not apply any encodings/transformations
--exit-char
ASCII code of special character that is used to exit the application,
default ``29`` (DEC)
default ``29`` (DEC).
For example, to use ``Ctrl+Q`` run
``platformio serialports monitor --exit-char 17``.
.. option::
--menu-char

View File

@ -14,7 +14,7 @@ int main()
//GET data
printf("\nTrying to fetch page...\n");
int ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 128);
int ret = http.get("https://developer.mbed.org/media/uploads/donatien/hello.txt", str, 128);
if (!ret)
{
printf("Page fetched successfully - read %d characters\n", strlen(str));

View File

@ -0,0 +1 @@
.pioenvs

View File

@ -0,0 +1,65 @@
# Continuous Integration (CI) is the practice, in software
# engineering, of merging all developer working copies with a shared mainline
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
#
# Documentation:
#
# * Travis CI Embedded Builds with PlatformIO
# < https://docs.travis-ci.com/user/integration/platformio/ >
#
# * PlatformIO integration with Travis CI
# < http://docs.platformio.org/en/latest/ci/travis.html >
#
# * User Guide for `platformio ci` command
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
#
#
# Please choice one of the following templates (proposed below) and uncomment
# it (remove "# " before each line) or use own configuration according to the
# Travis CI documentation (see above).
#
#
# Template #1: General project. Test it using existing `platformio.ini`.
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# install:
# - pip install -U platformio
#
# script:
# - platformio run
#
# Template #2: The project is intended to by used as a library with examples
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# env:
# - PLATFORMIO_CI_SRC=path/to/test/file.c
# - PLATFORMIO_CI_SRC=examples/file.ino
# - PLATFORMIO_CI_SRC=path/to/test/directory
#
# install:
# - pip install -U platformio
#
# script:
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N

View File

@ -0,0 +1,29 @@
.. Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
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.
How to build PlatformIO based project
=====================================
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
3. Extract ZIP archive
4. Run these commands:
.. code-block:: bash
# Change directory to example
> cd platformio-develop/examples/nordicnrf51/rfduino-ibeacon
# Process example project
> platformio run
# Upload firmware
> platformio run --target upload

View File

@ -0,0 +1,38 @@
This directory is intended for the project specific (private) libraries.
PlatformIO will compile them to static libraries and link to executable file.
The source code of each library should be placed in separate directory, like
"lib/private_lib/[here are source files]".
For example, see how can be organised `Foo` and `Bar` libraries:
|--lib
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |- readme.txt --> THIS FILE
|- platformio.ini
|--src
|- main.c
Then in `src/main.c` you should use:
#include <Foo.h>
#include <Bar.h>
// rest H/C/CPP code
PlatformIO will find your libraries automatically, configure preprocessor's
include paths and build them.
See additional options for PlatformIO Library Dependency Finder `lib_*`:
http://docs.platformio.org/en/latest/projectconf.html#lib-install

View File

@ -0,0 +1,23 @@
#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# http://docs.platformio.org/en/latest/projectconf.html
#
# A sign `#` at the beginning of the line indicates a comment
# Comment lines are ignored.
# Simple and base environment
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload
[env:rfduino]
platform = nordicnrf51
framework = arduino
board = rfduino

View File

@ -0,0 +1,61 @@
/*
The sketch demonstrates iBecaon from an RFduino
*/
/*
Copyright (c) 2014 OpenSourceRF.com. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <RFduinoBLE.h>
// pin 3 on the RGB shield is the green led
int led = 3;
void setup() {
// led used to indicate that iBeacon has started
pinMode(led, OUTPUT);
// do iBeacon advertising
RFduinoBLE.iBeacon = true;
// start the BLE stack
RFduinoBLE.begin();
}
void loop() {
// switch to lower power mode
RFduino_ULPDelay(INFINITE);
}
void RFduinoBLE_onAdvertisement(bool start)
{
// turn the green led on if we start advertisement, and turn it
// off if we stop advertisement
if (start)
digitalWrite(led, HIGH);
else
digitalWrite(led, LOW);
}

View File

@ -1,15 +1,17 @@
;
; Project Configuration File
;
; A detailed documentation with the EXAMPLES is located here:
; http://docs.platformio.org/en/latest/projectconf.html
;
; 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
build_flags = -D LED_BUILTIN=BUILTIN_LED
[env:teensy31]
platform = teensy
framework = arduino
@ -19,9 +21,4 @@ board = teensy31
platform = timsp430
framework = energia
board = lpmsp430g2553
[env:lptm4c1230c3pm]
platform = titiva
framework = energia
board = lptm4c1230c3pm
build_flags = -DLED_PIN=GREEN_LED
build_flags = -D LED_BUILTIN=RED_LED

View File

@ -1,21 +1,25 @@
#ifdef ENERGIA
#include "Energia.h"
#else
#include "Arduino.h"
#endif
/*
* Blink
* Turns on an LED on for one second,
* then off for one second, repeatedly.
*/
#ifndef LED_PIN
// Most Arduino boards already have a LED attached to pin 13 on the board itself
#define LED_PIN 13
#endif
#include "Arduino.h"
void setup() {
pinMode(LED_PIN, OUTPUT); // set pin as output
void setup()
{
// initialize digital pin 13 as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(LED_PIN, LOW); // set the LED off
delay(1000); // wait for a second
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);
}

View File

@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
VERSION = (2, 6, 3)
import sys
VERSION = (2, 7, 0)
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"
@ -31,3 +33,10 @@ __license__ = "Apache Software License"
__copyright__ = "Copyright 2014-2015 Ivan Kravets"
__apiurl__ = "http://api.platformio.org"
if 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]))
sys.exit(1)

View File

@ -2,7 +2,7 @@
"flora8": {
"build": {
"core": "arduino",
"extra_flags": "-DARDUINO_ARCH_AVR",
"extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_FLORA8",
"f_cpu": "8000000L",
"mcu": "atmega32u4",
"usb_product": "Adafruit Flora",
@ -21,16 +21,92 @@
"require_upload_port" : true,
"speed": 57600,
"use_1200bps_touch": true,
"wait_for_upload_port": false
"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",
"pid": "0x800A",
"variant": "bluefruitmicro",
"vid": "0x239A"
},
"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",
"pid": "0x800C",
"variant": "feather32u4",
"vid": "0x239C"
},
"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",
"extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_TRINKET3",
"f_cpu": "8000000L",
"mcu": "attiny85",
"variant": "tiny8"
@ -47,30 +123,10 @@
"vendor": "Adafruit"
},
"gemma": {
"build": {
"core": "arduino",
"extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_GEMMA",
"f_cpu": "8000000L",
"mcu": "attiny85",
"variant": "gemma"
},
"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"
},
"trinket5": {
"build": {
"core": "arduino",
"extra_flags": "-DARDUINO_ARCH_AVR",
"extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_TRINKET5",
"f_cpu": "16000000L",
"mcu": "attiny85",
"variant": "tiny8"
@ -87,10 +143,32 @@
"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",
"extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PROTRINKET3",
"f_cpu": "12000000L",
"mcu": "atmega328p",
"variant": "eightanaloginputs"
@ -110,7 +188,7 @@
"protrinket5": {
"build": {
"core": "arduino",
"extra_flags": "-DARDUINO_ARCH_AVR",
"extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PROTRINKET5",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "eightanaloginputs"
@ -129,7 +207,7 @@
"protrinket3ftdi": {
"build": {
"core": "arduino",
"extra_flags": "-DARDUINO_ARCH_AVR",
"extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PROTRINKET3FTDI",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "eightanaloginputs"
@ -150,7 +228,7 @@
"protrinket5ftdi": {
"build": {
"core": "arduino",
"extra_flags": "-DARDUINO_ARCH_AVR",
"extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PROTRINKET5FTDI",
"f_cpu": "16000000L",
"mcu": "atmega328p",
"variant": "eightanaloginputs"

View File

@ -142,5 +142,25 @@
},
"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"
}
}

View File

@ -12,37 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# pylint: disable=wrong-import-position,wrong-import-order,unused-import
try:
from platformio import util
except ImportError:
import sys
for p in sys.path:
_new_paths = []
for item in ("dist-packages", "site-packages"):
if not p.endswith(item) and item in p:
_new_paths.append(p[:p.rfind(item) + len(item)])
if "platformio" in p:
_new_paths.append(p[:p.rfind("platformio") - 1])
for _p in _new_paths:
if _p not in sys.path:
sys.path.insert(0, _p)
try:
from platformio import util
import lockfile # NOQA
break
except ImportError:
pass
import json
import sys
from os import environ
from os.path import isfile, join
from os.path import join, normpath
from time import time
from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, Variables
from platformio import util
from platformio.exception import UnknownBoard
# AllowSubstExceptions()
@ -99,6 +77,7 @@ DefaultEnvironment(
PROJECT_DIR=util.get_project_dir(),
PROJECTLIB_DIR=util.get_projectlib_dir(),
PROJECTSRC_DIR=util.get_projectsrc_dir(),
PROJECTDATA_DIR=util.get_projectdata_dir(),
PIOENVS_DIR=util.get_pioenvs_dir(),
PIOBUILDER_DIR=join(util.get_source_dir(), "builder"),
@ -110,7 +89,9 @@ DefaultEnvironment(
"$PROJECTLIB_DIR",
util.get_lib_dir(),
join("$PLATFORMFW_DIR", "libraries")
]
],
PYTHONEXE=normpath(sys.executable)
)
env = DefaultEnvironment()
@ -134,12 +115,7 @@ if "BOARD" in env:
UPLOAD_SPEED="${BOARD_OPTIONS['upload'].get('speed', None)}")
if "ldscript" in env.get("BOARD_OPTIONS", {}).get("build", {}):
env.Replace(
LDSCRIPT_PATH=(
env['BOARD_OPTIONS']['build']['ldscript']
if isfile(env['BOARD_OPTIONS']['build']['ldscript'])
else join("$PIOHOME_DIR", "packages", "ldscripts",
"${BOARD_OPTIONS['build']['ldscript']}")
)
LDSCRIPT_PATH="${BOARD_OPTIONS['build']['ldscript']}"
)
if env['PLATFORM'] != env.get("BOARD_OPTIONS", {}).get("platform"):

View File

@ -27,11 +27,15 @@ 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)

View File

@ -39,19 +39,19 @@ env.Replace(
"-Wall", # show warnings
"-ffunction-sections", # place each function in its own section
"-fdata-sections",
"-MMD", # output dependency info
"-mmcu=$BOARD_MCU"
],
CPPDEFINES=[
"F_CPU=$BOARD_F_CPU"
],
CFLAGS=["-std=gnu11"],
CXXFLAGS=[
"-std=gnu++11",
"-fno-exceptions",
"-fno-threadsafe-statics"
],
CPPDEFINES=["F_CPU=$BOARD_F_CPU"],
LINKFLAGS=[
"-Os",
"-mmcu=$BOARD_MCU",

View File

@ -12,34 +12,27 @@
# 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
import socket
from os.path import join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
DefaultEnvironment)
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
env.AutodetectUploadPort()
def _get_flash_size(env): # pylint: disable=redefined-outer-name
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
for f in env.get("LINKFLAGS", []):
if "-Wl,-T" not in f:
continue
match = re.search(r"-Wl,-T.*\.flash\.(\d+)(m|k).*\.ld", env.subst(f))
if not match:
continue
# 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":
@ -106,17 +99,35 @@ env.Replace(
"-Wl,--gc-sections"
],
SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES',
#
# Upload
#
UPLOADER=join("$PIOPACKAGES_DIR", "tool-esptool", "esptool"),
UPLOADEROTA=join("$PLATFORMFW_DIR", "tools", "espota.py"),
UPLOADERFLAGS=[
"-vv",
"-cd", "${BOARD_OPTIONS['upload']['resetmethod']}",
"-cb", "$UPLOAD_SPEED",
"-cp", "$UPLOAD_PORT",
"-cf", "$SOURCE"
"-cp", "$UPLOAD_PORT"
],
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS',
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"
@ -149,6 +160,66 @@ env.Append(
)
)
#
# 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=[
@ -158,20 +229,13 @@ if "FRAMEWORK" in env:
)
# Handle uploading via OTA
try:
if env.get("UPLOAD_PORT") and socket.inet_aton(env.get("UPLOAD_PORT")):
env.Replace(
UPLOADEROTA=join("$PLATFORMFW_DIR", "tools", "espota.py"),
UPLOADERFLAGS=[
"--debug",
"--progress",
"-i", "$UPLOAD_PORT",
"-f", "$SOURCE"
],
UPLOADCMD='"$UPLOADEROTA" $UPLOADERFLAGS'
)
except socket.error:
pass
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:
@ -226,10 +290,15 @@ else:
target_elf = env.BuildProgram()
#
# Target: Build the .hex
# Target: Build the .hex or SPIFFS image
#
if "uploadlazy" in COMMAND_LINE_TARGETS:
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"),
@ -253,12 +322,14 @@ target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD")
AlwaysBuild(target_size)
#
# Target: Upload firmware
# Target: Upload firmware or SPIFFS image
#
upload = env.Alias(["upload", "uploadlazy"], target_firm,
[BeforeUpload, "$UPLOADCMD"])
AlwaysBuild(upload)
target_upload = env.Alias(
["upload", "uploadlazy", "uploadfs"], target_firm,
[lambda target, source, env: env.AutodetectUploadPort(), "$UPLOADCMD"])
env.AlwaysBuild(target_upload)
#
# Target: Define targets

View File

@ -60,6 +60,34 @@ elif env.get("PLATFORM") == "espressif":
LIBS=["smartconfig", "pp", "main", "wpa", "lwip",
"net80211", "wps", "crypto", "phy", "hal", "axtls", "gcc", "m"]
)
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"]
)
env.Replace(PLATFORMFW_DIR=PLATFORMFW_DIR)

View File

@ -25,6 +25,17 @@ env = DefaultEnvironment()
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
if env.subst("$BOARD") == "rfduino":
env.Append(
CPPFLAGS=["-fno-builtin"],
LINKFLAGS=["--specs=nano.specs"]
)
env.Replace(
UPLOADER=join("$PIOPACKAGES_DIR", "tool-rfdloader", "rfdloader"),
UPLOADERFLAGS=["-q", "$UPLOAD_PORT"],
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES'
)
#
# Target: Build executable and linkable firmware
#
@ -51,7 +62,12 @@ AlwaysBuild(target_size)
# Target: Upload by default .bin file
#
upload = env.Alias(["upload", "uploadlazy"], target_firm, env.UploadToDisk)
if env.subst("$BOARD") == "rfduino":
upload = env.Alias(
["upload", "uploadlazy"], target_firm,
[lambda target, source, env: env.AutodetectUploadPort(), "$UPLOADCMD"])
else:
upload = env.Alias(["upload", "uploadlazy"], target_firm, env.UploadToDisk)
AlwaysBuild(upload)
#

View File

@ -20,7 +20,7 @@ import platform
from os.path import isfile, join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
DefaultEnvironment, Exit, SConscript)
DefaultEnvironment, SConscript)
env = DefaultEnvironment()
@ -28,8 +28,8 @@ 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")):
Exit(
"You are using GDB as firmware uploader. "
env.Exit(
"Error: You are using GDB as firmware uploader. "
"Please specify upload commands in upload.gdb "
"file in project directory!"
)

View File

@ -18,7 +18,7 @@ import atexit
import re
from glob import glob
from os import environ, remove
from os.path import basename, join
from os.path import basename, isfile, join
from platformio.util import exec_command, where_is_program
@ -190,6 +190,25 @@ def GetCompilerType(env):
return None
def GetActualLDScript(env):
script = None
for f in env.get("LINKFLAGS", []):
if f.startswith("-Wl,-T"):
script = env.subst(f[6:].replace('"', "").strip())
if isfile(script):
return script
for d in env.get("LIBPATH", []):
path = join(env.subst(d), script)
if isfile(path):
return path
if script:
env.Exit("Error: Could not find '%s' LD script in LDPATH '%s'" % (
script, env.subst("$LIBPATH")))
return None
def exists(_):
return True
@ -198,4 +217,5 @@ def generate(env):
env.AddMethod(ConvertInoToCpp)
env.AddMethod(DumpIDEData)
env.AddMethod(GetCompilerType)
env.AddMethod(GetActualLDScript)
return env

View File

@ -18,7 +18,6 @@ from os.path import isfile, join
from shutil import copyfile
from time import sleep
from SCons.Script import Exit
from serial import Serial
from platformio.util import get_logicaldisks, get_serialports, get_systype
@ -48,7 +47,7 @@ def TouchSerialPort(env, port, baudrate):
sleep(0.4)
def WaitForNewSerialPort(_, before):
def WaitForNewSerialPort(env, before):
new_port = None
elapsed = 0
while elapsed < 10:
@ -63,10 +62,10 @@ def WaitForNewSerialPort(_, before):
elapsed += 0.25
if not new_port:
Exit("Error: Couldn't find a board on the selected port. "
"Check that you have the correct port selected. "
"If it is correct, try pressing the board's reset "
"button after initiating the upload.")
env.Exit("Error: Couldn't find a board on the selected port. "
"Check that you have the correct port selected. "
"If it is correct, try pressing the board's reset "
"button after initiating the upload.")
return new_port
@ -100,10 +99,10 @@ def AutodetectUploadPort(env):
if "UPLOAD_PORT" in env:
print "Auto-detected UPLOAD_PORT/DISK: %s" % env['UPLOAD_PORT']
else:
Exit("Error: Please specify `upload_port` for environment or use "
"global `--upload-port` option.\n"
"For some development platforms this can be a USB flash drive "
"(i.e. /media/<user>/<device name>)\n")
env.Exit("Error: Please specify `upload_port` for environment or use "
"global `--upload-port` option.\n"
"For some development platforms this can be a USB flash "
"drive (i.e. /media/<user>/<device name>)\n")
def UploadToDisk(_, target, source, env): # pylint: disable=W0613,W0621
@ -113,8 +112,8 @@ def UploadToDisk(_, target, source, env): # pylint: disable=W0613,W0621
if not isfile(fpath):
continue
copyfile(fpath, join(env.subst("$UPLOAD_PORT"), "firmware.%s" % ext))
print ("Firmware has been successfully uploaded.\n"
"Please restart your board.")
print("Firmware has been successfully uploaded.\n"
"Please restart your board.")
def exists(_):

View File

@ -19,11 +19,9 @@ from glob import glob
from os import getenv, listdir, sep, walk
from os.path import basename, dirname, isdir, isfile, join, normpath, realpath
from SCons.Script import (COMMAND_LINE_TARGETS, DefaultEnvironment, Exit,
SConscript)
from SCons.Util import case_sensitive_suffixes
from platformio.util import pioversion_to_intstr
from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, SConscript
from SCons.Util import case_sensitive_suffixes
SRC_BUILD_EXT = ["c", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"]
SRC_HEADER_EXT = ["h", "hpp"]
@ -183,7 +181,7 @@ def BuildFrameworks(env, frameworks):
if board_frameworks:
frameworks.insert(0, board_frameworks[0])
else:
Exit("Error: Please specify board type")
env.Exit("Error: Please specify board type")
for f in frameworks:
if f in ("arduino", "energia"):
@ -193,7 +191,7 @@ def BuildFrameworks(env, frameworks):
SConscript(env.subst(
join("$PIOBUILDER_DIR", "scripts", "frameworks", "%s.py" % f)))
else:
Exit("Error: This board doesn't support %s framework!" % f)
env.Exit("Error: This board doesn't support %s framework!" % f)
def BuildLibrary(env, variant_dir, src_dir, src_filter=None):

View File

@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import click
import requests
@ -32,7 +35,8 @@ def cli():
fg="yellow")
cmds = (
["pip", "install", "--upgrade", "platformio"],
[os.path.normpath(sys.executable),
"-m", "pip", "install", "--upgrade", "platformio"],
["platformio", "--version"]
)
@ -44,8 +48,9 @@ def cli():
r = util.exec_command(cmd)
# try pip with disabled cache
if r['returncode'] != 0 and cmd[0] == "pip":
r = util.exec_command(["pip", "--no-cache-dir"] + cmd[1:])
if r['returncode'] != 0 and cmd[0] != "platformio":
cmd.insert(3, "--no-cache-dir")
r = util.exec_command(cmd)
assert r['returncode'] == 0
assert last in r['out'].strip()

View File

@ -191,14 +191,6 @@ class CIBuildEnvsEmpty(PlatformioException):
"predefined environments using `--project-conf` option"
class SConsNotInstalledError(PlatformioException):
MESSAGE = "SCons is not installed in your system. "\
"More details in FAQ/Troubleshooting section: "\
"http://docs.platformio.org/en/latest/faq.html"\
"#scons-is-not-installed-in-your-system"
class UpgradeError(PlatformioException):
MESSAGE = """{0}

View File

@ -0,0 +1,6 @@
.pioenvs
CMakeCache.txt
CMakeFiles/
MakeFile
cmake_install.cmake
compile_commands.json

View File

@ -0,0 +1,56 @@
cmake_minimum_required(VERSION 3.2)
project({{project_name}})
set(ENV{PATH} "{{env_path}}")
set(PLATFORMIO_CMD "{{platformio_path}}")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
% for include in includes:
% if include.startswith(user_home_dir):
% if "windows" in systype:
include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
% else:
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
% end
% else:
include_directories("{{include.replace("\\", "/")}}")
% end
% end
% for define in defines:
add_definitions(-D{{!define}})
% end
add_custom_target(
platformio_build ALL
COMMAND ${PLATFORMIO_CMD} -f -c emacs run
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(
platformio_upload ALL
COMMAND ${PLATFORMIO_CMD} -f -c emacs run --target upload
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(
platformio_clean ALL
COMMAND ${PLATFORMIO_CMD} -f -c emacs run --target clean
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(
platformio_update ALL
COMMAND ${PLATFORMIO_CMD} -f -c emacs update
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
% if main_src_file:
add_executable({{project_name}} {{main_src_file.replace("\\", "/")}})
% else:
#
# To enable code auto-completion, please specify path
# to main source file (*.c, *.cpp) and uncomment line below
#
# add_executable({{project_name}} src/main_change_me.cpp)
% end

View File

@ -14,6 +14,7 @@
import os
import re
import sys
from imp import load_source
from multiprocessing import cpu_count
from os.path import isdir, isfile, join
@ -46,6 +47,10 @@ PLATFORM_PACKAGES = {
("Arduino Wiring-based Framework (ESP8266 Core)",
"https://github.com/esp8266/Arduino")
],
"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/")
@ -112,6 +117,9 @@ PLATFORM_PACKAGES = {
("msp-gcc", "http://sourceforge.net/projects/mspgcc/"),
("GDB", "http://www.gnu.org/software/gdb/")
],
"tool-scons": [
("SCons software construction tool", "http://www.scons.org")
],
"tool-avrdude": [
("AVRDUDE", "http://www.nongnu.org/avrdude/")
],
@ -135,6 +143,13 @@ PLATFORM_PACKAGES = {
],
"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")
]
}
@ -365,6 +380,9 @@ class BasePlatform(object):
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():
@ -429,24 +447,7 @@ class BasePlatform(object):
"PIOPACKAGE_%s=%s" % (options['alias'].upper(), name))
self._found_error = False
try:
# test that SCons is installed correctly
assert util.test_scons()
result = util.exec_command(
[
"scons",
"-Q",
"-j %d" % self.get_job_nums(),
"--warn=no-no-parallel-support",
"-f", join(util.get_source_dir(), "builder", "main.py")
] + variables + targets,
stdout=util.AsyncPipe(self.on_run_out),
stderr=util.AsyncPipe(self.on_run_err)
)
except (OSError, AssertionError):
raise exception.SConsNotInstalledError()
result = self._run_scons(variables, targets)
assert "returncode" in result
# if self._found_error:
# result['returncode'] = 1
@ -456,6 +457,32 @@ class BasePlatform(object):
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)
result = util.exec_command(
[
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")
] + variables + targets,
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)

View File

@ -41,6 +41,10 @@ class EspressifPlatform(BasePlatform):
"default": True
},
"tool-mkspiffs": {
"alias": "uploader"
},
"sdk-esp8266": {
},

View File

@ -19,7 +19,7 @@ class NativePlatform(BasePlatform):
"""
Native development platform is intended to be used for desktop OS.
This platform uses built-in tool chains (preferable based on GCC),
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

View File

@ -37,8 +37,22 @@ class Nordicnrf51Platform(BasePlatform):
"framework-mbed": {
"alias": "framework"
},
"framework-arduinonordicnrf51": {
"alias": "framework"
},
"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)

View File

@ -15,7 +15,6 @@
import atexit
import platform
import Queue
import re
import sys
import threading
import uuid
@ -48,6 +47,13 @@ class TelemetryBase(object):
if name in self._params:
del self._params[name]
def get_cid(self):
cid = app.get_state_item("cid")
if not cid:
cid = self.MACHINE_ID
app.set_state_item("cid", cid)
return cid
def send(self, hittype):
raise NotImplementedError()
@ -67,7 +73,7 @@ class MeasurementProtocol(TelemetryBase):
TelemetryBase.__init__(self)
self['v'] = 1
self['tid'] = self.TRACKING_ID
self['cid'] = self.MACHINE_ID
self['cid'] = self.get_cid()
self['sr'] = "%dx%d" % click.get_terminal_size()
self._prefill_screen_name()
@ -92,13 +98,6 @@ class MeasurementProtocol(TelemetryBase):
dpdata.append("Click/%s" % click.__version__)
if app.get_session_var("caller_id"):
dpdata.append("Caller/%s" % app.get_session_var("caller_id"))
try:
result = util.exec_command(["scons", "--version"])
match = re.search(r"engine: v([\d\.]+)", result['out'])
if match:
dpdata.append("SCons/%s" % match.group(1))
except: # pylint: disable=W0702
pass
self['an'] = " ".join(dpdata)
def _prefill_custom_data(self):
@ -197,26 +196,25 @@ class MPDataPusher(object):
self._failedque.append(_item)
if self._send_data(item):
self._failedque.remove(_item)
else:
self._http_offline = True
self._queue.task_done()
except: # pylint: disable=W0702
pass
def _send_data(self, data):
result = False
if self._http_offline:
return False
try:
r = self._http_session.post(
"https://ssl.google-analytics.com/collect",
data=data,
headers=util.get_request_defheaders(),
timeout=2
timeout=1
)
r.raise_for_status()
result = True
return True
except: # pylint: disable=W0702
pass
return result
self._http_offline = True
return False
def on_command():

View File

@ -18,7 +18,6 @@ import json
import os
import re
import subprocess
import sys
from glob import glob
from os.path import (abspath, basename, dirname, expanduser, isdir, isfile,
join, realpath)
@ -201,6 +200,13 @@ def get_pioenvs_dir():
)
def get_projectdata_dir():
return _get_projconf_option_dir(
"data_dir",
join(get_project_dir(), "data")
)
def get_project_config():
path = join(get_project_dir(), "platformio.ini")
if not isfile(path):
@ -330,54 +336,6 @@ def get_api_result(path, params=None, data=None):
return result
def test_scons():
try:
r = exec_command(["scons", "--version"])
if "ImportError: No module named SCons.Script" in r['err']:
_PYTHONPATH = []
for p in sys.path:
if not p.endswith("-packages"):
continue
for item in glob(join(p, "scons*")):
if isdir(join(item, "SCons")) and item not in sys.path:
_PYTHONPATH.append(item)
sys.path.insert(0, item)
if _PYTHONPATH:
_PYTHONPATH = str(os.pathsep).join(_PYTHONPATH)
if os.getenv("PYTHONPATH"):
os.environ['PYTHONPATH'] += os.pathsep + _PYTHONPATH
else:
os.environ['PYTHONPATH'] = _PYTHONPATH
r = exec_command(["scons", "--version"])
assert r['returncode'] == 0
return True
except (OSError, AssertionError):
for p in sys.path:
try:
r = exec_command([join(p, "scons"), "--version"])
assert r['returncode'] == 0
os.environ['PATH'] += os.pathsep + p
return True
except (OSError, AssertionError):
pass
return False
def install_scons():
r = exec_command(["pip", "install", "-U", "scons"])
if r['returncode'] != 0:
r = exec_command(["pip", "install", "--egg", "scons",
'--install-option="--no-install-man"'])
return r['returncode'] == 0
def scons_in_pip():
r = exec_command(["pip", "list"])
if r['returncode'] != 0:
return False
return "scons (" in r['out'].lower()
@memoized
def _lookup_boards():
boards = {}

View File

@ -1,7 +0,0 @@
bottle==0.12.9
click==5.1
colorama==0.3.3
lockfile==0.12.2
pyserial==2.7
requests==2.8.1
scons==2.4.1

View File

@ -64,16 +64,32 @@ def fix_winpython_pathenv():
def exec_command(*args, **kwargs):
result = {
"out": None,
"err": None,
"returncode": None
}
kwargs['stdout'] = subprocess.PIPE
kwargs['stderr'] = subprocess.PIPE
kwargs['shell'] = IS_WINDOWS
p = subprocess.Popen(*args, **kwargs)
out, err = p.communicate()
result['out'], result['err'] = p.communicate()
result['returncode'] = p.returncode
if p.returncode != 0:
raise Exception("\n".join([out, err]))
return out.strip()
for k, v in result.iteritems():
if v and isinstance(v, basestring):
result[k].strip()
return result
def print_exec_result(result):
if result['returncode'] == 0:
print (result['out'])
else:
raise Exception("\n".join([result['out'], result['err']]))
def exec_python_cmd(args):
@ -92,18 +108,24 @@ def install_pip():
f.close()
try:
print (exec_python_cmd([f.name]))
r = exec_python_cmd([f.name])
finally:
os.unlink(f.name)
print_exec_result(r)
def install_platformio():
r = None
cmd = ["-m", "pip.__main__" if sys.version_info < (2, 7, 0) else "pip"]
try:
print (exec_python_cmd(cmd + ["install", "-U", "platformio"]))
except Exception:
print (exec_python_cmd(
cmd + ["--no-cache-dir", "install", "-U", "platformio"]))
r = exec_python_cmd(cmd + ["install", "-U", "platformio"])
assert r['returncode'] == 0
except AssertionError:
r = exec_python_cmd(
cmd + ["--no-cache-dir", "install", "-U", "platformio"])
if r:
print_exec_result(r)
def main():
@ -128,7 +150,13 @@ def main():
is_error = True
print (str(e))
print ("[FAILURE]")
if "Permission denied" in str(e) and not IS_WINDOWS:
permission_errors = (
"permission denied",
"not permitted"
)
if (any([m in str(e).lower() for m in permission_errors]) and not
IS_WINDOWS):
print ("""
-----------------
Permission denied
@ -150,10 +178,10 @@ https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platf
"successfully FINISHED! <==\n")
try:
print (exec_command("platformio"))
print_exec_result(exec_command("platformio"))
except:
try:
print (exec_python_cmd([
print_exec_result(exec_python_cmd([
"-m",
"platformio.__main__" if sys.version_info < (2, 7, 0) else
"platformio"]))

View File

@ -12,28 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from platform import system
import sys
from setuptools import find_packages, setup
from platformio import (__author__, __description__, __email__, __license__,
__title__, __url__, __version__, util)
__title__, __url__, __version__)
install_requires = [
"bottle",
"bottle<0.13",
"click>=3.2,<6",
"lockfile>=0.9.1",
"pyserial",
"requests>=2.4.0"
"lockfile>=0.9.1,<0.13",
"requests>=2.4.0,<3",
"colorama"
]
if system() == "Windows":
install_requires.append("colorama")
if not util.test_scons():
util.install_scons()
elif util.scons_in_pip():
install_requires.append("scons")
if sys.version_info < (2, 7, 0):
install_requires.append("pyserial<3")
else:
install_requires.append("pyserial<4")
setup(
name=__title__,

View File

@ -63,9 +63,10 @@ def test_board_ldscripts(platformio_setup, clirunner, validate_cliresult):
])
validate_cliresult(result)
ldscripts_path = join(util.get_home_dir(), "packages", "ldscripts")
for _, opts in util.get_boards().iteritems():
for type_, opts in util.get_boards().iteritems():
if opts['build'].get("ldscript"):
frameworks = opts['frameworks']
if any(fw in frameworks for fw in ["libopencm3", "mbed"]):
if (any(fw in frameworks for fw in ["libopencm3", "mbed"]) or
type_ in ("rfduino", )):
continue
assert isfile(join(ldscripts_path, opts['build'].get("ldscript")))