NOTE: The esp-idf build system does not support spaces in paths to esp-idf or to projects
The default location to create a project is in:
C:\msys32\home\[YOUR USER NAME]\esp
Create Project In Eclipse
Copy your sample \ template project files to:
C:\msys32\home\[YOUR USER NAME]\esp
Then follow these instrucitons to configure eclipse for your project (based on: https://docs.espressif.com/projects/esp-idf/en/stable/get-started/eclipse-setup-windows.html#eclipse-windows-setup )
Import New Project
Run Eclipse
File > Import
Choose “C/C++” > “Existing Code as Makefile Project” and click Next
Set “Existing Code Location” to be the directory of your IDF project. The directory you specify should contain a file named “Makefile” (the project Makefile)
On the same page, under “Toolchain for Indexer Settings” choose “Cross GCC”. Then click Finish.
Project Properties
The new project will appear under Project Explorer. Right-click the project and choose Properties
Select “C/C++ Build” > “Environment”
Click “Add…” > enter name BATCH_BUILD and value 1.
Click “Add…” again, enter name IDF_PATH. The value should be the full path where ESP-IDF is installed, e.g.
C:\msys32\home\[YOUR USER NAME]\esp\esp-idf
Edit the PATH environment variable. Replace the existing value with:
C:\msys32\usr\bin;C:\msys32\mingw32\bin;C:\msys32\opt\xtensa-esp32-elf\bin
Select “C/C++ General” > “Preprocessor Include Paths” > “Providers” tab
Select “CDT Cross GCC Built-in Compiler Settings”
Enable it if necessary
Change “Command to get compiler specs” to:
xtensa-esp32-elf-gcc ${FLAGS} -E -P -v -dD "${INPUTS}"
Select “CDT GCC Build Output Parser”
Enable it if necessary
Change the “Compiler command pattern” to:
xtensa-esp32-elf-(gcc|g\+\+|c\+\+|cc|cpp|clang)
Select “C/C++ General” > “Indexer” property page:
Check “Enable project specific settings” to enable the rest of the settings on this page.
Uncheck “Allow heuristic resolution of includes”
Click "Apply and Close"
Before building the project
These notes based on: https://docs.espressif.com/projects/esp-idf/en/stable/get-started/eclipse-setup.html#eclipse-build-project
Find our what com port your ESP32 is connected to
In Windows > Control Panel > System > Device Manager > Ports (COM & LPT)
Look for your USB to serial programming adaptor, e.g. a CH340 adapter if thats the chip being used in it (often is for ESP32) and note its COM port number.
Configure your project’s esp-idf settings (this step currently has to be run outside Eclipse)
Open the terminal window using Windows start button > Run
C:\msys32\mingw32.exe
Navigate to your project directory
cd ~/esp/[MY PROJECT NAME]
Run make menuconfig to configure your project’s esp-idf settings:
make menuconfig
It should complete and show you the Configuration Tool in the terminal window. This is used to configure the things eclipse can't do.
Navigate to Serial flasher config > Default serial port
Delete the default "/dev/tty/USB" and change to match your Windows serial port, e.g. "COM63"
Serial flasher config > Default baud rate > Set to 921600 baud
Use the "Save" command in the config tool to store the configuration ready for Eclipse to build using it.
Flashing the ESP32 from Eclipse
Select your project in Project Explorer (make sure you select the project, not a directory in the project, or Eclipse may find the wrong Makefile.)
Menu > Project > Build Targets > Create
Type “flash” as the target name. Leave the other options as their defaults.
Now you can use Project -> Build Target -> Build (Shift+F9) to build the custom flash target, which will compile and flash the project.
Build the project in Eclipse
Now in Eclipse:
Project > Clean
Project > Build Project
The project should build (takes a long time on first build).
Use Project > Build Target -> Build (Shift+F9) to build the custom flash target, which will compile and flash the project.