| 
									
										
										
										
											2015-11-18 17:33:46 +02:00
										 |  |  | ..  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.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | .. _cmd_init:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | platformio init
 | 
					
						
							|  |  |  | ===============
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. contents::
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Usage
 | 
					
						
							|  |  |  | -----
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  |     platformio init [OPTIONS]
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Description
 | 
					
						
							|  |  |  | -----------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Initialize new PlatformIO based project.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This command will create:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * :ref:`projectconf`
 | 
					
						
							| 
									
										
										
										
											2015-10-13 14:01:16 +01:00
										 |  |  | * ``src`` - a source directory. Put your source files here
 | 
					
						
							| 
									
										
										
										
											2015-08-21 23:56:22 +03:00
										 |  |  | * ``lib`` - a directory for the project specific (private) libraries.
 | 
					
						
							|  |  |  |   PlatformIO will compile them to static libraries and link to executable file
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-22 23:11:48 +03:00
										 |  |  | .. note::
 | 
					
						
							|  |  |  |     The source code of each library should be placed in separate directory.
 | 
					
						
							|  |  |  |     For example, ``lib/private_lib/[here are source files]``.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  | Options
 | 
					
						
							|  |  |  | -------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-07 16:44:56 +01:00
										 |  |  | .. program:: platformio init
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  | .. option::
 | 
					
						
							| 
									
										
										
										
											2015-05-15 22:31:55 +02:00
										 |  |  |     -d, --project-dir
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-29 20:22:01 +02:00
										 |  |  | A path to the directory where *PlatformIO* will initialise new project.
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-29 20:22:01 +02:00
										 |  |  | .. option::
 | 
					
						
							| 
									
										
										
										
											2015-05-15 22:31:55 +02:00
										 |  |  |     -b, --board
 | 
					
						
							| 
									
										
										
										
											2014-12-29 20:22:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | If you specify board ``type`` (you can pass multiple ``--board`` options), then
 | 
					
						
							|  |  |  | *PlatformIO* will automatically generate environment for :ref:`projectconf` and
 | 
					
						
							|  |  |  | pre-fill these data:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * :ref:`projectconf_env_platform`
 | 
					
						
							|  |  |  | * :ref:`projectconf_env_framework`
 | 
					
						
							|  |  |  | * :ref:`projectconf_env_board`
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The full list with pre-configured boards is available here :ref:`platforms`.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-22 19:08:51 +03:00
										 |  |  | .. option::
 | 
					
						
							|  |  |  |     --ide
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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.
 | 
					
						
							| 
									
										
										
										
											2015-05-22 21:05:38 +03:00
										 |  |  | Also, please look into :ref:`ide` page.
 | 
					
						
							| 
									
										
										
										
											2015-05-22 19:08:51 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-29 20:22:01 +02:00
										 |  |  | .. option::
 | 
					
						
							|  |  |  |     --disable-auto-uploading
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-07 16:44:56 +01:00
										 |  |  | If you initialise project with the specified
 | 
					
						
							| 
									
										
										
										
											2015-05-15 22:31:55 +02:00
										 |  |  | :option:`platformio init --board`, then *PlatformIO*
 | 
					
						
							| 
									
										
										
										
											2014-12-29 20:22:01 +02:00
										 |  |  | will create environment with enabled firmware auto-uploading. This option
 | 
					
						
							|  |  |  | allows you to disable firmware auto-uploading by default.
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-23 12:54:59 +01:00
										 |  |  | .. option::
 | 
					
						
							|  |  |  |     --env-prefix
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-06 11:28:56 +01:00
										 |  |  | An environment prefix which will be used with pair in board type.
 | 
					
						
							|  |  |  | For example, the default environment name for ``teensy_31`` board will
 | 
					
						
							|  |  |  | be ``[env:teensy_31]``.
 | 
					
						
							| 
									
										
										
										
											2015-04-23 12:54:59 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-22 23:11:48 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | Examples
 | 
					
						
							|  |  |  | --------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  | 1. Create new project in the current working directory
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | .. code-block:: bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $ platformio init
 | 
					
						
							| 
									
										
										
										
											2014-12-29 20:22:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  |     The current working directory *** will be used for the new project.
 | 
					
						
							|  |  |  |     You can specify another project directory via
 | 
					
						
							| 
									
										
										
										
											2014-12-03 14:56:24 +02:00
										 |  |  |     `platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     The next files/directories will be created in ***
 | 
					
						
							| 
									
										
										
										
											2015-01-31 22:42:52 +02:00
										 |  |  |     platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
 | 
					
						
							| 
									
										
										
										
											2015-10-13 14:01:16 +01:00
										 |  |  |     src - Put your source files here
 | 
					
						
							| 
									
										
										
										
											2015-08-21 23:56:22 +03:00
										 |  |  |     lib - Put here project specific (private) libraries
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  |     Do you want to continue? [y/N]: y
 | 
					
						
							|  |  |  |     Project has been successfully initialized!
 | 
					
						
							| 
									
										
										
										
											2015-01-31 22:42:52 +02:00
										 |  |  |     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)
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 2. Create new project in the specified directory
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $ platformio init -d %PATH_TO_DIR%
 | 
					
						
							| 
									
										
										
										
											2014-12-29 20:22:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     The next files/directories will be created in ***
 | 
					
						
							| 
									
										
										
										
											2015-01-31 22:42:52 +02:00
										 |  |  |      platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
 | 
					
						
							| 
									
										
										
										
											2015-10-13 14:01:16 +01:00
										 |  |  |     src - Put your source files here
 | 
					
						
							| 
									
										
										
										
											2015-08-21 23:56:22 +03:00
										 |  |  |     lib - Put here project specific (private) libraries
 | 
					
						
							| 
									
										
										
										
											2014-12-29 20:22:01 +02:00
										 |  |  |     Do you want to continue? [y/N]: y
 | 
					
						
							|  |  |  |     Project has been successfully initialized!
 | 
					
						
							| 
									
										
										
										
											2015-01-31 22:42:52 +02:00
										 |  |  |     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)
 | 
					
						
							| 
									
										
										
										
											2014-12-29 20:22:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 3. Initialise project for Arduino Uno
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $ platformio init --board uno
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-31 22:42:52 +02:00
										 |  |  |     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.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  |     The next files/directories will be created in ***
 | 
					
						
							| 
									
										
										
										
											2015-01-31 22:42:52 +02:00
										 |  |  |     platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
 | 
					
						
							| 
									
										
										
										
											2015-10-13 14:01:16 +01:00
										 |  |  |     src - Put your source files here
 | 
					
						
							| 
									
										
										
										
											2015-08-21 23:56:22 +03:00
										 |  |  |     lib - Put here project specific (private) libraries
 | 
					
						
							| 
									
										
										
										
											2014-11-30 18:14:18 +02:00
										 |  |  |     Do you want to continue? [y/N]: y
 | 
					
						
							|  |  |  |     Project has been successfully initialized!
 | 
					
						
							| 
									
										
										
										
											2015-01-31 22:42:52 +02:00
										 |  |  |     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)
 |