Custom CPU Frequency

See board_f_cpu option from Project Configuration File platformio.ini

[env:myenv]
; set frequency to 160MHz
board_f_cpu = 160000000L

Custom FLASH Frequency

See board_f_flash option from Project Configuration File platformio.ini. Possible values:

[env:myenv]
; set frequency to 80MHz
board_f_flash = 80000000L

Custom FLASH Mode

Flash chip interface mode. This parameter is stored in the binary image header, along with the flash size and flash frequency. The ROM bootloader in the ESP chip uses the value of these parameters in order to know how to talk to the flash chip.

See board_flash_mode option from Project Configuration File platformio.ini. Possible values:

[env:myenv]
board_flash_mode = qio

Custom Reset Method

You can set custom reset method using upload_resetmethod option from Project Configuration File platformio.ini.

The possible values are:

See default reset methods per board.

[env:myenv]
upload_resetmethod = ck

Custom Flash Size

Warning

Please make sure to read ESP8266 Flash layout information first.

Available LD-scripts: https://github.com/esp8266/Arduino/tree/master/tools/sdk/ld

To override default LD script please use build_flags from Project Configuration File platformio.ini.

[env:myenv]
build_flags = -Wl,-Teagle.flash.4m.ld

Custom Upload Speed

You can set custom upload speed using upload_speed option from Project Configuration File platformio.ini

[env:myenv]
upload_speed = 9600

Uploading files to file system SPIFFS

Warning

Please make sure to read ESP8266 Flash layout information first.

  1. Initialize project platformio init (if you have not initialized yet)

  2. Create data folder (it should be on the same level as src folder) and put files here. Also, you can specify own location for data_dir

  3. Run buildfs or uploadfs target using platformio run --target command.

To upload SPIFFS image using OTA update please specify upload_port / --upload-port as IP address or mDNS host name (ending with the *.local). For the details please follow to Over-the-Air (OTA) update.

By default, will be used default LD Script for the board where is specified SPIFFS offsets (start, end, page, block). You can override it using Custom Flash Size.

Active discussion is located in issue #382.

Over-the-Air (OTA) update

Firstly, please read What is OTA? How to use it?

There are 2 options:

platformio run --target upload --upload-port IP_ADDRESS_HERE or mDNS_NAME.local
[env:myenv]
upload_port = IP_ADDRESS_HERE or mDNS_NAME.local

For example,

Authentication and upload options

You can pass additional options/flags to OTA uploader using upload_flags option in Project Configuration File platformio.ini

[env:myenv]
upload_flags = --port=8266

Available flags

  • --port=ESP_PORT ESP8266 OTA Port. Default 8266

  • --auth=AUTH Set authentication password

  • --spiffs Use this option to transmit a SPIFFS image and do not flash the module

For the full list with available options please run

~/.platformio/packages/tool-espotapy/espota.py -h

Usage: espota.py [options]

Transmit image over the air to the esp8266 module with OTA support.

Options:
  -h, --help            show this help message and exit

  Destination:
    -i ESP_IP, --ip=ESP_IP
                        ESP8266 IP Address.
    -p ESP_PORT, --port=ESP_PORT
                        ESP8266 ota Port. Default 8266

  Authentication:
    -a AUTH, --auth=AUTH
                        Set authentication password.

  Image:
    -f FILE, --file=FILE
                        Image file.
    -s, --spiffs        Use this option to transmit a SPIFFS image and do not
                        flash the module.

  Output:
    -d, --debug         Show debug output. And override loglevel with debug.
    -r, --progress      Show progress output. Does not work for ArduinoIDE

Demo

../../_images/platformio-demo-ota-esp8266.jpg

Using Arduino Framework with Staging version

PlatformIO will install the latest Arduino Core for ESP8266 from https://github.com/esp8266/Arduino. The Git should be installed in a system. To update Arduino Core to the latest revision, please open PlatformIO IDE and navigate to PIO Home > Platforms > Updates.

  1. Please install PlatformIO IDE

  2. Initialize a new project, open Project Configuration File platformio.ini and set platform to https://github.com/platformio/platform-espressif8266.git#feature/stage. For example,

    [env:nodemcuv2]
    platform = https://github.com/platformio/platform-espressif8266.git#feature/stage
    board = nodemcuv2
    framework = arduino
    
  3. Try to build project

  4. If you see build errors, then try to build this project using the same stage with Arduino IDE

  5. If it works with Arduino IDE but doesn’t work with PlatformIO, then please file new issue with attached information:

    • test project/files

    • detailed log of build process from Arduino IDE (please copy it from console to https://hastebin.com)

    • detailed log of build process from PlatformIO Build System (please copy it from console to https://hastebin.com)

Articles

See more Articles about us.

Examples

All project examples are located in PlatformIO repository Examples for Espressif 8266 platform.