Merge branch 'develop' of https://github.com/ivankravets/platformio into develop

This commit is contained in:
Valeriy Koval
2015-02-02 13:05:08 +02:00
14 changed files with 188 additions and 59 deletions

View File

@ -4,6 +4,11 @@ Release History
0.11.0 (2015-?) 0.11.0 (2015-?)
--------------- ---------------
* Added support for *ARM*-based credit-card computers: `Raspberry Pi <http://www.raspberrypi.org>`_,
`BeagleBoard <http://beagleboard.org>`_ and `CubieBoard <http://cubieboard.org>`_
* Added new boards to `atmelavr <http://docs.platformio.org/en/latest/platforms/atmelavr.html#boards>`_
platform: *Arduino NG, Arduino BT, Arduino Esplora, Arduino Ethernet,
Arduino Robot Control, Arduino Robot Motor and Arduino Yun*
* Refactored *Library Dependency Finder* (issues * Refactored *Library Dependency Finder* (issues
`#48 <https://github.com/ivankravets/platformio/issues/48>`_, `#48 <https://github.com/ivankravets/platformio/issues/48>`_,
`#50 <https://github.com/ivankravets/platformio/issues/50>`_, `#50 <https://github.com/ivankravets/platformio/issues/50>`_,
@ -13,7 +18,7 @@ Release History
command which allows to return the output in `JSON <http://en.wikipedia.org/wiki/JSON>`_ format command which allows to return the output in `JSON <http://en.wikipedia.org/wiki/JSON>`_ format
(`issue #42 <https://github.com/ivankravets/platformio/issues/42>`_) (`issue #42 <https://github.com/ivankravets/platformio/issues/42>`_)
* Allowed to ignore some libs from *Library Dependency Finder* via * Allowed to ignore some libs from *Library Dependency Finder* via
`ignore_libs <http://docs.platformio.org/en/latest/projectconf.html#ignore-libs`_ option `ignore_libs <http://docs.platformio.org/en/latest/projectconf.html#ignore-libs>`_ option
* Fixed an issue with the libraries that are git repositories (`issue #49 <https://github.com/ivankravets/platformio/issues/49>`_) * Fixed an issue with the libraries that are git repositories (`issue #49 <https://github.com/ivankravets/platformio/issues/49>`_)

View File

@ -21,17 +21,31 @@ platforms using only one command :ref:`cmd_run`. This happens due to
options: platform type, firmware uploading settings, pre-built framework options: platform type, firmware uploading settings, pre-built framework
and many more. and many more.
Each platform consists of packages which are located in own repository. Embedded Development. *Easier Than Ever.*
Due to :ref:`cmd_update` command you will have up-to-date development -----------------------------------------
instruments.
**PlatformIO** is well suited for **embedded development**. It can: * Colourful command-line output
* Built-in :ref:`Serial Port Monitor <cmd_serialports_monitor>`
* Configurable build :ref:`-flags/-options <projectconf_build_flags>`
* Integration with :ref:`development environments (IDE) <ide>`
* Pre-built tool chains, frameworks for the popular Hardware Platforms
* Automatically analyse dependency Smart Code Builder. *Fast and Reliable.*
* Reliably detect build changes ----------------------------------------
* Build framework or library source code to static library
* Reliable, automatic dependency analysis and detection of build changes
* Improved support for parallel builds
* Ability to share built files in a cache
* Lookup for external libraries which are installed via :ref:`librarymanager` * Lookup for external libraries which are installed via :ref:`librarymanager`
* Upload firmware to your device
The Missing Library Manager. *It's here!*
-----------------------------------------
* Friendly Command-Line Interface
* Modern `Web 2.0 Library Search <http://platformio.org/#!/lib>`_
* Library dependency management
* Automatic library updating
* It runs on Windows, Mac OS X, and Linux (+ARM).
Contents Contents

View File

@ -3,16 +3,18 @@
Installation Installation
============ ============
*PlatformIO* is written in `Python <http://python.org/download/>`_ and works **PlatformIO** is written in `Python <http://python.org/download/>`_ and works
on *Mac OS X*, *Linux*, *Windows OS* and Credit-card *ARM*-based on Mac OS X, Linux, Windows OS and *ARM*-based credit-card
computers (*Raspberry Pi*). computers (`Raspberry Pi <http://www.raspberrypi.org>`_,
`BeagleBoard <http://beagleboard.org>`_,
`CubieBoard <http://cubieboard.org>`_).
System requirements System requirements
------------------- -------------------
* **Operating systems:** * **Operating systems:**
* Mac OS X * Mac OS X
* Linux * Linux, +ARM
* Windows * Windows
* `Python 2.6 or Python 2.7 <http://python.org/download/>`_ * `Python 2.6 or Python 2.7 <http://python.org/download/>`_
@ -36,7 +38,7 @@ Super-Quick (Mac / Linux)
------------------------- -------------------------
To install or upgrade *PlatformIO* paste that at a *Terminal* prompt To install or upgrade *PlatformIO* paste that at a *Terminal* prompt
(you might need to run ``sudo`` first): (**you might need** to run ``sudo`` first):
.. code-block:: bash .. code-block:: bash

View File

@ -75,6 +75,34 @@ Arduino
- Frequency ``board_f_cpu`` - Frequency ``board_f_cpu``
- Flash - Flash
- RAM - RAM
* - ``atmegangatmega168``
- `Arduino NG or older (ATmega168)
<http://arduino.cc/en/main/boards>`_
- ATmega168 ``atmega168``
- 16 MHz ``16000000L``
- 16 Kb
- 1 Kb
* - ``atmegangatmega8``
- `Arduino Arduino NG or older (ATmega8)
<http://arduino.cc/en/main/boards>`_
- ATmega8 ``atmega8``
- 16 MHz ``16000000L``
- 8 Kb
- 1 Kb
* - ``btatmega168``
- `Arduino BT (ATmega168)
<http://arduino.cc/en/main/boards>`_
- ATmega168 ``atmega168``
- 16 MHz ``16000000L``
- 16 Kb
- 1 Kb
* - ``btatmega328``
- `Arduino BT (ATmega328)
<http://arduino.cc/en/main/boards>`_
- ATmega328 ``atmega328``
- 16 MHz ``16000000L``
- 32 Kb
- 2 Kb
* - ``diecimilaatmega168`` * - ``diecimilaatmega168``
- `Arduino Diecimila or Duemilanove (ATmega168) - `Arduino Diecimila or Duemilanove (ATmega168)
<http://arduino.cc/en/Main/ArduinoBoardDiecimila>`_ <http://arduino.cc/en/Main/ArduinoBoardDiecimila>`_
@ -89,6 +117,19 @@ Arduino
- 16 MHz ``16000000L`` - 16 MHz ``16000000L``
- 32 Kb - 32 Kb
- 2 Kb - 2 Kb
* - ``esplora``
- `Arduino Esplora <http://arduino.cc/en/Main/ArduinoBoardEsplora>`_
- ATmega32u4 ``atmega32u4``
- 16 MHz ``16000000L``
- 32 Kb
- 2.5 Kb
* - ``ethernet``
- `Arduino Ethernet
<http://arduino.cc/en/Main/ArduinoBoardEthernet>`_
- ATmega328P ``atmega328p``
- 16 MHz ``16000000L``
- 32 Kb
- 2 Kb
* - ``fio`` * - ``fio``
- `Arduino Fio - `Arduino Fio
<http://arduino.cc/en/Main/ArduinoBoardFio>`_ <http://arduino.cc/en/Main/ArduinoBoardFio>`_
@ -123,6 +164,13 @@ Arduino
- 8 MHz ``8000000L`` - 8 MHz ``8000000L``
- 32 Kb - 32 Kb
- 2 Kb - 2 Kb
* - ``megaADK``
- `Arduino Mega ADK
<http://arduino.cc/en/Main/ArduinoBoardMegaADK>`_
- ATmega2560 ``atmega2560``
- 16 MHz ``16000000L``
- 256 Kb
- 8 Kb
* - ``megaatmega1280`` * - ``megaatmega1280``
- `Arduino Mega (ATmega1280) - `Arduino Mega (ATmega1280)
<http://arduino.cc/en/Main/arduinoBoardMega>`_ <http://arduino.cc/en/Main/arduinoBoardMega>`_
@ -137,13 +185,6 @@ Arduino
- 16 MHz ``16000000L`` - 16 MHz ``16000000L``
- 256 Kb - 256 Kb
- 8 Kb - 8 Kb
* - ``megaADK``
- `Arduino Mega ADK
<http://arduino.cc/en/Main/ArduinoBoardMegaADK>`_
- ATmega2560 ``atmega2560``
- 16 MHz ``16000000L``
- 256 Kb
- 8 Kb
* - ``micro`` * - ``micro``
- `Arduino Micro - `Arduino Micro
<http://arduino.cc/en/Main/ArduinoBoardMicro>`_ <http://arduino.cc/en/Main/ArduinoBoardMicro>`_
@ -207,6 +248,20 @@ Arduino
- 16 MHz ``16000000L`` - 16 MHz ``16000000L``
- 32 Kb - 32 Kb
- 2 Kb - 2 Kb
* - ``robotControl``
- `Arduino Robot Control
<http://arduino.cc/en/Main/Robot>`_
- ATmega32u4 ``atmega32u4``
- 16 MHz ``16000000L``
- 32 Kb
- 2.5 Kb
* - ``robotMotor``
- `Arduino Robot Motor
<http://arduino.cc/en/Main/Robot>`_
- ATmega32u4 ``atmega32u4``
- 16 MHz ``16000000L``
- 32 Kb
- 2.5 Kb
* - ``uno`` * - ``uno``
- `Arduino Uno - `Arduino Uno
<http://arduino.cc/en/Main/ArduinoBoardUno>`_ <http://arduino.cc/en/Main/ArduinoBoardUno>`_
@ -214,6 +269,13 @@ Arduino
- 16 MHz ``16000000L`` - 16 MHz ``16000000L``
- 32 Kb - 32 Kb
- 2 Kb - 2 Kb
* - ``yun``
- `Arduino Yun
<http://arduino.cc/en/Main/ArduinoBoardYun>`_
- ATmega32u4 ``atmega32u4``
- 16 MHz ``16000000L``
- 32 Kb
- 2.5 Kb
More detailed information you can find here More detailed information you can find here
`Arduino boards <http://arduino.cc/en/Main/Products>`_. `Arduino boards <http://arduino.cc/en/Main/Products>`_.

View File

@ -34,7 +34,7 @@ Packages
-------- --------
*PlatformIO* has pre-built packages for the most popular operation systems: *PlatformIO* has pre-built packages for the most popular operation systems:
*Mac OS*, *Linux (+ARMv6)* and *Windows*. *Mac OS*, *Linux (+ARM)* and *Windows*.
.. list-table:: .. list-table::
:header-rows: 1 :header-rows: 1

View File

@ -4,7 +4,7 @@ Platforms & Embedded Boards
=========================== ===========================
*PlatformIO* has pre-built different development platforms for popular OS *PlatformIO* has pre-built different development platforms for popular OS
(*Mac OS X, Linux (+ARMv6) and Windows*). Each of them include compiler, (*Mac OS X, Linux (+ARM) and Windows*). Each of them include compiler,
debugger, uploader (for embedded) and many other useful tools. debugger, uploader (for embedded) and many other useful tools.
Also it has pre-configured settings for most popular **Embedded Platform Also it has pre-configured settings for most popular **Embedded Platform

View File

@ -19,17 +19,23 @@ Quickstart
$ platformio init --board=TYPE_1 --board=TYPE_2 --board=TYPE_N $ platformio init --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
Would you like to enable firmware auto-uploading when project is successfully built using `platformio run` command?
Don't forget that you can upload firmware manually using `platformio run --target upload` command. [y/N]: y
The current working directory *** will be used for the new project. The current working directory *** will be used for the new project.
You can specify another project directory via You can specify another project directory via
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command. `platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.
The next files/directories will be created in *** The next files/directories will be created in ***
`platformio.ini` - Project Configuration File platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
`src` - a source directory. Put your source code here src - Put your source code here
`lib` - a directory for the project specific libraries lib - Put here project specific or 3-rd party libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!
Now you can process it with `platformio run` command. Useful commands:
`platformio run` - process/build project from the current directory
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files)
Put your source code ``*.h, *.c, *.cpp or *.ino`` files to ``src`` directory. Put your source code ``*.h, *.c, *.cpp or *.ino`` files to ``src`` directory.

View File

@ -68,12 +68,15 @@ Examples
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command. `platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.
The next files/directories will be created in *** The next files/directories will be created in ***
platformio.ini - Project Configuration File platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - a source directory. Put your source code here src - Put your source code here
lib - a directory for the project specific libraries lib - Put here project specific or 3-rd party libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!
Now you can process it with `platformio run` command. Useful commands:
`platformio run` - process/build project from the current directory
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files)
2. Create new project in the specified directory 2. Create new project in the specified directory
@ -83,12 +86,15 @@ Examples
$ platformio init -d %PATH_TO_DIR% $ platformio init -d %PATH_TO_DIR%
The next files/directories will be created in *** The next files/directories will be created in ***
platformio.ini - Project Configuration File platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - a source directory. Put your source code here src - Put your source code here
lib - a directory for the project specific libraries lib - Put here project specific or 3-rd party libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!
Now you can process it with `platformio run` command. Useful commands:
`platformio run` - process/build project from the current directory
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files)
3. Initialise project for Arduino Uno 3. Initialise project for Arduino Uno
@ -96,10 +102,20 @@ Examples
$ platformio init --board uno $ platformio init --board uno
Would you like to enable firmware auto-uploading when project is successfully built using `platformio run` command?
Don't forget that you can upload firmware manually using `platformio run --target upload` command. [y/N]: y
The current working directory *** will be used for the new project.
You can specify another project directory via
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.
The next files/directories will be created in *** The next files/directories will be created in ***
platformio.ini - Project Configuration File platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - a source directory. Put your source code here src - Put your source code here
lib - a directory for the project specific libraries lib - Put here project specific or 3-rd party libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!
Now you can process it with `platformio run` command. Useful commands:
`platformio run` - process/build project from the current directory
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files)

