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:

  1. 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

  2. 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

  3. 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

  4. 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

get-ready

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:

  1. 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

  2. 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

  1. Click on the top right Connect

  2. In the pop-up window, select the Port to connect to the ESP-BOX

  3. Click Connect below

    launchpad
  4. Select the firmware to be flashed to the ESP-BOX

    launchpad1
  5. Select ESP Chipset Type as ESP32-S3

  6. Click the bottom left Flash button to start flashing

  7. After the flashing starts, it will jump to the console interface, if correct, the flashing progress will be displayed

    launchpad3
  8. 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

  1. Run the .exe file of flash_download_tool

  2. Select 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 below

    FLASH-DOWNLOAD-TOOL2
  3. Click to select the .bin file to be flashed

  4. Enter the address offset to be flashed, you can default to the starting position 0x0

  5. Select the COM port connected to the development board

  6. Click START at the bottom left to start flashing

    FLASH-DOWNLOAD-TOOL3
  7. The interface will display a blue FINISH after the flashing is completed

    FLASH-DOWNLOAD-TOOL3

Use Flash download tool for Flash encryption and secure boot

  1. Disable all secure boot and Flash encryption configurations in menuconfig to ensure that plaintext firmware can be generated after compilation

  2. Adjust the offset of the default partition table (Offset of partition table), adjust from 0x8000 to 0xa000

    Note

    Flash encryption will increase the size of the bootloader .bin firmware, so you must leave enough space for the offset address

  3. 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
    
  4. Restart Flash Download Tool

  5. Add the generated plaintext firmware to the Flash Download Tool and set the corresponding offset address

  6. 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

    FLASH-DOWNLOAD-TOOL-KEY

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:

  1. Enter the path where you want to save the project in VSCode, and select Terminal -> New Terminal in the upper left window

  2. Use git clone to download the code of this project

    git clone --recursive https://github.com/espressif/esp-box.git
    
  3. 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.

  4. Connect the ESP-BOX to the computer via a data cable

    VSCode-IDF-1
  5. Select the corresponding COM port in the lower left corner

    Note

    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

  6. Select Target as esp32s3, VSCode selects ESP32-S3 chip (via ESP-PROG) at the top of the interface

  7. Click the ESP-IDF Build Project icon, after successful compilation, it will display:

    VSCode-IDF-2
  8. 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 ⚡️

  9. 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:

  1. Open the ESP-IDF CMD terminal window, the interface of successful installation of ESP-IDF SDK is shown as follows:

    idf-cmd
  2. Use the cd command to enter a project, for example:

    idf-cmd-open
  3. Switch to the correct chip environment, for example:

    idf.py set-target esp32
    

    Note

    Replace esp32 with the correct chip target

  4. Run the following command to build the project:

    idf.py build
    
  5. 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:

idf-cmd-flash