Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[Windows] Setup ESP-IDF for ESP32

Installation note of ESP-IDF for ESP32

Find your deveice's COM port

You can find all active COM ports by the following command. This command works in Windows' command prompt, PowerShell and MSYS shell. | findstr "COM"

Try connect and disconnect your device and run above command repeatedly. Difference of result is your device's COM port.

Make directory for new environment

Open command prompt window. And input the following commands to the window.

:: Input the following commands in Windows command prompt window
mkdir C:\esp
cd /d C:\esp

Download and move msys32 directory into your environment

  • Download latest prebuilt toolchain from the following URL. (note: .zip filename is usually '')
  • Extract the zip file.
  • Check there's msys32 directory in the extracted zip file.
  • Move msys32 directory under C:\esp. After moving, you have to have C:\esp\msys32 directory.
  • Open command prompt again. And input the following command to make sure you've succcessfully moved msys32.
:: Input the following commands in Windows command prompt window
cd /d C:\esp
cd msys32
dir /b opt\xtensa-esp32-elf

If you can see directory names such as bin, include, lib, etc, you've succeeded to move msys32.

Open msys2 window

Input the following command to Windows command prompt to open msys2 window.

:: Input the following commands in Windows command prompt window
start C:\esp\msys32\mingw32.exe && exit

Setup ESP-IDF and build & flash "hello_world"

## Input the following commands to msys2 window.

## Get ESP-IDF
mkdir ~/esp
cd ~/esp
git clone --recursive

## Setup Path to ESP-IDF
echo export IDF_PATH=\"$HOME/esp/esp-idf\" > /etc/profile.d/
source /etc/profile.d/
printenv IDF_PATH

## Start a Project
cd ~/esp
cp -r $IDF_PATH/examples/get-started/hello_world .

## Configure
cd ~/esp/hello_world
make menuconfig

## Here, read the following section
## And set your COM port properly.
## If your device's COM port is "COM3", input COM3 as your "default serial port".

## Build and Flash
make flash

## Monitor
make monitor

This comment has been minimized.

Copy link

@yvedant yvedant commented Apr 24, 2019

$ cp -r $IDF_PATH/examples/get-started/hello_world
cp: missing destination file operand after '/home/Vedant/esp/esp-idf/examples/get-started/hello_world'
i am getting this error after running copy command in msys32.please give me suggestion how to solve it.



This comment has been minimized.

Copy link

@spdi spdi commented May 22, 2019

you missed dot at the end. Should be:
$ cp -r $IDF_PATH/examples/get-started/hello_world .
$ cp -r $IDF_PATH/examples/get-started/hello_world ./

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment