| 
									
										
										
										
											2016-08-03 22:18:51 +03:00
										 |  |  | ..  Copyright 2014-present PlatformIO <contact@platformio.org>
 | 
					
						
							| 
									
										
										
										
											2015-11-18 17:33:46 +02:00
										 |  |  |     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_run:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | platformio run
 | 
					
						
							|  |  |  | ==============
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. contents::
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Usage
 | 
					
						
							|  |  |  | -----
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     platformio run [OPTIONS]
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Description
 | 
					
						
							|  |  |  | -----------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Process environments which are defined in :ref:`projectconf` file
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Options
 | 
					
						
							|  |  |  | -------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-07 16:44:56 +01:00
										 |  |  | .. program:: platformio run
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | .. option::
 | 
					
						
							|  |  |  |     -e, --environment
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-27 14:10:18 +03:00
										 |  |  | Process specified environments.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | You can also specify which environments should be processed by default using
 | 
					
						
							|  |  |  | :ref:`projectconf_pio_env_default`.
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. option::
 | 
					
						
							|  |  |  |     -t, --target
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-01 17:30:20 +03:00
										 |  |  | Process specified targets.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Pre-built targets:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * ``clean`` delete compiled object files, libraries and firmware/program binaries
 | 
					
						
							| 
									
										
										
										
											2015-11-02 22:36:49 +02:00
										 |  |  | * ``upload`` firmware "auto-uploading" for embedded platforms
 | 
					
						
							|  |  |  | * ``program`` firmware "auto-uploading" for embedded platforms using external
 | 
					
						
							|  |  |  |   programmer (available only for :ref:`platform_atmelavr`)
 | 
					
						
							| 
									
										
										
										
											2015-08-01 17:30:20 +03:00
										 |  |  | * ``uploadlazy`` upload existing firmware without project rebuilding
 | 
					
						
							| 
									
										
										
										
											2015-12-28 01:15:06 +02:00
										 |  |  | * ``uploadfs`` :ref:`platform_espressif_uploadfs`
 | 
					
						
							| 
									
										
										
										
											2015-08-01 17:30:20 +03:00
										 |  |  | * ``envdump`` dump current build environment
 | 
					
						
							|  |  |  | * ``size`` print the size of the sections in a firmware/program
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. option::
 | 
					
						
							|  |  |  |     --upload-port
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Upload port of embedded board. To print all available ports use
 | 
					
						
							| 
									
										
										
										
											2016-06-15 14:10:42 +03:00
										 |  |  | :ref:`cmd_serialports` command.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | If upload port is not specified, PlatformIO will try to detect it automatically.
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-06 17:29:58 +01:00
										 |  |  | .. option::
 | 
					
						
							| 
									
										
										
										
											2015-09-04 18:28:13 +03:00
										 |  |  |     -d, --project-dir
 | 
					
						
							| 
									
										
										
										
											2015-05-06 17:29:58 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-04 18:28:13 +03:00
										 |  |  | Specify the path to project directory. By default, ``--project-dir`` is equal
 | 
					
						
							|  |  |  | to current working directory (``CWD``).
 | 
					
						
							| 
									
										
										
										
											2015-05-06 17:29:58 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-15 22:40:29 +02:00
										 |  |  | .. option::
 | 
					
						
							|  |  |  |     -v, --verbose
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-17 00:48:59 +03:00
										 |  |  | Shows detailed information when processing environments.
 | 
					
						
							| 
									
										
										
										
											2015-05-15 22:40:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-17 00:48:59 +03:00
										 |  |  | This option can be set globally using :ref:`setting_force_verbose` setting
 | 
					
						
							|  |  |  | or by environment variable :envvar:`PLATFORMIO_SETTING_FORCE_VERBOSE`.
 | 
					
						
							| 
									
										
										
										
											2015-05-15 22:40:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-21 14:53:38 +03:00
										 |  |  | .. option::
 | 
					
						
							|  |  |  |     --disable-auto-clean
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Disable auto-clean of :ref:`projectconf_pio_envs_dir` when :ref:`projectconf`
 | 
					
						
							|  |  |  | or :ref:`projectconf_pio_src_dir` (project structure) have been modified.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | Examples
 | 
					
						
							|  |  |  | --------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-23 20:21:04 +03:00
										 |  |  | 1. Process `Wiring Blink Example <https://github.com/platformio/platformio-examples/tree/develop/wiring-blink>`_
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. code-block::   bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $ platformio run
 | 
					
						
							| 
									
										
										
										
											2016-07-17 00:48:59 +03:00
										 |  |  |     [Sun Jul 17 00:09:16 2016] Processing uno (platform: atmelavr, board: uno, framework: arduino)
 | 
					
						
							|  |  |  |     -----------------------------------------------------------------------------------------------
 | 
					
						
							|  |  |  |     Looking for dependencies...
 | 
					
						
							|  |  |  |     Collecting 32 compatible libraries
 | 
					
						
							|  |  |  |     Processing src/main.cpp
 | 
					
						
							|  |  |  |     Processing .pioenvs/uno/libFrameworkArduinoVariant.a
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoavr/cores/arduino/CDC.cpp
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoavr/cores/arduino/HardwareSerial.cpp
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoavr/cores/arduino/HardwareSerial0.cpp
 | 
					
						
							|  |  |  |     ...
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_analog.c
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_digital.c
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_pulse.c
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoavr/cores/arduino/wiring_shift.c
 | 
					
						
							|  |  |  |     Processing .pioenvs/uno/libFrameworkArduino.a
 | 
					
						
							|  |  |  |     Processing .pioenvs/uno/firmware.elf
 | 
					
						
							|  |  |  |     Processing .pioenvs/uno/firmware.hex
 | 
					
						
							|  |  |  |     Processing size
 | 
					
						
							|  |  |  |     AVR Memory Usage
 | 
					
						
							|  |  |  |     ----------------
 | 
					
						
							|  |  |  |     Device: atmega328p
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-17 00:48:59 +03:00
										 |  |  |     Program:    1034 bytes (3.2% Full)
 | 
					
						
							|  |  |  |     (.text + .data + .bootloader)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Data:          9 bytes (0.4% Full)
 | 
					
						
							|  |  |  |     (.data + .bss + .noinit)
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 2. Process specific environment
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $ platformio run -e arduino_pro5v -e launchpad_lm4f120
 | 
					
						
							| 
									
										
										
										
											2016-07-17 00:48:59 +03:00
										 |  |  |     [Sun Jul 17 00:10:14 2016] Processing nodemcu (platform: espressif, board: nodemcu, framework: arduino)
 | 
					
						
							|  |  |  |     --------------------------------------------------------------------------------------------------------
 | 
					
						
							|  |  |  |     Looking for dependencies...
 | 
					
						
							|  |  |  |     Collecting 29 compatible libraries
 | 
					
						
							|  |  |  |     Processing src/main.cpp
 | 
					
						
							|  |  |  |     Processing .pioenvs/nodemcu/libFrameworkArduinoVariant.a
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoespressif/cores/esp8266/Esp.cpp
 | 
					
						
							|  |  |  |     ...
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoespressif/cores/esp8266/pgmspace.cpp
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoespressif/cores/esp8266/setjmp.S
 | 
					
						
							|  |  |  |     Processing .pioenvs/nodemcu/libFrameworkArduino.a
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoespressif/tools/sdk/lib/libmesh.a
 | 
					
						
							|  |  |  |     ...
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoespressif/tools/sdk/lib/libaxtls.a
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoespressif/tools/sdk/lib/libstdc++.a
 | 
					
						
							|  |  |  |     Processing .pioenvs/nodemcu/firmware.elf
 | 
					
						
							|  |  |  |     Processing .platformio/packages/tool-esptool/esptool
 | 
					
						
							|  |  |  |     Processing .pioenvs/nodemcu/firmware.bin
 | 
					
						
							|  |  |  |     Processing size
 | 
					
						
							|  |  |  |     text       data     bss     dec     hex filename
 | 
					
						
							|  |  |  |     221456      884   29496  251836   3d7bc .pioenvs/nodemcu/firmware.elf
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 3. Process specific target
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $ platformio run -t clean
 | 
					
						
							| 
									
										
										
										
											2016-07-17 00:48:59 +03:00
										 |  |  |     [Sun Jul 17 00:19:36 2016] Processing uno (platform: atmelavr, board: uno, framework: arduino)
 | 
					
						
							|  |  |  |     ----------------------------------------------------------------------------------------------------------------------------------------------------------------
 | 
					
						
							|  |  |  |     Looking for dependencies...
 | 
					
						
							|  |  |  |     Collecting 32 compatible libraries
 | 
					
						
							|  |  |  |     Removed .pioenvs/uno/FrameworkArduino/CDC.o
 | 
					
						
							|  |  |  |     Removed .pioenvs/uno/FrameworkArduino/HardwareSerial.o
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  |     ...
 | 
					
						
							| 
									
										
										
										
											2016-07-17 00:48:59 +03:00
										 |  |  |     Removed .pioenvs/uno/libFrameworkArduinoVariant.a
 | 
					
						
							|  |  |  |     Removed .pioenvs/uno/src/main.o
 | 
					
						
							|  |  |  |     Removed .pioenvs/uno/libFrameworkArduino.a
 | 
					
						
							|  |  |  |     Removed .pioenvs/uno/firmware.elf
 | 
					
						
							|  |  |  |     Removed .pioenvs/uno/firmware.hex
 | 
					
						
							| 
									
										
										
										
											2014-08-09 16:31:20 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 4. Mix environments and targets
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. code-block:: bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-17 00:48:59 +03:00
										 |  |  |     $ platformio run -e teensy31 -t upload
 | 
					
						
							|  |  |  |     [Sun Jul 17 00:27:14 2016] Processing teensy31 (platform: teensy, board: teensy31, framework: arduino)
 | 
					
						
							|  |  |  |     -------------------------------------------------------------------------------------------------------
 | 
					
						
							|  |  |  |     Looking for dependencies...
 | 
					
						
							|  |  |  |     Collecting 25 compatible libraries
 | 
					
						
							|  |  |  |     Processing src/main.cpp
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/AudioStream.cpp
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/DMAChannel.cpp
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/HardwareSerial1.cpp
 | 
					
						
							|  |  |  |     ...
 | 
					
						
							|  |  |  |     Processing .platformio/packages/framework-arduinoteensy/cores/teensy3/yield.cpp
 | 
					
						
							|  |  |  |     Processing .platformio/packages/tool-teensy/teensy_loader_cli
 | 
					
						
							|  |  |  |     Processing .pioenvs/teensy31/libFrameworkArduino.a
 | 
					
						
							|  |  |  |     Processing .pioenvs/teensy31/firmware.elf
 | 
					
						
							|  |  |  |     Check program size...
 | 
					
						
							|  |  |  |     text       data     bss     dec     hex filename
 | 
					
						
							|  |  |  |     11080       168    2288   13536    34e0 .pioenvs/teensy31/firmware.elf
 | 
					
						
							|  |  |  |     Processing .pioenvs/teensy31/firmware.hex
 | 
					
						
							|  |  |  |     Processing upload
 | 
					
						
							|  |  |  |     Teensy Loader, Command Line, Version 2.0
 | 
					
						
							|  |  |  |     Read ".pioenvs/teensy31/firmware.hex": 11248 bytes, 4.3% usage
 | 
					
						
							|  |  |  |     Soft reboot is not implemented for OSX
 | 
					
						
							|  |  |  |     Waiting for Teensy device...
 | 
					
						
							|  |  |  |     (hint: press the reset button)
 | 
					
						
							|  |  |  |     Found HalfKay Bootloader
 | 
					
						
							|  |  |  |     Read ".pioenvs/teensy31/firmware.hex": 11248 bytes, 4.3% usage
 | 
					
						
							|  |  |  |     Programming...........
 | 
					
						
							|  |  |  |     Booting
 |