upload_port
¶Type: String (Pattern)
| Multiple: No
This option is used by “uploader” tool when sending firmware to board via
upload_port
. For example,
/dev/ttyUSB0
- Serial port (Unix-based OS)
COM3
- Serial port (Windows OS)
192.168.0.13
- IP address when using OTA
/media/disk
- physical path to media disk/flash drive
(Mbed enabled boards)
D:
- physical path to media disk/flash drive (Windows OS).
If upload_port
isn’t specified, then PlatformIO will try to detect it
automatically.
To print all available serial ports please use platformio device list command.
This option can also be set by global environment variable
PLATFORMIO_UPLOAD_PORT
.
Please note that you can use Unix shell-style wildcards:
Pattern |
Meaning |
---|---|
|
matches everything |
|
matches any single character |
|
matches any character in seq |
|
matches any character not in seq |
Example
[env:uno]
platform = atmelavr
framework = arduino
; any port that starts with /dev/ttyUSB
upload_port = /dev/ttyUSB*
; COM1 or COM3
upload_port = COM[13]
upload_protocol
¶Type: String
| Multiple: No
A protocol that “uploader” tool uses to talk to a board. Please check Boards for supported uploading protocols by your board.
upload_speed
¶Type: Integer
| Multiple: No
A connection speed (baud rate) which “uploader” tool uses when sending firmware to board.
upload_flags
¶Type: String
| Multiple: Yes
Extra flags for uploader. Will be added to the end of uploader command. If you need to override uploader command or base flags please use extra_scripts.
This option can also be set by global environment variable
PLATFORMIO_UPLOAD_FLAGS
.
Example
Please specify each flag/option in a new line starting with minimum 2 spaces.
[env:atmega328pb]
platform = atmelavr
board = atmega328pb
framework = arduino
upload_flags =
-P$UPLOAD_PORT
-b$UPLOAD_SPEED
-u
-Ulock:w:0xCF:m
-Uhfuse:w:0xD7:m
-Uefuse:w:0xF6:m
-Ulfuse:w:0xE2:m
upload_resetmethod
¶Type: String
| Multiple: No
Specify reset method for “uploader” tool. This option isn’t available for all development platforms. The only Espressif 8266 supports it.
upload_command
¶Type: String
| Multiple: No
Override default Development Platforms upload command with a custom. You can pass a full upload command with arguments and options or mix with upload_flags.
Default upload commands are declared in build/main.py
script file of
Development Platforms. See a list with open source
Development Platforms => https://github.com/topics/platformio-platform
Note
Please note that you can use build variables in upload_command
, such as
PlatformIO project folders and other runtime configuration. A list with
build variables are available by running
platformio run --target envdump
command.
Examples
Override default upload command but handle pre-uploading actions (looking
for serial port, extra image preparation, etc.). Normally, the
pre-configured upload options will be stored in $UPLOADERFLAGS
build
variable. A classic default upload command for Development Platforms may look as
some-flash-bin-tool $UPLOADERFLAGS $SOURCE
, where
$SOURCE
will be replaced by a real program/firmware binary.
$PROJECT_PACKAGES_DIR
build variable points to packages_dir.
[env:program_via_AVR_ISP]
platform = atmelavr
framework = arduino
board = uno
upload_flags =
-C
$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
-p
atmega328p
-P
$UPLOAD_PORT
-b
115200
-c
stk500v1
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
Override default upload command and skip pre-uploading actions.
[env:program_via_usbasp]
platform = atmelavr
framework = arduino
board = uno
upload_flags =
-C
$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
-p
atmega328p
-Pusb
-c
stk500v1
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
; Use ST-util for flashing
; https://github.com/texane/stlink
[env:custom_st_flash]
platform = ststm32
framework = stm32cube
board = bluepill_f103c6
upload_command = $PROJECT_PACKAGES_DIR/tool-stlink/st-flash write $SOURCE 0x8000000