Files
platformio-core/docs/userguide/cmd_init.rst

145 lines
4.0 KiB
ReStructuredText
Raw Normal View History

2016-08-03 22:18:51 +03:00
.. Copyright 2014-present PlatformIO <contact@platformio.org>
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
-----------
2015-12-07 22:23:20 +02:00
Initialize new PlatformIO based project or update existing with new data.
2014-08-09 16:31:20 +03:00
This command will create:
* :ref:`projectconf`
2016-03-06 01:03:43 +02:00
* ``src`` directory where you should place source code
(``*.h, *.c, *.cpp, *.S, *.ino, etc.``)
* ``lib`` directory can be used for the project specific (private) libraries.
More details are located in ``lib/readme.txt`` file.
* Miscellaneous files for VCS and :ref:`ci` support.
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
2016-06-13 19:24:13 +03:00
A path to the directory where *PlatformIO* will initialize new project.
2014-08-09 16:31:20 +03:00
.. option::
2015-05-15 22:31:55 +02:00
-b, --board
If you specify board ``ID`` (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`.
.. option::
--ide
Initialize 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-12-26 01:02:44 +02:00
Also, please take a look at :ref:`ide` page.
.. option::
-O, --project-option
Initialize project with additional options from :ref:`projectconf`. For example,
``platformio init --project-option="lib_deps=ArduinoJSON"``.
2016-09-20 20:16:39 +03:00
Multiple options are allowed.
2014-08-09 16:31:20 +03:00
.. option::
--env-prefix
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]``.
2014-08-09 16:31:20 +03:00
Examples
--------
1. Initialize new project in a current working directory
2014-11-30 18:14:18 +02:00
.. code::
2014-08-09 16:31:20 +03:00
> platformio init
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 ***
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source files here
lib - Put here project specific (private) libraries
2014-11-30 18:14:18 +02:00
Project has been successfully initialized!
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. Initialize new project in a specified directory
2014-11-30 18:14:18 +02:00
.. code::
2014-11-30 18:14:18 +02:00
> platformio init -d %PATH_TO_DIR%
The next files/directories will be created in ***
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
...
3. Initialize project for Arduino Uno
.. code::
> platformio init --board uno
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.
...
4. Initialize project for Teensy 3.1 board with custom :ref:`framework_mbed`
.. code::
> platformio init --board teensy31 --project-option "framework=mbed"
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.
...