View File

@ -65,6 +65,8 @@ Examples
Description: Silicon Labs CP210x USB to UART Bridge (COM3) Description: Silicon Labs CP210x USB to UART Bridge (COM3)
.. _cmd_serialports_monitor:
platformio serialports monitor platformio serialports monitor
------------------------------ ------------------------------

View File

@ -537,4 +537,4 @@
"wait_for_upload_port": true "wait_for_upload_port": true
} }
} }
} }

View File

@ -9,7 +9,7 @@ from os.path import join
from time import sleep from time import sleep
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
DefaultEnvironment, Exit) DefaultEnvironment)
from platformio.util import get_serialports from platformio.util import get_serialports
@ -52,8 +52,9 @@ env.Replace(
LINKFLAGS=[ LINKFLAGS=[
"-Os", "-Os",
"-mmcu=$BOARD_MCU",
"-Wl,--gc-sections", "-Wl,--gc-sections",
"-mmcu=$BOARD_MCU" "-Wl,--start-group"
], ],
UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"), UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
@ -189,8 +190,8 @@ if is_uptarget:
break break
if "UPLOAD_PORT" not in env: if "UPLOAD_PORT" not in env:
Exit("Please specify environment 'upload_port' or use global " print("WARNING!!! Please specify environment 'upload_port' or use "
"--upload-port option.") "global --upload-port option.\n")
# #
# Setup default targets # Setup default targets

View File

@ -56,14 +56,16 @@ def GlobCXXFiles(env, path):
return files return files
def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True): def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True,
ignore_pattern = (".git", ".svn", "examples") ignore_pattern=None):
if not ignore_pattern:
ignore_pattern = (".git", ".svn")
variants = [] variants = []
src_dir = env.subst(src_dir) src_dir = env.subst(src_dir)
for root, _, _ in walk(src_dir): for root, _, _ in walk(src_dir):
_src_dir = root _src_dir = root
_var_dir = variant_dir + root.replace(src_dir, "") _var_dir = variant_dir + root.replace(src_dir, "")
if any([s in _src_dir.lower() for s in ignore_pattern]): if any([s in _var_dir.lower() for s in ignore_pattern]):
continue continue
env.VariantDir(_var_dir, _src_dir, duplicate) env.VariantDir(_var_dir, _src_dir, duplicate)
variants.append(_var_dir) variants.append(_var_dir)
@ -72,7 +74,8 @@ def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True):
def BuildLibrary(env, variant_dir, library_dir): def BuildLibrary(env, variant_dir, library_dir):
lib = env.Clone() lib = env.Clone()
vdirs = lib.VariantDirRecursive(variant_dir, library_dir) vdirs = lib.VariantDirRecursive(
variant_dir, library_dir, ignore_pattern=(".git", ".svn", "examples"))
return lib.Library( return lib.Library(
lib.subst(variant_dir), lib.subst(variant_dir),
[lib.GlobCXXFiles(vdir) for vdir in vdirs] [lib.GlobCXXFiles(vdir) for vdir in vdirs]
@ -208,7 +211,7 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
if isdir(join(ld, "utility"))]) if isdir(join(ld, "utility"))])
libs = [] libs = []
for (libname, inc_dir) in deplibs: for (libname, inc_dir) in reversed(deplibs):
lib = env.BuildLibrary( lib = env.BuildLibrary(
join("$BUILD_DIR", libname), inc_dir) join("$BUILD_DIR", libname), inc_dir)
env.Clean(libname, lib) env.Clean(libname, lib)

View File

@ -30,8 +30,17 @@ def cli(project_dir, board, disable_auto_uploading):
if board and not set(board).issubset(builtin_boards): if board and not set(board).issubset(builtin_boards):
raise UnknownBoard(", ".join(set(board).difference(builtin_boards))) raise UnknownBoard(", ".join(set(board).difference(builtin_boards)))
# ask about auto-uploading
if board and app.get_setting("enable_prompts"):
disable_auto_uploading = not click.confirm(
"\nWould you like to enable firmware auto-uploading when project "
"is successfully built using `platformio run` command? \n"
"Don't forget that you can upload firmware manually using "
"`platformio run --target upload` command."
)
if project_dir == getcwd(): if project_dir == getcwd():
click.secho("The current working directory", fg="yellow", nl=False) click.secho("\nThe current working directory", fg="yellow", nl=False)
click.secho(" %s " % project_dir, fg="cyan", nl=False) click.secho(" %s " % project_dir, fg="cyan", nl=False)
click.secho( click.secho(
"will be used for the new project.\n" "will be used for the new project.\n"
@ -42,15 +51,16 @@ def cli(project_dir, board, disable_auto_uploading):
click.echo("The next files/directories will be created in %s" % click.echo("The next files/directories will be created in %s" %
click.style(project_dir, fg="cyan")) click.style(project_dir, fg="cyan"))
click.echo("%s - Project Configuration File" % click.echo("%s - Project Configuration File. |-> PLEASE EDIT ME <-|" %
click.style("platformio.ini", fg="cyan")) click.style("platformio.ini", fg="cyan"))
click.echo("%s - a source directory. Put your source code here" % click.echo("%s - Put your source code here" %
click.style("src", fg="cyan")) click.style("src", fg="cyan"))
click.echo("%s - a directory for the project specific libraries" % click.echo("%s - Put here project specific or 3-rd party libraries" %
click.style("lib", fg="cyan")) click.style("lib", fg="cyan"))
if (not app.get_setting("enable_prompts") or if (not app.get_setting("enable_prompts") or
click.confirm("Do you want to continue?")): click.confirm("Do you want to continue?")):
for d in (src_dir, lib_dir): for d in (src_dir, lib_dir):
if not isdir(d): if not isdir(d):
makedirs(d) makedirs(d)
@ -60,8 +70,13 @@ def cli(project_dir, board, disable_auto_uploading):
if board: if board:
fill_project_envs(project_file, board, disable_auto_uploading) fill_project_envs(project_file, board, disable_auto_uploading)
click.secho( click.secho(
"Project has been successfully initialized!\n" "Project has been successfully initialized!\nUseful commands:\n"
"Now you can process it with `platformio run` command.", "`platformio run` - process/build project from the current "
"directory\n"
"`platformio run --target upload` or `platformio run -t upload` "
"- upload firmware to embedded board\n"
"`platformio run --target clean` - clean project (remove compiled "
"files)",
fg="green" fg="green"
) )
else: else:

View File

@ -37,7 +37,7 @@ def get_home_dir():
pass pass
if not home_dir: if not home_dir:
home_dir = expanduser("~/.platformio") home_dir = join(expanduser("~"), ".platformio")
if not isdir(home_dir): if not isdir(home_dir):
makedirs(home_dir) makedirs(home_dir)
@ -85,9 +85,12 @@ def change_filemtime(path, time):
utime(path, (time, time)) utime(path, (time, time))
def exec_command(args): def exec_command(*args, **kwargs):
use_shell = system() == "Windows" kwargs['stdout'] = PIPE
p = Popen(args, stdout=PIPE, stderr=PIPE, shell=use_shell) kwargs['stderr'] = PIPE
kwargs['shell'] = system() == "Windows"
p = Popen(*args, **kwargs)
out, err = p.communicate() out, err = p.communicate()
return dict(out=out.strip(), err=err.strip()) return dict(out=out.strip(), err=err.strip())