Skip to content

Commit

Permalink
Merge branch 'develop' into feature/platformio-30
Browse files Browse the repository at this point in the history
* develop:
  Update docs for Teensy USB Features // Issue #722
  Implement Teensy 2.0 USB functionality (HID, SERIAL_HID, DISK, MIDI, etc.) // Resolve #722
  Add support for Pinoccio Scout board // Resolve #52
  Fix broken LD Script for Element14 chipKIT Pi board // Resolve #725  Resolve #726
  Fix USB flags processing for teensy platform // Issue #722
  Add Pinoccio board // Issue #52
  Minor improvements for CLion docs
  Improved docs for integration with CLion IDE
  Version bump to 2.11.1 (issues #472, #629, #710, #711, #712, #713, #718)
  Typo fix
  Add "udev" rules for OpenOCD CMSIS-DAP adapters // Resolve #718
  Update history
  Ignore "[platformio]" section from custom project configuration CI
  Bump to 2.11.1b1
  Add Arduino M0 Pro and Tian to the examples // Issue #472
  Fix issue when `pioenvs` folder doesn't exist
  Add more info about `.pioenvs` directory
  Improve CMSIS selection for SAMD21 boards
  Improve support for SAMD21 based boards
  Add contributing guidelines
  • Loading branch information
ivankravets committed Jul 18, 2016
2 parents 1127914 + f16c05c commit 1029233
Show file tree
Hide file tree
Showing 14 changed files with 239 additions and 35 deletions.
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Contributing
------------

To get started, <a href="https://www.clahub.com/agreements/platformio/platformio">sign the Contributor License Agreement</a>.

1. Fork the repository on GitHub.
2. Make a branch off of ``develop``
3. Run ``pip install tox``
4. Go to the root of project where is located ``tox.ini`` and run ``tox -e develop``
5. Activate current development environment:

* Windows: ``.tox\develop\Scripts\activate``
* Bash/ZSH: ``source .tox/develop/bin/activate``
* Fish: ``source .tox/bin/activate.fish``

6. Make changes to code, documentation, etc.
7. Lint source code ``tox -e lint``
8. Run the tests ``tox -e py27``
9. Build documentation ``tox -e docs`` (creates a directory _build under docs where you can find the html)
10. Commit changes to your forked repository
11. Submit a Pull Request on GitHub.
20 changes: 19 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,35 @@ PlatformIO 3.0
PlatformIO 2.0
--------------

2.11.1 (2016-??-??)
2.11.2 (2016-??-??)
~~~~~~~~~~~~~~~~~~~

* Added support for Pinoccio Scout board
(`issue #52 <https://github.com/platformio/platformio/issues/52>`_)
* Added support for `Teensy USB Features <http://docs.platformio.org/en/latest/platforms/teensy.html#usb-features>`__
(HID, SERIAL_HID, DISK, DISK_SDFLASH, MIDI, etc.)
(`issue #722 <https://github.com/platformio/platformio/issues/722>`_)
* Fixed broken LD Script for Element14 chipKIT Pi board
(`issue #725 <https://github.com/platformio/platformio/issues/725>`_)

2.11.1 (2016-07-12)
~~~~~~~~~~~~~~~~~~~

* Added support for Arduino M0, M0 Pro and Tian boards
(`issue #472 <https://github.com/platformio/platformio/issues/472>`_)
* Added support for Microchip chipKIT Lenny board
* Updated Microchip PIC32 Arduino framework to v1.2.1
* Documented `uploading of EEPROM data <http://docs.platformio.org/en/latest/platforms/atmelavr.html#upload-eeprom-data>`__
(from EEMEM directive)
* Added ``Rebuild C/C++ Project Index`` target to CLion and Eclipse IDEs
* Improved project generator for `CLion IDE <http://docs.platformio.org/en/latest/ide/clion.html>`__
* Added ``udev`` rules for OpenOCD CMSIS-DAP adapters
(`issue #718 <https://github.com/platformio/platformio/issues/718>`_)
* Auto-remove project cache when PlatformIO is upgraded
* Keep user changes for ``.gitignore`` file when re-generate/update project data
* Ignore ``[platformio]`` section from custom project configuration file when
`platformio ci --project-conf <http://docs.platformio.org/en/latest/userguide/cmd_ci.html>`__
command is used
* Fixed missed ``--boot`` flag for the firmware uploader for ATSAM3X8E
Cortex-M3 MCU based boards (Arduino Due, etc)
(`issue #710 <https://github.com/platformio/platformio/issues/710>`_)
Expand Down
23 changes: 4 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,27 +185,12 @@ For further details, please refer to `What is PlatformIO? <http://docs.platformi
Contributing
------------

1. Fork the repository on GitHub.
2. Make a branch off of ``develop``
3. Run ``pip install tox``
4. Go to the root of project where is located ``tox.ini`` and run ``tox -e develop``
5. Activate current development environment:

* Windows: ``.tox\develop\Scripts\activate``
* Bash/ZSH: ``source .tox/develop/bin/activate``
* Fish: ``source .tox/bin/activate.fish``

6. Make changes to code, documentation, etc.
7. Lint source code ``tox -e lint``
8. Run the tests ``tox -e py27``
9. Build documentation ``tox -e docs`` (creates a directory _build under docs where you can find the html)
10. Commit changes to your forked repository
11. Submit a Pull Request on GitHub.

Licence
See `contributing guidelines <https://github.com/platformio/platformio/blob/develop/CONTRIBUTING.md>`_.

License
-------

Copyright 2014-2016 Ivan Kravets <me@ikravets.com>

The PlatformIO is licensed under the permissive Apache 2.0 licence,
The PlatformIO is licensed under the permissive Apache 2.0 license,
so you can use it in both commercial and personal projects with confidence.
20 changes: 20 additions & 0 deletions docs/frameworks/arduino.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,26 @@ PanStamp
- 32 Kb
- 4 Kb

Pinoccio
~~~~~~~~

.. list-table::
:header-rows: 1

* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM

* - ``pinoccio``
- `Pinoccio Scout <https://www.crowdsupply.com/pinoccio/mesh-sensor-network>`_
- ATMEGA256RFR2
- 16 MHz
- 256 Kb
- 32 Kb

Punch Through
~~~~~~~~~~~~~

Expand Down
68 changes: 66 additions & 2 deletions docs/ide/clion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ command and generate project via :option:`platformio init --ide` command:
Then:

1. Place source files (``*.c, *.cpp, *.h, *.ino, etc.``) to ``src`` directory
1. Place source files (``*.c, *.cpp, *.h, *.hpp``) to ``src`` directory
2. Import this project via ``Menu: File > Import Project``
and specify root directory where is located :ref:`projectconf`
3. Open source file from ``src`` directory
4. Build project (*DO NOT RUN*): ``Menu: Run > Build``.

.. warning::

See know issue: :ref:`ide_clion_knownissues_inopde_not_supported` and how
to resolve it.

There are 6 predefined targets for building (*NOT FOR RUNNING*, see marks on
the screenshot below):

Expand All @@ -68,6 +73,65 @@ the screenshot below):
after generating process wont be reflected in IDE. To fix it please run
``PLATFORMIO_REBUILD_PROJECT_INDEX`` target.

