Install ESP SDK and Toolchain - mriksman/esp-idf-homekit GitHub Wiki

ESP-IDF Build System

ESP-IDF beginning with v4.0 uses CMake by default and plans to phase out support of GNU Make by v5.0.

Build Systems

CMake is a build system generator whilst GNU Make and Ninja are build systems. CMake can be used to generate the build system files for a number of different build systems, so it can be used platform independent.

Install Required Programs

There are multiple ways to configure the system;

  1. Download https://dl.espressif.com/dl/esp-idf-tools-setup-2.2.exe

The installer includes the cross-compilers, OpenOCD, CMake and Ninja build tool. The installer can also download and run installers for Python 3.7 and Git For Windows if they are not already installed on the computer.

  1. Use the idf_tools.py install command to install the ESP-IDF Tools.
    1. Install Git For Windows
    2. Install Python 3.x
    3. Get ESP-IDF git clone \--recursive https://github.com/espressif/esp-idf.git
    4. Run idf_tools.py install.
    5. This will install CMake, OpenOCD, Ninja and the xtensa-esp32-elf Toolchain.

ESP8266 RTOS SDK seems to still be catching up with ESP-IDF's use of CMake and ESP-IDF Tools installation.

  1. Install manually (Preferred, and easy to do)
    1. Install Git For Windows
    2. Install Python 3.x (ESP-IDF makes a note that there may be issues with 3.x and to use 2.7)
      1. Install to C:\Python (some scripts might not like spaces in default pathname)
      2. After installation, try running a .py script, and associate with the python.exe. Otherwise, you'll get a Program 'idf.py' failed to run: Application not found At line:1 char:1 error.
    3. Install CMake For Windows
      1. When the installer asks for Install Options, select 'Add CMake to the system PATH for the current user'.
    4. Download Ninja
      1. Extract the executable file to the bin folder within CMake. As CMake is now in the PATH environment variable, you won't have to add another PATH.
    5. Download the Toolchain
      1. ESP-IDF ESP8266
      2. Create a folder called esp32 (or esp8266)
      3. Extract xtensa-esp32-elf (or xtensa-lx106-elf) folder into it.
    6. Download the SDK
      1. Open PowerShell and navigate to the esp32/esp8266 folder.
      2. Run git clone --recursive https://github.com/espressif/esp-idf.git or git clone --recursive https://github.com/espressif/ESP8266_RTOS_SDK.git
    7. Install the Python dependencies pip install -r "path\to\esp32\esp-idf\requirements.txt"

The folder structure will look like this

 esp32                  esp8266
 |-- esp-idf            |-- ESP8266_RTOS_SDK
 └-- xtensa-esp32-elf   └-- xtensa-lx106-elf

For ESP-IDF pre 4.0 and ESP RTOS SDK v3.x, you'll need to supply a prebuilt binary called mconf-idf. Place the files in a directory listed in PATH.