diff --git a/HISTORY.rst b/HISTORY.rst index 5d6194ad..0c1fa5af 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,11 @@ Release History 0.11.0 (2015-?) --------------- +* Added support for *ARM*-based credit-card computers: `Raspberry Pi `_, + `BeagleBoard `_ and `CubieBoard `_ +* Added new boards to `atmelavr `_ + platform: *Arduino NG, Arduino BT, Arduino Esplora, Arduino Ethernet, + Arduino Robot Control, Arduino Robot Motor and Arduino Yun* * Refactored *Library Dependency Finder* (issues `#48 `_, `#50 `_, @@ -13,7 +18,7 @@ Release History command which allows to return the output in `JSON `_ format (`issue #42 `_) * Allowed to ignore some libs from *Library Dependency Finder* via - `ignore_libs `_ option * Fixed an issue with the libraries that are git repositories (`issue #49 `_) diff --git a/docs/index.rst b/docs/index.rst index ee2680b9..f0b272f2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 and many more. -Each platform consists of packages which are located in own repository. -Due to :ref:`cmd_update` command you will have up-to-date development -instruments. +Embedded Development. *Easier Than Ever.* +----------------------------------------- -**PlatformIO** is well suited for **embedded development**. It can: +* Colourful command-line output +* Built-in :ref:`Serial Port Monitor ` +* Configurable build :ref:`-flags/-options ` +* Integration with :ref:`development environments (IDE) ` +* Pre-built tool chains, frameworks for the popular Hardware Platforms -* Automatically analyse dependency -* Reliably detect build changes -* Build framework or library source code to static library +Smart Code Builder. *Fast and Reliable.* +---------------------------------------- + +* 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` -* Upload firmware to your device + +The Missing Library Manager. *It's here!* +----------------------------------------- + +* Friendly Command-Line Interface +* Modern `Web 2.0 Library Search `_ +* Library dependency management +* Automatic library updating +* It runs on Windows, Mac OS X, and Linux (+ARM). Contents diff --git a/docs/installation.rst b/docs/installation.rst index 386b5532..49a58742 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -3,16 +3,18 @@ Installation ============ -*PlatformIO* is written in `Python `_ and works -on *Mac OS X*, *Linux*, *Windows OS* and Credit-card *ARM*-based -computers (*Raspberry Pi*). +**PlatformIO** is written in `Python `_ and works +on Mac OS X, Linux, Windows OS and *ARM*-based credit-card +computers (`Raspberry Pi `_, +`BeagleBoard `_, +`CubieBoard `_). System requirements ------------------- * **Operating systems:** * Mac OS X - * Linux + * Linux, +ARM * Windows * `Python 2.6 or Python 2.7 `_ @@ -36,7 +38,7 @@ Super-Quick (Mac / Linux) ------------------------- 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 diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index 9e9722d9..fbd1cbc4 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -75,6 +75,34 @@ Arduino - Frequency ``board_f_cpu`` - Flash - RAM + * - ``atmegangatmega168`` + - `Arduino NG or older (ATmega168) + `_ + - ATmega168 ``atmega168`` + - 16 MHz ``16000000L`` + - 16 Kb + - 1 Kb + * - ``atmegangatmega8`` + - `Arduino Arduino NG or older (ATmega8) + `_ + - ATmega8 ``atmega8`` + - 16 MHz ``16000000L`` + - 8 Kb + - 1 Kb + * - ``btatmega168`` + - `Arduino BT (ATmega168) + `_ + - ATmega168 ``atmega168`` + - 16 MHz ``16000000L`` + - 16 Kb + - 1 Kb + * - ``btatmega328`` + - `Arduino BT (ATmega328) + `_ + - ATmega328 ``atmega328`` + - 16 MHz ``16000000L`` + - 32 Kb + - 2 Kb * - ``diecimilaatmega168`` - `Arduino Diecimila or Duemilanove (ATmega168) `_ @@ -89,6 +117,19 @@ Arduino - 16 MHz ``16000000L`` - 32 Kb - 2 Kb + * - ``esplora`` + - `Arduino Esplora `_ + - ATmega32u4 ``atmega32u4`` + - 16 MHz ``16000000L`` + - 32 Kb + - 2.5 Kb + * - ``ethernet`` + - `Arduino Ethernet + `_ + - ATmega328P ``atmega328p`` + - 16 MHz ``16000000L`` + - 32 Kb + - 2 Kb * - ``fio`` - `Arduino Fio `_ @@ -123,6 +164,13 @@ Arduino - 8 MHz ``8000000L`` - 32 Kb - 2 Kb + * - ``megaADK`` + - `Arduino Mega ADK + `_ + - ATmega2560 ``atmega2560`` + - 16 MHz ``16000000L`` + - 256 Kb + - 8 Kb * - ``megaatmega1280`` - `Arduino Mega (ATmega1280) `_ @@ -137,13 +185,6 @@ Arduino - 16 MHz ``16000000L`` - 256 Kb - 8 Kb - * - ``megaADK`` - - `Arduino Mega ADK - `_ - - ATmega2560 ``atmega2560`` - - 16 MHz ``16000000L`` - - 256 Kb - - 8 Kb * - ``micro`` - `Arduino Micro `_ @@ -207,6 +248,20 @@ Arduino - 16 MHz ``16000000L`` - 32 Kb - 2 Kb + * - ``robotControl`` + - `Arduino Robot Control + `_ + - ATmega32u4 ``atmega32u4`` + - 16 MHz ``16000000L`` + - 32 Kb + - 2.5 Kb + * - ``robotMotor`` + - `Arduino Robot Motor + `_ + - ATmega32u4 ``atmega32u4`` + - 16 MHz ``16000000L`` + - 32 Kb + - 2.5 Kb * - ``uno`` - `Arduino Uno `_ @@ -214,6 +269,13 @@ Arduino - 16 MHz ``16000000L`` - 32 Kb - 2 Kb + * - ``yun`` + - `Arduino Yun + `_ + - ATmega32u4 ``atmega32u4`` + - 16 MHz ``16000000L`` + - 32 Kb + - 2.5 Kb More detailed information you can find here `Arduino boards `_. diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index 8b67ede2..f135c5ae 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -34,7 +34,7 @@ Packages -------- *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:: :header-rows: 1 diff --git a/docs/platforms/index.rst b/docs/platforms/index.rst index fa41ce83..29ea4168 100644 --- a/docs/platforms/index.rst +++ b/docs/platforms/index.rst @@ -4,7 +4,7 @@ Platforms & Embedded Boards =========================== *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. Also it has pre-configured settings for most popular **Embedded Platform diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 773a416e..1ad7e264 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -19,17 +19,23 @@ Quickstart $ 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. You can specify another project directory via `platformio init -d %PATH_TO_THE_PROJECT_DIR%` command. The next files/directories will be created in *** - `platformio.ini` - Project Configuration File - `src` - a source directory. Put your source code here - `lib` - a directory for the project specific libraries + platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| + src - Put your source code here + lib - Put here project specific or 3-rd party libraries Do you want to continue? [y/N]: y 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. diff --git a/docs/userguide/cmd_init.rst b/docs/userguide/cmd_init.rst index 295d2b89..4890adf1 100644 --- a/docs/userguide/cmd_init.rst +++ b/docs/userguide/cmd_init.rst @@ -68,12 +68,15 @@ Examples `platformio init -d %PATH_TO_THE_PROJECT_DIR%` command. The next files/directories will be created in *** - platformio.ini - Project Configuration File - src - a source directory. Put your source code here - lib - a directory for the project specific libraries + platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| + src - Put your source code here + lib - Put here project specific or 3-rd party libraries Do you want to continue? [y/N]: y 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 @@ -83,12 +86,15 @@ Examples $ platformio init -d %PATH_TO_DIR% The next files/directories will be created in *** - platformio.ini - Project Configuration File - src - a source directory. Put your source code here - lib - a directory for the project specific libraries + platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| + src - Put your source code here + lib - Put here project specific or 3-rd party libraries Do you want to continue? [y/N]: y 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 @@ -96,10 +102,20 @@ Examples $ 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 *** - platformio.ini - Project Configuration File - src - a source directory. Put your source code here - lib - a directory for the project specific libraries + platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| + src - Put your source code here + lib - Put here project specific or 3-rd party libraries Do you want to continue? [y/N]: y 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) diff --git a/docs/userguide/cmd_serialports.rst b/docs/userguide/cmd_serialports.rst index 612429b3..360877ec 100644 --- a/docs/userguide/cmd_serialports.rst +++ b/docs/userguide/cmd_serialports.rst @@ -65,6 +65,8 @@ Examples Description: Silicon Labs CP210x USB to UART Bridge (COM3) +.. _cmd_serialports_monitor: + platformio serialports monitor ------------------------------ diff --git a/platformio/boards/arduino.json b/platformio/boards/arduino.json index 3e86b106..4d84f47a 100644 --- a/platformio/boards/arduino.json +++ b/platformio/boards/arduino.json @@ -537,4 +537,4 @@ "wait_for_upload_port": true } } -} \ No newline at end of file +} diff --git a/platformio/builder/scripts/atmelavr.py b/platformio/builder/scripts/atmelavr.py index dc02c28b..b3070b95 100644 --- a/platformio/builder/scripts/atmelavr.py +++ b/platformio/builder/scripts/atmelavr.py @@ -9,7 +9,7 @@ from os.path import join from time import sleep from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, - DefaultEnvironment, Exit) + DefaultEnvironment) from platformio.util import get_serialports @@ -52,8 +52,9 @@ env.Replace( LINKFLAGS=[ "-Os", + "-mmcu=$BOARD_MCU", "-Wl,--gc-sections", - "-mmcu=$BOARD_MCU" + "-Wl,--start-group" ], UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"), @@ -189,8 +190,8 @@ if is_uptarget: break if "UPLOAD_PORT" not in env: - Exit("Please specify environment 'upload_port' or use global " - "--upload-port option.") + print("WARNING!!! Please specify environment 'upload_port' or use " + "global --upload-port option.\n") # # Setup default targets diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 7bb942b6..ab982f8c 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -56,14 +56,16 @@ def GlobCXXFiles(env, path): return files -def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True): - ignore_pattern = (".git", ".svn", "examples") +def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True, + ignore_pattern=None): + if not ignore_pattern: + ignore_pattern = (".git", ".svn") variants = [] src_dir = env.subst(src_dir) for root, _, _ in walk(src_dir): _src_dir = root _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 env.VariantDir(_var_dir, _src_dir, duplicate) variants.append(_var_dir) @@ -72,7 +74,8 @@ def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True): def BuildLibrary(env, variant_dir, library_dir): 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( lib.subst(variant_dir), [lib.GlobCXXFiles(vdir) for vdir in vdirs] @@ -208,7 +211,7 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914 if isdir(join(ld, "utility"))]) libs = [] - for (libname, inc_dir) in deplibs: + for (libname, inc_dir) in reversed(deplibs): lib = env.BuildLibrary( join("$BUILD_DIR", libname), inc_dir) env.Clean(libname, lib) diff --git a/platformio/commands/init.py b/platformio/commands/init.py index f81cf5e4..31dc7a39 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -30,8 +30,17 @@ def cli(project_dir, board, disable_auto_uploading): if board and not set(board).issubset(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(): - 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( "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.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.echo("%s - a source directory. Put your source code here" % + click.echo("%s - Put your source code here" % 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")) if (not app.get_setting("enable_prompts") or click.confirm("Do you want to continue?")): + for d in (src_dir, lib_dir): if not isdir(d): makedirs(d) @@ -60,8 +70,13 @@ def cli(project_dir, board, disable_auto_uploading): if board: fill_project_envs(project_file, board, disable_auto_uploading) click.secho( - "Project has been successfully initialized!\n" - "Now you can process it with `platformio run` command.", + "Project has been successfully initialized!\nUseful commands:\n" + "`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" ) else: diff --git a/platformio/util.py b/platformio/util.py index 83c3bdf3..4e2e93b7 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -37,7 +37,7 @@ def get_home_dir(): pass if not home_dir: - home_dir = expanduser("~/.platformio") + home_dir = join(expanduser("~"), ".platformio") if not isdir(home_dir): makedirs(home_dir) @@ -85,9 +85,12 @@ def change_filemtime(path, time): utime(path, (time, time)) -def exec_command(args): - use_shell = system() == "Windows" - p = Popen(args, stdout=PIPE, stderr=PIPE, shell=use_shell) +def exec_command(*args, **kwargs): + kwargs['stdout'] = PIPE + kwargs['stderr'] = PIPE + kwargs['shell'] = system() == "Windows" + + p = Popen(*args, **kwargs) out, err = p.communicate() return dict(out=out.strip(), err=err.strip())