Known issues
------------

.. _ide_clion_knownissues_inopde_not_supported:

Arduino ``.ino`` files are not supported
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CLion uses "CMake" tool for code completion and code linting. As result, it
doesn't support Arduino files (``*.ino`` and ``.pde``) because they are
not valid C/C++ based source files:

1. Missing includes such as ``#include <Arduino.h>``
2. Function declarations are omitted.

Convert Arduino file to C++ manually
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For example, we have the next ``Demo.ino`` file:

.. code-block:: cpp
void function setup () {
someFunction(13);
}
void function loop() {
delay(1000);
}
void someFunction(int num) {
}
Let's convert it to ``Demo.cpp``:

1. Add ``#include <Arduino.h>`` at the top of the source file
2. Declare each custom function (excluding built-in, such as ``setup`` and ``loop``)
before it will be called.

The final ``Demo.cpp``:

.. code-block:: cpp
#include <Arduino.h>
void someFunction(int num);
void function setup () {
someFunction(13);
}
void function loop() {
delay(1000);
}
void someFunction(int num) {
}
Articles / Manuals
------------------

Expand All @@ -81,6 +145,6 @@ Examples
--------

"Blink" Project
^^^^^^^^^^^^^^^
~~~~~~~~~~~~~~~

Source code of `CLion "Blink" Project <https://github.com/platformio/platformio-examples/tree/develop/ide/clion>`_.
20 changes: 20 additions & 0 deletions docs/platforms/atmelavr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,26 @@ PanStamp
- 32 Kb
- 2 Kb

Pinoccio
~~~~~~~~

.. list-table::
:header-rows: 1

* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM

* - ``pinoccio``
- `Pinoccio Scout <https://www.crowdsupply.com/pinoccio/mesh-sensor-network>`_
- ATMEGA256RFR2
- 16 MHz
- 256 Kb
- 32 Kb

Punch Through
~~~~~~~~~~~~~

