Selecting the Suitable Flashing Platform
Note
This document is automatically translated using AI. Please excuse any detailed errors. The official English version is still in progress.
Espressif officially provides the following flashing methods for different needs:
Quick Firmware Testing: ESP LAUNCHPAD Quick Firmware Flashing
Advantage: Simple and fast, no need to set up an environment or additional tools, firmware can be easily flashed through the Web interface
Non-developers performing flashing: Flash Download Tool Flashing
Advantage: Provides a graphical interface, no need to understand command line operations in depth, also suitable for automated deployment and batch production flashing
Professional developers for comprehensive firmware development: IDE Flashing
Advantage: Integrated Development Environment (IDE) provides an intuitive user interface and toolset, supports firmware development, debugging and integrated flashing
Professional developers for comprehensive firmware development and more detailed configuration: IDF Terminal Flashing
Advantage: Allows developers to precisely manage projects, including firmware parameter settings. Convenient for flashing during development and debugging to quickly verify changes
Preparation
Note
If you haven’t selected a suitable development board for your project yet, please refer to Board selection
For the differences between chips, modules, and development boards, please refer to Chips, Modules, Development Boards
Using the Development Board
You can flash by connecting the USB or UART interface with a data cable.
Note
Some development boards use the USB Type C interface. Please make sure to use the appropriate data cable.
Using the Chip or Module
Espressif chips generally have two modes:
Firmware Flashing Mode: The chip will wait to receive firmware from the serial port for flashing. Usually, a flashing tool is needed to send firmware data
Normal Operating Mode: This is the normal working mode of the chip, it will load and run the firmware from the Flash storage
To use the chip or module, you need to enter the flashing mode by setting the status of specific pins, and flash through the UART0 or USB peripheral.
Note
Specific pin information should be referenced from the corresponding chip’s technical datasheet, which can be found on the Espressif official website.
ESP LAUNCHPAD Quick Firmware Flashing
ESP LAUNCHPAD is a platform that allows developers to quickly experience the features of Espressif chips.
After selecting some example firmware provided by Espressif, you can directly flash it on the web page
Developers can also upload their compiled
.bin
files and flash them on the web page
ESP LAUNCHPAD Flashing Process
The following uses ESP-BOX as an example:
Open the website ESP LAUCHPAD
Click on the top right Connect
In the pop-up window, select the Port to connect to the ESP-BOX
Click Connect below
Select the firmware to be flashed to the ESP-BOX
Select ESP Chipset Type as
ESP32-S3
Click the bottom left Flash button to start flashing
After the flashing starts, it will jump to the console interface, if correct, the flashing progress will be displayed
After the flashing is completed, press the top left Reset Device button, or click Disconnect in the top right corner.
Flash Download Tool Flashing
The Flash Download Tool is a tool developed by Espressif for flashing firmware to its ESP series chips, used to load pre-compiled firmware files into the chip’s flash memory, enabling the chip to correctly run applications or firmware.
Using the Flash download tool Flashing Process
Run the
.exe
file of flash_download_toolSelect Development Board (ChipType) as the corresponding development board, there will generally be a mark on the chip. Select Flashing Mode (LoadMode) as
UART
and then click OK belowClick to select the
.bin
file to be flashedEnter the address offset to be flashed, you can default to the starting position
0x0
Select the COM port connected to the development board
Click START at the bottom left to start flashing
The interface will display a blue FINISH after the flashing is completed
Use Flash download tool for Flash encryption and secure boot
Disable all secure boot and Flash encryption configurations in menuconfig to ensure that plaintext firmware can be generated after compilation
Adjust the offset of the default partition table (Offset of partition table), adjust from
0x8000
to0xa000
Note
Flash encryption will increase the size of the bootloader .bin firmware, so you must leave enough space for the offset address
Open the folder of Flash Download Tool, open configure -> esp chip type -> security.conf. Enable the following configurations and save the file:
[SECURE BOOT] secure_boot_en = True [FLASH ENCRYPTION] flash_encryption_en = True reserved_burn_times = 3 [ENCRYPTION KEYS SAVE] keys_save_enable = True encrypt_keys_enable = False encrypt_keys_aeskey_path = [DISABLE FUNC] jtag_disable = False dl_encrypt_disable = False dl_decrypt_disable = False dl_cache_disable = False
Restart Flash Download Tool
Add the generated plaintext firmware to the Flash Download Tool and set the corresponding offset address
Use the Flash Download Tool to flash the
.bin
plaintext firmware according to the above Using the Flash download tool Flashing Process, the encryption key will be saved locally
IDE Flashing
After setting up the development environment, you can use the ESP-IDF plugin in the IDE to build and flash.
Choose an instance project of interest from esp-iot-solution or the built-in
examples
of ESP-IDF.
Note
For environment setup, refer to: VSCode ESP IDF Extension
We can experience the flashing process of ESP32-S3-BOX, this project uses ESP32-S3-BOX as a USB speaker.
Take VSCode as an Example:
Enter the path where you want to save the project in VSCode, and select Terminal -> New Terminal in the upper left window
Use
git clone
to download the code of this projectgit clone --recursive https://github.com/espressif/esp-box.git
Open VSCode, select file -> open folder (or use the shortcut Ctrl + K, Ctrl + O) in the upper left window to enter the path where the project is saved -> esp-box -> examples -> usb_headset. Click to select the folder.
Connect the ESP-BOX to the computer via a data cable
Select the corresponding
COM port
in the lower left cornerNote
If the COM port is not detected, hold down the Boot key and the Reset key of the development board at the same time to enter the download mode
Select Target as
esp32s3
, VSCode selects ESP32-S3 chip (via ESP-PROG) at the top of the interfaceClick the ESP-IDF Build Project icon, after successful compilation, it will display:
Click the ESP-IDF Flash device icon to flash, then select UART at the top of the VSCode interface. After successful flashing, it will display in the terminal: Flash Done ⚡️
After pressing the Reset button on the development board, you can use the ESP-BOX to play sound via USB
IDF Terminal Flashing
Using the IDF terminal has advantages such as stable environment, easy version switching, and full advanced features.
Note
For environment setup, you can refer to: Windows Installation Guide.
The following will introduce how to use the IDF terminal to flash an example project:
Open the
ESP-IDF CMD
terminal window, the interface of successful installation of ESP-IDF SDK is shown as follows:Use the
cd
command to enter a project, for example:Switch to the correct chip environment, for example:
idf.py set-target esp32
Note
Replace
esp32
with the correct chip targetRun the following command to build the project:
idf.py build
Run the following command to flash the project, replace
PORT
with the serial name of the development board:idf.py -p PORT flash
Note
Using
idf.py flash
will attempt to automatically connect using the available serial port
The interface of successful flashing is shown as follows: