Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@t-mat
Last active May 22, 2019 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save t-mat/1488a122f9a1bc7db32a7bb9fdf8694f to your computer and use it in GitHub Desktop.
Save t-mat/1488a122f9a1bc7db32a7bb9fdf8694f to your computer and use it in GitHub Desktop.
[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.

mode.com | 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
exit

Download and move msys32 directory into your environment

  • Download latest prebuilt toolchain from the following URL. (note: .zip filename is usually 'esp32_win32_msys2_environment_and_toolchain-YYYYMMDD.zip') https://esp-idf.readthedocs.io/en/latest/get-started/windows-setup.html#toolchain-setup
  • 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
## https://esp-idf.readthedocs.io/en/latest/get-started/index.html#get-esp-idf
mkdir ~/esp
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git

## Setup Path to ESP-IDF
## https://esp-idf.readthedocs.io/en/latest/get-started/add-idf_path-to-profile.html#windows
echo export IDF_PATH=\"$HOME/esp/esp-idf\" > /etc/profile.d/export_idf_path.sh
source /etc/profile.d/export_idf_path.sh
printenv IDF_PATH

## Start a Project
## https://esp-idf.readthedocs.io/en/latest/get-started/index.html#start-a-project
cd ~/esp
cp -r $IDF_PATH/examples/get-started/hello_world .

## Configure
## https://esp-idf.readthedocs.io/en/latest/get-started/index.html#configure
cd ~/esp/hello_world
make menuconfig

## Here, read the following section
## https://esp-idf.readthedocs.io/en/latest/get-started/index.html#configure
## And set your COM port properly.
## If your device's COM port is "COM3", input COM3 as your "default serial port".

## Build and Flash
## https://esp-idf.readthedocs.io/en/latest/get-started/index.html#build-and-flash
make flash

## Monitor
## https://esp-idf.readthedocs.io/en/latest/get-started/index.html#monitor
make monitor
@yvedant
Copy link

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.

Thanks

@spdi
Copy link

spdi commented May 22, 2019

you missed dot at the end. Should be:
$ cp -r $IDF_PATH/examples/get-started/hello_world .
or
$ 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