Expand Down
20 changes: 20 additions & 0 deletions docs/platforms/embedded_boards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,26 @@ PanStamp
- 32 Kb
- 4 Kb

Pinoccio
~~~~~~~~

.. list-table::
:header-rows: 1

* - Type ``board``
- Name
- Microcontroller
- Frequency
- Flash
- RAM

* - ``pinoccio``
- `Pinoccio Scout <https://www.crowdsupply.com/pinoccio/mesh-sensor-network>`_
- ATMEGA256RFR2
- 16 MHz
- 256 Kb
- 32 Kb

Punch Through
~~~~~~~~~~~~~

Expand Down
27 changes: 27 additions & 0 deletions docs/platforms/teensy_extra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@
See the License for the specific language governing permissions and
limitations under the License.
USB Features
------------

If you want to use Teensy USB Features, you need to add special
acros/define using :ref:`projectconf_build_flags`:

* ``-D USB_HID``
* ``-D USB_SERIAL_HID``
* ``-D USB_DISK``
* ``-D USB_DISK_SDFLASH``
* ``-D USB_MIDI``
* ``-D USB_RAWHID``
* ``-D USB_FLIGHTSIM``
* ``-D USB_DISABLED``

Example:

.. code-block:: ini
[env:teensy_hid_device]
platform = teensy
framework = arduino
board = teensy20
build_flags = -D USB_RAWHID
See `Teensy USB Examples <https://www.pjrc.com/teensy/usb_debug_only.html>`_.

Examples
--------

Expand Down
6 changes: 5 additions & 1 deletion docs/projectconf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ This option can be overridden by global environment variable
``envs_dir``
^^^^^^^^^^^^

This is a cache directory. *PlatformIO Build System* uses this folder for project
.. warning::
**PLEASE DO NOT EDIT FILES IN THIS FOLDER**. PlatformIO will overwrite
your changes on the next build. **THIS IS A CACHE DIRECTORY**.

*PlatformIO Build System* uses this folder for project
environments to store compiled object files, static libraries, firmwares and
other cached information. It allows PlatformIO to build source code extremely
fast!
Expand Down
15 changes: 6 additions & 9 deletions platformio/builder/tools/pioupload.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,12 @@ def FlushSerialBuffer(env, port):
def TouchSerialPort(env, port, baudrate):
port = env.subst(port)
print "Forcing reset using %dbps open/close on port %s" % (baudrate, port)
if system() != "Windows":
try:
s = Serial(port)
s.close()
except: # pylint: disable=W0702
pass
s = Serial(port=port, baudrate=baudrate)
s.setDTR(False)
s.close()
try:
s = Serial(port=port, baudrate=baudrate)
s.setDTR(False)
s.close()
except: # pylint: disable=W0702
pass
sleep(0.4)


Expand Down
17 changes: 16 additions & 1 deletion platformio/commands/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
from platformio.commands.run import cli as cmd_run
from platformio.exception import CIBuildEnvsEmpty

# pylint: disable=wrong-import-order
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser


def validate_path(ctx, param, value): # pylint: disable=W0613
invalid_path = None
Expand Down Expand Up @@ -81,7 +87,7 @@ def cli(ctx, src, lib, exclude, board, # pylint: disable=R0913
_copy_contents(join(build_dir, dir_name), contents)

if project_conf and isfile(project_conf):
copyfile(project_conf, join(build_dir, "platformio.ini"))
_copy_project_conf(build_dir, project_conf)
elif not board:
raise CIBuildEnvsEmpty()

Expand Down Expand Up @@ -147,3 +153,12 @@ def _exclude_contents(dst_dir, patterns):
rmtree(path)
elif isfile(path):
remove(path)


def _copy_project_conf(build_dir, project_conf):
cp = ConfigParser()
cp.read(project_conf)
if cp.has_section("platformio"):
cp.remove_section("platformio")
with open(join(build_dir, "platformio.ini"), "w") as fp:
cp.write(fp)
12 changes: 11 additions & 1 deletion platformio/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,20 @@ def get_projectlib_dir():


def get_pioenvs_dir():
return _get_projconf_option_dir(
path = _get_projconf_option_dir(
"envs_dir",
join(get_project_dir(), ".pioenvs")
)
if not isdir(path):
os.makedirs(path)
dontmod_path = join(path, "do-not-modify-files-here.url")
if not isfile(dontmod_path):
with open(dontmod_path, "w") as fp:
fp.write("""
[InternetShortcut]
URL=http://docs.platformio.org/en/latest/projectconf.html#envs-dir
""")
return path


def get_projectdata_dir():
Expand Down
Loading

0 comments on commit 1029233

Please sign in to comment.