platform = espressif8266
Espressif Systems is a privately held fabless semiconductor company. They provide wireless communications and Wi-Fi chips which are widely used in mobile devices and the Internet of Things applications.
For more detailed information please visit vendor site.
See board_build.f_cpu option from “platformio.ini” (Project Configuration File)
[env:myenv]
; set frequency to 160MHz
board_build.f_cpu = 160000000L
Please use board_build.f_flash
option from “platformio.ini” (Project Configuration File) to change
a value. Possible values:
20000000L
26000000L
40000000L
(default)
80000000L
[env:myenv]
; set frequency to 80MHz
board_build.f_flash = 80000000L
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.
Please use board_build.flash_mode
option from “platformio.ini” (Project Configuration File) to change
a value. Possible values:
qio
qout
dio
dout
[env:myenv]
board_build.flash_mode = qio
You can set custom reset method using upload_resetmethod option from “platformio.ini” (Project Configuration File).
The possible values are:
ck
- RTS controls RESET or CH_PD, DTR controls GPIO0
wifio
- TXD controls GPIO0 via PNP transistor and DTR controls RESET via a capacitor
nodemcu
- GPIO0 and RESET controlled using two NPN transistors as in NodeMCU devkit.
See default reset methods per board.
[env:myenv]
upload_resetmethod = ck
Warning
Please make sure to read ESP8266 Flash layout information first.
Available LD-scripts: https://github.com/esp8266/Arduino/tree/master/tools/sdk/ld
Please open eagle.flash.***.ld
file to check how flash is split.
To override default LD script please use build_flags from “platformio.ini” (Project Configuration File).
[env:myenv]
build_flags = -Wl,-Teagle.flash.4m.ld
You can set custom upload speed using upload_speed option from “platformio.ini” (Project Configuration File)
[env:myenv]
upload_speed = 9600
Available variants (macros):
-D PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
v1.4 Higher Bandwidth
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
v2 Lower Memory (default)
-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
v2 Higher Bandwidth
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH
-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
You can change lwIP Variant passing a custom macro using project build_flags.
For example, switch to lwIP v1.4
[env:myenv]
...
build_flags = -D PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
Please use the next build_flags to enable Serial debug:
[env:myenv]
...
build_flags = -DDEBUG_ESP_PORT=Serial
; or for Serial1
build_flags = -DDEBUG_ESP_PORT=Serial1
Please use one of the next build_flags to change debug level. A build_flags option could be used only the one time per build environment. If you need to specify more flags, please separate them with a new line or space.
Also, please note that you will need to extend build_flags
with Serial Debug macro. For example,
build_flags = -DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL ...
.
Actual information is available in Arduino for ESP8266 Board Manifest.
Please scroll to generic.menu.DebugLevel
section.
[env:myenv]
platform = ...
board = ...
framework = arduino
;;;;; Possible options ;;;;;;
; SSL
build_flags = -DDEBUG_ESP_SSL
; TLS_MEM
build_flags = -DDEBUG_ESP_TLS_MEM
; HTTP_CLIENT
build_flags = -DDEBUG_ESP_HTTP_CLIENT
; HTTP_SERVER
build_flags = -DDEBUG_ESP_HTTP_SERVER
; SSL+TLS_MEM
build_flags =
-DDEBUG_ESP_SSL
-DDEBUG_ESP_TLS_MEM
; SSL+HTTP_CLIENT
build_flags =
-DDEBUG_ESP_SSL
-DDEBUG_ESP_HTTP_CLIENT
; SSL+HTTP_SERVER
build_flags =
-DDEBUG_ESP_SSL
-DDEBUG_ESP_HTTP_SERVER
; TLS_MEM+HTTP_CLIENT
build_flags =
-DDEBUG_ESP_TLS_MEM
-DDEBUG_ESP_HTTP_CLIENT
; TLS_MEM+HTTP_SERVER
build_flags =
-DDEBUG_ESP_TLS_MEM
-DDEBUG_ESP_HTTP_SERVER
; HTTP_CLIENT+HTTP_SERVER
build_flags =
-DDEBUG_ESP_HTTP_CLIENT
-DDEBUG_ESP_HTTP_SERVER
; SSL+TLS_MEM+HTTP_CLIENT
build_flags =
-DDEBUG_ESP_SSL
-DDEBUG_ESP_TLS_MEM
-DDEBUG_ESP_HTTP_CLIENT
; SSL+TLS_MEM+HTTP_SERVER
build_flags =
-DDEBUG_ESP_SSL
-DDEBUG_ESP_TLS_MEM
-DDEBUG_ESP_HTTP_SERVER
; SSL+HTTP_CLIENT+HTTP_SERVER
build_flags =
-DDEBUG_ESP_SSL
-DDEBUG_ESP_HTTP_CLIENT
-DDEBUG_ESP_HTTP_SERVER
; TLS_MEM+HTTP_CLIENT+HTTP_SERVER
build_flags =
-DDEBUG_ESP_TLS_MEM
-DDEBUG_ESP_HTTP_CLIENT
-DDEBUG_ESP_HTTP_SERVER
; SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER
build_flags =
-DDEBUG_ESP_SSL
-DDEBUG_ESP_TLS_MEM
-DDEBUG_ESP_HTTP_CLIENT
-DDEBUG_ESP_HTTP_SERVER
; CORE
build_flags = -DDEBUG_ESP_CORE
; WIFI
build_flags = -DDEBUG_ESP_WIFI
; HTTP_UPDATE
build_flags = -DDEBUG_ESP_HTTP_UPDATE
; UPDATER
build_flags = -DDEBUG_ESP_UPDATER
; OTA
build_flags = -DDEBUG_ESP_OTA
; OOM
build_flags =
-DDEBUG_ESP_OOM
-include "umm_malloc/umm_malloc_cfg.h"
; CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM
build_flags =
-DDEBUG_ESP_CORE
-DDEBUG_ESP_WIFI
-DDEBUG_ESP_HTTP_UPDATE
-DDEBUG_ESP_UPDATER
-DDEBUG_ESP_OTA
-DDEBUG_ESP_OOM -include "umm_malloc/umm_malloc_cfg.h"
; SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM
build_flags =
-DDEBUG_ESP_SSL
-DDEBUG_ESP_TLS_MEM
-DDEBUG_ESP_HTTP_CLIENT
-DDEBUG_ESP_HTTP_SERVER
-DDEBUG_ESP_CORE
-DDEBUG_ESP_WIFI
-DDEBUG_ESP_HTTP_UPDATE
-DDEBUG_ESP_UPDATER
-DDEBUG_ESP_OTA
-DDEBUG_ESP_OOM -include "umm_malloc/umm_malloc_cfg.h"
; NoAssert-NDEBUG
build_flags = -DNDEBUG
Please use one of the next build_flags:
[env:myenv]
...
; Flash (default)
build_flags = -DVTABLES_IN_FLASH
; Heap
build_flags = -DVTABLES_IN_DRAM
; IRAM
build_flags = -DVTABLES_IN_IRAM
Warning
Please make sure to read ESP8266 Flash layout information first.
Create new project using PlatformIO IDE or initialize project using PlatformIO Core (CLI) and platformio init (if you have not initialized it yet)
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
Run “Upload File System image” task in PlatformIO IDE or use PlatformIO Core (CLI)
and platformio run --target
command with uploadfs
target.
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 Flash Size.
Active discussion is located in issue #382.
Firstly, please read What is OTA? How to use it?
There are 2 options:
Directly specify platformio run --upload-port
in command line
platformio run --target upload --upload-port IP_ADDRESS_HERE or mDNS_NAME.local
Specify upload_port
option in “platformio.ini” (Project Configuration File)
[env:myenv]
upload_port = IP_ADDRESS_HERE or mDNS_NAME.local
For example,
platformio run -t upload --upload-port 192.168.0.255
platformio run -t upload --upload-port myesp8266.local
You can pass additional options/flags to OTA uploader using
upload_flags
option in “platformio.ini” (Project Configuration File)
[env:myenv]
; each flag in a new line
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 --help
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.
-I HOST_IP, --host_ip=HOST_IP
Host IP Address.
-p ESP_PORT, --port=ESP_PORT
ESP8266 ota Port. Default 8266
-P HOST_PORT, --host_port=HOST_PORT
Host server ota Port. Default random 10000-60000
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
-t TIMEOUT, --timeout=TIMEOUT
Timeout to wait for the ESP8266 to accept invitation
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
.
Please install PlatformIO IDE
Initialize a new project, open “platformio.ini” (Project Configuration File) 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
Try to build project
If you see build errors, then try to build this project using the same
stage
with Arduino IDE
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)
Examples are listed from Espressif 8266 development platform repository:
You can switch between stable releases of Espressif 8266 development platform and the latest upstream version using platform option in “platformio.ini” (Project Configuration File) as described below.
; Latest stable version
[env:latest_stable]
platform = espressif8266
board = ...
; Custom stable version
[env:custom_stable]
platform = espressif8266@x.y.z
board = ...
[env:upstream_develop]
platform = https://github.com/platformio/platform-espressif8266.git
board = ...
Name |
Description |
---|---|
Arduino Wiring-based Framework (ESP8266 Core) |
|
ESP8266 Non-OS SDK |
|
ESP8266 SDK based on FreeRTOS |
|
Simba Framework |
|
ESP8266 SDK |
|
ESP8266 OTA utility |
|
esptool-ck |
|
Tool to build and unpack SPIFFS images |
|
xtensa-gcc |
Warning
Linux Users:
Install “udev” rules 99-platformio-udev.rules
Raspberry Pi users, please read this article Enable serial port on Raspberry Pi.
Windows Users:
Please check that you have a correctly installed USB driver from board manufacturer
Name |
Description |
---|---|
Arduino Wiring-based Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences. |
|
The non-OS SDK provides a set of application programming interfaces (APIs) for core ESP8266 functionalities such as data reception/transmission over Wi-Fi, TCP/IP stack functions, hardware interface functions and basic system management functions. |
|
ESP8266 SDK based on FreeRTOS, a truly free professional grade RTOS for microcontrollers |
|
Simba is an RTOS and build framework. It aims to make embedded programming easy and portable. |
Note
You can list pre-configured boards by platformio boards command or PlatformIO Boards Explorer
For more detailed board
information please scroll tables below by
horizontal.
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
512KB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
2MB |
80KB |
|
No |
ESP8266 |
80MHz |
4MB |
80KB |
|
No |
ESP8266 |
80MHz |
1MB |
80KB |
|
No |
ESP8266 |
80MHz |
512KB |
80KB |
|
No |
ESP8266 |
80MHz |
4MB |
80KB |
|
No |
ESP8266 |
80MHz |
423.98KB |
80KB |
|
No |
ESP8266 |
80MHz |
4MB |
80KB |
|
No |
ESP8266 |
80MHz |
4MB |
80KB |
|
No |
ESP8266 |
80MHz |
1MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
2MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
|
No |
ESP8266 |
80MHz |
512KB |
80KB |
|
No |
ESP8266 |
80MHz |
512KB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
|
No |
ESP8266 |
80MHz |
4MB |
80KB |
|
No |
ESP8266 |
80MHz |
1MB |
80KB |
|
No |
ESP8266 |
80MHz |
16MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP8266 |
80MHz |
4MB |
80KB |