platform = espressif32
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:
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 enable external RAM using the next extra build_flags in “platformio.ini” (Project Configuration File) depending on a framework type.
Framework Arduino:
[env:myenv]
platform = espressif32
framework = arduino
board = ...
build_flags =
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
Framework ESP-IDF:
[env:myenv]
platform = espressif32
framework = espidf
board = ...
build_flags =
-DCONFIG_SPIRAM_CACHE_WORKAROUND
More details are located in the official ESP-IDF documentation - Support for external RAM.
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.
Actual information is available in Arduino for ESP32 Board Manifest.
Please scroll to esp32.menu.DebugLevel
section.
[env:myenv]
platform = ...
board = ...
framework = arduino
;;;;; Possible options ;;;;;;
; None
build_flags = -DCORE_DEBUG_LEVEL=0
; Error
build_flags = -DCORE_DEBUG_LEVEL=1
; Warn
build_flags = -DCORE_DEBUG_LEVEL=2
; Info
build_flags = -DCORE_DEBUG_LEVEL=3
; Debug
build_flags = -DCORE_DEBUG_LEVEL=4
; Verbose
build_flags = -DCORE_DEBUG_LEVEL=5
You can set custom upload speed using upload_speed option from “platformio.ini” (Project Configuration File)
[env:myenv]
upload_speed = 9600
Please platformio run --target
the next command to erase the entire
flash chip (all data replaced with 0xFF bytes):
> platformio run --target erase
# or short version
> pio run -t erase
Please add -D PIO_FRAMEWORK_ESP_IDF_ENABLE_EXCEPTIONS
to build_flags
of “platformio.ini” (Project Configuration File) to enable C++ exceptions for ESP-IDF.
See project example.
You can create a custom partitions table (CSV) following ESP32 Partition Tables documentation. PlatformIO uses default partition tables depending on a framework type:
To override default table please use board_build.partitions
option in
“platformio.ini” (Project Configuration File).
Warning
SPIFFS partition MUST have configured “Type” as “data” and “SubType”
as “spiffs”. For example, spiffs, data, spiffs, 0x291000, 1M,
Examples:
; 1) A "partitions_custom.csv" in the root of project directory
[env:custom_table]
board_build.partitions = partitions_custom.csv
; 2) Switch between built-in tables
; https://github.com/espressif/arduino-esp32/tree/master/tools/partitions
; https://github.com/espressif/esp-idf/tree/master/components/partition_table
[env:custom_builtin_table]
board_build.partitions = no_ota.csv
Sometimes you have a file with some binary or text data that you’d like to make available to your program - but you don’t want to reformat the file as C source.
You can set a macro (define) COMPONENT_EMBED_TXTFILES
using
build_flags in “platformio.ini” (Project Configuration File), giving the names of the
files to embed in this way:
[env:myenv]
platform = espressif32
board = ...
build_flags =
-DCOMPONENT_EMBED_TXTFILES=src/private.pem.key:src/certificate.pem.crt:src/aws-root-ca.pem
Multiple files are allowed and should be split by colon - :
.
The file’s contents will be added to the .rodata
section in flash, and
are available via symbol names as follows:
extern const uint8_t aws_root_ca_pem_start[] asm("_binary_src_aws_root_ca_pem_start");
extern const uint8_t aws_root_ca_pem_end[] asm("_binary_src_aws_root_ca_pem_end");
extern const uint8_t certificate_pem_crt_start[] asm("_binary_src_certificate_pem_crt_start");
extern const uint8_t certificate_pem_crt_end[] asm("_binary_src_certificate_pem_crt_end");
extern const uint8_t private_pem_key_start[] asm("_binary_src_private_pem_key_start");
extern const uint8_t private_pem_key_end[] asm("_binary_src_private_pem_key_end");
The names are generated from the full name of the file, as given in
COMPONENT_EMBED_TXTFILES
. Characters /, .
, etc. are replaced with
underscores. The _binary
+ _nested_folder
prefix in the symbol name
is added by “objcopy” and is the same for both text and binary files.
See full example with embedding Amazon AWS certificates:
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
).
Examples:
Video and presentation - swampUP: Over-The-Air (OTA) firmware upgrades for Internet of Things devices with PlatformIO and JFrog Bintray
Demo source code: https://github.com/platformio/bintray-secure-ota
Demo code for:
There are 2 options how to upload firmware OTA:
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 myesp32.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=3232
Available flags
--port=ESP_PORT
ESP32 OTA Port. Default 3232
--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 esp32 module with OTA support.
Options:
-h, --help show this help message and exit
Destination:
-i ESP_IP, --ip=ESP_IP
ESP32 IP Address.
-p ESP_PORT, --port=ESP_PORT
ESP32 ota Port. Default 3232
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
PlatformIO will install the latest Arduino Core for ESP32 from
https://github.com/espressif/arduino-esp32. 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-espressif32.git#feature/stage
.
For example,
[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git#feature/stage
board = esp32dev
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)
Tips, tricks and common problems: http://desire.giesecke.tk/index.php/2018/01/30/esp32-wiki-entries/
Examples are listed from Espressif 32 development platform repository:
PIO Unified Debugger - “1-click” solution for debugging with a zero configuration.
JTAG Wiring Connections
Board Pin |
JTAG Tool Pin |
---|---|
IO13 |
TCK |
IO12 |
TDI |
IO15 |
TDO |
IO14 |
TMS |
EN |
RST |
GND |
GND |
Supported debugging tools are listed in “Debug” column. For more detailed information, please scroll table by horizontal. You can switch between debugging Tools & Debug Probes using debug_tool option in “platformio.ini” (Project Configuration File).
Warning
You will need to install debug tool drivers depending on your system. Please click on compatible debug tool below for the further instructions.
Boards listed below have on-board debug probe and ARE READY for debugging! You do not need to use/buy external debug probe.
Name |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|
ESP32 |
240MHz |
4MB |
320KB |
Boards listed below are compatible with PIO Unified Debugger but DEPEND ON external debug probe. They ARE NOT READY for debugging. Please click on board name for the further details.
Name |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
8MB |
320KB |
|
ESP32 |
240MHz |
8MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
1.25MB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
1.25MB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
|
ESP32 |
240MHz |
4MB |
320KB |
You can switch between stable releases of Espressif 32 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 = espressif32
board = ...
; Custom stable version
[env:custom_stable]
platform = espressif32@x.y.z
board = ...
[env:upstream_develop]
platform = https://github.com/platformio/platform-espressif32.git
board = ...
Name |
Description |
---|---|
Arduino Wiring-based Framework (ESP32 Core) |
|
Espressif IoT Development Framework |
|
Pumbaa Framework |
|
Simba Framework |
|
ESP8266 OTA utility |
|
ESP8266 and ESP32 serial bootloader utility |
|
Tool to build and unpack SPIFFS images |
|
OpenOCD for Espressif 32 |
|
xtensa32-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. |
|
Espressif IoT Development Framework. Official development framework for ESP32. |
|
Pumbaa is Python on top of Simba. The implementation is a port of MicroPython, designed for embedded devices with limited amount of RAM and code memory. |
|
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 |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
160MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
4MB |
320KB |
|
On-board |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
16MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
8MB |
320KB |
|
External |
ESP32 |
240MHz |
8MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
4MB |
320KB |
|
No |
ESP32 |
240MHz |
16MB |
6.25MB |
|
No |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
16MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
4MB |
320KB |
|
No |
ESP32 |
240MHz |
4MB |
320KB |
|
No |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
4MB |
1.25MB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
4MB |
1.25MB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
16MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
ESP32 |
240MHz |
4MB |
320KB |
|
External |
ESP32 |
240MHz |
4MB |
320KB |
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ESP32 |
240MHz |
2MB |
320KB |